/* Heaven Bound v1.2.13.2 — Specialized Officer Dashboard Experience
 * Scope: authenticated modern portal only. This file does not style the
 * website theme, body, print output, or non-portal pages.
 */

.hb-modern-portal .hb-modern-officer-dashboard {
  width: 100%;
  max-width: none;
  min-width: 0;
  margin: 0;
  padding: 0;
  color: var(--hb-portal-text);
}

/* Shared officer landing page. */
.hb-modern-portal .hb-modern-officer-dashboard .hb-role-focus-section,
.hb-modern-portal .hb-modern-officer-dashboard .hb-task-section,
.hb-modern-portal .hb-modern-officer-dashboard .hb-officer-assignments-heading,
.hb-modern-portal .hb-modern-officer-dashboard > .hb-member-card {
  border: 1px solid var(--hb-portal-border);
  border-radius: 17px;
  background: var(--hb-portal-card);
  box-shadow: 0 6px 18px rgba(24, 39, 75, .04);
}

.hb-modern-portal .hb-modern-officer-dashboard .hb-role-focus-section {
  border-top: 4px solid var(--hb-portal-purple);
}

.hb-modern-portal .hb-modern-officer-dashboard .hb-task-section {
  border-top: 4px solid var(--hb-portal-secondary);
}

.hb-modern-portal .hb-modern-officer-dashboard .hb-officer-assignments-heading {
  border-top: 4px solid var(--hb-portal-orange);
}

.hb-modern-portal .hb-modern-officer-dashboard .hb-role-focus-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.hb-modern-portal .hb-modern-officer-dashboard .hb-role-focus-card {
  min-width: 0;
  border: 1px solid var(--hb-portal-border);
  border-radius: 15px;
  background: color-mix(in srgb, var(--hb-portal-purple) 5%, white);
  box-shadow: none;
}

.hb-modern-portal .hb-modern-officer-dashboard .hb-role-focus-card h3,
.hb-modern-portal .hb-modern-officer-dashboard .hb-role-focus-card p,
.hb-modern-portal .hb-modern-officer-dashboard .hb-role-focus-card li {
  color: var(--hb-portal-text);
}

/* Specialized ministry modules remain in normal document flow and inside the
 * portal canvas. No fixed positioning, viewport sizing, or theme overrides. */
.hb-modern-portal :is(
  .hb-secretary-records,
  .hb-nurture-care,
  .hb-interest-outreach,
  .hb-sop-resources,
  .hb-elder-care,
  .hb-treasurer-funds
) {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: visible;
  box-sizing: border-box;
  border: 1px solid var(--hb-portal-border);
  border-radius: 18px;
  background: var(--hb-portal-card);
  color: var(--hb-portal-text);
  box-shadow: 0 7px 20px rgba(24, 39, 75, .045);
}

.hb-modern-portal .hb-secretary-records { border-top: 4px solid var(--hb-portal-orange); }
.hb-modern-portal .hb-nurture-care { border-top: 4px solid var(--hb-portal-green); }
.hb-modern-portal .hb-interest-outreach { border-top: 4px solid var(--hb-portal-primary); }
.hb-modern-portal .hb-sop-resources { border-top: 4px solid var(--hb-portal-purple); }
.hb-modern-portal .hb-elder-care { border-top: 4px solid var(--hb-portal-purple); }
.hb-modern-portal .hb-treasurer-funds { border-top: 4px solid var(--hb-portal-green); }

.hb-modern-portal :is(
  .hb-secretary-section-header,
  .hb-nurture-section-header,
  .hb-interest-section-header,
  .hb-sop-section-header,
  .hb-elder-header,
  .hb-treasurer-header
) {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--hb-portal-border);
}

.hb-modern-portal :is(
  .hb-secretary-section-header,
  .hb-nurture-section-header,
  .hb-interest-section-header,
  .hb-sop-section-header,
  .hb-elder-header,
  .hb-treasurer-header
) h2 {
  margin: 3px 0 7px;
  color: var(--hb-portal-text);
  font-size: clamp(23px, 2.6vw, 34px);
  line-height: 1.15;
  letter-spacing: -.02em;
}

.hb-modern-portal :is(
  .hb-secretary-section-header,
  .hb-nurture-section-header,
  .hb-interest-section-header,
  .hb-sop-section-header,
  .hb-elder-header,
  .hb-treasurer-header
) p {
  margin: 0;
  color: var(--hb-portal-muted);
}

.hb-modern-portal :is(
  .hb-secretary-scope,
  .hb-nurture-scope,
  .hb-interest-scope,
  .hb-sop-scope,
  .hb-elder-header > strong,
  .hb-treasurer-header > strong
) {
  flex: 0 1 260px;
  min-width: 0;
  padding: 10px 13px;
  border: 1px solid var(--hb-portal-border);
  border-radius: 12px;
  background: color-mix(in srgb, var(--hb-portal-surface) 72%, white);
  color: var(--hb-portal-secondary);
  text-align: right;
  overflow-wrap: anywhere;
}

.hb-modern-portal :is(
  .hb-secretary-scope,
  .hb-nurture-scope,
  .hb-interest-scope,
  .hb-sop-scope
) span {
  display: block;
  margin-top: 3px;
  color: var(--hb-portal-muted);
  font-size: 12px;
}

/* Privacy, consent, and attribution callouts. */
.hb-modern-portal :is(
  .hb-nurture-boundary,
  .hb-interest-boundary,
  .hb-sop-boundary,
  .hb-elder-care > .hb-mgr-notice--info
) {
  margin: 0 0 20px;
  padding: 14px 16px;
  border: 1px solid color-mix(in srgb, var(--hb-portal-primary) 20%, var(--hb-portal-border));
  border-left: 4px solid var(--hb-portal-primary);
  border-radius: 13px;
  background: color-mix(in srgb, var(--hb-portal-primary) 5%, white);
  color: var(--hb-portal-text);
}

