.leads-table .lead-row-details-link {
    color: inherit;
    text-decoration: none;
}
.leads-table .lead-row-details-link:hover {
    text-decoration: underline;
}

/* leads.aspx — bootstrap-rtl body + bare <small> in leads.aspx.cs */
.leads-table.table {
    font-family: 'Source Sans Pro', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.428571429;
    color: #333333;
}

.leads-table .lead-name-company-cell .lead-row-details-link strong {
    color: #333333;
    font-weight: 700;
}

.leads-table tbody td small {
    display: inline-block;
    font-size: 85%;
    color: #333333;
    font-weight: 400;
    line-height: 1.428571429;
}

.leads-table tbody td br + small {
    margin-top: 2px;
}

.leads-table.selectable-rows-table tbody td {
    vertical-align: middle;
}

.leads-table .lead-contact-cell {
    direction: ltr;
    text-align: right;
    white-space: normal;
}

.leads-list-box .box-body.table-responsive.no-padding {
    padding: 0;
}

/* List table status badges — legacy: crm-shared flex label fills text-center cell */
.leads-table td.lead-status-cell {
    text-align: center;
    vertical-align: middle;
}

.leads-table td.lead-status-cell .label.lead-list-status-label {
    display: flex !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
    align-items: center;
    justify-content: center;
    font-size: 13px !important;
    font-weight: normal !important;
    line-height: 1 !important;
    padding: 0.2em 0.6em 0.3em !important;
    border-radius: 0.25em;
    white-space: nowrap !important;
    background-color: var(--lead-status-bg) !important;
    color: var(--lead-status-fg) !important;
}

.leads-table .rating-wrapper input:checked ~ label,
.leads-table .rating-wrapper label:hover,
.leads-table .rating-wrapper label:hover ~ label {
    color: #f0ad4e;
}

/* leads.aspx — list box toolbar + table */
.leads-list-box.box-success {
    border-top-color: #00a65a;
}

.leads-list-box > .box-header.with-border {
    overflow: visible;
}

.leads-list-box > .box-header .insert-btn i.fa-plus-circle {
    color: #f39c12;
    font-size: 14px;
}

.leads-list-box > .box-header .insert-btn label {
    font-weight: normal;
    padding: 0 7px;
    margin: 0;
    cursor: pointer;
}

.leads-table th {
    white-space: nowrap;
}

.groups-table th {
    white-space: nowrap;
}

.leads-table .rating-wrapper .fa {
    font-size: 18px;
    margin: 0 0;
}

.leads-table .rating-wrapper label {
    padding: 0rem 0.2rem;
    color: #c9c7c7;
}

#leadDetailsEditor + .ck-editor .ck-editor__editable_inline {
    min-height: 140px !important;
}

/* ===================== Lead details page (legacy leadDetails.aspx parity) ===================== */

.lead-details-main-layout.row {
    margin-left: 0;
    margin-right: 0;
}

@media (min-width: 992px) {
    .lead-details-main-layout.row {
        display: flex;
        flex-wrap: nowrap;
        align-items: flex-start;
    }

    .lead-details-main-layout.row > [class*="col-"] {
        float: none !important;
    }

    .lead-details-main-layout.row > .lead-details-sidebar {
        flex: 0 0 33.33333333%;
        width: 33.33333333%;
        max-width: 33.33333333%;
    }

    .lead-details-main-layout.row > .col-md-8 {
        flex: 1 1 0;
        min-width: 0;
        width: auto;
        max-width: none;
    }
}

/* Sidebar boxes */
.lead-details-sidebar .box {
    margin-bottom: 20px;
}

.lead-details-sidebar .box-body.box-profile,
.lead-details-sidebar .box-body.lead-details-profile {
    padding: 15px;
}

.lead-details-sidebar .box-profile {
    padding-bottom: 0;
}

.lead-details-sidebar .box-header.with-border {
    padding: 10px 15px;
}

.lead-details-sidebar .box-header .box-title {
    font-size: 14px;
    font-weight: 600 !important;
    margin: 0;
}

/* Profile header */
.lead-details-sidebar .profile-username {
    font-size: 21px !important;
    font-weight: 700 !important;
    line-height: 1.35;
    margin-top: 0 !important;
    margin-bottom: 10px !important;
}

.lead-details-sidebar .flex.space-between {
    align-items: flex-start;
}

/* flex-list-50 — label right / value left (50% each) */
.lead-details-sidebar ul.flex-list-50 > .list-group-item {
    padding: 10px 0;
    font-size: 14px;
    align-items: center;
}

