@layer pages {
  .customers-page .customer-kpi-grid {
    margin-bottom: 6px;
  }

  .customers-page .customer-analytics-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    align-items: start;
    margin-bottom: 6px;
  }

  .customers-page .customer-analytics-grid .panel {
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 5px 16px rgba(15, 23, 42, 0.04);
  }

  .customers-page .customer-source-summary-card {
    width: 100%;
    max-width: none;
    margin-top: 0;
    margin-bottom: 0;
    padding: 9px 11px;
  }

  .customers-page .customer-source-summary-card h3,
  .customers-page .customer-tier-summary-card h3 {
    margin: 0 0 5px;
    font-size: 12.5px;
    font-weight: 700;
    color: #334155;
  }

  .customers-page .customer-source-panel-note {
    margin: 0 0 8px;
    font-size: 11.5px;
    line-height: 1.45;
    color: #64748b;
  }

  body.dark .customers-page .customer-source-panel-note {
    color: #94a3b8;
  }

  .customers-page .customer-tier-summary-card {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 9px 11px;
  }

  .customers-page .customer-source-summary {
    border-radius: 8px;
  }

  .customers-page .customer-source-head,
  .customers-page .customer-source-row {
    grid-template-columns: minmax(0, 1fr) 84px 122px;
    padding: 4px 8px;
    gap: 6px;
    min-height: 24px;
  }

  .customers-page .customer-source-head {
    font-size: 11px;
  }

  .customers-page .customer-source-head .source-col:nth-child(2),
  .customers-page .customer-source-row .source-count {
    text-align: right;
  }

  .customers-page .customer-source-head .source-col:nth-child(3),
  .customers-page .customer-source-row .source-revenue {
    text-align: right;
    font-variant-numeric: tabular-nums;
  }

  .customers-page .customer-source-row .source-name,
  .customers-page .customer-source-row .source-count,
  .customers-page .customer-source-row .source-revenue {
    font-size: 11.8px;
  }

  .customers-page .customer-source-row .source-revenue {
    font-weight: 600;
  }

  .customers-page .customer-source-row {
    border-bottom: 1px solid #f3f6fb;
  }

  .customers-page .customer-source-empty {
    padding: 8px;
    font-size: 12px;
  }

  .customers-page .customer-tier-summary {
    border: 1px solid #e7edf5;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    flex: 1 1 auto;
  }

  .customers-page .customer-tier-layout {
    display: flex;
    align-items: center;
    gap: 10px;
  }

  .customers-page .customer-tier-donut-wrap {
    width: 96px;
    min-width: 96px;
    height: 96px;
    border-radius: 50%;
    position: relative;
    display: grid;
    place-items: center;
  }

  .customers-page .customer-tier-donut {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    --cum1: 0deg;
    --cum2: 0deg;
    --cum3: 0deg;
    --cum4: 0deg;
    background:
      conic-gradient(
        #facc15 0deg var(--cum1),
        #34d399 var(--cum1) var(--cum2),
        #fb923c var(--cum2) var(--cum3),
        #60a5fa var(--cum3) var(--cum4),
        #cbd5e1 var(--cum4) 360deg
      );
    position: relative;
  }

  .customers-page .customer-tier-donut::after {
    content: "";
    position: absolute;
    inset: 18px;
    border-radius: 50%;
    background: #fff;
    border: 1px solid #edf2f7;
  }

  .customers-page .customer-tier-total {
    position: absolute;
    z-index: 1;
    font-size: 13px;
    font-weight: 700;
    color: #475569;
  }

  .customers-page .customer-tier-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 84px;
    align-items: center;
    gap: 6px;
    min-height: 24px;
    padding: 4px 8px;
    border-bottom: 1px solid #f3f6fb;
  }

  .customers-page .customer-tier-row:last-child {
    border-bottom: 0;
  }

  .customers-page .customer-tier-row .tier-count {
    text-align: right;
    color: #64748b;
    font-size: 11.8px;
  }

  .customers-page .customer-crm-table th.customer-col-orders,
  .customers-page .customer-crm-table td.customer-col-orders {
    text-align: right;
    font-variant-numeric: tabular-nums;
  }

  .customers-page .customer-crm-table th.customer-col-spent,
  .customers-page .customer-crm-table td.customer-col-spent {
    text-align: right;
    font-variant-numeric: tabular-nums;
  }

  .customers-page .customer-crm-table th.customer-col-last-date,
  .customers-page .customer-crm-table td.customer-col-last-date {
    text-align: center;
  }

  .customers-page .customer-crm-table th.customer-col-actions {
    text-align: center;
  }

  .customers-page .customer-actions-stack {
    display: inline-flex;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 4px;
    align-items: center;
    justify-content: center;
  }

  .customers-page .customer-care-details {
    display: inline-block;
    position: relative;
  }

  .customers-page .customer-care-summary {
    list-style: none;
    cursor: pointer;
    user-select: none;
  }

  .customers-page .customer-care-summary::-webkit-details-marker {
    display: none;
  }

  .customers-page .customer-care-panel {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    z-index: 25;
    min-width: 168px;
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: stretch;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.12);
  }

  .customers-page .customer-care-panel .btn {
    width: 100%;
    justify-content: center;
    white-space: normal;
    line-height: 1.25;
    text-align: center;
    hyphens: auto;
  }

  @media (max-width: 1024px) {
    .customers-page .customer-analytics-grid {
      grid-template-columns: 1fr;
      gap: 8px;
    }

    .customers-page .customer-source-summary-card,
    .customers-page .customer-tier-summary-card {
      max-width: 100%;
      width: 100%;
    }

    .customers-page .customer-tier-layout {
      flex-direction: column;
      align-items: stretch;
    }

    .customers-page .customer-tier-donut-wrap {
      margin: 0 auto;
    }
  }

  .customers-page .customer-mo-arch-badge {
    margin-left: 6px;
    vertical-align: middle;
  }

  .customers-intelligence--crm .customer-kpi-compact-section,
  .customers-intelligence--crm .customer-analytics-grid {
    display: none !important;
  }

  .customers-toolbar--crm .customers-sort-select {
    min-width: 168px;
    max-width: 220px;
  }

  .reports-tools-page .customer-reports-section {
    display: flex;
    flex-direction: column;
    gap: 14px;
  }

  .reports-tools-page .customer-analytics-grid--report {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .reports-tools-page .customer-report-grid-2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .reports-tools-page .customer-report-panel h3 {
    margin: 0 0 4px;
    font-size: 14px;
  }

  .reports-tools-page .customer-report-top-table {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 8px;
  }

  .reports-tools-page .customer-report-top-head,
  .reports-tools-page .customer-report-top-row {
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr) auto auto;
    gap: 8px;
    align-items: center;
    font-size: 13px;
  }

  .reports-tools-page .customer-report-top-head {
    font-size: 11px;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.04em;
  }

  .reports-tools-page .customer-report-top-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .reports-tools-page .customer-report-growth {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
  }

  .reports-tools-page .customer-report-growth-row {
    display: grid;
    grid-template-columns: 52px minmax(0, 1fr) 28px;
    gap: 8px;
    align-items: center;
    font-size: 12px;
  }

  .reports-tools-page .customer-report-growth-bar {
    height: 8px;
    border-radius: 999px;
    background: #f1f5f9;
    overflow: hidden;
  }

  .reports-tools-page .customer-report-growth-bar span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #fb923c, #f97316);
  }

  @media (max-width: 900px) {
    .reports-tools-page .customer-analytics-grid--report,
    .reports-tools-page .customer-report-grid-2 {
      grid-template-columns: 1fr;
    }
  }
}
