/*
 * 3DPA CRM responsive consistency layer.
 * Loaded after every CRM admin module and after customer-portal styles.
 */

.three-dpa-crm-wrap,
.crm-reporting-dashboard,
.three-dpa-ops-wrap,
.three-dpa-retention-wrap,
.crm-health-wrap,
.crm-mailbox-wrap,
.crm-campaign-wrap,
.crm-campaigns-wrap,
.three-dpa-crm-bi,
.three-dpa-contracts,
.crm-portal-admin,
.crm-data-quality,
.crm-communications-wrap,
.three-dpa-schedule-wrap {
    box-sizing: border-box;
    width: calc(100% - 20px);
    min-width: 0;
    max-width: none !important;
}

.three-dpa-crm-wrap *,
.crm-reporting-dashboard *,
.three-dpa-ops-wrap *,
.three-dpa-retention-wrap *,
.crm-health-wrap *,
.crm-mailbox-wrap *,
.crm-campaign-wrap *,
.three-dpa-crm-bi *,
.three-dpa-contracts *,
.three-dpa-schedule-wrap *,
.crm-portal-admin *,
.three-dpa-portal * {
    min-width: 0;
}

.three-dpa-crm-wrap img,
.three-dpa-crm-wrap svg,
.three-dpa-crm-wrap canvas,
.three-dpa-portal img,
.three-dpa-portal svg,
.three-dpa-portal canvas,
.three-dpa-contracts img,
.three-dpa-contracts svg,
.three-dpa-contracts canvas {
    max-width: 100%;
}

.three-dpa-crm-header,
.three-dpa-ops-header,
.three-dpa-retention-header,
.crm-health-hero,
.crm-mailbox-header,
.crm-campaign-header,
.bi-header,
.three-dpa-contract-header {
    min-width: 0;
}

.three-dpa-crm-header > div:first-child,
.panel-heading > div:first-child,
.table-summary > div:first-child,
.three-dpa-ops-header > div:first-child,
.three-dpa-retention-header > div:first-child,
.crm-health-hero > div:first-child,
.crm-mailbox-header > div:first-child,
.crm-campaign-header > div:first-child,
.bi-header > div:first-child,
.three-dpa-contract-header > div:first-child {
    min-width: 0;
    flex: 1 1 auto;
}

.three-dpa-crm-header h1,
.three-dpa-crm-header p,
.panel-heading h2,
.panel-heading p,
.record-title,
.record-subtitle,
.crm-note-content,
.crm-activity-copy,
.crm-appointment-main,
.three-dpa-portal-card,
.three-dpa-contracts td,
.three-dpa-contracts th {
    overflow-wrap: anywhere;
}

.three-dpa-crm-metrics,
.three-dpa-crm-metrics.three,
.three-dpa-crm-metrics.four,
.crm-report-kpis,
.crm-comms-metrics,
.crm-quality-metrics,
.crm-mailbox-metrics,
.crm-campaign-metrics,
.three-dpa-ops-kpis,
.three-dpa-retention-kpis,
.three-dpa-contract-stats,
.bi-kpis,
.three-dpa-portal-admin-stats {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr));
    align-items: stretch;
}

.three-dpa-crm-metric,
.crm-report-kpi,
.crm-comms-metric,
.crm-quality-card,
.crm-mailbox-metric,
.crm-campaign-metric,
.three-dpa-ops-kpi,
.three-dpa-retention-kpi,
.three-dpa-contract-stat,
.bi-kpi,
.three-dpa-portal-admin-stats > div {
    height: 100%;
}

.three-dpa-crm-grid > *,
.crm-report-grid > *,
.crm-report-grid-four > *,
.crm-report-grid-charts > *,
.crm-report-grid-insights > *,
.crm-report-grid-operations > *,
.crm-comms-workspace-grid > *,
.crm-mailbox-grid > *,
.crm-campaign-dashboard-grid > *,
.crm-campaign-report-grid > *,
.crm-campaign-two-col > *,
.bi-primary-grid > *,
.bi-secondary-grid > *,
.bi-tertiary-grid > *,
.three-dpa-contract-form-grid > *,
.three-dpa-portal-grid > * {
    min-width: 0;
}

.three-dpa-crm-panel,
.crm-chart-panel,
.three-dpa-portal-card {
    max-width: 100%;
}

.crm-chart-wrap,
.bi-chart,
.crm-chart-panel canvas,
.crm-chart-panel svg {
    width: 100%;
    max-width: 100%;
}

.crm-chart-wrap canvas,
.bi-chart canvas {
    display: block;
    width: 100% !important;
    max-width: 100% !important;
}

.nav-tab-wrapper,
.crm-comms-tabs,
.three-dpa-portal-nav,
.crm-filter-row,
.crm-report-range-buttons {
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-inline: contain;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
}

.nav-tab-wrapper .nav-tab,
.crm-comms-tabs .nav-tab,
.three-dpa-portal-nav a,
.crm-report-range-buttons button {
    flex: 0 0 auto;
    white-space: nowrap;
}

.table-scroll {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    -webkit-overflow-scrolling: touch;
}

.table-scroll table,
.three-dpa-crm-table,
.three-dpa-portal-table,
.crm-merge-table,
.crm-quote-items-table {
    width: 100%;
}

.table-scroll > table:not(.crm-compact-table),
.table-scroll > .three-dpa-crm-table,
.table-scroll > .crm-merge-table,
.table-scroll > .crm-quote-items-table {
    min-width: 720px;
}

