.lead-profile-shell {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.lead-profile-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 9px 12px;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    background: #FFFFFF;
}

.lead-profile-hero-main {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.lead-profile-name {
    min-width: 0;
    color: #111827;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lead-profile-subtitle {
    min-width: 0;
    color: #374151;
    font-size: 12px;
    line-height: 1.35;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lead-profile-subtitle::before {
    content: '|';
    margin-right: 10px;
    color: #D1D5DB;
}

.lead-profile-chips,
.lead-profile-actions,
.lead-profile-tag-list,
.lead-profile-record-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.lead-profile-chip,
.lead-profile-action,
.lead-profile-tag,
.lead-profile-record-badges span {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    max-width: 100%;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
}

.lead-profile-chip {
    gap: 5px;
    padding: 3px 7px;
    border: 1px solid #E5E7EB;
    background: #F9FAFB;
    color: #374151;
}

.lead-profile-chip span {
    color: #6B7280;
}

.lead-profile-chip--empty,
.lead-profile-muted {
    color: #9CA3AF;
}

.lead-profile-actions {
    justify-content: flex-end;
}

.lead-profile-action {
    justify-content: center;
    padding: 5px 9px;
    border: 1px solid #D1D5DB;
    border-radius: 6px;
    background: #FFFFFF;
    color: #374151;
    font-size: 12px;
    text-decoration: none;
    cursor: pointer;
}

.lead-profile-action:hover {
    background: #F3F4F6;
}

.lead-profile-tabs-wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    width: 100%;
    margin: 0;
}

.lead-profile-tabs-wrap .qb-view-tabs {
    display: flex;
    align-items: stretch;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 2px;
    max-width: 100%;
    min-height: 38px;
    padding: 3px;
    border: 1px solid var(--qb-border, #DDE5DF);
    border-radius: var(--qb-radius-sm, 8px);
    background: var(--qb-tab-track, #F5F7F6);
    box-shadow: none;
}

.lead-profile-tabs-actions {
    flex: 0 0 auto;
    margin-left: auto;
}

.lead-profile-tabs-wrap .qb-view-tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin: 0;
    padding: 6px 12px;
    border: 1px solid transparent;
    border-radius: 4px;
    background: transparent;
    color: var(--qb-text-secondary, #6B7280);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.25;
    cursor: pointer;
}

.lead-profile-tabs-wrap .qb-view-tab.active {
    background: var(--lmpb-tab-active-bg, var(--qb-brand-off, #E8FCEC));
    color: var(--qb-text, #111827);
    border-color: var(--qb-h-primary-border-mid, #9ED0AE);
    box-shadow: 0 1px 2px rgba(7, 43, 46, 0.1);
}

.lead-profile-tabs-wrap .qb-view-tab.active::after {
    display: none;
    content: none;
}

.lead-profile-tabs-wrap .qb-view-tab .tab-count {
    padding: 1px 7px;
    border-radius: 999px;
    background: var(--qb-surface-muted, #EEF2F7);
    color: var(--qb-text-secondary, #6B7280);
    font-size: 11px;
    font-weight: 600;
}

.lead-profile-tabs-wrap .qb-view-tab.active .tab-count {
    background: rgba(7, 43, 46, 0.08);
    color: var(--qb-brand-deep, #072B2E);
}

.lead-profile-panel {
    display: block;
}

.lead-profile-panel[hidden] {
    display: none;
}

.lead-profile-card,
.lead-top-section {
    background: #F9FAFB;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    padding: 10px 12px;
}

.lead-profile-card {
    margin-top: 12px;
}

.lead-profile-card:first-child {
    margin-top: 0;
}

.lead-overview-grid--secondary {
    margin-top: 12px;
}

.lead-overview-grid--secondary > .lead-profile-card {
    margin-top: 0;
}

.lead-profile-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}

.lead-profile-card-header h3,
.lead-top-title {
    margin: 0;
    color: #111827;
    font-size: 12px;
    font-weight: 700;
}

.lead-profile-card-header p {
    margin: 4px 0 0;
    color: #6B7280;
    font-size: 12px;
    line-height: 1.4;
}

.lead-overview-grid--secondary,
.lead-top-layout,
.lead-profile-field-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 12px;
}

.lead-top-layout {
    margin-bottom: 16px;
}

.lead-top-row {
    display: grid;
    grid-template-columns: 105px minmax(0, 1fr);
    gap: 8px;
    align-items: start;
    padding: 4px 0;
}

.lead-top-key {
    color: #6B7280;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.lead-top-value {
    color: #111827;
    font-size: 13px;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.lead-top-value.empty {
    color: #9CA3AF;
}

.lead-profile-tag {
    gap: 5px;
    padding: 3px 8px;
    border: 1px solid var(--qb-h-primary-border-soft, #D3EBDD);
    background: var(--qb-brand-off, #E8FCEC);
    color: var(--buro-brand-dark-green, #072B2E);
}

.lead-profile-chip-remove,
.lead-profile-field-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: #6B7280;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
}

.lead-profile-chip-remove:hover,
.lead-profile-field-remove:hover {
    background: rgba(7, 43, 46, 0.08);
    color: #111827;
}

.lead-profile-tag-editor,
.lead-profile-custom-field-editor,
.lead-profile-field-list {
    display: grid;
    gap: 10px;
}

.lead-profile-inline-add {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: start;
}

.lead-profile-inline-add--fields {
    grid-template-columns: minmax(120px, 0.8fr) minmax(140px, 1fr) auto;
}

.lead-profile-autocomplete {
    position: relative;
    min-width: 0;
}

.lead-profile-tag-dropdown {
    left: 0;
    right: 0;
    width: 100%;
}

.lead-profile-input {
    width: 100%;
    min-height: 34px;
    padding: 7px 9px;
    border: 1px solid #D1D5DB;
    border-radius: 6px;
    background: #FFFFFF;
    color: #111827;
    font: inherit;
    font-size: 13px;
    line-height: 1.3;
}

.lead-profile-input:focus {
    outline: 2px solid rgba(5, 150, 105, 0.16);
    border-color: #9ED0AE;
}

.lead-profile-mini-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 7px 10px;
    border: 1px solid #9ED0AE;
    border-radius: 6px;
    background: var(--qb-brand-off, #E8FCEC);
    color: var(--qb-brand-deep, #072B2E);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
}

.lead-profile-mini-btn--secondary {
    justify-self: start;
    border-color: #D1D5DB;
    background: #FFFFFF;
    color: #374151;
}

.lead-profile-mini-btn--inline {
    margin-left: 8px;
    padding: 3px 8px;
    min-height: 24px;
    font-size: 11px;
    vertical-align: middle;
}

.lead-profile-mini-btn:disabled,
.lead-profile-input:disabled,
.lead-profile-chip-remove:disabled,
.lead-profile-field-remove:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.lead-profile-field {
    min-width: 0;
    padding: 9px 10px;
    border: 1px solid #E5E7EB;
    border-radius: 7px;
    background: #FFFFFF;
}

.lead-profile-field-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 6px;
}

.lead-profile-field span,
.lead-profile-field-heading span {
    display: block;
    color: #6B7280;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.lead-profile-field strong,
.lead-profile-field-value {
    display: block;
    color: #111827;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.lead-profile-inline-json {
    margin: 0;
    max-height: 160px;
    overflow: auto;
    color: #111827;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 11px;
    font-weight: 500;
    white-space: pre-wrap;
}

.lead-profile-empty {
    color: #6B7280;
    font-size: 13px;
    line-height: 1.45;
}

.lead-profile-record-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.lead-profile-record {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 9px 10px;
    border: 1px solid #E5E7EB;
    border-radius: 7px;
    background: #FFFFFF;
}

.lead-profile-record-main {
    display: grid;
    gap: 3px;
    min-width: 0;
}

.lead-profile-record-main strong {
    color: #111827;
    font-size: 13px;
    line-height: 1.35;
}

.lead-profile-record-main span {
    color: #6B7280;
    font-size: 12px;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.lead-profile-record-badges {
    flex: 0 0 auto;
    justify-content: flex-end;
}

.lead-profile-record-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    flex-wrap: wrap;
    flex: 0 0 auto;
}

.lead-profile-record-badges span {
    min-height: 22px;
    padding: 2px 7px;
    border: 1px solid #E5E7EB;
    background: #F9FAFB;
    color: #374151;
}

.lead-profile-booking-record {
    display: block;
    padding: 0;
    overflow: hidden;
}

.lead-profile-booking-record[open] {
    border-color: #CDE7DF;
    background: #FBFEFD;
}

.lead-profile-booking-summary {
    align-items: flex-start;
    cursor: pointer;
    display: flex;
    gap: 12px;
    justify-content: space-between;
    list-style: none;
    padding: 9px 10px;
    user-select: none;
}

.lead-profile-booking-summary::-webkit-details-marker {
    display: none;
}

.lead-profile-booking-summary-main {
    display: grid;
    gap: 3px;
    min-width: 0;
}

.lead-profile-booking-summary-main strong {
    color: #111827;
    font-size: 13px;
    line-height: 1.35;
}

.lead-profile-booking-summary-main > span {
    color: #6B7280;
    font-size: 12px;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.lead-profile-booking-summary-side {
    align-items: flex-start;
    display: flex;
    flex: 0 0 auto;
    gap: 6px;
    justify-content: flex-end;
}

.lead-profile-booking-expand-label {
    align-items: center;
    border: 1px solid #D1D5DB;
    border-radius: 999px;
    color: #4B5563;
    display: inline-flex;
    font-size: 11px;
    font-weight: 700;
    min-height: 22px;
    padding: 2px 8px;
    white-space: nowrap;
}

.lead-profile-booking-expand-label::before {
    color: #9CA3AF;
    content: '▸';
    font-size: 10px;
    margin-right: 5px;
    transition: transform 0.15s ease;
}

.lead-profile-booking-record[open] .lead-profile-booking-expand-label::before {
    transform: rotate(90deg);
}

.lead-profile-booking-detail {
    border-top: 1px solid #E5E7EB;
    display: grid;
    gap: 14px;
    padding: 12px;
}

.lead-profile-booking-detail-section {
    display: grid;
    gap: 8px;
}

.lead-profile-booking-detail-section h4 {
    color: #111827;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0;
    margin: 0;
}

.lead-profile-booking-detail-grid,
.lead-profile-booking-answer-list {
    border: 1px solid #E5E7EB;
    border-radius: 7px;
    overflow: hidden;
}

.lead-profile-booking-detail-row,
.lead-profile-booking-answer {
    display: grid;
    gap: 8px;
    grid-template-columns: minmax(120px, 0.34fr) minmax(0, 1fr);
    padding: 9px 10px;
}

.lead-profile-booking-detail-row + .lead-profile-booking-detail-row,
.lead-profile-booking-answer + .lead-profile-booking-answer {
    border-top: 1px solid #E5E7EB;
}

.lead-profile-booking-detail-row > span,
.lead-profile-booking-answer > span {
    color: #6B7280;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.2px;
    text-transform: uppercase;
}

.lead-profile-booking-detail-row > div,
.lead-profile-booking-answer > div {
    color: #111827;
    font-size: 12px;
    line-height: 1.45;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

.lead-profile-booking-detail-row a {
    color: #166B5B;
    font-weight: 700;
    text-decoration: none;
}

.lead-json-pre {
    margin: 0;
    padding: 12px;
    max-height: 420px;
    overflow: auto;
    border-radius: 6px;
    background: #111827;
    color: #F9FAFB;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 11px;
    line-height: 1.5;
}

.company-profile-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.company-profile-field-label {
    display: grid;
    gap: 5px;
    color: #374151;
    font-size: 11px;
    font-weight: 650;
}

.company-profile-form-actions {
    grid-column: 1 / -1;
    display: flex;
    justify-content: flex-end;
}

.company-profile-link-list {
    display: grid;
    gap: 10px;
}

.company-profile-link-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid #E5E7EB;
    border-radius: 6px;
    background: #FFFFFF;
}

.company-profile-link-row > div {
    display: grid;
    gap: 3px;
    min-width: 0;
}

.company-profile-link-row strong {
    color: #111827;
    font-size: 13px;
}

.company-profile-link-row span {
    color: #6B7280;
    font-size: 12px;
}

@media (max-width: 760px) {
    .lead-profile-hero,
    .lead-profile-hero-main,
    .lead-profile-record {
        align-items: stretch;
        flex-direction: column;
    }

    .lead-profile-name,
    .lead-profile-subtitle {
        white-space: normal;
    }

    .lead-profile-subtitle::before {
        display: none;
        content: none;
    }

    .lead-profile-actions,
    .lead-profile-record-badges,
    .lead-profile-record-actions {
        justify-content: flex-start;
    }

    .lead-profile-tabs-actions {
        margin-left: 0;
    }

    .lead-top-row {
        grid-template-columns: 1fr;
    }

    .lead-profile-inline-add,
    .lead-profile-inline-add--fields,
    .lead-profile-booking-detail-row,
    .lead-profile-booking-answer,
    .company-profile-form {
        grid-template-columns: 1fr;
    }

    .lead-profile-booking-summary {
        align-items: stretch;
        flex-direction: column;
    }

    .lead-profile-booking-summary-side {
        justify-content: flex-start;
    }

    .company-profile-link-row {
        align-items: stretch;
        flex-direction: column;
    }
}
