/* ══════════════════════════════════════════════════════════
   Client Detail — Stripe / Mercury fintech refresh
   ──────────────────────────────────────────────────────────
   Scoped to .client-detail so nothing leaks globally.
   ══════════════════════════════════════════════════════════ */

/* ── Design Tokens ─────────────────────────────────────── */
.client-detail {
    --cd-radius: 12px;
    --cd-radius-sm: 8px;
    --cd-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.06);
    --cd-shadow-hover: 0 4px 16px rgba(0,0,0,0.07), 0 1px 3px rgba(0,0,0,0.04);
    --cd-border: #e5e7eb;
    --cd-border-light: #f3f4f6;
    --cd-bg-subtle: #f9fafb;
    --cd-text-primary: #111827;
    --cd-text-secondary: #374151;
    --cd-text-muted: #6b7280;
    --cd-text-faint: #9ca3af;
    --cd-spacing-section: 28px;
    --cd-spacing-item: 14px;
}

/* ── Page Header ───────────────────────────────────────── */
.client-detail .cd-page-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 1.5rem;
}
.client-detail .cd-back-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 1px solid var(--cd-border);
    background: #fff;
    color: var(--cd-text-muted);
    text-decoration: none;
    transition: all 0.15s ease;
    flex-shrink: 0;
}
.client-detail .cd-back-btn:hover {
    background: var(--cd-bg-subtle);
    color: var(--cd-text-primary);
    border-color: #d1d5db;
}
.client-detail .cd-back-btn svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
}
.client-detail .cd-page-title {
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--cd-text-primary);
    margin: 0;
    line-height: 1.3;
}

/* ── Card Base ─────────────────────────────────────────── */
.client-detail .cd-card {
    background: #fff;
    border: 1px solid var(--cd-border);
    border-radius: var(--cd-radius);
    overflow: hidden;
    transition: box-shadow 0.2s ease;
}
.client-detail .cd-card:hover {
    box-shadow: var(--cd-shadow);
}

/* ── Card Header ───────────────────────────────────────── */
.client-detail .cd-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--cd-border-light);
    background: var(--cd-bg-subtle);
}
.client-detail .cd-card-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: 10px;
    flex-shrink: 0;
}
.client-detail .cd-card-icon svg {
    width: 18px;
    height: 18px;
    stroke-width: 1.8;
}
.client-detail .cd-card-icon--blue {
    background: #eff6ff;
    color: #3b82f6;
}
.client-detail .cd-card-icon--green {
    background: #ecfdf5;
    color: #059669;
}
.client-detail .cd-card-icon--violet {
    background: #f5f3ff;
    color: #7c3aed;
}
.client-detail .cd-card-title {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--cd-text-primary);
    margin: 0;
    letter-spacing: -0.01em;
}
.client-detail .cd-count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 7px;
    font-size: 0.6875rem;
    font-weight: 700;
    line-height: 1;
    color: var(--cd-text-muted);
    background: #e5e7eb;
    border-radius: 50rem;
    margin-left: auto;
}
.client-detail .cd-card-body {
    padding: 20px;
}

/* ── Profile Hero Zone ─────────────────────────────────── */
.client-detail .cd-profile-hero {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 28px 28px 24px;
    border-bottom: 1px solid var(--cd-border-light);
}
.client-detail .cd-avatar-ring {
    flex-shrink: 0;
    padding: 3px;
    border-radius: 18px;
    background: linear-gradient(135deg, #e0e7ff 0%, #c7d2fe 50%, #a5b4fc 100%);
    transition: background 0.3s ease;
}
.client-detail .cd-avatar-ring:hover {
    background: linear-gradient(135deg, #c7d2fe 0%, #a5b4fc 50%, #818cf8 100%);
}
.client-detail .cd-avatar-link {
    display: block;
    flex-shrink: 0;
}
.client-detail .cd-avatar {
    width: 68px;
    height: 68px;
    border-radius: 15px;
    object-fit: cover;
    border: 3px solid #fff;
    background: var(--cd-bg-subtle);
    display: block;
}
.client-detail .cd-hero-info {
    flex: 1;
    min-width: 0;
}
.client-detail .cd-hero-name-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.client-detail .cd-hero-name {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--cd-text-primary);
    margin: 0;
    letter-spacing: -0.02em;
    line-height: 1.3;
}
.client-detail .cd-hero-email {
    font-size: 0.875rem;
    color: var(--cd-text-muted);
    margin: 4px 0 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── Status Badge ──────────────────────────────────────── */
.client-detail .cd-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 50rem;
    white-space: nowrap;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}
.client-detail .cd-badge--active {
    background: #ecfdf5;
    color: #059669;
    border: 1px solid #d1fae5;
}
.client-detail .cd-badge--active::before {
    content: '';
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #10b981;
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}
.client-detail .cd-badge--inactive {
    background: #fef3c7;
    color: #b45309;
    border: 1px solid #fde68a;
}
.client-detail .cd-badge--inactive::before {
    content: '';
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #f59e0b;
    box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.2);
}