.lead-details-sidebar ul.flex-list-50 > .list-group-item > b {
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    margin-bottom: 0;
}

.lead-details-sidebar ul.flex-list-50 > .list-group-item > span,
.lead-details-sidebar ul.flex-list-50 > .list-group-item > .field.field-editable,
.lead-details-sidebar ul.flex-list-50 > .list-group-item > div.field {
    min-width: 0;
    max-width: 100%;
}

/* Editable fields + pencil */
.lead-details-sidebar .field.field-editable {
    display: inline-flex;
    flex-wrap: nowrap;
    align-items: center;
    max-width: 100%;
    min-width: 0;
    vertical-align: middle;
}

.lead-details-sidebar .field.field-editable .field-clickable {
    position: relative;
    cursor: default;
    display: inline-flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    gap: 6px;
    max-width: 100%;
    min-width: 0;
    min-height: 22px;
    vertical-align: middle;
    box-sizing: border-box;
}

.lead-details-sidebar .field.field-editable .field-clickable-value,
.lead-details-sidebar .field.field-editable .field-clickable > :not(.field-edit-icon):not(.managers-avatars):not(.label) {
    flex: 1 1 auto;
    min-width: 0;
    white-space: normal;
    overflow-wrap: break-word;
    word-break: normal;
    line-height: 1.4;
}

.lead-details-sidebar .field.field-editable .field-clickable .label {
    flex: 0 1 auto;
    min-width: 0;
    white-space: normal;
    overflow-wrap: break-word;
    word-break: normal;
}

.lead-details-sidebar .field-clickable a,
.lead-details-sidebar .field-clickable a.js-voicenter-call {
    color: #3c8dbc;
}

.lead-details-sidebar .field-clickable a:hover,
.lead-details-sidebar .field-clickable a.js-voicenter-call:hover {
    color: #367fa9;
}

.lead-details-main-layout > .col-md-8 .nav-tabs-custom .badge.label-warning {
    background-color: #f39c12;
    color: #fff;
}

.lead-details-sidebar .field.field-editable .field-edit-icon {
    opacity: 0 !important;
    flex-shrink: 0;
    order: 2;
    align-self: center;
    margin: 0;
    color: #8b93a6;
    font-size: 12px;
    line-height: 1;
    cursor: pointer;
    transition: opacity 0.15s ease;
    pointer-events: none;
}

.lead-details-sidebar .field.field-editable:hover .field-edit-icon {
    opacity: 1 !important;
    pointer-events: auto;
}

.lead-details-sidebar .fullname-field .field-clickable {
    display: inline-flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    gap: 6px;
    position: relative;
    cursor: default;
    min-height: 22px;
    vertical-align: middle;
}

.lead-details-sidebar .fullname-field .field-clickable-value {
    white-space: normal;
}

.lead-details-sidebar .fullname-field .field-clickable .field-edit-icon {
    flex-shrink: 0;
    order: 2;
    align-self: center;
}

.lead-details-sidebar .fullname-field .field-clickable:hover .field-edit-icon,
.lead-details-sidebar .fullname-field.field-editable:hover .field-edit-icon {
    opacity: 1 !important;
    pointer-events: auto;
}

/* Status badge — legacy AdminLTE .status-field .label + leadDetails.aspx */
.lead-details-sidebar .status-field .field-clickable {
    cursor: pointer;
}

.lead-details-sidebar .status-field .field-clickable .label {
    display: inline-block !important;
    flex: none !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    font-size: 14px !important;
    font-weight: normal !important;
    line-height: 1 !important;
    padding: 6px 15px !important;
    border-radius: 0.25em;
    text-align: center;
    white-space: nowrap !important;
    overflow-wrap: normal !important;
    word-break: normal !important;
    box-sizing: border-box;
    vertical-align: middle;
}

/* Managers field — layout from managers-selector.css + projects.css (.crm-responsible-avatars-stack) */
.lead-details-sidebar .managers-display.field-clickable {
    white-space: nowrap;
    max-width: 100%;
}

.lead-details-sidebar .datetimepicker.dropdown-menu,
body > .datetimepicker {
    z-index: 10050 !important;
}

/* Tabs column (legacy: col-md-8 > nav-tabs-custom) */
.lead-details-main-layout > .col-md-8 .nav-tabs-custom {
    margin-bottom: 20px;
}

