.lead-workspace {
    width: min(100%, 1540px);
    margin: 0 auto;
    padding: 22px clamp(14px, 2.5vw, 34px) 40px;
    color: #172b4d;
}

.lead-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.lead-eyebrow,
.lead-modal-kicker {
    display: flex;
    align-items: center;
    gap: 9px;
    color: #637590;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .16em;
}

.lead-live-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #32bf91;
    box-shadow: 0 0 0 4px rgba(50, 191, 145, .12);
}

.lead-hero h1 {
    margin: 0;
    color: #14253e;
    font-size: 22px;
    font-weight: 750;
    letter-spacing: -.025em;
}

.lead-hero p {
    color: #71809a;
    font-size: 13px;
}

.lead-primary-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 0 18px;
    border: 0;
    border-radius: 12px;
    color: #fff;
    background: linear-gradient(135deg, #246bfe, #4888ff);
    box-shadow: 0 8px 18px rgba(44, 111, 246, .2);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: transform .18s ease, box-shadow .18s ease;
}

.lead-primary-action:hover {
    transform: translateY(-1px);
    box-shadow: 0 11px 22px rgba(44, 111, 246, .27);
}

.lead-primary-action span {
    font-size: 20px;
    font-weight: 400;
    line-height: 1;
}

.lead-metrics {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 13px;
    margin-bottom: 16px;
}

.lead-metric {
    position: relative;
    display: grid;
    gap: 5px;
    min-height: 114px;
    padding: 17px 19px 15px;
    overflow: hidden;
    border: 1px solid #e8edf4;
    border-radius: 15px;
    background: #fff;
    text-align: left;
    cursor: pointer;
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.lead-metric:hover {
    transform: translateY(-2px);
    border-color: #d7e3f2;
    box-shadow: 0 8px 22px rgba(31, 54, 83, .07);
}

.lead-metric::after {
    position: absolute;
    top: 17px;
    right: 18px;
    width: 34px;
    height: 34px;
    border-radius: 11px;
    background: #eff5ff;
    color: #477ce4;
    content: "↗";
    display: grid;
    place-items: center;
    font-size: 15px;
    font-weight: 700;
}

.lead-metric-alert {
    border-color: #f4e1dc;
    background: linear-gradient(130deg, #fff 55%, #fff8f6);
}

.lead-metric-alert::after {
    content: "!";
    color: #e3624f;
    background: #fff0ed;
}

.lead-metric-positive::after {
    content: "✦";
    color: #1ca87e;
    background: #e9f8f2;
}

.lead-metric-label {
    color: #6b7a91;
    font-size: 12px;
    font-weight: 650;
}

.lead-metric strong {
    color: #152b48;
    font-size: 28px;
    line-height: 1.1;
    letter-spacing: -.04em;
}

.lead-metric-alert strong {
    color: #d94f3e;
}

.lead-metric-hint {
    color: #99a5b6;
    font-size: 11px;
}

.lead-reminder-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0 0 17px;
    padding: 12px 15px;
    border: 1px solid #f4d8d2;
    border-radius: 12px;
    background: #fff8f6;
    color: #7c433d;
}

.lead-reminder-banner[hidden] {
    display: none;
}

.lead-reminder-icon {
    display: grid;
    flex: 0 0 26px;
    width: 26px;
    height: 26px;
    place-items: center;
    border-radius: 50%;
    background: #ffe7e1;
    color: #db5b48;
    font-size: 14px;
    font-weight: 800;
}

.lead-reminder-banner div {
    display: grid;
    gap: 2px;
    flex: 1;
}

.lead-reminder-banner strong {
    font-size: 12px;
}

.lead-reminder-banner small {
    color: #a0716b;
    font-size: 11px;
}

.lead-reminder-banner button {
    padding: 6px 8px;
    border: 0;
    background: transparent;
    color: #ca5547;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.lead-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    min-height: 56px;
    margin: 20px 0 13px;
    padding: 7px 9px 7px 14px;
    border: 1px solid #e8edf4;
    border-radius: 14px;
    background: #fff;
}

.lead-filter-tabs,
.lead-toolbar-tools {
    display: flex;
    align-items: center;
}

.lead-filter-tabs {
    gap: 4px;
    min-width: 0;
}

.lead-filter-tabs button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 36px;
    padding: 0 11px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: #76849a;
    white-space: nowrap;
    font-size: 12px;
    font-weight: 650;
    cursor: pointer;
}

.lead-filter-tabs button:hover {
    color: #315fbb;
    background: #f4f7fc;
}

