:root {
  --crm-table-header-background: color-mix(in srgb, var(--gold-deep) 85%, var(--ink));
  --crm-heading-font: Fraunces, Georgia, serif;
  --crm-body-font: Inter, system-ui, sans-serif;
  --crm-unit-font: "IBM Plex Mono", monospace;
  --crm-page-title-type: 600 25px/1.12 var(--crm-heading-font);
  --crm-section-title-type: 400 12.6px/1.35 var(--crm-heading-font);
  --crm-item-title-type: 600 13px/1.3 var(--crm-heading-font);
  --crm-customer-name-type: 500 15px/1.3 var(--crm-heading-font);
  --crm-detail-text-type: 400 12.5px/1.45 var(--crm-body-font);
  --crm-secondary-text-type: 400 11.5px/1.4 var(--crm-body-font);
  --crm-unit-code-type: 600 12px/1.4 var(--crm-unit-font);
  --crm-action-type: 500 12.5px/1.3 var(--crm-body-font);
  --crm-status-type: 500 11px/1.2 var(--crm-body-font);
}

/* Approved classic section-title treatment.
   Existing title/subtitle text is preserved exactly. The four top KPI tiles
   are excluded by the runtime frame guard and keep their own styling. */
html body #app main#main .section-label {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  min-height: 42px !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
  padding: 9px 14px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
  flex-wrap: nowrap !important;
  gap: 0;

  background: #f1e8d3 !important;
  border: 1px solid #dcd2b6 !important;
  border-radius: 8px !important;
  box-shadow: none !important;

  color: #16232f !important;
  font: var(--crm-section-title-type) !important;
  letter-spacing: .025em !important;
  text-transform: uppercase !important;
  text-align: left !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: clip !important;
}

/* No decorative left accent/elements in the approved version. */
html body #app main#main .section-label::before {
  content: none !important;
  display: none !important;
}

/* The title is physically attached to its section, matching the approved reference. */
html body #app main#main .sbx-section-frame {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  margin: 18px 0 20px !important;
  overflow: hidden;
  border: 1px solid #dcd2b6;
  border-radius: 12px;
  background: rgba(255, 253, 248, .16);
  box-shadow: none;
}

html body #app main#main .sbx-section-frame > .section-label {
  min-height: 44px !important;
  margin: 0 !important;
  padding: 10px 14px !important;
  border: 0 !important;
  border-bottom: 1px solid #dcd2b6 !important;
  border-radius: 0 !important;
  background: #f1e8d3 !important;
}

html body #app main#main .sbx-section-body {
  box-sizing: border-box;
  min-width: 0;
  padding: 10px 12px 12px;
}

/* Existing child layouts stay intact inside the connected section frame. */
html body #app main#main .sbx-section-body > .pipeline,
html body #app main#main .sbx-section-body > .list,
html body #app main#main .sbx-section-body > .stage-scroll {
  margin-top: 0 !important;
  margin-bottom: 0 !important;
}

html body #app main#main .sbx-section-body > .list {
  padding-left: 0 !important;
  padding-right: 0 !important;
}

html body #app main#main .section-label .section-heading-subtitle {
  flex: 0 0 auto;
  display: inline-block;
  white-space: nowrap;
  font-family: Fraunces, Georgia, serif !important;
  font-size: 11px !important;
  font-weight: 400 !important;
  line-height: 1.35 !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
  color: #736c5c !important;
}

html body #app main#main .section-heading-separator {
  display: block !important;
  flex: 0 0 1px;
  align-self: center;
  width: 1px;
  height: 15px !important;
  margin: 0 11px;
  background: #a19883;
  color: transparent;
  font-size: 0 !important;
  line-height: 0 !important;
}

/* Explicit KPI protection. */
html body #app main#main .stat-hero .section-label,
html body #app main#main .kpi-card .section-label,
html body #app main#main .kpi-tile .section-label,
html body #app main#main .summary-card .section-label,
html body #app main#main .summary-tile .section-label {
  all: revert;
}

@media (max-width: 600px) {
  html body #app main#main .sbx-section-frame {
    margin-top: 16px !important;
    margin-bottom: 18px !important;
    border-radius: 10px;
  }

  html body #app main#main .sbx-section-frame > .section-label {
    min-height: 42px !important;
    padding: 9px 12px !important;
  }

  html body #app main#main .sbx-section-body {
    padding: 9px 9px 10px;
  }
}

@media (max-width: 380px) {
  html body #app main#main .section-label {
    font-size: 10.8px !important;
  }

  html body #app main#main .section-heading-separator {
    margin: 0 6px;
  }

  html body #app main#main .section-label .section-heading-subtitle {
    font-size: 9px !important;
  }
}

/* Match equivalent text roles across the customer record and the workspaces. */
html body #app main#main .detail .stage-name,
html body #app main#main #scheduledActionsOverview .sa-ref-content .scheduled-overview-title,
html body #app main#main .crm-activity-list .sb-v2-activity-copy strong {
  font: var(--crm-item-title-type) !important;
}

html body #app main#main .list > .row-btn .row-unit,
html body #app main#main #scheduledActionsOverview .sa-ref-unit {
  font: var(--crm-unit-code-type) !important;
}

html body #app main#main #scheduledActionsOverview :is(.sa-ref-installment, .sa-ref-payment-date, .sa-ref-completion),
html body #app main#main .crm-activity-list .sb-v2-activity-copy small {
  font: var(--crm-secondary-text-type) !important;
}

@media (min-width: 1024px) {
  html body #app main#main :is(
    .detail .d-name,
    #crmDesktopTasks .sa-header-title,
    .crm-desktop-activity h2,
    .crm-desktop-reports h2,
    .sb-di-title,
    .rm-detail-name,
    .broker-detail-name
  ) {
    font: var(--crm-page-title-type) !important;
    letter-spacing: normal !important;
  }

  html body #app main#main :is(#sbRefOverviewV2 .sb-v2-title, #crmDesktopTasks .sa-worklist-head) {
    font: var(--crm-section-title-type) !important;
  }

  html body #app main#main :is(.list > .row-btn .row-name, #crmDesktopTasks .sa-ref-name) {
    font: var(--crm-customer-name-type) !important;
  }

  html body #app main#main :is(#crmDesktopTasks .sa-ref-due, .crm-activity-list .sb-v2-time) {
    font: var(--crm-detail-text-type) !important;
  }

  html body #app main#main #crmDesktopTasks .sa-ref-header > .scheduled-task-state {
    font: var(--crm-status-type) !important;
  }

  html body #app main#main #crmDesktopTasks :is(
    .sa-type-filter select,
    .scheduled-overview-select,
    .scheduled-rounded-trigger,
    .sa-ref-bottom > .scheduled-overview-done
  ) {
    font: var(--crm-action-type) !important;
  }
}