.lead-details-main-layout > .col-md-8 .controls.flex {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.lead-details-main-layout > .col-md-8 .insert-btn i.fa-plus-circle {
    color: #f39c12;
    font-size: 14px;
}

/* leadDetails.aspx — filter toggle: caret left of label, small gap (legacy HTML space) */
.lead-details-main-layout > .col-md-8 .filter-by-type .dropdown-toggle {
    white-space: nowrap;
}

.lead-details-main-layout > .col-md-8 .filter-by-type .dropdown-toggle .caret {
    margin-right: 4px !important;
    margin-left: 0 !important;
}

.lead-details-main-layout > .col-md-8 .updates-list .post {
    background: #fff;
}

.lead-details-main-layout > .col-md-8 .updates-list .post .user-block .img-wrap {
    width: 40px;
    height: 40px;
}

.lead-details-main-layout > .col-md-8 .updates-list .post .user-block img {
    width: 40px;
    height: 40px;
}

.lead-details-main-layout > .col-md-8 .updates-list .post .user-block .img-wrap .fa {
    width: 20px;
    height: 20px;
    font-size: 13px;
    line-height: 20px;
    bottom: -5px;
    right: -5px;
}

.lead-details-main-layout > .col-md-8 .updates-list .post .username {
    font-size: 16px;
    font-weight: 600;
}

.lead-details-main-layout > .col-md-8 .updates-list .post .description {
    color: #999;
    font-size: 13px;
}

.lead-details-main-layout > .col-md-8 .post-footer.flex {
    display: flex;
    align-items: center;
}

/* leadDetails.aspx — .lead-details-form-controls (legacy AdminLTE pt-2 = 2rem, не bs5 0.5rem) */
.lead-details-main-layout > .col-md-8 .lead-details-form-controls {
    padding-top: 2rem;
}

.lead-details-main-layout > .col-md-8 .lead-details-form-controls .btn + .btn {
    margin-right: 5px;
}

/* leadDetails.aspx — WhatsApp tab (#whatsapp) */
.lead-details-main-layout #whatsappMessagesList {
    list-style: none;
    margin: 0;
    padding: 0;
}

.lead-details-main-layout #whatsappMessagesList .list-group-item {
    border: 0;
    background: transparent;
    padding: 6px 0;
    border-bottom: 1px solid #e2e6ef;
}

.lead-details-main-layout #whatsappMessagesList .list-group-item:last-child {
    border-bottom: none;
}

.lead-details-main-layout .wa-msg {
    width: 100%;
}

.lead-details-main-layout .wa-msg-card {
    max-width: 100%;
    padding: 10px 12px;
}

.lead-details-main-layout .wa-msg-card:last-child {
    border-bottom: none;
}

.lead-details-main-layout .wa-msg-in .wa-msg-card {
    background: #ffffff;
}

.lead-details-main-layout .wa-msg-head {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
    flex-wrap: wrap;
    justify-content: space-between;
}

.lead-details-main-layout .wa-msg-status {
    margin-right: 3px;
    margin-left: 3px;
    font-size: 12px;
}

.lead-details-main-layout .wa-msg-sender {
    font-weight: 700;
    color: #2e3340;
}

.lead-details-main-layout .wa-msg-time {
    color: #7a8395;
    font-size: 11px;
}

.lead-details-main-layout .wa-msg-text {
    color: #1f2633;
    line-height: 1.45;
    white-space: pre-wrap;
    word-break: break-word;
}

.lead-details-main-layout .wa-msg-fallback {
    color: #7a8395;
    font-size: 12px;
}

.lead-details-main-layout .whatsapp-reply {
    border-top: 1px solid #eceff5;
    margin-top: 10px;
    padding-top: 20px;
    background: #fff;
}

.lead-details-main-layout .whatsapp-reply .form-inline {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

.lead-details-main-layout .whatsapp-reply #btnSendWhatsAppTemplate {
    margin-right: 6px;
    flex-shrink: 0;
}

.lead-details-main-layout .whatsapp-reply .form-group {
    margin-bottom: 0;
    flex: 0 1 auto;
}

.lead-details-main-layout .whatsapp-reply .form-group label {
    margin-left: 6px;
}

.lead-details-main-layout .whatsapp-reply #whatsappTemplateSelect {
    min-width: 200px;
    max-width: 100%;
}

/* leadDetails.aspx — #modal-update-task */
#modal-update-task .btn-group[data-toggle="buttons"] > .btn {
    font-size: 13px;
    padding: 6px 12px;
}

#modal-update-task .btn-group[data-toggle="buttons"] > .btn > i.fa {
    margin: 0;
}

#modal-update-task .btn-group[data-toggle="buttons"] > .btn.active {
    box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
}

#modal-update-task .task-form-group .has-feedback .form-control-feedback {
    line-height: 34px;
    pointer-events: none;
}