.hb-modern-portal .hb-nurture-boundary { border-left-color: var(--hb-portal-green); }
.hb-modern-portal .hb-sop-boundary,
.hb-modern-portal .hb-elder-care > .hb-mgr-notice--info { border-left-color: var(--hb-portal-purple); }

.hb-modern-portal :is(
  .hb-nurture-boundary,
  .hb-interest-boundary,
  .hb-sop-boundary
) p {
  margin: 5px 0 0;
  color: var(--hb-portal-muted);
}

/* Compact secondary navigation. */
.hb-modern-portal :is(
  .hb-secretary-nav,
  .hb-nurture-nav,
  .hb-interest-nav,
  .hb-sop-nav,
  .hb-elder-nav
) {
  position: static;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 0 0 20px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.hb-modern-portal :is(
  .hb-secretary-nav,
  .hb-nurture-nav,
  .hb-interest-nav,
  .hb-sop-nav,
  .hb-elder-nav
) a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid var(--hb-portal-border);
  border-radius: 999px;
  background: var(--hb-portal-card);
  color: var(--hb-portal-secondary);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none !important;
}

.hb-modern-portal :is(
  .hb-secretary-nav,
  .hb-nurture-nav,
  .hb-interest-nav,
  .hb-sop-nav,
  .hb-elder-nav
) a:hover,
.hb-modern-portal :is(
  .hb-secretary-nav,
  .hb-nurture-nav,
  .hb-interest-nav,
  .hb-sop-nav,
  .hb-elder-nav
) a:focus {
  border-color: var(--hb-portal-primary);
  background: color-mix(in srgb, var(--hb-portal-primary) 7%, white);
  color: var(--hb-portal-primary);
}

/* Existing ministry summary blocks are modernized without changing their PHP
 * data or calculation logic. */
.hb-modern-portal :is(
  .hb-secretary-stat-grid,
  .hb-nurture-stat-grid,
  .hb-interest-summary,
  .hb-sop-summary
) {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
  gap: 12px;
  margin: 0 0 22px;
}

.hb-modern-portal :is(
  .hb-secretary-stat-grid > div,
  .hb-nurture-stat-grid > div,
  .hb-interest-summary > article,
  .hb-sop-summary > article
) {
  min-width: 0;
  min-height: 94px;
  padding: 15px;
  border: 1px solid var(--hb-portal-border);
  border-radius: 14px;
  background: var(--hb-portal-card);
  box-shadow: 0 4px 14px rgba(24, 39, 75, .035);
}

.hb-modern-portal :is(
  .hb-secretary-stat-grid > div,
  .hb-nurture-stat-grid > div,
  .hb-interest-summary > article,
  .hb-sop-summary > article
):nth-child(4n + 1) { border-top: 3px solid var(--hb-portal-primary); }
.hb-modern-portal :is(
  .hb-secretary-stat-grid > div,
  .hb-nurture-stat-grid > div,
  .hb-interest-summary > article,
  .hb-sop-summary > article
):nth-child(4n + 2) { border-top: 3px solid var(--hb-portal-green); }
.hb-modern-portal :is(
  .hb-secretary-stat-grid > div,
  .hb-nurture-stat-grid > div,
  .hb-interest-summary > article,
  .hb-sop-summary > article
):nth-child(4n + 3) { border-top: 3px solid var(--hb-portal-purple); }
.hb-modern-portal :is(
  .hb-secretary-stat-grid > div,
  .hb-nurture-stat-grid > div,
  .hb-interest-summary > article,
  .hb-sop-summary > article
):nth-child(4n) { border-top: 3px solid var(--hb-portal-orange); }

.hb-modern-portal :is(
  .hb-secretary-stat-grid,
  .hb-nurture-stat-grid,
  .hb-interest-summary,
  .hb-sop-summary
) strong {
  color: var(--hb-portal-text);
  font-size: 24px;
  line-height: 1.1;
}

.hb-modern-portal :is(
  .hb-secretary-stat-grid,
  .hb-nurture-stat-grid,
  .hb-interest-summary,
  .hb-sop-summary
) span {
  color: var(--hb-portal-text);
  font-weight: 700;
}

.hb-modern-portal :is(
  .hb-interest-summary,
  .hb-sop-summary
) small {
  color: var(--hb-portal-muted);
}