.three-dpa-crm-table th,
.three-dpa-crm-table td,
.three-dpa-portal-table th,
.three-dpa-portal-table td {
    max-width: 420px;
    overflow-wrap: anywhere;
}

.row-actions-cell,
.crm-row-actions,
.three-dpa-portal-table .actions {
    white-space: normal;
}

.row-actions-cell .button,
.crm-row-actions .button,
.three-dpa-portal-table .actions .button {
    margin: 2px;
}

.three-dpa-crm-filter,
.crm-report-toolbar,
.crm-followup-toolbar,
.crm-pipeline-tools,
.crm-bulk-toolbar,
.three-dpa-portal-admin-actions,
.crm-campaign-toolbar,
.bi-toolbar,
.three-dpa-contract-toolbar {
    max-width: 100%;
}

.three-dpa-crm-filter input,
.three-dpa-crm-filter select,
.crm-report-toolbar input,
.crm-report-toolbar select,
.crm-bulk-toolbar input,
.crm-bulk-toolbar select,
.bi-filters input,
.bi-filters select,
.three-dpa-contracts input,
.three-dpa-contracts select,
.three-dpa-contracts textarea {
    max-width: 100%;
}

.form-actions,
.crm-quote-actions,
.crm-quote-workflow-actions,
.crm-modal-actions,
.crm-sheet-actions,
.three-dpa-contract-actions,
.three-dpa-portal-action-row {
    flex-wrap: wrap;
}

.crm-modal-dialog {
    width: min(720px, calc(100vw - 28px));
    max-height: min(90dvh, 920px);
    overscroll-behavior: contain;
}

.crm-appointment-outcome form {
    max-width: min(360px, calc(100vw - 48px));
}

.crm-pipeline {
    scroll-snap-type: x proximity;
    overscroll-behavior-inline: contain;
    -webkit-overflow-scrolling: touch;
}

.pipeline-column {
    scroll-snap-align: start;
}

.crm-quick-activity,
.three-dpa-contract-source form,
.bi-filters {
    max-width: 100%;
}

.three-dpa-portal {
    width: 100%;
    max-width: 100%;
}

.three-dpa-portal-hero > div:first-child {
    min-width: 0;
    flex: 1 1 auto;
}

.three-dpa-portal-scope {
    flex: 0 1 360px;
    max-width: 100%;
}

.three-dpa-portal-scope form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 6px;
}

.three-dpa-portal-scope select {
    width: 100%;
}

.three-dpa-portal-scope button {
    margin-left: 0;
}

.three-dpa-portal-kpis {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr));
}

.three-dpa-portal-card .button,
.three-dpa-portal-action-row .button,
.three-dpa-portal-contracts .button {
    max-width: 100%;
    white-space: normal;
    text-align: center;
}

.three-dpa-portal-document {
    overflow-wrap: anywhere;
}

@media (max-width: 1280px) {
    .three-dpa-crm-wrap,
    .crm-reporting-dashboard,
    .three-dpa-ops-wrap,
    .three-dpa-retention-wrap,
    .crm-health-wrap,
    .crm-mailbox-wrap,
    .crm-campaign-wrap,
    .three-dpa-crm-bi,
    .three-dpa-contracts,
    .crm-portal-admin,
    .three-dpa-schedule-wrap {
        margin-right: 14px;
    }

    .three-dpa-crm-grid.two,
    .crm-comms-workspace-grid,
    .crm-mailbox-grid,
    .crm-campaign-dashboard-grid,
    .crm-campaign-report-grid,
    .crm-campaign-two-col,
    .bi-primary-grid,
    .bi-secondary-grid,
    .bi-tertiary-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .three-dpa-crm-grid.two > .crm-span-two,
    .crm-comms-workspace-grid > .crm-span-two,
    .crm-mailbox-grid > .crm-span-two,
    .crm-campaign-dashboard-grid > .crm-span-two,
    .bi-primary-grid > .crm-span-two {
        grid-column: 1 / -1;
    }
}