.lead-filter-tabs button.active {
    color: #245eca;
    background: #edf4ff;
}

.lead-filter-tabs button span {
    display: grid;
    min-width: 19px;
    height: 19px;
    place-items: center;
    border-radius: 20px;
    background: #ffe8e3;
    color: #c94e40;
    font-size: 10px;
}

.lead-toolbar-tools {
    gap: 8px;
}

.lead-search {
    position: relative;
    display: flex;
    align-items: center;
    width: min(340px, 32vw);
    height: 38px;
    padding: 0 42px 0 10px;
    border: 1px solid #e8edf3;
    border-radius: 9px;
    background: #fbfcfe;
}

.lead-search input {
    width: 100%;
    min-width: 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: #243955;
    font: inherit;
    font-size: 12px;
}

.lead-search input::placeholder {
    color: #a4afbf;
}

.lead-search .btn-search {
    right: 2px;
    width: 34px;
    height: 34px;
}

.lead-search .btn-search svg {
    width: 17px;
    height: 17px;
}

.lead-refresh-button {
    display: grid;
    width: 36px;
    height: 36px;
    place-items: center;
    border: 0;
    border-radius: 9px;
    background: #f5f7fa;
    color: #728199;
    font-size: 21px;
    cursor: pointer;
}

.lead-refresh-button:hover {
    background: #edf3ff;
    color: #386bc4;
}

.lead-pipeline {
    display: grid;
    grid-template-columns: repeat(5, minmax(235px, 1fr));
    gap: 12px;
    min-height: 390px;
    overflow-x: auto;
    padding: 2px 1px 10px;
    scrollbar-color: #cad5e3 transparent;
    scrollbar-width: thin;
}

.lead-stage {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 355px;
    padding: 10px;
    border: 1px solid #e9edf3;
    border-radius: 14px;
    background: #f7f9fc;
}

.lead-stage-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 48px;
    padding: 2px 4px 10px;
}

.lead-stage-heading {
    display: flex;
    align-items: center;
    gap: 9px;
}

.lead-stage-heading > div {
    display: grid;
    gap: 3px;
}

.lead-stage-heading strong {
    color: #293c58;
    font-size: 12px;
    font-weight: 750;
}

.lead-stage-heading small {
    color: #98a4b5;
    font-size: 10px;
}

.lead-stage-marker {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4d86e9;
    box-shadow: 0 0 0 4px #e7efff;
}