.hb-modern-portal :is(
  .hb-secretary-records,
  .hb-nurture-care,
  .hb-interest-outreach,
  .hb-sop-resources,
  .hb-elder-care,
  .hb-treasurer-funds
) > .hb-portal-summary-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.hb-modern-portal .hb-treasurer-funds > .hb-portal-summary-grid {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.hb-modern-portal :is(
  .hb-secretary-records,
  .hb-nurture-care,
  .hb-interest-outreach,
  .hb-sop-resources,
  .hb-elder-care,
  .hb-treasurer-funds
) .hb-portal-action-card {
  min-height: 195px;
}

/* Ministry sections and records. */
.hb-modern-portal :is(
  .hb-secretary-panel,
  .hb-nurture-panel,
  .hb-interest-panel,
  .hb-sop-panel,
  .hb-elder-panel,
  .hb-fund-report
) {
  min-width: 0;
  margin-top: 18px;
  padding: 18px;
  border: 1px solid var(--hb-portal-border);
  border-radius: 16px;
  background: color-mix(in srgb, var(--hb-portal-surface) 35%, white);
  box-shadow: none;
}

.hb-modern-portal :is(
  .hb-secretary-panel-heading,
  .hb-nurture-panel-heading,
  .hb-interest-panel-heading,
  .hb-sop-panel-heading,
  .hb-fund-report-heading
) {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.hb-modern-portal :is(
  .hb-secretary-panel,
  .hb-nurture-panel,
  .hb-interest-panel,
  .hb-sop-panel,
  .hb-elder-panel,
  .hb-fund-report
) h3 {
  margin: 2px 0 6px;
  color: var(--hb-portal-text);
  font-size: 20px;
  line-height: 1.25;
}

.hb-modern-portal :is(
  .hb-secretary-panel,
  .hb-nurture-panel,
  .hb-interest-panel,
  .hb-sop-panel,
  .hb-elder-panel,
  .hb-fund-report
) p {
  color: var(--hb-portal-muted);
}

.hb-modern-portal :is(
  .hb-secretary-record,
  .hb-nurture-case,
  .hb-nurture-insight,
  .hb-nurture-activity-grid > article,
  .hb-interest-card,
  .hb-sop-card,
  .hb-elder-record,
  .hb-fund-record
) {
  min-width: 0;
  border: 1px solid var(--hb-portal-border);
  border-radius: 14px;
  background: var(--hb-portal-card);
  box-shadow: 0 3px 12px rgba(24, 39, 75, .035);
}

.hb-modern-portal .hb-elder-record { border-left: 4px solid var(--hb-portal-purple); }
.hb-modern-portal .hb-fund-status-verified { border-left: 4px solid var(--hb-portal-green); }
.hb-modern-portal .hb-fund-status-needs_clarification { border-left: 4px solid var(--hb-portal-orange); }
.hb-modern-portal .hb-fund-status-voided { border-left: 4px solid var(--hb-portal-danger); }

/* Forms and collapsible editors. */
.hb-modern-portal :is(
  .hb-secretary-editor,
  .hb-nurture-editor,
  .hb-nurture-manage-panel,
  .hb-interest-editor,
  .hb-sop-editor,
  .hb-elder-form-panel,
  .hb-treasurer-form-panel,
  .hb-fund-record-actions details
) {
  min-width: 0;
  margin: 12px 0;
  border: 1px solid var(--hb-portal-border);
  border-radius: 13px;
  background: var(--hb-portal-card);
}

.hb-modern-portal :is(
  .hb-secretary-editor,
  .hb-nurture-editor,
  .hb-nurture-manage-panel,
  .hb-interest-editor,
  .hb-sop-editor,
  .hb-elder-form-panel,
  .hb-treasurer-form-panel,
  .hb-fund-record-actions details
) > summary {
  min-height: 44px;
  padding: 12px 14px;
  border-radius: 12px;
  color: var(--hb-portal-secondary);
  font-weight: 800;
  cursor: pointer;
}

.hb-modern-portal :is(
  .hb-secretary-editor,
  .hb-nurture-editor,
  .hb-nurture-manage-panel,
  .hb-interest-editor,
  .hb-sop-editor,
  .hb-elder-form-panel,
  .hb-treasurer-form-panel,
  .hb-fund-record-actions details
)[open] > summary {
  border-bottom: 1px solid var(--hb-portal-border);
  background: color-mix(in srgb, var(--hb-portal-primary) 5%, white);
}

.hb-modern-portal :is(
  .hb-secretary-form,
  .hb-nurture-form,
  .hb-interest-form,
  .hb-sop-form,
  .hb-elder-form,
  .hb-elder-inline-form,
  .hb-treasurer-form,
  .hb-fund-inline-form
) {
  min-width: 0;
  padding: 14px;
}

.hb-modern-portal :is(
  .hb-secretary-form-grid,
  .hb-nurture-form-grid,
  .hb-interest-form-grid,
  .hb-sop-form-grid,
  .hb-elder-grid,
  .hb-treasurer-grid
) {
  min-width: 0;
}

.hb-modern-portal :is(
  .hb-secretary-records,
  .hb-nurture-care,
  .hb-interest-outreach,
  .hb-sop-resources,
  .hb-elder-care,
  .hb-treasurer-funds
) :is(input, select, textarea) {
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.hb-modern-portal :is(
  .hb-secretary-records,
  .hb-nurture-care,
  .hb-interest-outreach,
  .hb-sop-resources,
  .hb-elder-care,
  .hb-treasurer-funds
) :is(input, select, textarea):focus {
  border-color: var(--hb-portal-primary);
  outline: 3px solid color-mix(in srgb, var(--hb-portal-primary) 15%, transparent);
}

.hb-modern-portal .hb-fund-month-filter {
  margin: 0 0 18px;
  padding: 12px 14px;
  border: 1px solid var(--hb-portal-border);
  border-radius: 13px;
  background: color-mix(in srgb, var(--hb-portal-surface) 55%, white);
}

.hb-modern-portal .hb-fund-print-summary {
  border-color: var(--hb-portal-border);
  background: var(--hb-portal-card);
}

.hb-modern-portal .hb-fund-record-actions summary {
  color: var(--hb-portal-primary);
  font-weight: 800;
  cursor: pointer;
}

.hb-modern-portal .hb-secretary-shortcut-grid a {
  border-color: var(--hb-portal-border);
  border-radius: 13px;
  background: color-mix(in srgb, var(--hb-portal-green) 5%, white);
  color: var(--hb-portal-text);
}

/* ResizeObserver classes supplied by modern-portal.js. */
.hb-modern-portal.hb-modern-compact .hb-modern-officer-dashboard .hb-role-focus-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.hb-modern-portal.hb-modern-compact :is(
  .hb-secretary-section-header,
  .hb-nurture-section-header,
  .hb-interest-section-header,
  .hb-sop-section-header,
  .hb-elder-header,
  .hb-treasurer-header
) {
  flex-direction: column;
}

.hb-modern-portal.hb-modern-compact :is(
  .hb-secretary-scope,
  .hb-nurture-scope,
  .hb-interest-scope,
  .hb-sop-scope,
  .hb-elder-header > strong,
  .hb-treasurer-header > strong
) {
  flex-basis: auto;
  width: 100%;
  text-align: left;
}

.hb-modern-portal.hb-modern-narrow .hb-modern-officer-dashboard .hb-role-focus-grid,
.hb-modern-portal.hb-modern-narrow :is(
  .hb-secretary-stat-grid,
  .hb-nurture-stat-grid,
  .hb-interest-summary,
  .hb-sop-summary
) {
  grid-template-columns: 1fr;
}

.hb-modern-portal.hb-modern-narrow :is(
  .hb-secretary-nav,
  .hb-nurture-nav,
  .hb-interest-nav,
  .hb-sop-nav,
  .hb-elder-nav
) a {
  flex: 1 1 calc(50% - 7px);
}

.hb-modern-portal.hb-modern-narrow :is(
  .hb-elder-record,
  .hb-fund-record
) {
  grid-template-columns: 1fr;
}

.hb-modern-portal.hb-modern-narrow :is(
  .hb-secretary-form-actions,
  .hb-nurture-form-actions,
  .hb-interest-form-actions,
  .hb-sop-form-actions,
  .hb-form-actions
) > * {
  flex: 1 1 100%;
  width: 100%;
  text-align: center;
}



/* Existing ministry grids originally used viewport media queries. The modern
 * portal can be narrow inside a wide WordPress theme, so mirror those rules
 * using the ResizeObserver classes that measure the real portal width. */
.hb-modern-portal.hb-modern-compact :is(
  .hb-secretary-form-grid,
  .hb-secretary-record-grid,
  .hb-secretary-report-detail-grid,
  .hb-secretary-shortcut-grid,
  .hb-nurture-form-grid,
  .hb-nurture-insight-grid,
  .hb-nurture-activity-grid,
  .hb-nurture-meta,
  .hb-interest-form-grid,
  .hb-interest-meta,
  .hb-interest-history-grid,
  .hb-interest-visit-grid,
  .hb-sop-form-grid,
  .hb-sop-meta,
  .hb-sop-member-grid,
  .hb-elder-grid,
  .hb-treasurer-grid,
  .hb-fund-print-summary
) {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.hb-modern-portal.hb-modern-compact :is(
  .hb-interest-card-tools,
  .hb-sop-card-tools,
  .hb-fund-print-signatures
) {
  grid-template-columns: 1fr;
}

.hb-modern-portal.hb-modern-narrow :is(
  .hb-secretary-form-grid,
  .hb-secretary-record-grid,
  .hb-secretary-report-detail-grid,
  .hb-secretary-shortcut-grid,
  .hb-nurture-form-grid,
  .hb-nurture-insight-grid,
  .hb-nurture-activity-grid,
  .hb-nurture-meta,
  .hb-interest-form-grid,
  .hb-interest-meta,
  .hb-interest-history-grid,
  .hb-interest-visit-grid,
  .hb-interest-card-tools,
  .hb-sop-form-grid,
  .hb-sop-meta,
  .hb-sop-card-tools,
  .hb-sop-member-grid,
  .hb-sop-approval-form,
  .hb-elder-grid,
  .hb-treasurer-grid,
  .hb-fund-print-summary,
  .hb-fund-print-signatures
) {
  grid-template-columns: minmax(0, 1fr);
}

.hb-modern-portal.hb-modern-narrow :is(
  .hb-secretary-field-wide,
  .hb-secretary-record-wide,
  .hb-nurture-field-wide,
  .hb-interest-field-wide,
  .hb-sop-field-wide,
  .hb-elder-wide,
  .hb-treasurer-wide
) {
  grid-column: auto;
}

.hb-modern-portal.hb-modern-narrow :is(
  .hb-secretary-panel-heading,
  .hb-nurture-panel-heading,
  .hb-interest-panel-heading,
  .hb-sop-panel-heading,
  .hb-fund-report-heading,
  .hb-interest-card-head,
  .hb-nurture-case-head,
  .hb-nurture-activity-head
) {
  flex-direction: column;
  align-items: stretch;
}

.hb-modern-portal.hb-modern-narrow :is(
  .hb-secretary-records,
  .hb-nurture-care,
  .hb-interest-outreach,
  .hb-sop-resources,
  .hb-elder-care,
  .hb-treasurer-funds
) {
  overflow-wrap: anywhere;
}

/* Container-query equivalents for browsers with native support. */
@container hbportal (max-width: 980px) {
  .hb-modern-portal .hb-modern-officer-dashboard .hb-role-focus-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hb-modern-portal :is(
    .hb-secretary-form-grid,
    .hb-secretary-record-grid,
    .hb-secretary-report-detail-grid,
    .hb-secretary-shortcut-grid,
    .hb-nurture-form-grid,
    .hb-nurture-insight-grid,
    .hb-nurture-activity-grid,
    .hb-nurture-meta,
    .hb-interest-form-grid,
    .hb-interest-meta,
    .hb-interest-history-grid,
    .hb-interest-visit-grid,
    .hb-sop-form-grid,
    .hb-sop-meta,
    .hb-sop-member-grid,
    .hb-elder-grid,
    .hb-treasurer-grid,
    .hb-fund-print-summary
  ) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hb-modern-portal :is(.hb-interest-card-tools, .hb-sop-card-tools, .hb-fund-print-signatures) {
    grid-template-columns: 1fr;
  }

  .hb-modern-portal :is(
    .hb-secretary-section-header,
    .hb-nurture-section-header,
    .hb-interest-section-header,
    .hb-sop-section-header,
    .hb-elder-header,
    .hb-treasurer-header
  ) {
    flex-direction: column;
  }

  .hb-modern-portal :is(
    .hb-secretary-scope,
    .hb-nurture-scope,
    .hb-interest-scope,
    .hb-sop-scope,
    .hb-elder-header > strong,
    .hb-treasurer-header > strong
  ) {
    flex-basis: auto;
    width: 100%;
    text-align: left;
  }
}

@container hbportal (max-width: 640px) {
  .hb-modern-portal .hb-modern-officer-dashboard .hb-role-focus-grid,
  .hb-modern-portal :is(
    .hb-secretary-stat-grid,
    .hb-nurture-stat-grid,
    .hb-interest-summary,
    .hb-sop-summary,
    .hb-secretary-form-grid,
    .hb-secretary-record-grid,
    .hb-secretary-report-detail-grid,
    .hb-secretary-shortcut-grid,
    .hb-nurture-form-grid,
    .hb-nurture-insight-grid,
    .hb-nurture-activity-grid,
    .hb-nurture-meta,
    .hb-interest-form-grid,
    .hb-interest-meta,
    .hb-interest-history-grid,
    .hb-interest-visit-grid,
    .hb-interest-card-tools,
    .hb-sop-form-grid,
    .hb-sop-meta,
    .hb-sop-card-tools,
    .hb-sop-member-grid,
    .hb-sop-approval-form,
    .hb-elder-grid,
    .hb-treasurer-grid,
    .hb-fund-print-summary,
    .hb-fund-print-signatures
  ) {
    grid-template-columns: 1fr;
  }

  .hb-modern-portal :is(
    .hb-secretary-field-wide,
    .hb-secretary-record-wide,
    .hb-nurture-field-wide,
    .hb-interest-field-wide,
    .hb-sop-field-wide,
    .hb-elder-wide,
    .hb-treasurer-wide
  ) {
    grid-column: auto;
  }

  .hb-modern-portal :is(
    .hb-secretary-nav,
    .hb-nurture-nav,
    .hb-interest-nav,
    .hb-sop-nav,
    .hb-elder-nav
  ) a {
    flex: 1 1 calc(50% - 7px);
  }

  .hb-modern-portal :is(.hb-elder-record, .hb-fund-record) {
    grid-template-columns: 1fr;
  }
}

@container hbportal (max-width: 480px) {
  .hb-modern-portal :is(
    .hb-secretary-nav,
    .hb-nurture-nav,
    .hb-interest-nav,
    .hb-sop-nav,
    .hb-elder-nav
  ) a {
    flex-basis: 100%;
  }

  .hb-modern-portal :is(
    .hb-secretary-panel,
    .hb-nurture-panel,
    .hb-interest-panel,
    .hb-sop-panel,
    .hb-elder-panel,
    .hb-fund-report
  ) {
    padding: 14px;
  }
}

/* Viewport fallbacks for browsers without container queries. */
@media (max-width: 900px) {
  .hb-modern-portal .hb-modern-officer-dashboard .hb-role-focus-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .hb-modern-portal .hb-modern-officer-dashboard .hb-role-focus-grid {
    grid-template-columns: 1fr;
  }
}



/* Version 1.2.13.4.2 — Elder and Treasurer routed layout spacing hotfix.
 * These screen-only rules apply solely when a specific Elder or Treasurer
 * sidebar route is active. The legacy embedded layout and print output remain
 * unchanged. */
@media screen {
  .hb-modern-portal[data-hb-active-section^="elder-"] .hb-modern-route-heading,
  .hb-modern-portal[data-hb-active-section^="treasurer-"] .hb-modern-route-heading {
    margin-bottom: 12px;
  }

  .hb-modern-portal[data-hb-active-section^="elder-"] .hb-modern-route-output > :is(.hb-wrap, .hb-mgr-wrap, .hb-leader-wrap, .hb-officer-wrap),
  .hb-modern-portal[data-hb-active-section^="treasurer-"] .hb-modern-route-output > :is(.hb-wrap, .hb-mgr-wrap, .hb-leader-wrap, .hb-officer-wrap) {
    padding: 0;
  }

  .hb-modern-portal[data-hb-active-section^="elder-"] .hb-elder-care,
  .hb-modern-portal[data-hb-active-section^="treasurer-"] .hb-treasurer-funds {
    gap: 16px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  /* Defensive fallback: JavaScript also removes these non-context headers
   * from a selected child route, but CSS prevents a flash or cache-stale copy. */
  .hb-modern-portal[data-hb-active-section^="elder-"] .hb-elder-header,
  .hb-modern-portal[data-hb-active-section^="treasurer-"] .hb-treasurer-header {
    display: none !important;
  }

  .hb-modern-portal[data-hb-active-section^="elder-"] .hb-elder-nav {
    display: none !important;
  }

  .hb-modern-portal[data-hb-active-section^="elder-"] .hb-elder-care > .hb-mgr-notice--info {
    margin: 0;
  }

  .hb-modern-portal[data-hb-active-section^="elder-"] .hb-elder-panel {
    margin-top: 0;
  }

  .hb-modern-portal[data-hb-active-section^="elder-"] .hb-elder-panel > .hb-routed-panel-title {
    display: none !important;
  }

  .hb-modern-portal[data-hb-active-section="treasurer-entry"] .hb-treasurer-form-panel,
  .hb-modern-portal[data-hb-active-section="treasurer-report"] .hb-fund-month-filter,
  .hb-modern-portal[data-hb-active-section="treasurer-report"] .hb-fund-report {
    margin-top: 0;
    margin-bottom: 0;
  }
}

@media print {
  .hb-modern-portal .hb-portal-summary-grid,
  .hb-modern-portal .hb-portal-action-section,
  .hb-modern-portal :is(
    .hb-secretary-nav,
    .hb-nurture-nav,
    .hb-interest-nav,
    .hb-sop-nav,
    .hb-elder-nav
  ) {
    display: none !important;
  }
}


/* Version 1.2.13.4.3 — Elder and Treasurer form UI modernization.
 * Mirrors the established Secretary/SOP editor treatment while remaining
 * fully scoped to the Modern Portal and excluded from print output. */
@media screen {
  .hb-modern-portal :is(details.hb-elder-form-panel, details.hb-treasurer-form-panel) {
    overflow: hidden;
    margin: 10px 0 16px;
    border: 1px solid var(--hb-portal-border);
    border-radius: 16px;
    background: var(--hb-portal-card);
    box-shadow: 0 8px 24px rgba(24, 39, 75, .055);
  }

  .hb-modern-portal :is(details.hb-elder-form-panel, details.hb-treasurer-form-panel) > summary {
    display: flex;
    align-items: center;
    gap: 11px;
    min-height: 54px;
    padding: 14px 18px;
    border: 0;
    border-radius: 0;
    background: color-mix(in srgb, var(--hb-portal-primary) 6%, white);
    color: var(--hb-portal-secondary);
    font-size: 16px;
    font-weight: 800;
    line-height: 1.35;
    list-style: none;
    cursor: pointer;
  }

  .hb-modern-portal details.hb-elder-form-panel > summary {
    background: color-mix(in srgb, var(--hb-portal-purple) 7%, white);
  }

  .hb-modern-portal details.hb-treasurer-form-panel > summary {
    background: color-mix(in srgb, var(--hb-portal-green) 7%, white);
  }

  .hb-modern-portal :is(details.hb-elder-form-panel, details.hb-treasurer-form-panel) > summary::-webkit-details-marker {
    display: none;
  }

  .hb-modern-portal :is(details.hb-elder-form-panel, details.hb-treasurer-form-panel) > summary::before {
    content: "+";
    display: inline-grid;
    place-items: center;
    flex: 0 0 28px;
    width: 28px;
    height: 28px;
    border-radius: 9px;
    background: var(--hb-portal-primary);
    color: #fff;
    font-size: 20px;
    font-weight: 700;
    line-height: 1;
  }

  .hb-modern-portal details.hb-elder-form-panel > summary::before {
    background: var(--hb-portal-purple);
  }

  .hb-modern-portal details.hb-treasurer-form-panel > summary::before {
    background: var(--hb-portal-green);
  }

  .hb-modern-portal :is(details.hb-elder-form-panel, details.hb-treasurer-form-panel)[open] > summary {
    border-bottom: 1px solid var(--hb-portal-border);
  }

  .hb-modern-portal :is(details.hb-elder-form-panel, details.hb-treasurer-form-panel)[open] > summary::before {
    content: "−";
  }

  .hb-modern-portal :is(.hb-elder-form, .hb-treasurer-form) {
    padding: 20px;
    background: var(--hb-portal-card);
  }

  .hb-modern-portal .hb-elder-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 17px 18px;
    margin: 0 0 18px;
  }

  .hb-modern-portal .hb-treasurer-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 17px 18px;
    margin: 0 0 18px;
  }

  .hb-modern-portal :is(.hb-elder-grid, .hb-treasurer-grid) label {
    display: grid;
    align-content: start;
    gap: 7px;
    min-width: 0;
    margin: 0;
    color: var(--hb-portal-text);
    font-size: 13px;
    font-weight: 800;
    line-height: 1.35;
  }

  .hb-modern-portal :is(.hb-elder-grid, .hb-treasurer-grid) :is(input, select, textarea) {
    width: 100%;
    min-width: 0;
    min-height: 44px;
    margin: 0;
    padding: 10px 12px;
    border: 1px solid color-mix(in srgb, var(--hb-portal-border) 85%, #aeb9c8);
    border-radius: 10px;
    background: #fff;
    color: var(--hb-portal-text);
    font: inherit;
    font-size: 15px;
    line-height: 1.4;
    box-shadow: 0 1px 2px rgba(24, 39, 75, .025);
    transition: border-color .16s ease, box-shadow .16s ease, background-color .16s ease;
  }

  .hb-modern-portal :is(.hb-elder-grid, .hb-treasurer-grid) :is(input, select, textarea):hover {
    border-color: color-mix(in srgb, var(--hb-portal-primary) 34%, var(--hb-portal-border));
  }

  .hb-modern-portal :is(.hb-elder-grid, .hb-treasurer-grid) :is(input, select, textarea):focus {
    border-color: var(--hb-portal-primary);
    outline: none;
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--hb-portal-primary) 16%, transparent);
  }

  .hb-modern-portal .hb-elder-grid :is(input, select, textarea):focus {
    border-color: var(--hb-portal-purple);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--hb-portal-purple) 16%, transparent);
  }

  .hb-modern-portal .hb-treasurer-grid :is(input, select, textarea):focus {
    border-color: var(--hb-portal-green);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--hb-portal-green) 16%, transparent);
  }

  .hb-modern-portal :is(.hb-elder-grid, .hb-treasurer-grid) textarea {
    min-height: 98px;
    resize: vertical;
  }

  .hb-modern-portal .hb-elder-wide,
  .hb-modern-portal .hb-treasurer-wide {
    grid-column: 1 / -1;
  }

  .hb-modern-portal .hb-elder-form > .hb-btn,
  .hb-modern-portal .hb-treasurer-form .hb-form-actions .hb-btn {
    min-height: 43px;
    padding: 10px 18px;
    border: 1px solid transparent;
    border-radius: 10px;
    color: #fff;
    font-size: 14px;
    font-weight: 800;
    line-height: 1.2;
    box-shadow: 0 5px 12px rgba(24, 39, 75, .10);
  }

  .hb-modern-portal .hb-elder-form > .hb-btn {
    background: var(--hb-portal-purple);
  }

  .hb-modern-portal .hb-treasurer-form .hb-form-actions {
    align-items: center;
    gap: 10px;
    margin-top: 2px;
    padding-top: 16px;
    border-top: 1px solid var(--hb-portal-border);
  }

  .hb-modern-portal .hb-treasurer-form .hb-form-actions .hb-btn:not(.hb-btn-secondary) {
    background: var(--hb-portal-green);
  }

  .hb-modern-portal .hb-treasurer-form .hb-form-actions .hb-btn-secondary {
    border-color: var(--hb-portal-border) !important;
    background: #fff !important;
    color: var(--hb-portal-secondary) !important;
    box-shadow: none;
  }

  .hb-modern-portal .hb-elder-form > .hb-btn:hover,
  .hb-modern-portal .hb-treasurer-form .hb-form-actions .hb-btn:hover {
    filter: brightness(.96);
    transform: translateY(-1px);
  }

  .hb-modern-portal .hb-elder-form > .hb-btn:focus-visible,
  .hb-modern-portal .hb-treasurer-form .hb-form-actions .hb-btn:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--hb-portal-primary) 22%, transparent);
    outline-offset: 2px;
  }
}