@media (max-width: 960px) {
    .three-dpa-crm-wrap,
    .crm-reporting-dashboard,
    .three-dpa-ops-wrap,
    .three-dpa-retention-wrap,
    .crm-health-wrap,
    .crm-mailbox-wrap,
    .crm-campaign-wrap,
    .three-dpa-crm-bi,
    .three-dpa-contracts,
    .crm-portal-admin,
    .three-dpa-schedule-wrap {
        margin-top: 14px;
        margin-right: 12px;
    }

    .three-dpa-crm-header,
    .three-dpa-ops-header,
    .three-dpa-retention-header,
    .crm-health-hero,
    .crm-mailbox-header,
    .crm-campaign-header,
    .bi-header,
    .three-dpa-contract-header,
    .panel-heading,
    .table-summary,
    .crm-report-toolbar,
    .crm-followup-toolbar,
    .crm-pipeline-tools,
    .three-dpa-portal-admin-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .three-dpa-crm-header-actions,
    .crm-live-actions,
    .crm-row-actions,
    .crm-quote-actions,
    .crm-quote-workflow-actions,
    .three-dpa-contract-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .three-dpa-crm-header-actions .button,
    .crm-live-actions .button,
    .crm-row-actions .button,
    .crm-quote-actions .button,
    .crm-quote-workflow-actions .button,
    .three-dpa-contract-actions .button {
        flex: 1 1 180px;
        text-align: center;
    }

    .three-dpa-crm-grid.two,
    .crm-comms-workspace-grid,
    .crm-mailbox-grid,
    .crm-campaign-dashboard-grid,
    .crm-campaign-report-grid,
    .crm-campaign-two-col,
    .bi-primary-grid,
    .bi-secondary-grid,
    .bi-tertiary-grid,
    .three-dpa-contract-form-grid {
        grid-template-columns: 1fr;
    }

    .three-dpa-crm-grid.two > *,
    .crm-comms-workspace-grid > *,
    .crm-mailbox-grid > *,
    .crm-campaign-dashboard-grid > *,
    .crm-campaign-report-grid > *,
    .crm-campaign-two-col > *,
    .bi-primary-grid > *,
    .bi-secondary-grid > *,
    .bi-tertiary-grid > * {
        grid-column: auto;
    }

    .three-dpa-crm-grid.profile-grid {
        grid-template-columns: 1fr;
    }

    .profile-card {
        position: static;
    }

    .crm-quick-activity {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .crm-quick-activity textarea,
    .crm-quick-activity button {
        grid-column: 1 / -1;
    }

    .crm-report-grid-insights > .three-dpa-crm-panel,
    .crm-report-grid-charts > .three-dpa-crm-panel,
    .crm-report-grid-operations > .three-dpa-crm-panel {
        height: auto;
        min-height: 0;
        max-height: none;
    }

    .crm-report-activity-panel .crm-recent-activity {
        max-height: min(56dvh, 520px);
    }

    .three-dpa-portal-hero {
        align-items: stretch;
        flex-direction: column;
    }

    .three-dpa-portal-scope {
        width: 100%;
        flex-basis: auto;
    }
}

@media (max-width: 782px) {
    .three-dpa-crm-wrap,
    .crm-reporting-dashboard,
    .three-dpa-ops-wrap,
    .three-dpa-retention-wrap,
    .crm-health-wrap,
    .crm-mailbox-wrap,
    .crm-campaign-wrap,
    .three-dpa-crm-bi,
    .three-dpa-contracts,
    .crm-portal-admin,
    .three-dpa-schedule-wrap {
        margin: 12px 10px 32px 0;
    }

    .three-dpa-crm-header,
    .three-dpa-crm-panel,
    .crm-chart-panel,
    .three-dpa-portal-card {
        border-radius: 14px;
    }

    .three-dpa-crm-header {
        padding: 20px;
    }

    .three-dpa-crm-header h1,
    .crm-reporting-hero h1 {
        font-size: clamp(24px, 7vw, 30px);
    }

    .three-dpa-crm-panel,
    .crm-chart-panel {
        padding: 18px;
    }

    .table-panel,
    .crm-report-orders-panel {
        padding: 0;
    }

    .three-dpa-crm-filter {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        align-items: end;
    }

    .three-dpa-crm-filter > * {
        width: 100%;
        min-width: 0 !important;
    }

    .three-dpa-crm-filter input[type="search"] {
        grid-column: 1 / -1;
    }

    .form-grid.two,
    .form-grid.three,
    .three-dpa-crm-bi .form-grid.three,
    .three-dpa-portal-detail-grid,
    .three-dpa-portal-permission-grid {
        grid-template-columns: 1fr;
    }

    .form-actions {
        justify-content: stretch;
    }

    .form-actions .button,
    .form-actions .button-large {
        flex: 1 1 180px;
        min-height: 44px;
        text-align: center;
    }

    .three-dpa-crm-list-row,
    .crm-notification-row,
    .crm-appointment-row,
    .crm-followup-row,
    .crm-opportunity-alert {
        align-items: flex-start;
        flex-direction: column;
    }

    .list-meta,
    .crm-alert-meta {
        white-space: normal;
        text-align: left;
        align-items: flex-start;
    }

    .crm-row-actions {
        padding-left: 0;
    }

    .crm-appointment-time {
        width: auto;
        flex-basis: auto;
        text-align: left;
    }

    .crm-appointment-outcome,
    .crm-appointment-outcome form {
        width: 100%;
        max-width: none;
    }

    .crm-modal {
        align-items: flex-end;
        padding: 0;
    }

    .crm-modal-dialog {
        width: 100%;
        max-height: 92dvh;
        border-radius: 20px 20px 0 0;
        padding: 18px;
    }

    .crm-pipeline {
        grid-auto-columns: minmax(min(84vw, 320px), 1fr);
    }

    .pipeline-column {
        min-height: 420px;
    }

    .three-dpa-portal-table-wrap,
    .three-dpa-portal .table-scroll {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .three-dpa-portal-table {
        min-width: 640px;
    }
}

@media (max-width: 600px) {
    .three-dpa-crm-wrap,
    .crm-reporting-dashboard,
    .three-dpa-ops-wrap,
    .three-dpa-retention-wrap,
    .crm-health-wrap,
    .crm-mailbox-wrap,
    .crm-campaign-wrap,
    .three-dpa-crm-bi,
    .three-dpa-contracts,
    .crm-portal-admin,
    .three-dpa-schedule-wrap {
        margin-right: 8px;
    }

    .three-dpa-crm-metrics,
    .three-dpa-crm-metrics.three,
    .three-dpa-crm-metrics.four,
    .crm-report-kpis,
    .crm-comms-metrics,
    .crm-quality-metrics,
    .crm-mailbox-metrics,
    .crm-campaign-metrics,
    .three-dpa-ops-kpis,
    .three-dpa-retention-kpis,
    .three-dpa-contract-stats,
    .bi-kpis,
    .three-dpa-portal-admin-stats {
        grid-template-columns: 1fr;
    }

    .three-dpa-crm-filter {
        grid-template-columns: 1fr;
    }

    .three-dpa-crm-filter input[type="search"] {
        grid-column: auto;
    }

    .three-dpa-crm-header-actions,
    .crm-live-actions,
    .crm-row-actions,
    .crm-quote-actions,
    .crm-quote-workflow-actions,
    .three-dpa-contract-actions,
    .form-actions,
    .crm-modal-actions,
    .three-dpa-portal-action-row {
        flex-direction: column;
        align-items: stretch;
    }

    .three-dpa-crm-header-actions .button,
    .crm-live-actions .button,
    .crm-row-actions .button,
    .crm-quote-actions .button,
    .crm-quote-workflow-actions .button,
    .three-dpa-contract-actions .button,
    .form-actions .button,
    .crm-modal-actions .button,
    .three-dpa-portal-action-row .button {
        width: 100%;
        flex: 0 0 auto;
        min-height: 44px;
        height: auto;
        padding: 10px 14px;
        line-height: 1.3;
        white-space: normal;
        text-align: center;
    }

    .crm-quick-activity {
        grid-template-columns: 1fr;
    }

    .crm-quick-activity textarea,
    .crm-quick-activity button {
        grid-column: auto;
    }

    .table-summary,
    .three-dpa-crm-pagination {
        align-items: flex-start;
        flex-direction: column;
        gap: 10px;
    }

    .three-dpa-crm-pagination {
        justify-content: flex-start;
        overflow-x: auto;
    }

    .crm-report-grid-charts .crm-chart-wrap,
    .crm-report-grid-insights .crm-chart-wrap,
    .bi-chart {
        min-height: 220px;
        height: 220px;
    }

    .crm-donut-layout,
    .crm-donut-layout.compact {
        grid-template-columns: 1fr;
    }

    .crm-donut-wrap {
        max-width: 240px;
        margin-inline: auto;
    }

    .crm-conversion-summary {
        grid-template-columns: 1fr;
    }

    .crm-conversion-summary > div {
        border-left: 0 !important;
        border-top: 1px solid var(--crm-line, #dce4ec);
    }

    .crm-conversion-summary > div:first-child {
        border-top: 0;
    }

    .three-dpa-portal-hero {
        padding: 21px 18px;
    }

    .three-dpa-portal-scope form {
        grid-template-columns: 1fr;
    }

    .three-dpa-portal-scope button {
        width: 100%;
    }

    .three-dpa-portal-kpis,
    .three-dpa-portal-grid.two,
    .three-dpa-portal-grid.three,
    .three-dpa-portal-document-grid {
        grid-template-columns: 1fr;
    }

    .three-dpa-portal-kpi {
        min-height: 82px;
    }

    .three-dpa-portal-card {
        padding: 17px;
    }
}

@media (max-width: 400px) {
    .three-dpa-crm-header,
    .three-dpa-crm-panel,
    .crm-chart-panel,
    .three-dpa-portal-card {
        padding-left: 15px;
        padding-right: 15px;
    }

    .table-panel,
    .crm-report-orders-panel {
        padding-left: 0;
        padding-right: 0;
    }

    .crm-pipeline {
        grid-auto-columns: calc(100vw - 54px);
    }

    .three-dpa-portal-kpi {
        grid-template-columns: 38px minmax(0, 1fr) 18px;
        gap: 10px;
        padding: 14px;
    }

    .three-dpa-portal-kpi-icon,
    .doc-icon {
        width: 38px;
        height: 38px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .three-dpa-crm-wrap *,
    .three-dpa-portal *,
    .three-dpa-contracts * {
        scroll-behavior: auto !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}

/* v2.7.2 true fluid desktop and wide-screen layout */
#wpbody-content > .wrap.three-dpa-crm-wrap {
    width: calc(100% - 20px);
    max-width: none !important;
}

.three-dpa-crm-wrap,
.crm-reporting-dashboard,
.three-dpa-ops-wrap,
.three-dpa-retention-wrap,
.crm-health-wrap,
.crm-mailbox-wrap,
.crm-campaign-wrap,
.crm-campaigns-wrap,
.three-dpa-crm-bi,
.three-dpa-contracts,
.crm-portal-admin,
.crm-data-quality,
.crm-communications-wrap,
.three-dpa-schedule-wrap {
    container-type: inline-size;
    container-name: three-dpa-crm-page;
}

/* Prevent module-level legacy width ceilings from winning on large screens. */
.three-dpa-crm-wrap.crm-reporting-dashboard,
.three-dpa-crm-wrap.three-dpa-ops-wrap,
.three-dpa-crm-wrap.three-dpa-retention-wrap,
.three-dpa-crm-wrap.crm-health-wrap,
.three-dpa-crm-wrap.crm-mailbox-wrap,
.three-dpa-crm-wrap.crm-campaign-wrap,
.three-dpa-crm-wrap.crm-campaigns-wrap,
.three-dpa-crm-wrap.three-dpa-crm-bi,
.three-dpa-crm-wrap.three-dpa-contracts,
.three-dpa-crm-wrap.crm-portal-admin,
.three-dpa-crm-wrap.crm-data-quality,
.three-dpa-crm-wrap.crm-communications-wrap,
.three-dpa-schedule-wrap {
    max-width: none !important;
}

/* Let content use the screen while keeping readable controls and text. */
.three-dpa-crm-header,
.three-dpa-crm-panel,
.crm-chart-panel,
.three-dpa-ops-panel,
.three-dpa-retention-panel,
.crm-health-panel,
.crm-mailbox-panel,
.crm-campaign-panel,
.bi-panel,
.three-dpa-portal-card {
    width: 100%;
}

@media (min-width: 1600px) {
    .three-dpa-crm-wrap,
    .crm-reporting-dashboard,
    .three-dpa-ops-wrap,
    .three-dpa-retention-wrap,
    .crm-health-wrap,
    .crm-mailbox-wrap,
    .crm-campaign-wrap,
    .crm-campaigns-wrap,
    .three-dpa-crm-bi,
    .three-dpa-contracts,
    .crm-portal-admin,
    .crm-data-quality,
    .crm-communications-wrap,
.three-dpa-schedule-wrap {
        margin-right: 24px;
        width: calc(100% - 24px);
    }

    .three-dpa-crm-header,
    .three-dpa-crm-panel,
    .crm-chart-panel {
        padding-left: clamp(24px, 1.35vw, 34px);
        padding-right: clamp(24px, 1.35vw, 34px);
    }

    .three-dpa-crm-metrics,
    .three-dpa-crm-metrics.three,
    .three-dpa-crm-metrics.four,
    .crm-report-kpis,
    .crm-comms-metrics,
    .crm-quality-metrics,
    .crm-mailbox-metrics,
    .crm-campaign-metrics,
    .three-dpa-ops-kpis,
    .three-dpa-retention-kpis,
    .three-dpa-contract-stats,
    .bi-kpis,
    .three-dpa-portal-admin-stats {
        grid-template-columns: repeat(auto-fit, minmax(225px, 1fr));
    }

    .three-dpa-crm-grid.profile-grid {
        grid-template-columns: minmax(330px, 380px) minmax(0, 1fr);
    }

    .crm-report-grid-charts {
        grid-template-columns: minmax(0, 2.25fr) minmax(330px, .9fr) minmax(350px, 1fr);
        grid-auto-rows: minmax(430px, auto);
    }

    .crm-report-grid-charts > .three-dpa-crm-panel {
        min-height: 430px;
    }

    .crm-report-grid-charts .crm-chart-wrap {
        height: 310px;
        min-height: 310px;
    }

    .crm-report-grid-insights {
        grid-auto-rows: 410px;
    }

    .crm-report-grid-insights > .three-dpa-crm-panel {
        height: 410px;
        min-height: 410px;
    }

    .crm-report-grid-insights .crm-chart-wrap.compact {
        height: 192px;
        min-height: 192px;
        flex-basis: 192px;
    }

    .crm-report-grid-operations {
        grid-template-columns: minmax(0, 2.25fr) minmax(380px, .9fr);
    }

    .crm-report-grid-operations > .crm-report-orders-panel,
    .crm-report-grid-operations > .crm-report-activity-panel {
        min-height: 510px;
        max-height: 510px;
    }

    .bi-primary-grid {
        grid-template-columns: minmax(0, 2.35fr) minmax(360px, .85fr);
    }

    .bi-secondary-grid,
    .bi-tertiary-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .three-dpa-ops-detail-grid,
    .three-dpa-retention-detail-grid,
    .three-dpa-contract-layout {
        grid-template-columns: minmax(0, 2.4fr) minmax(340px, .75fr);
    }

    .crm-global-results {
        grid-template-columns: repeat(5, minmax(0, 1fr));
    }
}

@media (min-width: 2200px) {
    .three-dpa-crm-wrap,
    .crm-reporting-dashboard,
    .three-dpa-ops-wrap,
    .three-dpa-retention-wrap,
    .crm-health-wrap,
    .crm-mailbox-wrap,
    .crm-campaign-wrap,
    .crm-campaigns-wrap,
    .three-dpa-crm-bi,
    .three-dpa-contracts,
    .crm-portal-admin,
    .crm-data-quality,
    .crm-communications-wrap,
.three-dpa-schedule-wrap {
        margin-right: 30px;
        width: calc(100% - 30px);
    }

    .three-dpa-crm-metrics,
    .three-dpa-crm-metrics.three,
    .three-dpa-crm-metrics.four,
    .crm-report-kpis,
    .crm-comms-metrics,
    .crm-quality-metrics,
    .crm-mailbox-metrics,
    .crm-campaign-metrics,
    .three-dpa-ops-kpis,
    .three-dpa-retention-kpis,
    .three-dpa-contract-stats,
    .bi-kpis,
    .three-dpa-portal-admin-stats {
        grid-template-columns: repeat(auto-fit, minmax(245px, 1fr));
    }

    .crm-report-grid-charts {
        grid-template-columns: minmax(0, 2.5fr) minmax(390px, .85fr) minmax(410px, .95fr);
        grid-auto-rows: minmax(470px, auto);
    }

    .crm-report-grid-charts > .three-dpa-crm-panel {
        min-height: 470px;
    }

    .crm-report-grid-charts .crm-chart-wrap {
        height: 345px;
        min-height: 345px;
    }

    .crm-report-grid-insights {
        grid-auto-rows: 440px;
    }

    .crm-report-grid-insights > .three-dpa-crm-panel {
        height: 440px;
        min-height: 440px;
    }

    .crm-report-grid-operations > .crm-report-orders-panel,
    .crm-report-grid-operations > .crm-report-activity-panel {
        min-height: 560px;
        max-height: 560px;
    }

    .three-dpa-crm-panel,
    .crm-chart-panel {
        border-radius: 18px;
    }
}

/* Container-aware fallback when the WordPress menu changes the usable width. */
@container three-dpa-crm-page (min-width: 1800px) {
    .three-dpa-crm-grid.two {
        gap: 24px;
    }

    .crm-feature-grid {
        grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    }

    .form-grid.two,
    .three-dpa-contract-form-grid,
    .three-dpa-ops-form-grid,
    .retention-form-grid {
        column-gap: 22px;
    }
}


/* v2.7.3 adaptive card sizing and density */
.three-dpa-crm-wrap,
.crm-reporting-dashboard,
.three-dpa-ops-wrap,
.three-dpa-retention-wrap,
.crm-health-wrap,
.crm-mailbox-wrap,
.crm-campaign-wrap,
.crm-campaigns-wrap,
.three-dpa-crm-bi,
.three-dpa-contracts,
.crm-portal-admin,
.crm-data-quality,
.crm-communications-wrap,
.three-dpa-schedule-wrap {
    --crm-adaptive-gap: clamp(12px, .8cqw, 24px);
    --crm-adaptive-panel-padding: clamp(18px, 1.15cqw, 34px);
    --crm-adaptive-kpi-padding: clamp(15px, .95cqw, 26px);
    --crm-adaptive-kpi-height: clamp(108px, 7.4cqw, 168px);
    --crm-adaptive-kpi-value: clamp(24px, 1.55cqw, 38px);
    --crm-adaptive-kpi-label: clamp(12px, .72cqw, 15px);
    --crm-adaptive-icon: clamp(40px, 2.45cqw, 56px);
    --crm-adaptive-radius: clamp(13px, .75cqw, 20px);
}

.three-dpa-portal {
    container-type: inline-size;
    container-name: three-dpa-portal-page;
    --crm-adaptive-gap: clamp(12px, 1.35cqw, 24px);
    --crm-adaptive-panel-padding: clamp(17px, 2cqw, 30px);
    --crm-adaptive-kpi-padding: clamp(14px, 1.7cqw, 24px);
    --crm-adaptive-kpi-height: clamp(84px, 10cqw, 132px);
    --crm-adaptive-kpi-value: clamp(23px, 2.5cqw, 34px);
    --crm-adaptive-radius: clamp(13px, 1.4cqw, 20px);
}

/* The grid follows the usable WordPress content width, not the browser width. */
.three-dpa-crm-metrics,
.three-dpa-crm-metrics.three,
.three-dpa-crm-metrics.four,
.crm-report-kpis,
.crm-comms-metrics,
.crm-quality-metrics,
.crm-mailbox-metrics,
.crm-campaign-metrics,
.three-dpa-ops-kpis,
.three-dpa-retention-kpis,
.three-dpa-contract-stats,
.bi-kpi-grid,
.bi-kpis,
.three-dpa-portal-admin-stats {
    gap: var(--crm-adaptive-gap);
    grid-auto-rows: 1fr;
}

.three-dpa-crm-metric,
.crm-report-kpi,
.crm-comms-metric,
.crm-quality-card,
.crm-mailbox-metric,
.crm-campaign-metric,
.three-dpa-ops-kpi,
.three-dpa-retention-kpi,
.three-dpa-contract-stat,
.bi-kpi-card,
.bi-kpi,
.three-dpa-portal-admin-stats > div {
    box-sizing: border-box;
    min-height: var(--crm-adaptive-kpi-height);
    height: 100%;
    padding: var(--crm-adaptive-kpi-padding);
    border-radius: var(--crm-adaptive-radius);
}

.three-dpa-crm-metric strong,
.crm-report-kpi strong,
.crm-comms-metric strong,
.crm-quality-card strong,
.crm-mailbox-metric strong,
.crm-campaign-metric strong,
.three-dpa-ops-kpi strong,
.three-dpa-ops-kpi .kpi-number,
.three-dpa-retention-kpi strong,
.three-dpa-retention-kpi .kpi-number,
.three-dpa-contract-stat strong,
.bi-kpi-card strong,
.bi-kpi strong,
.three-dpa-portal-admin-stats > div strong {
    font-size: var(--crm-adaptive-kpi-value);
}

.three-dpa-crm-metric > span,
.crm-report-kpi .crm-kpi-copy > span,
.crm-comms-metric small,
.crm-quality-card > span,
.crm-mailbox-metric > span,
.crm-campaign-metric > span,
.three-dpa-ops-kpi > span,
.three-dpa-retention-kpi > span,
.three-dpa-contract-stat > span,
.bi-kpi-card > span,
.bi-kpi > span {
    font-size: var(--crm-adaptive-kpi-label);
}

.crm-kpi-icon,
.crm-comms-metric > .dashicons:first-child,
.crm-mailbox-metric > .dashicons:first-child,
.crm-campaign-metric > .dashicons:first-child {
    width: var(--crm-adaptive-icon);
    height: var(--crm-adaptive-icon);
    flex-basis: var(--crm-adaptive-icon);
    border-radius: calc(var(--crm-adaptive-radius) - 2px);
}

.three-dpa-crm-panel:not(.table-panel):not(.crm-report-orders-panel),
.crm-chart-panel,
.three-dpa-ops-panel,
.three-dpa-retention-panel,
.crm-health-panel,
.crm-mailbox-panel,
.crm-campaign-panel,
.three-dpa-contract-panel,
.three-dpa-portal-card {
    box-sizing: border-box;
    padding: var(--crm-adaptive-panel-padding);
    border-radius: var(--crm-adaptive-radius);
}

.crm-report-grid-charts,
.crm-report-grid-insights,
.crm-report-grid-operations,
.bi-primary-grid,
.bi-secondary-grid,
.bi-tertiary-grid,
.three-dpa-crm-grid,
.crm-comms-workspace-grid,
.crm-mailbox-grid,
.crm-campaign-dashboard-grid,
.crm-campaign-report-grid {
    gap: var(--crm-adaptive-gap);
}

/* Keep matched cards matched, while allowing the complete row to grow with the screen. */
@container three-dpa-crm-page (min-width: 1000px) {
    .crm-report-grid-charts {
        grid-auto-rows: minmax(clamp(350px, 27cqw, 520px), auto);
    }

    .crm-report-grid-charts > .three-dpa-crm-panel {
        min-height: clamp(350px, 27cqw, 520px);
    }

    .crm-report-grid-charts .crm-chart-wrap {
        height: clamp(245px, 18cqw, 395px);
        min-height: clamp(245px, 18cqw, 395px);
    }

    .crm-report-grid-insights {
        grid-auto-rows: clamp(330px, 23cqw, 480px);
    }

    .crm-report-grid-insights > .three-dpa-crm-panel {
        height: clamp(330px, 23cqw, 480px);
        min-height: clamp(330px, 23cqw, 480px);
    }

    .crm-report-grid-insights .crm-chart-wrap.compact {
        height: clamp(155px, 11cqw, 220px);
        min-height: clamp(155px, 11cqw, 220px);
        flex-basis: clamp(155px, 11cqw, 220px);
    }

    .crm-report-grid-operations > .crm-report-orders-panel,
    .crm-report-grid-operations > .crm-report-activity-panel {
        min-height: clamp(430px, 30cqw, 620px);
        max-height: clamp(430px, 30cqw, 620px);
    }
}

/* One-column phones and narrow embedded panes. */
@container three-dpa-crm-page (max-width: 519px) {
    .three-dpa-crm-metrics,
    .three-dpa-crm-metrics.three,
    .three-dpa-crm-metrics.four,
    .crm-report-kpis,
    .crm-comms-metrics,
    .crm-quality-metrics,
    .crm-mailbox-metrics,
    .crm-campaign-metrics,
    .three-dpa-ops-kpis,
    .three-dpa-retention-kpis,
    .three-dpa-contract-stats,
    .bi-kpi-grid,
    .bi-kpis,
    .three-dpa-portal-admin-stats {
        grid-template-columns: 1fr;
    }
}

/* Small tablets and narrow laptop panes. */
@container three-dpa-crm-page (min-width: 520px) and (max-width: 799px) {
    .three-dpa-crm-metrics,
    .three-dpa-crm-metrics.three,
    .three-dpa-crm-metrics.four,
    .crm-report-kpis,
    .crm-comms-metrics,
    .crm-quality-metrics,
    .crm-mailbox-metrics,
    .crm-campaign-metrics,
    .three-dpa-ops-kpis,
    .three-dpa-retention-kpis,
    .three-dpa-contract-stats,
    .bi-kpi-grid,
    .bi-kpis,
    .three-dpa-portal-admin-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* Tablets and standard laptop working widths. */
@container three-dpa-crm-page (min-width: 800px) and (max-width: 1099px) {
    .three-dpa-crm-metrics,
    .crm-comms-metrics,
    .crm-quality-metrics,
    .crm-mailbox-metrics,
    .crm-campaign-metrics,
    .three-dpa-ops-kpis,
    .three-dpa-retention-kpis,
    .three-dpa-contract-stats,
    .bi-kpi-grid,
    .bi-kpis,
    .three-dpa-portal-admin-stats {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .three-dpa-crm-metrics.four,
    .crm-report-kpis {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

/* Normal desktop layout. */
@container three-dpa-crm-page (min-width: 1100px) and (max-width: 1519px) {
    .three-dpa-crm-metrics,
    .three-dpa-crm-metrics.four,
    .crm-report-kpis,
    .crm-quality-metrics,
    .crm-mailbox-metrics,
    .crm-campaign-metrics,
    .three-dpa-ops-kpis,
    .three-dpa-retention-kpis,
    .three-dpa-contract-stats,
    .bi-kpi-grid,
    .bi-kpis,
    .three-dpa-portal-admin-stats {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .three-dpa-crm-metrics.three,
    .crm-comms-metrics {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

/* Wide desktop: the eight headline cards use one balanced row. */
@container three-dpa-crm-page (min-width: 1520px) {
    .crm-report-kpis {
        grid-template-columns: repeat(8, minmax(0, 1fr));
    }

    .three-dpa-crm-metrics.four,
    .three-dpa-ops-kpis,
    .three-dpa-retention-kpis,
    .three-dpa-contract-stats,
    .three-dpa-portal-admin-stats {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .three-dpa-crm-metrics.three,
    .crm-comms-metrics {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .crm-quality-metrics,
    .crm-mailbox-metrics,
    .crm-campaign-metrics,
    .bi-kpi-grid,
    .bi-kpis {
        grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    }
}

/* Ultrawide cards gain breathing room but remain readable rather than becoming flat banners. */
@container three-dpa-crm-page (min-width: 2200px) {
    .crm-report-kpi {
        min-height: clamp(142px, 6.5cqw, 182px);
    }

    .crm-quality-metrics,
    .crm-mailbox-metrics,
    .crm-campaign-metrics,
    .bi-kpi-grid,
    .bi-kpis {
        grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
    }
}

/* Customer portal cards use their own actual content width. */
@container three-dpa-portal-page (max-width: 559px) {
    .three-dpa-portal-kpis,
    .three-dpa-portal-grid.two,
    .three-dpa-portal-grid.three,
    .three-dpa-portal-document-grid {
        grid-template-columns: 1fr;
    }
}

@container three-dpa-portal-page (min-width: 560px) and (max-width: 899px) {
    .three-dpa-portal-kpis,
    .three-dpa-portal-grid.two,
    .three-dpa-portal-grid.three,
    .three-dpa-portal-document-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@container three-dpa-portal-page (min-width: 900px) {
    .three-dpa-portal-kpis {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: var(--crm-adaptive-gap);
    }

    .three-dpa-portal-grid.two {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .three-dpa-portal-grid.three {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

.three-dpa-portal-kpi {
    min-height: var(--crm-adaptive-kpi-height);
    padding: var(--crm-adaptive-kpi-padding);
    border-radius: var(--crm-adaptive-radius);
}

.three-dpa-portal-kpi strong {
    font-size: var(--crm-adaptive-kpi-value);
}

/* v2.8.0 adaptive card interiors: internal content responds to each card, not only the page. */
.crm-health-metric,
.crm-health-card,
.crm-report-kpi,
.crm-comms-metric,
.crm-quality-card,
.crm-mailbox-metric,
.crm-campaign-metric,
.three-dpa-ops-kpi,
.three-dpa-retention-kpi,
.three-dpa-contract-stat,
.bi-kpi,
.three-dpa-portal-kpi,
.three-dpa-portal-admin-stats > div,
.schedule-kpi,
.schedule-resource-card {
    container-type: inline-size;
}

.crm-health-metric {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
        "label value"
        "description value";
    align-content: center;
    align-items: center;
    column-gap: clamp(14px, 4cqi, 34px);
    row-gap: 7px;
    min-height: clamp(118px, 10vw, 156px);
    padding: clamp(17px, 3cqi, 28px);
}
.crm-health-metric > span {
    grid-area: label;
    align-self: end;
    line-height: 1.25;
    overflow-wrap: anywhere;
}
.crm-health-metric > strong {
    grid-area: value;
    align-self: center;
    margin: 0;
    min-width: 1.25em;
    font-size: clamp(31px, 8cqi, 52px);
    line-height: 1;
    text-align: right;
}
.crm-health-metric > small {
    grid-area: description;
    align-self: start;
    max-width: 34ch;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.crm-health-card {
    display: flex;
    flex-direction: column;
    min-height: clamp(190px, 13vw, 245px);
    padding: clamp(17px, 2.4cqi, 25px);
}
.crm-health-card-top {
    min-height: 30px;
}
.crm-health-card-top > strong {
    display: grid;
    place-content: center;
    min-width: 38px;
    min-height: 30px;
    padding: 3px 8px;
    border-radius: 10px;
    background: #f1f5f9;
    line-height: 1;
}
.crm-health-card > h3 {
    margin-top: clamp(13px, 3cqi, 22px);
    font-size: clamp(16px, 4.2cqi, 20px);
    line-height: 1.3;
    overflow-wrap: anywhere;
}
.crm-health-card > p {
    flex: 1 1 auto;
    margin-bottom: clamp(14px, 3cqi, 22px);
    line-height: 1.5;
    overflow-wrap: anywhere;
}
.crm-health-card > .crm-health-link {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    margin-top: auto;
}

.crm-report-kpi,
.crm-comms-metric,
.crm-mailbox-metric,
.crm-campaign-metric,
.three-dpa-ops-kpi,
.three-dpa-retention-kpi,
.three-dpa-contract-stat,
.bi-kpi {
    align-content: center;
    min-height: clamp(112px, 9vw, 148px);
    padding: clamp(15px, 2.5cqi, 24px);
}

@container (max-width: 300px) {
    .crm-health-metric {
        grid-template-columns: 1fr;
        grid-template-areas: "label" "value" "description";
        align-content: start;
    }
    .crm-health-metric > strong {
        text-align: left;
        font-size: 36px;
    }
    .crm-health-metric > small {
        max-width: none;
    }
    .crm-health-card-top {
        align-items: flex-start;
        flex-wrap: wrap;
    }
    .crm-health-card-top > strong {
        margin-left: 0;
    }
}

@container (min-width: 500px) {
    .crm-health-card {
        min-height: 210px;
    }
    .crm-health-card-top > strong {
        min-width: 46px;
        font-size: 22px;
    }
}