.lead-stage-violet .lead-stage-marker { background: #8871dc; box-shadow: 0 0 0 4px #eeeaff; }
.lead-stage-amber .lead-stage-marker { background: #e9a741; box-shadow: 0 0 0 4px #fff2d9; }
.lead-stage-green .lead-stage-marker { background: #36ad85; box-shadow: 0 0 0 4px #e2f5ed; }
.lead-stage-slate .lead-stage-marker { background: #9ba8b9; box-shadow: 0 0 0 4px #e9edf2; }

.lead-stage-count {
    display: grid;
    min-width: 25px;
    height: 25px;
    place-items: center;
    border: 1px solid #e6ebf2;
    border-radius: 8px;
    background: #fff;
    color: #6d7c91;
    font-size: 11px;
    font-weight: 700;
}

.lead-stage-cards {
    display: grid;
    align-content: start;
    gap: 9px;
}

.lead-stage-empty {
    display: grid;
    min-height: 96px;
    place-items: center;
    border: 1px dashed #dce3ec;
    border-radius: 11px;
    color: #a0aaba;
    font-size: 11px;
}

.lead-card {
    min-width: 0;
    padding: 12px;
    border: 1px solid #e8edf3;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 2px 5px rgba(25, 45, 75, .025);
    transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}

.lead-card:hover {
    transform: translateY(-1px);
    border-color: #d2ddeb;
    box-shadow: 0 7px 16px rgba(32, 56, 89, .07);
}

.lead-card.is-overdue {
    border-color: #f1d8d4;
    box-shadow: inset 3px 0 #e26a59, 0 2px 5px rgba(25, 45, 75, .025);
}

.lead-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 7px;
    margin-bottom: 9px;
}

.lead-card-no {
    overflow: hidden;
    color: #98a4b5;
    font-size: 9px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.lead-followup-state {
    padding: 4px 7px;
    border-radius: 6px;
    background: #f0f4f8;
    color: #718097;
    font-size: 9px;
    font-weight: 750;
    white-space: nowrap;
}

.state-overdue { background: #fff0ed; color: #d55645; }
.state-new { background: #fff5e6; color: #bb7b1e; }
.state-today { background: #fff4e2; color: #b9781a; }
.state-planned { background: #edf4ff; color: #4c75ba; }
.state-recent { background: #eaf7f0; color: #33936e; }
.state-closed { background: #f0f2f5; color: #7d8998; }

.lead-card-name {
    display: block;
    max-width: 100%;
    overflow: hidden;
    padding: 0;
    border: 0;
    background: transparent;
    color: #223753;
    font-size: 14px;
    font-weight: 750;
    text-align: left;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
}

.lead-card-name:hover {
    color: #2868d6;
}

.lead-card-contact {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    min-height: 24px;
    margin-top: 3px;
    color: #7d8ba0;
    font-size: 10px;
}

.lead-card-contact span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.lead-card-contact a {
    flex: 0 0 auto;
    color: #3474d8;
    font-size: 10px;
    text-decoration: none;
}

.lead-card-next {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 8px 0;
    padding: 7px 8px;
    border-radius: 7px;
    background: #f7f9fc;
    color: #6e7d92;
    font-size: 10px;
    font-weight: 650;
}

.is-overdue .lead-card-next {
    background: #fff6f4;
    color: #c05a4d;
}

.lead-next-icon {
    color: #8497b1;
    font-size: 13px;
}

.lead-card-note {
    display: -webkit-box;
    max-height: 35px;
    overflow: hidden;
    color: #78879c;
    font-size: 10px;
    line-height: 1.55;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.lead-card-note span {
    margin-right: 5px;
    color: #a0aabb;
    font-size: 9px;
}

.lead-card-note-empty {
    color: #aab4c2;
}

.lead-card-owner {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 10px;
    padding-top: 9px;
    border-top: 1px solid #f0f2f6;
    color: #7d8ba0;
    font-size: 10px;
}

.lead-card-stage {
    margin-left: auto;
    overflow: hidden;
    color: #a0aabb;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.lead-card-actions {
    display: flex;
    gap: 5px;
    margin-top: 9px;
}

.lead-card-actions button {
    min-height: 29px;
    padding: 0 8px;
    border: 1px solid #e9edf3;
    border-radius: 7px;
    background: #fff;
    color: #75839a;
    font-size: 10px;
    font-weight: 650;
    cursor: pointer;
}

.lead-card-actions button:hover {
    border-color: #d5e2f7;
    color: #356bc6;
}

.lead-card-actions .lead-card-followup {
    flex: 1;
    border-color: #dce8ff;
    background: #f1f6ff;
    color: #356bc6;
}

.lead-board-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 7px 2px;
    color: #9aa6b6;
    font-size: 11px;
}

.lead-board-footer .load-more-btn {
    min-height: 34px;
    padding: 0 13px;
    border: 1px solid #e4eaf2;
    border-radius: 8px;
    background: #fff;
    color: #5c7292;
    font-size: 11px;
    cursor: pointer;
}

.lead-edit-modal,
.lead-followup-modal {
    width: min(900px, calc(100vw - 28px));
    max-width: 900px !important;
    overflow: hidden;
    border-radius: 19px;
}

.lead-edit-modal .modal-header,
.lead-followup-modal .modal-header {
    align-items: center;
    padding: 20px 24px 17px;
    border-bottom: 1px solid #edf0f5;
}

.lead-edit-modal .modal-header h2,
.lead-followup-modal .modal-header h2 {
    margin-top: 5px;
    color: #1b2e49;
    font-size: 20px;
}

.lead-edit-modal .modal-body,
.lead-followup-modal .modal-body {
    max-height: min(72vh, 760px);
    padding: 0;
}

.lead-edit-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(220px, .9fr);
    align-items: start;
    gap: 14px;
    padding: 20px 24px;
    background: #f8fafc;
}

.lead-edit-main,
.lead-edit-side {
    display: grid;
    gap: 14px;
}

.lead-form-section {
    padding: 17px;
    border: 1px solid #e9edf3;
    border-radius: 13px;
    background: #fff;
}

.lead-form-heading {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 17px;
}

.lead-form-heading > span {
    display: grid;
    flex: 0 0 27px;
    width: 27px;
    height: 27px;
    place-items: center;
    border-radius: 8px;
    background: #edf4ff;
    color: #4d77c1;
    font-size: 10px;
    font-weight: 800;
}

.lead-form-heading div {
    display: grid;
    gap: 3px;
}

.lead-form-heading strong {
    color: #293c57;
    font-size: 13px;
}

.lead-form-heading small {
    color: #98a4b5;
    font-size: 10px;
}

.lead-edit-modal .form-row {
    gap: 12px;
}

.lead-edit-modal .form-group {
    margin-bottom: 13px;
}

.lead-edit-modal .form-group:last-child {
    margin-bottom: 0;
}

.lead-edit-modal .form-group label,
.lead-followup-modal .form-group label {
    margin-bottom: 6px;
    color: #5e6f87;
    font-size: 11px;
    font-weight: 700;
}

.lead-phone-hint {
    display: block;
    margin-top: 5px;
    color: #98a4b5;
    font-size: 10px;
}

.lead-detail-view-sections {
    display: grid;
    gap: 14px;
    padding: 4px 2px 8px;
}

.lead-detail-view-sections > .view-section {
    min-width: 0;
    margin: 0;
}

.lead-detail-view-sections .view-grid {
    column-gap: 18px;
    row-gap: 14px;
}

.lead-detail-view-sections .view-value {
    overflow-wrap: anywhere;
}

.lead-edit-modal .form-group input,
.lead-edit-modal .form-group select,
.lead-edit-modal .form-group textarea,
.lead-followup-modal .form-group input,
.lead-followup-modal .form-group select,
.lead-followup-modal .form-group textarea {
    min-height: 39px;
    border-color: #e2e8f0;
    border-radius: 8px;
    background: #fbfcfe;
    font-size: 12px;
}

.lead-edit-modal .form-group textarea,
.lead-followup-modal .form-group textarea {
    padding: 10px 11px;
    line-height: 1.6;
}

.lead-side-card .form-group {
    margin-bottom: 15px;
}

.lead-edit-note {
    display: flex;
    gap: 8px;
    margin-top: 18px;
    padding: 10px;
    border-radius: 9px;
    background: #f3f7ff;
    color: #7183a0;
}

.lead-edit-note span {
    color: #5481cb;
    font-size: 14px;
}

.lead-edit-note p {
    font-size: 10px;
    line-height: 1.6;
}

.lead-image-section > label {
    display: block;
    margin-bottom: 7px;
    color: #5e6f87;
    font-size: 11px;
    font-weight: 700;
}

.lead-edit-modal .modal-footer {
    padding: 13px 24px;
    border-top: 1px solid #edf0f5;
    background: #fff;
}

.lead-followup-modal {
    width: min(570px, calc(100vw - 28px));
    max-width: 570px !important;
}

.lead-followup-modal .modal-body {
    padding: 18px 22px 22px;
    background: #f8fafc;
}

.lead-followup-customer {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    border: 1px solid #e8edf3;
    border-radius: 11px;
    background: #fff;
}

.lead-followup-customer div {
    display: grid;
    gap: 3px;
    min-width: 0;
}

.lead-followup-customer strong {
    color: #263a56;
    font-size: 13px;
}

.lead-followup-customer small {
    overflow: hidden;
    color: #94a0b1;
    font-size: 10px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.lead-timeline {
    max-height: 210px;
    overflow-y: auto;
    margin: 14px 0;
}

.lead-detail-timeline {
    max-height: 340px;
    margin: 0;
}

.lead-detail-followups .lead-timeline-item {
    padding-bottom: 15px;
}

.lead-timeline-title {
    margin-bottom: 10px;
    color: #718099;
    font-size: 11px;
    font-weight: 750;
}

.lead-timeline-item {
    position: relative;
    display: flex;
    gap: 10px;
    padding: 0 0 12px 2px;
}

.lead-timeline-item:not(:last-child)::after {
    position: absolute;
    top: 10px;
    bottom: 0;
    left: 5px;
    width: 1px;
    background: #e3e9f1;
    content: "";
}

.lead-timeline-dot {
    z-index: 1;
    flex: 0 0 9px;
    width: 9px;
    height: 9px;
    margin-top: 3px;
    border: 2px solid #fff;
    border-radius: 50%;
    background: #68a0f0;
    box-shadow: 0 0 0 1px #bdd2f4;
}

.lead-timeline-body {
    flex: 1;
    min-width: 0;
}

.lead-timeline-meta {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    color: #65758d;
    font-size: 10px;
}

.lead-timeline-meta time {
    color: #a0aaba;
}

.lead-timeline-body p {
    margin: 4px 0;
    color: #40536e;
    font-size: 11px;
    line-height: 1.55;
    white-space: pre-wrap;
    word-break: break-word;
}

.lead-timeline-body small {
    color: #9aa6b6;
    font-size: 9px;
}

.lead-timeline-empty,
.lead-timeline-loading,
.lead-timeline-error {
    padding: 13px;
    border-radius: 9px;
    background: #fff;
    color: #9aa6b6;
    font-size: 11px;
    text-align: center;
}

.lead-timeline-error {
    color: #c3574b;
}

.lead-followup-form {
    padding: 15px;
    border: 1px solid #e8edf3;
    border-radius: 12px;
    background: #fff;
}

.lead-followup-form-title {
    margin-bottom: 13px;
    color: #293c57;
    font-size: 12px;
    font-weight: 750;
}

.lead-stage-hint {
    display: block;
    margin-top: 5px;
    color: #98a4b5;
    font-size: 10px;
}

.lead-followup-modal .form-row {
    gap: 12px;
}

.lead-followup-modal .form-group {
    margin-bottom: 12px;
}

.lead-followup-submit {
    width: 100%;
    min-height: 40px;
    border-radius: 9px;
    font-size: 12px;
    font-weight: 700;
}

@media (max-width: 1050px) {
    .lead-toolbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .lead-toolbar-tools,
    .lead-search {
        width: 100%;
    }

    .lead-toolbar-tools {
        justify-content: space-between;
    }

    .lead-pipeline {
        grid-template-columns: repeat(5, minmax(230px, 1fr));
    }
}

@media (max-width: 700px) {
    .lead-workspace {
        padding: 16px 12px 28px;
    }

    .lead-hero {
        align-items: center;
        gap: 10px;
    }

    .lead-hero h1 {
        font-size: 20px;
    }

    .lead-primary-action {
        flex: 0 0 auto;
        min-height: 38px;
        padding: 0 10px;
        border-radius: 9px;
        font-size: 11px;
    }

    .lead-metrics {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }

    .lead-metric {
        min-height: 96px;
        padding: 12px;
        border-radius: 12px;
    }

    .lead-metric::after {
        top: 12px;
        right: 11px;
        width: 27px;
        height: 27px;
    }

    .lead-metric strong {
        font-size: 24px;
    }

    .lead-reminder-banner {
        align-items: flex-start;
        gap: 8px;
        padding: 10px;
    }

    .lead-reminder-banner small {
        line-height: 1.4;
    }

    .lead-reminder-banner button {
        flex: 0 0 auto;
        padding: 4px 0;
        font-size: 10px;
    }

    .lead-toolbar {
        gap: 8px;
        margin: 14px 0 10px;
        padding: 9px;
        border-radius: 12px;
    }

    .lead-filter-tabs {
        width: 100%;
        overflow-x: auto;
        padding-bottom: 2px;
    }

    .lead-filter-tabs button {
        min-height: 33px;
        padding: 0 9px;
        font-size: 11px;
    }

    .lead-search {
        height: 36px;
    }

    .lead-search input {
        font-size: 11px;
    }

    .lead-refresh-button {
        flex: 0 0 36px;
    }

    .lead-pipeline {
        grid-template-columns: repeat(5, minmax(245px, 1fr));
        min-height: 345px;
        gap: 9px;
    }

    .lead-stage {
        min-height: 330px;
        padding: 8px;
    }

    .lead-board-footer {
        font-size: 10px;
    }

    .lead-edit-modal,
    .lead-followup-modal {
        width: calc(100vw - 16px);
        max-height: calc(100dvh - 18px);
        border-radius: 15px;
    }

    .lead-edit-modal .modal-header,
    .lead-followup-modal .modal-header {
        padding: 15px 16px 13px;
    }

    .lead-edit-modal .modal-body {
        max-height: calc(100dvh - 145px);
    }

    .lead-edit-grid {
        grid-template-columns: 1fr;
        gap: 10px;
        padding: 12px;
    }

    .lead-form-section {
        padding: 13px;
    }

    .lead-edit-modal .form-row,
    .lead-followup-modal .form-row {
        gap: 8px;
    }

    .lead-edit-modal .form-group input,
    .lead-edit-modal .form-group select,
    .lead-followup-modal .form-group input,
    .lead-followup-modal .form-group select {
        min-height: 37px;
    }

    .lead-edit-modal .modal-footer {
        padding: 10px 14px;
    }

    .lead-followup-modal .modal-body {
        max-height: calc(100dvh - 100px);
        padding: 13px;
    }
}

@media (max-width: 380px) {
    .lead-hero {
        flex-direction: row;
    }

    .lead-hero h1 {
        max-width: none;
    }

    .lead-edit-modal .form-row,
    .lead-followup-modal .form-row {
        flex-direction: column;
    }
}