/* ── Hero Levels — Stepper ────────────────────────────── */
.client-detail .cd-hero-levels {
    padding: 20px 28px 24px;
    border-bottom: 1px solid var(--cd-border-light);
    background: #fff;
}
.client-detail .cd-levels-stepper {
    display: flex;
    align-items: flex-start;
    gap: 0;
}
.client-detail .cd-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    flex: 1;
    min-width: 0;
}
.client-detail .cd-step-indicator {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    font-weight: 700;
    position: relative;
    z-index: 1;
    transition: all 0.2s ease;
}
.client-detail .cd-step--complete .cd-step-indicator {
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
    color: #059669;
    border: 2px solid #a7f3d0;
}
.client-detail .cd-step--incomplete .cd-step-indicator {
    background: #fff;
    color: var(--cd-text-muted);
    border: 2px solid var(--cd-border);
}
.client-detail .cd-step-number {
    font-size: 0.875rem;
    font-weight: 700;
    line-height: 1;
}
.client-detail .cd-step-indicator svg {
    stroke: currentColor;
    fill: none;
}
.client-detail .cd-step-connector {
    position: absolute;
    top: 20px;
    left: calc(50% + 24px);
    width: calc(100% - 48px);
    height: 2px;
    background: var(--cd-border);
    border-radius: 1px;
    z-index: 0;
}
.client-detail .cd-step-connector--done {
    background: linear-gradient(90deg, #a7f3d0, #6ee7b7);
}
.client-detail .cd-step-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 10px;
    text-align: center;
}
.client-detail .cd-step-label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--cd-text-secondary);
    line-height: 1.3;
}
.client-detail .cd-step--complete .cd-step-label {
    color: #059669;
}
.client-detail .cd-step-status {
    font-size: 0.75rem;
    font-weight: 500;
    margin-top: 2px;
    line-height: 1.3;
}
.client-detail .cd-step--complete .cd-step-status {
    color: #10b981;
}
.client-detail .cd-step--incomplete .cd-step-status {
    color: var(--cd-text-faint);
}

/* ── Data Sections ─────────────────────────────────────── */
.client-detail .cd-data-grid {
    padding: 4px 24px 24px;
}
.client-detail .cd-section {
    padding-top: var(--cd-spacing-section);
}
.client-detail .cd-section:first-child {
    padding-top: 20px;
}
.client-detail .cd-section + .cd-section {
    border-top: 1px solid var(--cd-border-light);
}
.client-detail .cd-section-title {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--cd-text-faint);
    margin: 0 0 16px;
    padding: 0;
}
.client-detail .cd-data-item {
    padding: var(--cd-spacing-item) 0 0;
}
.client-detail .cd-data-item:first-child {
    padding-top: 0;
}
.client-detail .cd-data-label {
    font-size: 0.78rem;
    font-weight: 400;
    color: var(--cd-text-muted);
    margin-bottom: 2px;
    line-height: 1.4;
}
.client-detail .cd-data-value {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--cd-text-primary);
    line-height: 1.5;
    word-break: break-word;
}
.client-detail .cd-data-value--empty {
    color: var(--cd-text-faint);
    font-weight: 400;
}

/* ── Orders Empty State ────────────────────────────────── */
.client-detail .cd-orders-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 32px 20px;
    color: var(--cd-text-faint);
    font-size: 0.8125rem;
}
.client-detail .cd-orders-empty svg {
    flex-shrink: 0;
    opacity: 0.45;
}

/* ── Responsive ────────────────────────────────────────── */
@media (max-width: 767.98px) {
    .client-detail .cd-profile-hero {
        flex-direction: column;
        text-align: center;
        gap: 14px;
        padding: 24px 20px 20px;
    }
    .client-detail .cd-hero-info {
        text-align: center;
    }
    .client-detail .cd-hero-name-row {
        justify-content: center;
    }
    .client-detail .cd-hero-name {
        font-size: 1.125rem;
    }
    .client-detail .cd-hero-levels {
        padding: 16px 16px 20px;
    }
    .client-detail .cd-step-indicator {
        width: 36px;
        height: 36px;
        border-radius: 10px;
    }
    .client-detail .cd-step-connector {
        top: 18px;
        left: calc(50% + 22px);
        width: calc(100% - 44px);
    }
    .client-detail .cd-data-grid {
        padding: 4px 16px 16px;
    }
    .client-detail .cd-data-grid .row > [class*="col-6"] {
        flex: 0 0 100%;
        max-width: 100%;
    }
    .client-detail .cd-page-title {
        font-size: 1.125rem;
    }
}