/* Actual portal-width responsive rules. */
.hb-modern-portal.hb-modern-compact .hb-treasurer-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.hb-modern-portal.hb-modern-narrow :is(.hb-elder-grid, .hb-treasurer-grid) {
  grid-template-columns: minmax(0, 1fr);
}

.hb-modern-portal.hb-modern-narrow :is(.hb-elder-wide, .hb-treasurer-wide) {
  grid-column: auto;
}

.hb-modern-portal.hb-modern-narrow .hb-elder-form > .hb-btn,
.hb-modern-portal.hb-modern-narrow .hb-treasurer-form .hb-form-actions > * {
  width: 100%;
  justify-content: center;
  text-align: center;
}

@container hbportal (max-width: 980px) {
  .hb-modern-portal .hb-treasurer-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@container hbportal (max-width: 640px) {
  .hb-modern-portal :is(.hb-elder-grid, .hb-treasurer-grid) {
    grid-template-columns: minmax(0, 1fr);
  }

  .hb-modern-portal :is(.hb-elder-wide, .hb-treasurer-wide) {
    grid-column: auto;
  }

  .hb-modern-portal :is(.hb-elder-form, .hb-treasurer-form) {
    padding: 16px;
  }

  .hb-modern-portal :is(details.hb-elder-form-panel, details.hb-treasurer-form-panel) > summary {
    padding: 13px 15px;
    font-size: 15px;
  }

  .hb-modern-portal .hb-elder-form > .hb-btn,
  .hb-modern-portal .hb-treasurer-form .hb-form-actions > * {
    width: 100%;
    justify-content: center;
    text-align: center;
  }
}

@media (max-width: 640px) {
  .hb-modern-portal :is(.hb-elder-grid, .hb-treasurer-grid) {
    grid-template-columns: minmax(0, 1fr);
  }

  .hb-modern-portal :is(.hb-elder-wide, .hb-treasurer-wide) {
    grid-column: auto;
  }
}


/* Version 1.2.15.6: privacy-safe Officer Portal people directory. */
.hb-modern-portal .hb-officer-people-directory {
  display: grid;
  gap: 22px;
}

.hb-modern-portal .hb-officer-people-heading,
.hb-modern-portal .hb-officer-people-group-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.hb-modern-portal .hb-officer-people-heading h2,
.hb-modern-portal .hb-officer-people-group-header h3,
.hb-modern-portal .hb-officer-people-column h4 {
  margin-top: 0;
}

.hb-modern-portal .hb-officer-people-readonly,
.hb-modern-portal .hb-officer-people-count {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 5px 10px;
  border: 1px solid color-mix(in srgb, var(--hb-portal-primary) 22%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--hb-portal-primary) 8%, #fff);
  color: var(--hb-portal-secondary);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
  white-space: nowrap;
}

.hb-modern-portal .hb-officer-people-groups {
  display: grid;
  gap: 18px;
}

.hb-modern-portal .hb-officer-people-group {
  padding: 20px;
  border: 1px solid var(--hb-portal-border, #dfe6f1);
  border-radius: 16px;
  background: var(--hb-portal-card, #fff);
  box-shadow: 0 7px 20px rgba(24, 39, 75, .06);
}

.hb-modern-portal .hb-officer-people-columns {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.hb-modern-portal .hb-officer-people-column {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--hb-portal-border, #dfe6f1);
  border-radius: 13px;
  background: color-mix(in srgb, var(--hb-portal-surface, #f4f7fc) 70%, #fff);
}

.hb-modern-portal .hb-officer-people-column h4 {
  margin-bottom: 12px;
  color: var(--hb-portal-secondary);
  font-size: 15px;
}

.hb-modern-portal .hb-officer-people-list {
  display: grid;
  gap: 9px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.hb-modern-portal .hb-officer-people-list li {
  display: grid;
  gap: 2px;
  padding-bottom: 9px;
  border-bottom: 1px solid var(--hb-portal-border, #dfe6f1);
}

.hb-modern-portal .hb-officer-people-list li:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.hb-modern-portal .hb-officer-people-list strong {
  overflow-wrap: anywhere;
  color: var(--hb-portal-text);
  font-size: 14px;
}

.hb-modern-portal .hb-officer-people-list span,
.hb-modern-portal .hb-officer-people-empty,
.hb-modern-portal .hb-officer-people-privacy {
  color: var(--hb-portal-muted, #64748b);
  font-size: 12px;
  line-height: 1.5;
}

.hb-modern-portal .hb-officer-people-empty,
.hb-modern-portal .hb-officer-people-privacy {
  margin: 0;
}

.hb-modern-portal .hb-officer-people-privacy {
  padding-top: 15px;
  border-top: 1px solid var(--hb-portal-border, #dfe6f1);
}

.hb-modern-portal.hb-modern-compact .hb-officer-people-columns {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.hb-modern-portal.hb-modern-narrow .hb-officer-people-columns {
  grid-template-columns: minmax(0, 1fr);
}

@container hbportal (max-width: 760px) {
  .hb-modern-portal .hb-officer-people-columns {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 640px) {
  .hb-modern-portal .hb-officer-people-heading,
  .hb-modern-portal .hb-officer-people-group-header {
    display: grid;
  }

  .hb-modern-portal .hb-officer-people-readonly,
  .hb-modern-portal .hb-officer-people-count {
    justify-self: start;
  }

  .hb-modern-portal .hb-officer-people-group,
  .hb-modern-portal .hb-officer-people-column {
    padding: 14px;
  }

  .hb-modern-portal .hb-officer-people-columns {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* v1.2.16.8 — Official Record Card ministry ownership */
.hb-official-ministry-card{scroll-margin-top:20px}
.hb-official-ministry-selector{display:flex;flex-wrap:wrap;gap:12px;align-items:end;margin:18px 0;padding:14px;border:1px solid #e4e7ec;border-radius:14px;background:#f9fafb}
.hb-official-ministry-selector label{display:grid;gap:6px;min-width:160px;flex:1}
.hb-official-ministry-selector label>span,.hb-official-ministry-tmi-grid label>span{font-weight:700;color:#344054;font-size:13px}
.hb-official-ministry-selector select{width:100%;min-height:44px;border:1px solid #d0d5dd;border-radius:10px;background:#fff;padding:8px 10px}
.hb-official-ministry-status{display:flex;justify-content:space-between;gap:12px;align-items:center;margin:14px 0;padding:12px 14px;border-radius:12px;background:#eff8ff;color:#175cd3}
.hb-official-ministry-status span{font-size:13px;color:#475467}
.hb-official-ministry-reference{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px;margin:12px 0 18px}
.hb-official-ministry-reference span{padding:10px 12px;border:1px solid #e4e7ec;border-radius:10px;background:#fff;color:#475467;font-size:13px}.hb-official-ministry-reference strong{display:block;color:#101828;font-size:18px;margin-top:3px}
.hb-official-ministry-tmi-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;margin:16px 0}
.hb-official-ministry-tmi-grid>label{display:flex;align-items:center;justify-content:space-between;gap:12px;border:1px solid #e4e7ec;border-radius:12px;padding:12px;background:#fff}
.hb-official-ministry-tmi-grid .hb-record-card-number-stepper{display:grid;grid-template-columns:38px 68px 38px;align-items:center;flex:0 0 auto}.hb-official-ministry-tmi-grid .hb-record-card-number-stepper button{min-height:40px}.hb-official-ministry-tmi-grid input[type=number]{width:68px;min-height:40px;text-align:center}
.hb-official-ministry-person-list{display:grid;gap:10px;margin:16px 0}.hb-official-ministry-person{display:grid;grid-template-columns:minmax(0,1fr) auto auto;gap:12px;align-items:center;border:1px solid #e4e7ec;border-radius:12px;padding:12px;background:#fff}.hb-official-ministry-person-name{display:grid;gap:2px}.hb-official-ministry-person-name>span,.hb-official-ministry-person-name>small{font-size:12px;color:#667085}.hb-official-ministry-person>label{display:flex;align-items:center;gap:7px;min-height:42px;padding:8px 10px;border:1px solid #d0d5dd;border-radius:10px;font-weight:700}.hb-official-ministry-person input[type=checkbox]{width:22px;height:22px}
@media(max-width:760px){.hb-official-ministry-selector{display:grid;grid-template-columns:1fr 1fr}.hb-official-ministry-selector .hb-btn{grid-column:1/-1;width:100%}.hb-official-ministry-reference{grid-template-columns:1fr 1fr}.hb-official-ministry-tmi-grid{grid-template-columns:1fr}.hb-official-ministry-tmi-grid>label{align-items:flex-start;flex-direction:column}.hb-official-ministry-tmi-grid .hb-record-card-number-stepper{width:100%;grid-template-columns:48px minmax(0,1fr) 48px}.hb-official-ministry-tmi-grid input[type=number]{width:100%}.hb-official-ministry-person{grid-template-columns:1fr 1fr}.hb-official-ministry-person-name{grid-column:1/-1}.hb-official-ministry-person>label{justify-content:center}.hb-official-ministry-status{align-items:flex-start;flex-direction:column}}
.hb-official-ministry-care-summary{display:flex;flex-wrap:wrap;gap:8px;margin:10px 0 16px}.hb-official-ministry-care-summary span{display:inline-flex;gap:5px;align-items:center;padding:7px 10px;border-radius:999px;background:#f2f4f7;color:#344054;font-size:12px}.hb-official-ministry-care-summary strong{font-size:14px;color:#101828}
