:root {
    --bg: #f4f7fb;
    --surface: #ffffff;
    --surface-soft: #eaf0f8;
    --text: #18212f;
    --muted: #607086;
    --line: #d7e0ec;
    --accent: #1266db;
    --accent-strong: #0d4fae;
    --success: #15815d;
    --warning: #9f6500;
    --danger: #b63a43;
    --shadow: 0 18px 44px rgba(30, 51, 83, 0.12);
}

/* SPB-ZPI compact lead tiles, scoped filters, and return-position highlight. */
body.profile-spb_zpi .lead-list-filter-panel {
    display: grid;
    gap: 12px;
    margin-bottom: 14px;
    padding: 14px;
}

body.profile-spb_zpi .lead-list-filter-panel .lead-scope-tabs {
    margin: 0;
}

body.profile-spb_zpi .lead-list-filter-form {
    align-items: end;
    display: grid;
    gap: 10px;
    grid-template-columns: minmax(220px, 1.5fr) repeat(2, minmax(160px, .8fr)) auto;
    min-width: 0;
}

body.profile-spb_zpi .lead-list-filter-form > label {
    display: grid;
    gap: 5px;
    min-width: 0;
}

body.profile-spb_zpi .lead-list-filter-form > label > span {
    color: #60738e;
    font-size: .73rem;
    font-weight: 850;
    letter-spacing: .04em;
    text-transform: uppercase;
}

body.profile-spb_zpi .lead-list-filter-form :is(input, select, button) {
    min-height: 44px;
    width: 100%;
}

body.profile-spb_zpi .lead-list-filter-actions {
    align-items: center;
    display: flex;
    gap: 9px;
}

body.profile-spb_zpi .lead-list-filter-actions a {
    align-items: center;
    border: 1px solid #cdd8e7;
    border-radius: 10px;
    color: #40546f;
    display: inline-flex;
    font-weight: 800;
    justify-content: center;
    min-height: 44px;
    padding: 0 13px;
    text-decoration: none;
}

body.profile-spb_zpi .lead-filter-note {
    color: #4f637e;
    font-size: .82rem;
    margin: 0;
}

body.profile-spb_zpi .lead-production-pointer {
    align-items: center;
    background: linear-gradient(135deg, #eef4ff, #f7f9ff);
    border: 1px solid #cad8f5;
    border-radius: 14px;
    display: flex;
    gap: 14px;
    justify-content: space-between;
    margin: 0 0 14px;
    padding: 14px 16px;
}

body.profile-spb_zpi .lead-production-pointer div {
    display: grid;
    gap: 3px;
    min-width: 0;
}

body.profile-spb_zpi .lead-production-pointer strong { color: #203b72; }
body.profile-spb_zpi .lead-production-pointer span { color: #566984; font-size: .86rem; }
body.profile-spb_zpi .lead-production-pointer .primary-link { flex: 0 0 auto; }

body.profile-spb_zpi .spb-zpi-lead-grid {
    align-items: stretch;
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 310px), 1fr));
    min-width: 0;
}

body.profile-spb_zpi .lead-tile {
    background: #fff;
    border: 1px solid #d9e2ed;
    border-left-width: 4px;
    border-radius: 13px;
    box-shadow: 0 7px 20px rgba(38, 55, 80, .07);
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
    scroll-margin: 88px;
    transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}

body.profile-spb_zpi .lead-tile:hover {
    border-color: #aebfe0;
    box-shadow: 0 11px 26px rgba(38, 55, 80, .11);
    transform: translateY(-1px);
}

body.profile-spb_zpi .lead-tile:focus { outline: none; }
body.profile-spb_zpi .lead-tile.is-return-target {
    border-color: #4169d8;
    box-shadow: 0 0 0 3px rgba(65, 105, 216, .2), 0 12px 28px rgba(38, 55, 80, .13);
}

body.profile-spb_zpi .lead-tile.status-new { border-left-color: #4776df; }
body.profile-spb_zpi .lead-tile.status-in_work { border-left-color: #d89b18; }
body.profile-spb_zpi .lead-tile.status-quote_sent { border-left-color: #4c72c7; }
body.profile-spb_zpi .lead-tile.status-contract { border-left-color: #7659c7; }
body.profile-spb_zpi .lead-tile.status-deferred { border-left-color: #8b98aa; }
body.profile-spb_zpi .lead-tile.status-production { border-left-color: #168d83; }
body.profile-spb_zpi .lead-tile.status-done { border-left-color: #299667; }
body.profile-spb_zpi .lead-tile.status-rejected { border-left-color: #cc596c; }

body.profile-spb_zpi .lead-tile-head {
    align-items: center;
    background: #f7f9fc;
    border-bottom: 1px solid #e1e7ef;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    min-width: 0;
    padding: 7px 10px;
}

body.profile-spb_zpi .lead-tile-number {
    color: #5b6c82;
    font-size: .76rem;
    font-weight: 850;
}

body.profile-spb_zpi .lead-tile-head .status-pill {
    font-size: .7rem;
    min-height: 23px;
    padding: 3px 7px;
}

body.profile-spb_zpi .lead-tile-event {
    background: #e9f7f1;
    border: 1px solid #bfe4d4;
    border-radius: 999px;
    color: #176846;
    font-size: .68rem;
    font-weight: 900;
    padding: 3px 7px;
}

body.profile-spb_zpi .lead-tile.new-age-warn .lead-tile-event.is-age {
    background: #fff4d7;
    border-color: #ebcf83;
    color: #805a08;
}

body.profile-spb_zpi .lead-tile.new-age-danger .lead-tile-event.is-age {
    background: #fff0f2;
    border-color: #efc5cd;
    color: #9b3548;
}

body.profile-spb_zpi .lead-tile-head time {
    color: #6e7f94;
    font-size: .7rem;
    margin-left: auto;
    white-space: nowrap;
}

body.profile-spb_zpi .lead-tile-body {
    min-width: 0;
    padding: 10px 11px;
}

body.profile-spb_zpi .lead-tile-identity,
body.profile-spb_zpi .lead-tile-direction {
    min-width: 0;
}

body.profile-spb_zpi .lead-tile-label {
    color: #78889b;
    display: block;
    font-size: .67rem;
    font-weight: 900;
    letter-spacing: .055em;
    margin-bottom: 4px;
    text-transform: uppercase;
}

body.profile-spb_zpi .lead-tile h2 {
    font-size: clamp(1rem, 1.7vw, 1.2rem);
    line-height: 1.16;
    margin: 0;
    overflow-wrap: anywhere;
}

body.profile-spb_zpi .lead-tile-title {
    color: #14243c;
    text-decoration: none;
}

body.profile-spb_zpi .lead-tile-title:hover { color: #2f57c5; }

body.profile-spb_zpi .lead-tile-contact {
    color: #455872;
    font-size: .88rem;
    margin: 4px 0 0;
    overflow-wrap: anywhere;
}

body.profile-spb_zpi .lead-tile-phone {
    color: #263f68;
    display: inline-flex;
    font-size: .82rem;
    font-weight: 800;
    margin-top: 4px;
    min-height: 25px;
    padding: 3px 0;
    text-decoration: none;
}

body.profile-spb_zpi .lead-tile-phone.is-empty { color: #8a97a8; font-weight: 700; }

body.profile-spb_zpi .lead-tile-direction {
    align-items: baseline;
    border-top: 1px solid #edf1f6;
    display: flex;
    gap: 7px;
    margin-top: 6px;
    padding-top: 6px;
}

body.profile-spb_zpi .lead-tile-direction .lead-tile-label {
    flex: 0 0 auto;
    margin: 0;
}

body.profile-spb_zpi .lead-tile-direction strong {
    color: #263b58;
    display: block;
    font-size: .78rem;
    line-height: 1.3;
    overflow-wrap: anywhere;
}

body.profile-spb_zpi .lead-tile-foot {
    align-items: center;
    border-top: 1px solid #e4eaf1;
    display: flex;
    gap: 10px;
    justify-content: space-between;
    margin-top: auto;
    min-width: 0;
    padding: 8px 10px;
}

body.profile-spb_zpi .lead-tile-foot > span {
    display: grid;
    min-width: 0;
}

body.profile-spb_zpi .lead-tile-foot small { color: #7a899b; font-size: .66rem; }
body.profile-spb_zpi .lead-tile-foot strong { color: #394d68; font-size: .77rem; overflow-wrap: anywhere; }

body.profile-spb_zpi .lead-tile-open {
    align-items: center;
    background: #edf2ff;
    border: 1px solid #cad6f5;
    border-radius: 9px;
    color: #2f52b3;
    display: inline-flex;
    flex: 0 0 auto;
    font-size: .76rem;
    font-weight: 900;
    justify-content: center;
    min-height: 38px;
    padding: 0 11px;
    text-decoration: none;
}

body.profile-spb_zpi .production-overview-copy > p:nth-last-child(2) {
    color: #314a71;
    margin: 7px 0 0;
}

@media (max-width: 980px) {
    body.profile-spb_zpi .lead-list-filter-form {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    body.profile-spb_zpi .lead-filter-search { grid-column: 1 / -1; }
    body.profile-spb_zpi .lead-list-filter-actions { align-self: end; }
}

@media (max-width: 700px) {
    body.profile-spb_zpi .lead-list-filter-panel { padding: 12px; }
    body.profile-spb_zpi .lead-list-filter-form { grid-template-columns: minmax(0, 1fr); }
    body.profile-spb_zpi .lead-filter-search { grid-column: 1; }
    body.profile-spb_zpi .lead-list-filter-actions > * { flex: 1; }
    body.profile-spb_zpi .lead-production-pointer { align-items: stretch; display: grid; }
    body.profile-spb_zpi .lead-production-pointer .primary-link { width: 100%; }
    body.profile-spb_zpi .spb-zpi-lead-grid { grid-template-columns: minmax(0, 1fr); }
    body.profile-spb_zpi .lead-tile-body { grid-template-columns: minmax(0, 1fr); padding: 12px; }
    body.profile-spb_zpi .lead-tile-head time { margin-left: 0; width: 100%; }
    body.profile-spb_zpi .lead-tile-foot { align-items: stretch; display: grid; }
    body.profile-spb_zpi .lead-tile-open { min-height: 44px; width: 100%; }
}

/* SPB_ZPI_ENGINEER_QUEUE_MOBILE_FACTS_V1
   Keep organization names and availability badges readable on narrow screens. */
@media (max-width: 700px) {
    body.profile-spb_zpi .engineer-job-facts {
        gap: 7px;
        grid-template-columns: minmax(0, 1fr);
    }

    body.profile-spb_zpi .engineer-job-facts > div {
        align-items: start;
        display: grid;
        gap: 8px;
        grid-template-columns: minmax(96px, auto) minmax(0, 1fr);
        width: 100%;
    }

    body.profile-spb_zpi .engineer-job-facts dd {
        min-width: 0;
        overflow-wrap: break-word;
        word-break: normal;
    }

    body.profile-spb_zpi .engineer-job-availability {
        max-width: 100%;
        white-space: normal;
    }
}

/* SPB-ZPI production queue and material specification */
body.profile-spb_zpi .lead-materials-field .lead-field-value {
    display: grid;
    gap: 0.25rem;
}

body.profile-spb_zpi .material-summary-item {
    display: block;
}

body.profile-spb_zpi .material-entry-list {
    display: grid;
    gap: 0.75rem;
    margin: 0.75rem 0;
}

body.profile-spb_zpi .material-entry {
    display: grid;
    grid-template-columns: minmax(180px, 1.7fr) minmax(110px, 0.7fr) minmax(120px, 0.8fr) auto;
    gap: 0.65rem;
    align-items: end;
    padding: 0.8rem;
    border: 1px solid #d8e1f1;
    border-radius: 12px;
    background: #f8faff;
}

body.profile-spb_zpi .material-entry .material-custom {
    grid-column: 1 / -1;
}

body.profile-spb_zpi .material-remove {
    min-height: 42px;
    color: #a32929;
    background: #fff;
    border: 1px solid #e8b8b8;
}

body.profile-spb_zpi .material-add {
    margin-bottom: 0.75rem;
}

body.profile-spb_zpi .production-material-line {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin: 0.35rem 0;
}

body.profile-spb_zpi .production-queue-hero {
    margin-bottom: 1rem;
}

body.profile-spb_zpi .production-queue-list {
    display: grid;
    gap: 1rem;
}

body.profile-spb_zpi .production-queue-card {
    border-left: 5px solid #90a1bd;
}

body.profile-spb_zpi .production-queue-card.priority-high {
    border-left-color: #d88916;
}

body.profile-spb_zpi .production-queue-card.priority-urgent {
    border-left-color: #c83c4f;
}

body.profile-spb_zpi .production-queue-card-head,
body.profile-spb_zpi .production-queue-actions,
body.profile-spb_zpi .production-queue-badges {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
}

body.profile-spb_zpi .production-queue-card-head h2 {
    margin: 0.15rem 0 0;
}

body.profile-spb_zpi .production-queue-card-head h2 a {
    color: #17243b;
}

body.profile-spb_zpi .production-queue-spec {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0.7rem;
    margin: 1rem 0;
}

body.profile-spb_zpi .production-queue-spec p {
    display: grid;
    gap: 0.25rem;
    margin: 0;
    padding: 0.65rem;
    border-radius: 10px;
    background: #f4f7fc;
}

body.profile-spb_zpi .production-queue-spec span,
body.profile-spb_zpi .production-queue-comment {
    overflow-wrap: anywhere;
}

body.profile-spb_zpi .priority-badge {
    padding: 0.35rem 0.65rem;
    border-radius: 999px;
    color: #31415d;
    background: #e8eef7;
    font-size: 0.82rem;
    font-weight: 700;
}

body.profile-spb_zpi .priority-badge.priority-high {
    color: #754300;
    background: #fff0cf;
}

body.profile-spb_zpi .priority-badge.priority-urgent {
    color: #8f1d2e;
    background: #ffe1e5;
}

body.profile-spb_zpi .production-stage.stage-queued {
    color: #31415d;
    background: #e8eef7;
}

body.profile-spb_zpi .production-priority-form,
body.profile-spb_zpi .production-priority-inline {
    display: flex;
    align-items: end;
    gap: 0.65rem;
    flex-wrap: wrap;
    margin: 0.75rem 0;
}

body.profile-spb_zpi .production-emergency {
    border-color: #efb9c0;
    background: #fff8f8;
}

@media (max-width: 900px) {
    body.profile-spb_zpi .production-queue-spec {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 620px) {
    body.profile-spb_zpi .material-entry,
    body.profile-spb_zpi .production-queue-spec {
        grid-template-columns: minmax(0, 1fr);
    }

    body.profile-spb_zpi .material-entry .material-custom {
        grid-column: auto;
    }

    body.profile-spb_zpi .production-queue-actions,
    body.profile-spb_zpi .production-priority-inline,
    body.profile-spb_zpi .production-priority-inline select,
    body.profile-spb_zpi .production-priority-inline button {
        width: 100%;
    }
}

/* Production controls polish v2 */
.production-panel {
    background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
    border: 1px solid #d8e3f0;
    box-shadow: 0 12px 32px rgba(30, 64, 108, 0.07);
}

.production-panel button,
.engineer-task-panel button,
.production-stage-controls button {
    align-items: center;
    box-shadow: 0 6px 16px rgba(20, 35, 58, 0.14);
    display: inline-flex;
    justify-content: center;
    letter-spacing: 0.01em;
    transition: background-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.production-panel button:hover,
.engineer-task-panel button:hover,
.production-stage-controls button:hover {
    background: #203a61;
    box-shadow: 0 9px 22px rgba(20, 35, 58, 0.19);
    transform: translateY(-1px);
}

.production-panel button:focus-visible,
.engineer-task-panel button:focus-visible,
.production-stage-controls button:focus-visible,
.notification-switch input:focus-visible + span {
    outline: 3px solid rgba(18, 102, 219, 0.28);
    outline-offset: 3px;
}

.production-panel button:disabled,
.engineer-task-panel button:disabled,
.production-stage-controls button:disabled {
    box-shadow: none;
    cursor: wait;
    opacity: 0.58;
    transform: none;
}

.production-panel input[type="file"],
.engineer-task-panel input[type="file"] {
    background: #f6f9fd;
    border: 1px dashed #aebfd4;
    min-height: 52px;
    padding: 6px;
}

.production-panel input[type="file"]::file-selector-button,
.engineer-task-panel input[type="file"]::file-selector-button {
    background: #e8f1ff;
    border: 0;
    border-radius: 8px;
    color: #144f9e;
    cursor: pointer;
    font: inherit;
    font-weight: 750;
    margin-right: 12px;
    padding: 9px 13px;
    transition: background-color 160ms ease, color 160ms ease;
}

.production-panel input[type="file"]::file-selector-button:hover,
.engineer-task-panel input[type="file"]::file-selector-button:hover {
    background: #d9e9ff;
    color: #0b438d;
}

.production-reassign {
    background: #f6f8fb;
    border: 1px solid #dce5ef;
    border-radius: 13px;
    overflow: hidden;
}

.production-reassign > summary {
    cursor: pointer;
    font-weight: 750;
    padding: 14px 16px;
}

.production-reassign[open] > summary {
    border-bottom: 1px solid #dce5ef;
}

.production-reassign form {
    padding: 16px;
}

/* Customer contact profile */
.customer-contact-lines {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 14px;
    margin-top: 8px;
}

.customer-contact-lines a,
.customer-profile-grid a {
    color: #0d58ba;
    font-weight: 700;
    text-decoration: none;
}

.customer-profile-panel {
    margin-bottom: 18px;
}

.customer-profile-grid {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin: 14px 0 0;
}

.customer-profile-grid > div {
    background: #f4f7fb;
    border: 1px solid #dce5ef;
    border-radius: 12px;
    min-width: 0;
    padding: 12px 14px;
}

.customer-profile-grid dt {
    color: #61738b;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.customer-profile-grid dd {
    line-height: 1.45;
    margin: 6px 0 0;
    overflow-wrap: anywhere;
}

.customer-lead-long {
    line-height: 1.45;
    white-space: pre-wrap;
}

.customer-lead-fields {
    display: grid;
    gap: 8px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin: 12px 0 14px;
}

.customer-lead-fields > div {
    background: rgba(255, 255, 255, 0.66);
    border: 1px solid #dce5ef;
    border-radius: 10px;
    min-width: 0;
    padding: 9px 11px;
}

.customer-lead-fields > .is-wide {
    grid-column: 1 / -1;
}

.customer-lead-fields dt {
    color: #6a7a8f;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.045em;
    text-transform: uppercase;
}

.customer-lead-fields dd {
    line-height: 1.42;
    margin: 4px 0 0;
    overflow-wrap: anywhere;
}

.customer-lead-fields a {
    color: #0d58ba;
    font-weight: 700;
    text-decoration: none;
}

/* Push settings */
.notification-settings-head {
    margin-bottom: 18px;
}

.current-device-card {
    align-items: center;
    display: grid;
    gap: 12px 24px;
    grid-template-columns: minmax(0, 1fr) auto;
    margin-bottom: 18px;
}

.current-device-card h2,
.current-device-card p {
    margin-bottom: 0;
}

.notification-device-status {
    color: #607086;
    grid-column: 1 / -1;
    margin: 0;
}

.notification-switch {
    align-items: center;
    cursor: pointer;
    display: inline-flex;
    gap: 10px;
}

.notification-switch input {
    height: 1px;
    opacity: 0;
    position: absolute;
    width: 1px;
}

.notification-switch span {
    background: #bcc8d7;
    border-radius: 999px;
    height: 28px;
    position: relative;
    transition: background 160ms ease;
    width: 50px;
}

.notification-switch span::after {
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 2px 7px rgba(21, 38, 63, 0.25);
    content: "";
    height: 22px;
    left: 3px;
    position: absolute;
    top: 3px;
    transition: transform 160ms ease;
    width: 22px;
}

.notification-switch input:checked + span {
    background: #1c9c69;
}

.notification-switch input:checked + span::after {
    transform: translateX(22px);
}

.notification-user-list {
    display: grid;
    gap: 9px;
    margin-top: 16px;
}

.notification-user-row {
    align-items: stretch;
    background: #f8fafc;
    border: 1px solid #dce5ef;
    border-radius: 13px;
    display: grid;
    gap: 10px;
    grid-template-columns: minmax(220px, 1fr) repeat(2, minmax(150px, 0.55fr));
    padding: 11px;
}

.notification-user-name,
.notification-channel-state {
    display: grid;
    gap: 3px;
    padding: 7px 9px;
}

.notification-user-name span,
.notification-channel-state span,
.notification-channel-state small {
    color: #66768b;
    font-size: 12px;
}

.notification-channel-state {
    border-left: 3px solid #c1cad6;
}

.notification-channel-state.is-on {
    background: #ecf9f3;
    border-left-color: #1c9c69;
    border-radius: 9px;
}

.notification-channel-state.is-off strong {
    color: #758297;
}

.notification-owner-switch {
    align-items: center;
    border-top: 1px solid rgba(96, 112, 134, 0.18);
    justify-content: space-between;
    margin-top: 7px;
    padding-top: 9px;
}

.notification-owner-switch span {
    flex: 0 0 50px;
}

.notification-owner-switch b {
    color: #344258;
    font-size: 12px;
    font-weight: 800;
}

@media (max-width: 760px) {
    .customer-profile-grid,
    .customer-lead-fields,
    .current-device-card,
    .notification-user-row {
        grid-template-columns: 1fr;
    }

    .notification-device-status {
        grid-column: auto;
    }
}

/* Engineer production workflow */
.impersonation-banner {
    align-items: center;
    background: #fff1c2;
    border-bottom: 1px solid #e5be42;
    display: flex;
    gap: 20px;
    justify-content: space-between;
    padding: 10px max(20px, calc((100vw - 1160px) / 2));
}

.impersonation-banner div,
.impersonation-panel > div {
    display: grid;
    gap: 3px;
}

.impersonation-banner button,
.impersonation-panel button,
.production-panel button,
.engineer-task-panel button,
.production-stage-controls button {
    background: #14233a;
    border: 0;
    border-radius: 10px;
    color: #fff;
    cursor: pointer;
    font-weight: 700;
    min-height: 42px;
    padding: 10px 16px;
}

.impersonation-panel {
    align-items: end;
    display: grid;
    gap: 20px;
    grid-template-columns: minmax(0, 1fr) minmax(320px, 0.7fr);
    margin-bottom: 22px;
}

.impersonation-panel form,
.production-assignment-form,
.production-feedback-form,
.production-inline-form {
    align-items: end;
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.impersonation-panel label,
.production-panel label,
.engineer-task-panel label,
.production-stage-controls label {
    display: grid;
    font-size: 13px;
    font-weight: 700;
    gap: 6px;
}

.impersonation-panel select,
.production-panel select,
.production-panel input,
.production-panel textarea,
.engineer-task-panel select,
.engineer-task-panel input,
.engineer-task-panel textarea,
.production-stage-controls input {
    background: #fff;
    border: 1px solid #cbd7e7;
    border-radius: 10px;
    font: inherit;
    min-height: 44px;
    padding: 10px 12px;
    width: 100%;
}

.visually-hidden {
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    height: 1px;
    overflow: hidden;
    position: absolute;
    white-space: nowrap;
    width: 1px;
}

.role-mode-banner form {
    align-items: center;
    display: flex;
    gap: 8px;
}

.role-mode-banner select {
    background: #fff;
    border: 1px solid #d5dfec;
    border-radius: 10px;
    min-height: 42px;
    padding: 8px 34px 8px 12px;
}

.self-role-card {
    align-items: end;
    display: grid;
    gap: 18px;
    grid-template-columns: minmax(0, 1fr) minmax(320px, .72fr);
    margin-bottom: 18px;
}

.self-role-card form {
    align-items: end;
    display: grid;
    gap: 10px;
    grid-template-columns: minmax(0, 1fr) auto;
}

.self-role-card label {
    display: grid;
    font-weight: 800;
    gap: 6px;
}

.self-role-card select {
    min-height: 46px;
}

@media (max-width: 719px) {
    .self-role-card,
    .self-role-card form {
        align-items: stretch;
        grid-template-columns: minmax(0, 1fr);
        width: 100%;
    }

    .role-mode-banner form {
        display: grid;
        width: 100%;
    }

    .role-mode-banner select,
    .role-mode-banner button,
    .self-role-card button {
        width: 100%;
    }
}

/* SPB-ZPI direct repeat order: compact, explicit and safe production shortcut. */
body.profile-spb_zpi .direct-repeat-production {
    border-color: #cfd9f6;
    padding: 0;
    overflow: hidden;
}

body.profile-spb_zpi .direct-repeat-production > details > summary {
    align-items: center;
    background: linear-gradient(135deg, #eef3ff 0%, #f7f9ff 100%);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    gap: 16px;
    list-style: none;
    min-height: 76px;
    padding: 16px 20px;
}

body.profile-spb_zpi .direct-repeat-production > details > summary::-webkit-details-marker {
    display: none;
}

body.profile-spb_zpi .direct-repeat-production > details > summary span:first-child {
    display: grid;
    gap: 3px;
}

body.profile-spb_zpi .direct-repeat-production > details > summary small {
    color: #667a9a;
    font-size: .7rem;
    font-weight: 850;
    letter-spacing: .05em;
    text-transform: uppercase;
}

body.profile-spb_zpi .direct-repeat-production > details > summary strong {
    color: #17233b;
    font-size: 1.05rem;
}

body.profile-spb_zpi .direct-repeat-production-action {
    background: #fff;
    border: 1px solid #c8d4f4;
    border-radius: 12px;
    color: #3150ad;
    flex: 0 0 auto;
    font-size: .8rem;
    font-weight: 850;
    padding: 9px 14px;
}

body.profile-spb_zpi .direct-repeat-production details[open] .direct-repeat-production-action::before {
    content: "Свернуть";
    font-size: .8rem;
}

body.profile-spb_zpi .direct-repeat-production details[open] .direct-repeat-production-action {
    font-size: 0;
}

body.profile-spb_zpi .direct-repeat-production-intro {
    background: #fff9e8;
    border: 1px solid #f0dda4;
    border-radius: 14px;
    margin: 18px 20px 0;
    padding: 13px 15px;
}

body.profile-spb_zpi .direct-repeat-production-intro strong {
    color: #7a5900;
}

body.profile-spb_zpi .direct-repeat-production-intro p {
    color: #6b7280;
    margin: 5px 0 0;
}

body.profile-spb_zpi .direct-repeat-production form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    padding: 18px 20px 20px;
}

body.profile-spb_zpi .direct-repeat-production form > label {
    display: grid;
    gap: 7px;
    min-width: 0;
}

body.profile-spb_zpi .direct-repeat-production .direct-repeat-wide,
body.profile-spb_zpi .direct-repeat-production .direct-repeat-confirm,
body.profile-spb_zpi .direct-repeat-production .direct-repeat-submit {
    grid-column: 1 / -1;
}

body.profile-spb_zpi .direct-repeat-production .direct-repeat-confirm {
    align-items: center;
    background: #f2f6ff;
    border: 1px solid #d5def7;
    border-radius: 13px;
    display: flex;
    gap: 10px;
    padding: 12px 14px;
}

body.profile-spb_zpi .direct-repeat-production .direct-repeat-confirm input {
    flex: 0 0 auto;
    height: 19px;
    margin: 0;
    width: 19px;
}

body.profile-spb_zpi .direct-repeat-production .direct-repeat-submit {
    min-height: 48px;
}

@media (max-width: 719px) {
    body.profile-spb_zpi .direct-repeat-production > details > summary {
        min-height: 70px;
        padding: 14px 16px;
    }

    body.profile-spb_zpi .direct-repeat-production-intro {
        margin: 14px 14px 0;
    }

    body.profile-spb_zpi .direct-repeat-production form {
        grid-template-columns: minmax(0, 1fr);
        padding: 14px;
    }

    body.profile-spb_zpi .direct-repeat-production form > *,
    body.profile-spb_zpi .direct-repeat-production .direct-repeat-wide,
    body.profile-spb_zpi .direct-repeat-production .direct-repeat-confirm,
    body.profile-spb_zpi .direct-repeat-production .direct-repeat-submit {
        grid-column: 1;
    }
}

/* SPB-ZPI staged engineer workspace v1 */
body.profile-spb_zpi .engineer-workspace-shell {
    display: grid;
    gap: 14px;
    max-width: 1224px;
}

body.profile-spb_zpi .engineer-detail-head {
    align-items: center;
    min-height: 0;
    padding: 18px 22px;
}

body.profile-spb_zpi .engineer-detail-head h1 {
    font-size: clamp(1.35rem, 2vw, 1.75rem);
    margin: 4px 0 0;
}

body.profile-spb_zpi .engineer-compact-details {
    padding: 0;
}

body.profile-spb_zpi .engineer-compact-details > summary {
    align-items: center;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    list-style: none;
    min-height: 62px;
    padding: 13px 20px;
}

body.profile-spb_zpi .engineer-compact-details > summary::-webkit-details-marker {
    display: none;
}

body.profile-spb_zpi .engineer-compact-details > summary > span:first-child {
    display: grid;
    gap: 3px;
}

body.profile-spb_zpi .engineer-compact-details > summary small,
body.profile-spb_zpi .engineer-form-label {
    color: #60738e;
    font-family: inherit;
    font-size: .72rem;
    font-weight: 850;
    letter-spacing: .035em;
    text-transform: uppercase;
}

body.profile-spb_zpi .engineer-compact-details > summary strong {
    font-size: 1.05rem;
}

body.profile-spb_zpi .engineer-details-toggle,
body.profile-spb_zpi .engineer-compact-details > summary > span:last-child {
    align-items: center;
    background: #edf2f9;
    border-radius: 999px;
    color: #506580;
    display: inline-flex;
    font-size: .76rem;
    font-weight: 800;
    min-height: 30px;
    padding: 5px 10px;
}

body.profile-spb_zpi .engineer-request-grid-compact {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    padding: 0 20px 14px;
}

body.profile-spb_zpi .engineer-request-grid-compact > :is(p, div) {
    min-height: 0;
    padding: 10px 12px;
}

body.profile-spb_zpi .engineer-request-grid-compact > .engineer-request-wide {
    grid-column: 1 / -1;
}

body.profile-spb_zpi .engineer-source-files,
body.profile-spb_zpi .engineer-result-files {
    border-top: 1px solid #dce5f1;
    padding: 12px 20px 16px;
}

body.profile-spb_zpi .engineer-section-title {
    align-items: center;
    display: flex;
    gap: 10px;
    justify-content: space-between;
    margin-bottom: 8px;
}

body.profile-spb_zpi .engineer-section-title > span {
    align-items: center;
    background: #edf2f9;
    border-radius: 999px;
    color: #506580;
    display: inline-flex;
    font-size: .75rem;
    font-weight: 850;
    justify-content: center;
    min-height: 28px;
    min-width: 28px;
}

body.profile-spb_zpi .engineer-file-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

body.profile-spb_zpi .engineer-file-list :is(a, p) {
    margin: 0;
}

body.profile-spb_zpi .engineer-file-list a {
    background: #f1f5fb;
    border: 1px solid #d8e2f0;
    border-radius: 10px;
    font-size: .84rem;
    font-weight: 750;
    max-width: 100%;
    overflow-wrap: anywhere;
    padding: 8px 10px;
}

body.profile-spb_zpi .engineer-current-stage,
body.profile-spb_zpi .engineer-compact-panel {
    padding: 18px 20px;
}

body.profile-spb_zpi .engineer-stage-head {
    margin-bottom: 14px;
}

body.profile-spb_zpi .engineer-stage-head > strong {
    color: #384f70;
    font-size: .9rem;
}

body.profile-spb_zpi .engineer-calculation-form {
    display: grid;
    gap: 12px;
    grid-template-columns: minmax(0, 1fr) minmax(250px, .65fr);
}

body.profile-spb_zpi .engineer-calculation-form > label,
body.profile-spb_zpi .engineer-form-field,
body.profile-spb_zpi .engineer-upload-form label {
    color: #60738e;
    display: grid;
    font-family: inherit;
    font-size: .78rem;
    font-weight: 850;
    gap: 6px;
    min-width: 0;
}

body.profile-spb_zpi .engineer-calculation-form :is(input[type="datetime-local"], textarea, select),
body.profile-spb_zpi .engineer-upload-form :is(input, textarea, select) {
    border: 1px solid #cbd8e9;
    border-radius: 11px;
    box-sizing: border-box;
    font: inherit;
    min-height: 44px;
    padding: 9px 11px;
    width: 100%;
}

body.profile-spb_zpi .engineer-form-wide {
    grid-column: 1 / -1;
}

body.profile-spb_zpi button.engineer-form-wide {
    min-height: 46px;
    width: 100%;
}

body.profile-spb_zpi .engineer-file-picker {
    align-items: center;
    background: #f5f8fc;
    border: 1px solid #cbd8e9;
    border-radius: 11px;
    cursor: pointer;
    display: flex;
    gap: 10px;
    min-height: 46px;
    overflow: hidden;
    padding: 5px;
    position: relative;
}

body.profile-spb_zpi .engineer-file-picker input[type="file"] {
    height: 1px;
    opacity: 0;
    pointer-events: none;
    position: absolute;
    width: 1px;
}

body.profile-spb_zpi .engineer-file-picker .secondary-button {
    align-items: center;
    display: inline-flex;
    flex: 0 0 auto;
    justify-content: center;
    min-height: 36px;
    padding: 8px 12px;
}

body.profile-spb_zpi .engineer-file-picker small {
    color: #506580;
    font-size: .82rem;
    font-weight: 650;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

body.profile-spb_zpi .engineer-secondary-action,
body.profile-spb_zpi .engineer-secondary-actions {
    margin-top: 12px;
}

body.profile-spb_zpi .engineer-secondary-actions {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

body.profile-spb_zpi .engineer-production-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

body.profile-spb_zpi .engineer-file-columns {
    display: grid;
    gap: 20px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

body.profile-spb_zpi .production-file-groups {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 12px;
}

body.profile-spb_zpi .production-file-groups > div {
    background: #f5f8fc;
    border: 1px solid #dbe4f1;
    border-radius: 12px;
    padding: 11px;
}

body.profile-spb_zpi .engineer-upload-form {
    align-items: end;
    border-top: 1px solid #dce5f1;
    display: grid;
    gap: 10px;
    grid-template-columns: minmax(0, 1fr) auto;
    margin-top: 14px;
    padding-top: 14px;
}

body.profile-spb_zpi .engineer-upload-form > button {
    min-height: 46px;
    min-width: 132px;
}

body.profile-spb_zpi .operations-stage-gate {
    border-left: 4px solid #6274f6;
    padding: 18px 20px;
}

body.profile-spb_zpi .operations-stage-gate h2,
body.profile-spb_zpi .operations-stage-gate p {
    margin-bottom: 6px;
    margin-top: 0;
}

body.profile-spb_zpi .lead-stage-control.is-locked {
    cursor: not-allowed;
    opacity: .58;
}

@media (max-width: 719px) {
    body.profile-spb_zpi .engineer-workspace-shell {
        gap: 10px;
        padding-inline: 10px;
    }

    body.profile-spb_zpi .engineer-detail-head {
        align-items: flex-start;
        gap: 10px;
        padding: 14px;
    }

    body.profile-spb_zpi .engineer-compact-details > summary {
        min-height: 56px;
        padding: 11px 13px;
    }

    body.profile-spb_zpi .engineer-details-toggle {
        font-size: 0;
        min-width: 30px;
        padding: 5px;
    }

    body.profile-spb_zpi .engineer-details-toggle::after {
        content: "⌃";
        font-size: .9rem;
    }

    body.profile-spb_zpi .engineer-request-grid-compact,
    body.profile-spb_zpi .engineer-calculation-form,
    body.profile-spb_zpi .engineer-secondary-actions,
    body.profile-spb_zpi .engineer-file-columns,
    body.profile-spb_zpi .engineer-production-summary,
    body.profile-spb_zpi .engineer-upload-form {
        grid-template-columns: minmax(0, 1fr);
    }

    body.profile-spb_zpi .production-file-groups {
        grid-template-columns: minmax(0, 1fr);
    }

    body.profile-spb_zpi .engineer-request-grid-compact {
        padding: 0 13px 11px;
    }

    body.profile-spb_zpi .engineer-request-grid-compact > .engineer-request-wide,
    body.profile-spb_zpi .engineer-form-wide {
        grid-column: 1;
    }

    body.profile-spb_zpi .engineer-source-files,
    body.profile-spb_zpi .engineer-result-files,
    body.profile-spb_zpi .engineer-current-stage,
    body.profile-spb_zpi .engineer-compact-panel {
        padding: 13px;
    }

    body.profile-spb_zpi .engineer-file-picker {
        align-items: stretch;
        flex-direction: column;
        gap: 5px;
    }

    body.profile-spb_zpi .engineer-file-picker small {
        padding: 4px 6px;
        white-space: normal;
    }

    body.profile-spb_zpi .engineer-upload-form > button {
        width: 100%;
    }
}

.production-panel textarea,
.engineer-task-panel textarea {
    min-height: 92px;
    resize: vertical;
}

.production-panel {
    grid-column: 1 / -1;
    scroll-margin-top: 90px;
}

.production-panel .panel-headline {
    align-items: center;
    display: flex;
    justify-content: space-between;
}

.production-wide {
    grid-column: 1 / -1;
}

.production-hint {
    color: #52647c;
    margin: 0;
}

.production-stage {
    background: #e8eef8;
    border-radius: 999px;
    color: #30445f;
    display: inline-flex;
    font-size: 12px;
    font-weight: 800;
    padding: 7px 11px;
    text-transform: uppercase;
}

.production-stage.stage-preparing_files { background: #fff1c2; color: #7d5800; }
.production-stage.stage-production { background: #dcecff; color: #13559c; }
.production-stage.stage-ready { background: #dff6e8; color: #17643a; }
.production-stage.stage-completed { background: #e9edf2; color: #465467; }

.production-summary {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin: 14px 0;
}

.production-summary div,
.production-main-comment {
    background: #f1f5fa;
    border: 1px solid #d7e1ee;
    border-radius: 12px;
    padding: 12px;
}

.production-summary dt { color: #60718a; font-size: 11px; font-weight: 800; text-transform: uppercase; }
.production-summary dd { font-weight: 700; margin: 5px 0 0; }
.production-main-comment p { margin: 7px 0 0; white-space: pre-wrap; }

.production-file-list {
    display: grid;
    gap: 8px;
    margin: 14px 0;
}

.production-file-list a {
    align-items: center;
    background: #f7f9fc;
    border: 1px solid #d7e1ee;
    border-radius: 10px;
    color: #1557b0;
    display: flex;
    font-weight: 700;
    justify-content: space-between;
    padding: 10px 12px;
    text-decoration: none;
}

.production-file-row {
    align-items: center;
    display: flex;
    gap: 8px;
    min-width: 0;
}

.production-file-row > a {
    flex: 1 1 auto;
    min-width: 0;
    overflow-wrap: anywhere;
}

.production-file-delete-form {
    flex: 0 0 auto;
    margin: 0;
}

.production-file-delete-button {
    font-size: .78rem;
    min-height: 36px;
    padding: 7px 10px;
}

.production-upload-form,
.production-comment-form {
    align-items: end;
    display: grid;
    gap: 12px;
    grid-template-columns: minmax(0, 1fr) auto;
    margin-top: 12px;
}

.production-comments {
    border-top: 1px solid #d7e1ee;
    display: grid;
    gap: 9px;
    margin-top: 18px;
    padding-top: 14px;
}

.production-comments article {
    background: #f7f9fc;
    border-left: 3px solid #6e7ff6;
    border-radius: 8px;
    padding: 10px 12px;
}

.production-comments article div { display: flex; gap: 12px; justify-content: space-between; }
.production-comments article p { margin: 7px 0 0; white-space: pre-wrap; }
.production-comments time { color: #66758a; font-size: 12px; }
.production-reassign { margin-top: 18px; }

.stage-link-button {
    align-items: center;
    background: #1473e6;
    border-radius: 10px;
    color: #fff;
    display: inline-flex;
    font-weight: 700;
    justify-content: center;
    min-height: 42px;
    padding: 9px 14px;
    text-decoration: none;
}

.feedback-queue { margin: 20px 0; }
.feedback-queue .is-overdue { border-left: 4px solid #c43e45; }

.engineer-hero {
    align-items: end;
    display: flex;
    gap: 24px;
    justify-content: space-between;
    margin-bottom: 22px;
}

.engineer-hero h1 { font-size: clamp(32px, 6vw, 58px); margin: 4px 0; }
.engineer-hero p { margin: 0; }
.engineer-summary { display: grid; gap: 12px; grid-template-columns: repeat(3, 1fr); margin-bottom: 22px; }
.engineer-summary a { background: #fff; border: 1px solid #d7e1ee; border-radius: 14px; color: #14233a; display: grid; gap: 4px; padding: 18px; text-decoration: none; }
.engineer-summary b { font-size: 28px; }
.engineer-job-grid { display: grid; gap: 10px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.engineer-job-card { background: #fff; border: 1px solid #d7e1ee; border-left: 6px solid #8794a8; border-radius: 13px; color: #14233a; display: grid; font-family: inherit; font-size: 1rem; gap: 12px; line-height: 1.45; padding: 17px 18px; text-decoration: none; }
.engineer-job-card-body { color: inherit; display: grid; gap: 12px; text-decoration: none; }
.engineer-job-card.status-queued { border-left-color: #596fe5; }
.engineer-job-card.status-preparing_files { border-left-color: #d89b18; }
.engineer-job-card.status-production { border-left-color: #1473e6; }
.engineer-job-card.status-ready { border-left-color: #27a361; }
.engineer-job-card.status-completed { border-left-color: #7d8b9e; }
.engineer-job-card-head { align-items: center; display: flex; flex-wrap: wrap; gap: 7px; justify-content: space-between; }
.engineer-job-card-head > strong { flex: 1 1 170px; font-family: inherit; font-size: 1.12rem; line-height: 1.3; }
.engineer-job-card .engineer-job-status { border: 1px solid transparent; border-radius: 999px; font-family: inherit; font-size: .88rem; font-weight: 850; line-height: 1.2; margin-left: auto; padding: 6px 10px; white-space: nowrap; }
.engineer-job-card.status-queued .engineer-job-status { background: #eef1ff; border-color: #ccd4fb; color: #344ba5; }
.engineer-job-card.status-preparing_files .engineer-job-status { background: #fff4d6; border-color: #edd18a; color: #805a08; }
.engineer-job-card.status-production .engineer-job-status { background: #eaf3ff; border-color: #c6daf5; color: #205d9d; }
.engineer-job-card.status-ready .engineer-job-status { background: #e7f7ef; border-color: #c3e5d3; color: #21704b; }
.engineer-job-card.status-completed .engineer-job-status { background: #eff2f6; border-color: #d6dde6; color: #566477; }
.engineer-job-direction { align-items: baseline; background: #f2f5fa; border: 1px solid #e2e8f1; border-radius: 9px; display: flex; gap: 9px; padding: 9px 11px; }
.engineer-job-direction > span,
.engineer-job-facts dt,
.engineer-job-note > span,
.engineer-job-due > span { color: #667791; flex: 0 0 auto; font-family: inherit; font-size: .8rem; font-weight: 900; letter-spacing: .035em; text-transform: uppercase; }
.engineer-job-direction > strong { color: #233b63; font-family: inherit; font-size: .98rem; line-height: 1.35; overflow-wrap: anywhere; }
.engineer-job-facts { display: grid; gap: 10px 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 0; }
.engineer-job-facts > div { align-items: baseline; display: flex; gap: 6px; min-width: 0; }
.engineer-job-facts dt,
.engineer-job-facts dd { margin: 0; }
.engineer-job-facts dd { color: #344967; font-family: inherit; font-size: .94rem; line-height: 1.4; min-width: 0; overflow-wrap: anywhere; }
.engineer-job-availability { background: #eef1ff; border: 1px solid #cbd4ff; border-radius: 999px; color: #344ba5; display: inline-flex; font-size: .88rem; font-weight: 850; line-height: 1.2; padding: 5px 9px; }
.engineer-job-card.status-preparing_files .engineer-job-availability { background: #fff4d6; border-color: #edd18a; color: #805a08; }
.engineer-job-card.status-production .engineer-job-availability { background: #eaf3ff; border-color: #c6daf5; color: #205d9d; }
.engineer-job-card.status-ready .engineer-job-availability { background: #e7f7ef; border-color: #c3e5d3; color: #21704b; }
.engineer-job-card.status-completed .engineer-job-availability { background: #eff2f6; border-color: #d6dde6; color: #566477; }
.engineer-job-note { background: #fff9ea; border-left: 3px solid #d89b18; border-radius: 7px; color: #435570; display: grid; font-family: inherit; font-size: .94rem; gap: 5px; line-height: 1.4; margin: 0; padding: 9px 11px; }
.engineer-job-due { align-items: center; border-top: 1px solid #e8edf4; color: #344967; display: flex; font-family: inherit; font-size: .94rem; gap: 9px; justify-content: space-between; margin: 0; padding-top: 9px; }
.engineer-job-due strong { font-family: inherit; }
.engineer-ready-action { border-top: 1px solid #dce8e2; margin: 0; padding-top: 11px; }
.engineer-ready-action button,
.production-ready-queue-button { align-items: center; background: linear-gradient(135deg, #137b54, #25a873); border: 0; border-radius: 11px; box-shadow: 0 7px 18px rgba(19,123,84,.18); color: #fff; cursor: pointer; display: grid; font: inherit; gap: 1px 9px; grid-template-columns: auto 1fr; min-height: 48px; padding: 9px 14px; text-align: left; width: 100%; }
.engineer-ready-action button > span,
.production-ready-queue-button > span:first-child { align-items: center; background: rgba(255,255,255,.18); border-radius: 999px; display: inline-flex; font-size: 1.05rem; grid-row: 1 / 3; height: 28px; justify-content: center; width: 28px; }
.engineer-ready-action strong,
.production-ready-queue-button strong { display: block; font-size: .94rem; line-height: 1.2; }
.engineer-ready-action small,
.production-ready-queue-button small { color: rgba(255,255,255,.82); display: block; font-size: .78rem; font-weight: 650; line-height: 1.2; margin-top: 2px; }
.engineer-ready-action button:hover,
.production-ready-queue-button:hover { box-shadow: 0 9px 22px rgba(19,123,84,.28); transform: translateY(-1px); }
.engineer-ready-action-detail { border: 0; padding: 0; }
.production-ready-queue-form { margin: 0; min-width: 250px; }
.engineer-jobs-panel, .engineer-task-panel, .production-stage-controls, .production-files-panel, .production-comments-panel { margin-bottom: 20px; }
.engineer-private-grid { display: grid; gap: 16px; grid-template-columns: 0.7fr 1.3fr; margin-bottom: 20px; }
.engineer-private-grid .record-panel { margin: 0; }
.production-comment-main { font-size: 18px; white-space: pre-wrap; }

@media (max-width: 760px) {
    .impersonation-banner,
    .engineer-hero { align-items: stretch; flex-direction: column; }
    .impersonation-panel,
    .production-assignment-form,
    .production-feedback-form,
    .production-summary,
    .engineer-summary,
    .engineer-job-grid,
    .engineer-private-grid { grid-template-columns: 1fr; }
    .production-wide { grid-column: auto; }
    .production-upload-form,
    .production-comment-form,
    .production-inline-form { grid-template-columns: 1fr; }
}

* {
    box-sizing: border-box;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    letter-spacing: 0;
    margin: 0;
}

a {
    color: inherit;
}

button,
input,
select,
textarea {
    font: inherit;
}

.app-header {
    align-items: center;
    background: rgba(255, 255, 255, 0.94);
    border-bottom: 1px solid var(--line);
    display: grid;
    gap: 12px;
    grid-template-columns: 1fr auto;
    padding: 14px clamp(16px, 4vw, 40px);
    position: sticky;
    top: 0;
    z-index: 2;
}

.brand,
.app-nav,
.page-intro,
.lead-topline,
.lead-body,
.event-list li div {
    align-items: center;
    display: flex;
}

.brand {
    gap: 10px;
    font-weight: 800;
    text-decoration: none;
}

.brand-mark {
    align-items: center;
    background: var(--text);
    border-radius: 8px;
    color: var(--surface);
    display: inline-flex;
    font-size: 1rem;
    height: 34px;
    justify-content: center;
    width: 34px;
}

.brand-mark-large {
    font-size: 1.35rem;
    height: 52px;
    width: 52px;
}

.app-nav {
    gap: 8px;
    grid-column: 1 / -1;
    overflow-x: auto;
}

.app-nav a,
.icon-action,
.primary-link,
.open-link {
    border-radius: 8px;
    text-decoration: none;
}

.app-nav a {
    color: var(--muted);
    padding: 9px 12px;
}

.app-nav a:hover {
    background: var(--surface-soft);
    color: var(--text);
}

.icon-action {
    background: var(--surface-soft);
    border: 0;
    color: var(--text);
    cursor: pointer;
    min-height: 40px;
    padding: 0 14px;
}

.app-shell {
    margin: 0 auto;
    max-width: 1240px;
    padding: clamp(22px, 5vw, 48px) clamp(16px, 4vw, 40px);
}

.page-intro {
    flex-wrap: wrap;
    gap: 16px;
    justify-content: space-between;
    margin-bottom: 24px;
}

.eyebrow {
    color: var(--muted);
    font-size: 0.84rem;
    font-weight: 800;
    margin: 0 0 8px;
    text-transform: uppercase;
}

h1,
h2,
p {
    margin-top: 0;
}

h1 {
    font-size: clamp(2rem, 6vw, 3.4rem);
    line-height: 1.05;
    margin-bottom: 0;
}

h2 {
    font-size: 1.15rem;
}

.primary-link,
.login-form button {
    background: var(--accent);
    border: 0;
    color: var(--surface);
    cursor: pointer;
    display: inline-flex;
    justify-content: center;
    min-height: 48px;
    padding: 14px 18px;
}

.primary-link:hover,
.login-form button:hover {
    background: var(--accent-strong);
}

.metric-grid,
.quick-grid,
.detail-layout {
    display: grid;
    gap: 16px;
}

.metric-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    margin-bottom: 20px;
}

.metric-card,
.quick-card,
.lead-card,
.record-panel,
.login-panel,
.empty-state {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.metric-card {
    display: grid;
    gap: 16px;
    min-height: 168px;
    padding: 24px;
}

.metric-card span,
.lead-card time,
.event-list time,
dt {
    color: var(--muted);
}

.metric-card strong {
    font-size: 3rem;
    line-height: 1;
}

.workspace-band {
    background: #172a46;
    border-radius: 8px;
    color: var(--surface);
    display: grid;
    gap: 18px;
    padding: clamp(20px, 4vw, 34px);
}

.workspace-band .eyebrow,
.workspace-band span {
    color: #c6d5ea;
}

.quick-card {
    color: var(--text);
    display: grid;
    gap: 10px;
    min-height: 156px;
    padding: 22px;
    text-decoration: none;
}

.lead-list {
    display: grid;
    gap: 14px;
}

.lead-card {
    box-shadow: var(--shadow);
    display: grid;
    gap: 18px;
    padding: 20px;
}

.lead-list-intro {
    margin-bottom: 14px;
}

.lead-tools,
.lead-search,
.lead-search label,
.search-actions,
.lead-card-main,
.dashboard-filter-links {
    display: grid;
    gap: 10px;
}

.lead-tools {
    margin-bottom: 16px;
}

.lead-search {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 14px;
}

.lead-search label {
    color: var(--muted);
    font-size: 0.92rem;
    font-weight: 800;
}

.lead-search input,
.lead-search select {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--text);
    min-height: 50px;
    min-width: 0;
    padding: 0 13px;
    width: 100%;
}

.search-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.search-actions button,
.search-actions a,
.lead-pagination a,
.lead-pagination span {
    align-items: center;
    border: 0;
    border-radius: 8px;
    display: inline-flex;
    justify-content: center;
    min-height: 46px;
    padding: 11px 13px;
    text-decoration: none;
}

.search-actions button,
.lead-pagination a {
    background: var(--accent);
    color: var(--surface);
    cursor: pointer;
}

.search-actions a,
.lead-pagination span {
    background: var(--surface-soft);
    color: var(--muted);
}

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

.lead-counters span,
.lead-counters a {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--muted);
    display: grid;
    font-size: 0.78rem;
    gap: 2px;
    min-width: 0;
    padding: 9px 7px;
    text-align: center;
    text-decoration: none;
}

.lead-counters b {
    color: var(--text);
    font-size: 1.12rem;
}

.status-chips {
    display: flex;
    gap: 8px;
    max-width: 100%;
    overflow-x: auto;
    padding-bottom: 3px;
}

.status-chips a {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--muted);
    flex: 0 0 auto;
    font-size: 0.9rem;
    font-weight: 800;
    min-height: 42px;
    padding: 11px 13px;
    text-decoration: none;
}

.status-chips .is-active {
    background: var(--text);
    border-color: var(--text);
    color: var(--surface);
}

.lead-results {
    color: var(--muted);
    font-size: 0.88rem;
    margin-bottom: 11px;
}

.lead-results p,
.lead-source,
.lead-snippet {
    margin-bottom: 0;
}

.compact-lead-card {
    gap: 12px;
    padding: 15px;
}

.compact-lead-card .lead-topline {
    align-items: flex-start;
}

.compact-lead-card .lead-topline strong {
    font-size: 1rem;
}

.compact-lead-card .lead-topline time {
    font-size: 0.82rem;
}

.lead-card-main h2 {
    font-size: 1.18rem;
    margin-bottom: 7px;
}

.lead-card-main p,
.lead-source,
.lead-snippet {
    overflow-wrap: anywhere;
}

.lead-card-main p,
.lead-source {
    color: var(--muted);
}

.lead-call {
    align-items: center;
    background: var(--surface-soft);
    border-radius: 8px;
    display: inline-flex;
    min-height: 42px;
    padding: 9px 11px;
    text-decoration: none;
}

.lead-source {
    font-size: 0.84rem;
    font-weight: 800;
}

.lead-owner {
    background: var(--surface-soft);
    border-radius: 8px;
    color: var(--muted);
    font-size: 0.88rem;
    font-weight: 800;
    margin-bottom: 0;
    overflow-wrap: anywhere;
    padding: 8px 10px;
}

.lead-owner.is-mine {
    background: #d9f3e8;
    color: var(--success);
}

.lead-owner.is-other {
    background: #fff0ca;
    color: var(--warning);
}

.lead-snippet {
    color: var(--text);
    display: -webkit-box;
    font-size: 0.93rem;
    line-height: 1.35;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.lead-empty {
    display: grid;
    gap: 12px;
}

.lead-empty .primary-link {
    justify-self: stretch;
}

.lead-pagination {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 16px;
}

.dashboard-links {
    gap: 14px;
}

.dashboard-filter-links {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.dashboard-filter-links .quick-card {
    min-height: 106px;
    padding: 16px;
}

.dashboard-filter-links .quick-card span {
    font-size: 1.6rem;
    font-weight: 900;
}

.intro-note {
    color: var(--muted);
    margin: 11px 0 0;
}

.dashboard-counters {
    margin-bottom: 14px;
}

.dashboard-actions,
.dashboard-queues,
.queue-list,
.owner-actions,
.manual-lead-form,
.manual-extra-fields {
    display: grid;
    gap: 10px;
}

.dashboard-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-bottom: 16px;
}

.dashboard-actions a,
.dashboard-actions span,
.manual-form-actions a,
.manual-form-actions button,
.owner-actions button {
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--text);
    display: inline-flex;
    font-weight: 800;
    justify-content: center;
    min-height: 48px;
    padding: 12px;
    text-align: center;
    text-decoration: none;
}

.dashboard-actions span {
    color: var(--muted);
    cursor: not-allowed;
}

.dashboard-actions .primary-link {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--surface);
}

.dashboard-queues {
    align-items: start;
}

.queue-panel h2,
.owner-panel h2,
.source-panel h2 {
    margin-bottom: 0;
}

.queue-head {
    align-items: center;
    display: flex;
    gap: 10px;
    justify-content: space-between;
    margin-bottom: 12px;
}

.queue-head a {
    color: var(--accent-strong);
    font-weight: 900;
}

.queue-lead {
    background: var(--surface-soft);
    border-radius: 8px;
    display: grid;
    gap: 4px;
    min-height: 58px;
    overflow-wrap: anywhere;
    padding: 11px;
    text-decoration: none;
}

.queue-lead span,
.queue-empty {
    color: var(--muted);
    font-size: 0.9rem;
    margin-bottom: 0;
}

.source-panel,
.owner-panel {
    padding: 16px;
}

.source-grid {
    display: grid;
    gap: 8px;
    margin: 14px 0 0;
}

.source-grid div,
.owner-state {
    background: var(--surface-soft);
    border-radius: 8px;
    min-width: 0;
    overflow-wrap: anywhere;
    padding: 10px;
}

.source-grid dd {
    font-size: 0.94rem;
}

.owner-state {
    font-weight: 900;
    margin: 12px 0 8px;
}

.owner-warning {
    background: #fff0ca;
    border-radius: 8px;
    color: var(--warning);
    margin-bottom: 10px;
    padding: 10px;
}

.claim-form button {
    font-size: 1.02rem;
    min-height: 56px;
}

.locked-panel {
    background: var(--surface);
    display: grid;
    gap: 10px;
    padding: 16px;
}

.locked-panel p {
    background: var(--surface-soft);
    border-radius: 8px;
    color: var(--muted);
    margin-bottom: 0;
    padding: 12px;
}

.readonly-grid {
    margin-top: 0;
}

.owner-actions button,
.manual-form-actions button {
    background: var(--accent);
    border: 0;
    color: var(--surface);
    cursor: pointer;
}

.manager-transfer {
    width: 100%;
}

.manual-lead-form {
    margin: 0 auto;
    max-width: 720px;
    padding: 16px;
}

.manual-lead-form label {
    color: var(--muted);
    display: grid;
    font-size: 0.92rem;
    font-weight: 800;
    gap: 8px;
}

.manual-lead-form input,
.manual-lead-form select,
.manual-lead-form textarea {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--text);
    min-height: 48px;
    min-width: 0;
    padding: 11px 12px;
    width: 100%;
}

.manual-lead-form textarea {
    min-height: 78px;
    resize: vertical;
}

.manual-extra {
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
}

.manual-extra summary {
    cursor: pointer;
    font-weight: 900;
    list-style: none;
    min-height: 48px;
    padding: 14px;
}

.manual-extra summary::-webkit-details-marker {
    display: none;
}

.manual-extra-fields {
    padding: 0 12px 12px;
}

.manual-form-actions {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.manual-form-actions button:disabled {
    background: var(--muted);
    cursor: not-allowed;
}

.lead-topline,
.lead-body {
    flex-wrap: wrap;
    gap: 12px;
    justify-content: space-between;
}

.lead-body h2 {
    font-size: 1.25rem;
    margin-bottom: 8px;
}

.lead-body p {
    color: var(--muted);
    margin-bottom: 0;
}

.phone-link,
dd a {
    color: var(--accent-strong);
    font-weight: 700;
}

.status-pill {
    background: #dceafe;
    border: 1px solid rgba(36, 99, 235, 0.16);
    border-radius: 999px;
    color: var(--accent-strong);
    display: inline-flex;
    font-size: 0.82rem;
    font-weight: 900;
    letter-spacing: 0.02em;
    min-height: 32px;
    padding: 7px 12px;
    text-transform: uppercase;
}

.status-new {
    background: #dceafe;
    border-color: rgba(36, 99, 235, 0.22);
    color: #1d4ed8;
}

.status-in_work {
    background: #fff0ca;
    border-color: rgba(180, 83, 9, 0.2);
    color: var(--warning);
}

.status-measurement {
    background: #ede9fe;
    border-color: rgba(109, 40, 217, 0.18);
    color: #6d28d9;
}

.status-thinking {
    background: #ffedd5;
    border-color: rgba(194, 65, 12, 0.18);
    color: #c2410c;
}

.status-agreement {
    background: #e0f2fe;
    border-color: rgba(3, 105, 161, 0.18);
    color: #0369a1;
}

.status-construction {
    background: #e5e7eb;
    border-color: rgba(55, 65, 81, 0.18);
    color: #374151;
}

.status-done {
    background: #d9f3e8;
    border-color: rgba(21, 128, 61, 0.18);
    color: var(--success);
}

.status-rejected {
    background: #f1f5f9;
    border-color: rgba(71, 85, 105, 0.18);
    color: #475569;
}

.open-link {
    background: var(--surface-soft);
    color: var(--text);
    display: inline-flex;
    justify-content: center;
    min-height: 46px;
    padding: 13px 16px;
}

.empty-state {
    padding: 28px;
}

.back-link {
    color: var(--accent-strong);
    display: inline-block;
    font-weight: 800;
    margin-bottom: 16px;
}

.detail-intro {
    align-items: flex-end;
}

.record-panel {
    overflow: hidden;
    padding: 22px;
}

.field-grid {
    display: grid;
    gap: 14px;
    margin: 0;
}

.field-grid div {
    background: var(--surface-soft);
    border-radius: 8px;
    min-width: 0;
    padding: 14px;
}

dt {
    font-size: 0.84rem;
    font-weight: 800;
    margin-bottom: 6px;
    text-transform: uppercase;
}

dd {
    margin: 0;
    overflow-wrap: anywhere;
}

.event-list {
    display: grid;
    gap: 12px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.event-list li {
    background: var(--surface-soft);
    border-radius: 8px;
    padding: 14px;
}

.event-list li div {
    flex-wrap: wrap;
    gap: 8px;
    justify-content: space-between;
}

.event-list p,
.event-list small {
    display: block;
    margin: 10px 0 0;
    overflow-wrap: anywhere;
}

.login-shell {
    align-items: center;
    display: grid;
    min-height: 100vh;
    padding: clamp(16px, 5vw, 48px);
}

.login-panel {
    box-shadow: var(--shadow);
    display: grid;
    gap: 28px;
    margin: 0 auto;
    max-width: 880px;
    overflow: hidden;
    padding: clamp(24px, 5vw, 54px);
    width: 100%;
}

.login-copy p {
    color: var(--muted);
    font-size: 1.08rem;
    line-height: 1.5;
    margin: 18px 0 0;
    max-width: 32rem;
}

.login-form {
    display: grid;
    gap: 16px;
}

.login-form label {
    color: var(--muted);
    display: grid;
    font-size: 0.92rem;
    font-weight: 800;
    gap: 8px;
}

.login-form input {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--text);
    min-height: 52px;
    padding: 0 14px;
}

.notice {
    border-radius: 8px;
    margin: -4px 0 18px;
    padding: 14px 16px;
}

.notice-success {
    background: #d9f3e8;
    color: var(--success);
}

.notice-error {
    background: #fde0e3;
    color: var(--danger);
}

.deleted-warning,
.deleted-card-actions,
.phone-history-list,
.delete-lead-form,
.deleted-lead-list {
    display: grid;
    gap: 10px;
}

.deleted-warning {
    background: #fff0ca;
    border: 1px solid #f1cf75;
    border-radius: 8px;
    margin-bottom: 18px;
    padding: 14px;
}

.deleted-warning p {
    color: var(--warning);
    margin: 5px 0 0;
}

.deleted-warning button,
.deleted-card-actions button,
.delete-lead-form button {
    background: var(--accent);
    border: 0;
    border-radius: 8px;
    color: var(--surface);
    cursor: pointer;
    min-height: 48px;
    padding: 12px 14px;
    width: 100%;
}

.lead-hero,
.compact-workspace {
    display: grid;
    gap: 14px;
}

.lead-hero {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
    margin-bottom: 18px;
    padding: 18px;
}

.lead-hero h1 {
    font-size: 1.8rem;
    margin-bottom: 8px;
}

.lead-hero-head,
.hero-meta,
.form-actions {
    display: flex;
    gap: 10px;
}

.lead-hero-head {
    align-items: flex-start;
    flex-wrap: wrap;
    justify-content: space-between;
}

.hero-phone {
    color: var(--accent-strong);
    display: inline-flex;
    font-size: 1.16rem;
    font-weight: 800;
    text-decoration: none;
}

.hero-address {
    font-size: 1.02rem;
    font-weight: 700;
    margin: 0;
}

.call-link,
.quick-actions button,
.action-drop summary,
.action-drop button,
.inline-field button {
    background: var(--accent);
    border: 0;
    border-radius: 8px;
    color: var(--surface);
    cursor: pointer;
    display: inline-flex;
    justify-content: center;
    min-height: 48px;
    padding: 12px 14px;
    text-decoration: none;
    width: 100%;
}

.call-link {
    align-items: center;
    font-weight: 800;
}

.hero-meta {
    color: var(--muted);
    flex-wrap: wrap;
    font-size: 0.88rem;
    margin: 0;
    overflow-wrap: anywhere;
}

.hero-meta span + span::before {
    content: "·";
    margin-right: 10px;
}

.compact-workspace {
    align-items: start;
}

.action-panel,
.fields-panel,
.history-panel {
    padding: 16px;
}

.quick-actions,
.secondary-actions,
.inline-fields,
.action-drop form,
.inline-field form {
    display: grid;
    gap: 10px;
}

.quick-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.quick-actions > :last-child {
    grid-column: 1 / -1;
}

.secondary-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 10px;
}

.action-drop,
.inline-field,
.history-panel {
    border: 1px solid var(--line);
    border-radius: 8px;
    min-width: 0;
}

.action-drop {
    background: var(--surface-soft);
    overflow: hidden;
}

.action-drop summary {
    align-items: center;
    list-style: none;
}

.action-drop summary::-webkit-details-marker,
.inline-field summary::-webkit-details-marker,
.history-panel > summary::-webkit-details-marker {
    display: none;
}

.action-drop form,
.inline-field form {
    background: var(--surface-soft);
    padding: 12px;
}

.action-drop label,
.inline-field label {
    color: var(--muted);
    display: grid;
    font-size: 0.9rem;
    font-weight: 800;
    gap: 8px;
}

.action-drop input,
.action-drop textarea,
.inline-field input,
.inline-field select,
.inline-field textarea {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--text);
    min-height: 46px;
    padding: 10px 12px;
    width: 100%;
}

.action-drop textarea,
.inline-field textarea {
    min-height: 82px;
    resize: vertical;
}

.reject-drop summary,
.action-drop .danger-button {
    background: var(--danger);
}

.stage-facts {
    color: var(--muted);
    display: flex;
    flex-wrap: wrap;
    font-size: 0.88rem;
    gap: 8px;
    margin-top: 12px;
}

.stage-facts span {
    background: var(--surface-soft);
    border-radius: 8px;
    max-width: 100%;
    overflow-wrap: anywhere;
    padding: 7px 9px;
}

.inline-fields {
    gap: 8px;
}

.inline-field {
    background: var(--surface-soft);
    overflow: hidden;
}

.inline-field summary,
.history-panel > summary {
    cursor: pointer;
    list-style: none;
}

.inline-field summary {
    align-items: center;
    display: grid;
    gap: 10px;
    grid-template-columns: minmax(0, 1fr) auto;
    min-height: 60px;
    padding: 11px 12px;
}

.inline-field summary span {
    display: grid;
    gap: 4px;
    min-width: 0;
    overflow-wrap: anywhere;
}

.inline-field summary b {
    color: var(--muted);
    font-size: 0.78rem;
    text-transform: uppercase;
}

.inline-field summary i {
    background: var(--surface);
    border-radius: 8px;
    color: var(--accent-strong);
    font-style: normal;
    font-weight: 900;
    padding: 8px 10px;
}

.form-actions {
    align-items: center;
    flex-wrap: wrap;
}

.form-actions span {
    color: var(--muted);
    font-size: 0.82rem;
}

.form-actions button {
    width: auto;
}

.history-panel,
.phone-history-panel,
.more-panel {
    background: var(--surface);
}

.history-panel > summary,
.phone-history-panel > summary,
.more-panel > summary {
    color: var(--accent-strong);
    cursor: pointer;
    font-size: 1rem;
    font-weight: 900;
    list-style: none;
}

.history-panel > summary::-webkit-details-marker,
.phone-history-panel > summary::-webkit-details-marker,
.more-panel > summary::-webkit-details-marker {
    display: none;
}

.history-panel[open] > summary,
.phone-history-panel[open] > summary,
.more-panel[open] > summary {
    margin-bottom: 14px;
}

.phone-history-panel {
    padding: 16px;
}

.phone-history-card,
.deleted-meta div {
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 8px;
    display: grid;
    gap: 8px;
    min-width: 0;
    overflow-wrap: anywhere;
    padding: 12px;
}

.phone-history-card.is-deleted {
    border-color: #efb0b6;
}

.locked-fact {
    background: var(--surface);
    border-radius: 8px;
    color: var(--muted);
    display: inline-flex;
    font-weight: 800;
    justify-content: center;
    min-height: 44px;
    padding: 12px;
}

.more-panel {
    padding: 16px;
}

.delete-lead-form {
    background: var(--surface-soft);
    border-radius: 8px;
    padding: 12px;
}

.delete-lead-form p {
    color: var(--warning);
    margin-bottom: 0;
}

.delete-lead-form label {
    color: var(--muted);
    display: grid;
    font-size: 0.92rem;
    font-weight: 800;
    gap: 7px;
}

.delete-lead-form select,
.delete-lead-form textarea {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--text);
    min-height: 48px;
    padding: 11px 12px;
    width: 100%;
}

.delete-lead-form textarea {
    min-height: 76px;
    resize: vertical;
}

.delete-lead-form .danger-button {
    background: var(--danger);
}

.deleted-search {
    grid-template-columns: 1fr;
}

.deleted-lead-card {
    gap: 10px;
    padding: 15px;
}

.deleted-lead-card > p,
.deleted-meta {
    margin-bottom: 0;
}

.deleted-meta {
    display: grid;
    gap: 8px;
}

.deleted-card-actions form,
.deleted-card-actions button {
    width: 100%;
}

.form-error {
    background: #fde0e3;
    border-radius: 8px;
    color: var(--danger);
    margin-bottom: 0;
    padding: 12px;
}

.intro-actions,
.work-tabs,
.work-board,
.work-mini-list,
.work-lead-list,
.directory-grid,
.directory-list,
.settings-create form {
    display: grid;
    gap: 10px;
}

.intro-actions {
    width: 100%;
}

.intro-actions > a,
.work-tabs a {
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    display: inline-flex;
    font-weight: 800;
    justify-content: center;
    min-height: 48px;
    padding: 12px;
    text-decoration: none;
}

.intro-actions .primary-link {
    background: var(--accent);
    border-color: var(--accent);
}

.work-tabs {
    display: flex;
    margin-bottom: 16px;
    max-width: 100%;
    overflow-x: auto;
    padding-bottom: 3px;
}

.work-tabs a {
    flex: 0 0 auto;
    min-height: 44px;
    white-space: nowrap;
}

.work-tabs .danger-chip {
    background: #fde0e3;
    color: var(--danger);
}

.work-column,
.settings-create,
.directory-card {
    padding: 16px;
}

.work-mini-card {
    background: var(--surface-soft);
    border: 1px solid transparent;
    border-radius: 8px;
    display: grid;
    gap: 4px;
    min-height: 76px;
    overflow-wrap: anywhere;
    padding: 11px;
    text-decoration: none;
}

.work-mini-card span,
.work-mini-card small,
.work-mini-card time,
.directory-card p,
.date-fact {
    color: var(--muted);
    margin-bottom: 0;
}

.work-lead-card {
    gap: 10px;
    padding: 15px;
}

.work-lead-card h2,
.directory-card h2 {
    margin-bottom: 0;
}

.work-lead-card > p {
    margin-bottom: 0;
    overflow-wrap: anywhere;
}

.date-overdue {
    border-color: #efb0b6;
}

.date-overdue .date-fact,
.date-overdue small {
    color: var(--danger);
    font-weight: 800;
}

.date-today {
    border-color: #f1cf75;
}

.date-future {
    border-color: #c7d9f4;
}

.date-today .date-fact {
    color: var(--warning);
    font-weight: 800;
}

.work-card-actions {
    display: grid;
    gap: 9px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.work-card-actions form,
.work-card-actions button {
    width: 100%;
}

.work-card-actions button,
.settings-create button {
    background: var(--accent);
    border: 0;
    border-radius: 8px;
    color: var(--surface);
    cursor: pointer;
    min-height: 46px;
    padding: 11px;
}

.directory-grid a,
.directory-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    min-width: 0;
}

.directory-grid a {
    display: grid;
    gap: 5px;
    min-height: 88px;
    padding: 16px;
    text-decoration: none;
}

.directory-grid span {
    color: var(--muted);
}

.settings-head h1 {
    margin-bottom: 16px;
}

.settings-create {
    margin-bottom: 14px;
}

.settings-create > summary {
    color: var(--accent-strong);
    cursor: pointer;
    font-weight: 900;
    list-style: none;
}

.settings-create > summary::-webkit-details-marker {
    display: none;
}

.settings-create[open] > summary {
    margin-bottom: 12px;
}

.settings-create label {
    color: var(--muted);
    display: grid;
    font-size: 0.92rem;
    font-weight: 800;
    gap: 7px;
}

.settings-create input {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--text);
    min-height: 48px;
    padding: 11px 12px;
    width: 100%;
}

.directory-card {
    display: grid;
    gap: 8px;
}

.state-on,
.state-off {
    border-radius: 999px;
    display: inline-flex;
    font-size: 0.85rem;
    font-weight: 900;
    justify-self: start;
    min-height: 32px;
    padding: 7px 11px;
}

.state-on {
    background: #d9f3e8;
    color: var(--success);
}

.state-off {
    background: #fde0e3;
    color: var(--danger);
}

@media (min-width: 720px) {
    .app-header {
        grid-template-columns: auto 1fr auto;
    }

    .app-nav {
        grid-column: auto;
    }

    .quick-grid,
    .login-panel {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .field-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .compact-workspace {
        grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
    }

    .history-panel {
        grid-column: 1 / -1;
    }

    .phone-history-panel,
    .more-panel {
        grid-column: 1 / -1;
    }

    .lead-hero {
        padding: 24px;
    }

    .call-link {
        justify-self: start;
        min-width: 180px;
    }

    .lead-search {
        align-items: end;
        grid-template-columns: minmax(0, 1fr) minmax(200px, 0.55fr) auto;
    }

    .deleted-search {
        grid-template-columns: minmax(0, 1fr) auto;
    }

    .search-actions {
        min-width: 240px;
    }

    .lead-counters {
        grid-template-columns: repeat(6, minmax(0, 1fr));
    }

    .lead-card-main {
        align-items: center;
        grid-template-columns: minmax(0, 1fr) minmax(220px, 0.72fr);
    }

    .dashboard-filter-links {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .dashboard-counters {
        grid-template-columns: repeat(7, minmax(0, 1fr));
    }

    .dashboard-actions {
        grid-template-columns: repeat(6, minmax(0, 1fr));
    }

    .dashboard-queues {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .source-panel {
        grid-column: 1 / -1;
    }

    .source-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .open-link {
        justify-self: end;
        min-width: 120px;
    }

    .intro-actions {
        grid-template-columns: repeat(2, minmax(160px, auto));
        justify-content: end;
        width: auto;
    }

    .work-board,
    .directory-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .work-lead-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .deleted-warning {
        align-items: center;
        grid-template-columns: minmax(0, 1fr) auto;
    }

    .phone-history-list,
    .deleted-lead-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .deleted-card-actions {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .directory-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

.push-status[hidden] {
    display: none !important;
}

.push-status {
    color: var(--muted);
    font-size: 0.78rem;
}

.browser-push-prompt[hidden] {
    display: none !important;
}

.browser-push-prompt {
    align-items: center;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 14px;
    box-shadow: 0 16px 38px rgba(15, 23, 42, 0.16);
    display: grid;
    gap: 12px;
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    left: 50%;
    max-width: min(760px, calc(100vw - 32px));
    padding: 13px 14px;
    position: fixed;
    top: 78px;
    transform: translateX(-50%);
    width: max-content;
    z-index: 1200;
}

.browser-push-icon {
    color: #2563eb;
    font-size: 1.1rem;
}

.browser-push-prompt strong {
    color: #0f172a;
    display: block;
    font-size: 0.92rem;
}

.browser-push-prompt p {
    color: #475569;
    font-size: 0.82rem;
    margin: 2px 0 0;
}

.browser-push-prompt button {
    background: #172033;
    border: 0;
    border-radius: 9px;
    color: #ffffff;
    cursor: pointer;
    font-weight: 700;
    min-height: 40px;
    padding: 0 14px;
    white-space: nowrap;
}

.browser-push-prompt button:disabled {
    cursor: wait;
    opacity: 0.65;
}

.browser-push-prompt .browser-push-close {
    background: transparent;
    color: #64748b;
    font-size: 1.4rem;
    min-height: 36px;
    padding: 0 8px;
}

@media (max-width: 719px) {
    .browser-push-prompt {
        align-items: start;
        grid-template-columns: auto minmax(0, 1fr) auto;
        top: 68px;
    }

    .browser-push-prompt > button[data-enable-browser-push] {
        grid-column: 2 / 4;
        width: 100%;
    }
}

.brand-logo {
    display: none;
}

.login-logo {
    width: 280px;
    max-width: min(76vw, 280px);
    height: auto;
    max-height: 200px;
    object-fit: contain;
    display: block;
    margin: 0 0 16px;
}

@media (max-width: 719px) {
    .login-logo {
        width: 240px;
        max-width: 78vw;
        max-height: 172px;
    }
}

/* P35: dashboard as working inbox */
.dashboard-inbox {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
    margin-bottom: 14px;
    padding: clamp(16px, 4vw, 24px);
}

.dashboard-inbox-hot {
    border-color: rgba(36, 99, 235, 0.28);
}

.dashboard-inbox-clear {
    background: linear-gradient(135deg, #ffffff 0%, #f5f8fd 100%);
}

.inbox-head {
    align-items: flex-start;
    display: flex;
    gap: 14px;
    justify-content: space-between;
}

.inbox-head h1 {
    font-size: clamp(1.65rem, 7vw, 2.5rem);
}

.new-lead-list {
    display: grid;
    gap: 12px;
    margin-top: 16px;
}

.dashboard-new-lead {
    border-color: rgba(36, 99, 235, 0.2);
    box-shadow: none;
}

.dashboard-phone {
    font-size: 1.15rem;
    font-weight: 900;
}

.dashboard-card-actions {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.compact-dashboard-counters {
    margin-bottom: 12px;
}

.compact-dashboard-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-bottom: 14px;
}

.quick-control-list .queue-lead strong {
    font-size: 1rem;
}

.app-nav a[href="/crm/work"] {
    display: none;
}

@media (max-width: 719px) {
    .app-header {
        gap: 8px;
        padding: 10px 12px;
    }

    .app-nav {
        gap: 6px;
    }

    .app-nav a {
        font-size: 0.88rem;
        min-height: 38px;
        padding: 8px 10px;
        white-space: nowrap;
    }

    .app-shell {
        padding: 14px 12px 28px;
    }

    .inbox-head {
        display: grid;
    }

    .inbox-head .primary-link {
        width: 100%;
    }

    .dashboard-card-actions,
    .compact-dashboard-actions {
        grid-template-columns: 1fr;
    }

    .compact-dashboard-counters {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .dashboard-queues {
        gap: 12px;
    }
}

/* P39: new lead reaction traffic light */
.new-lead-age {
    border-radius: 999px;
    display: inline-flex;
    font-size: 0.78rem;
    font-weight: 900;
    min-height: 30px;
    padding: 6px 10px;
}

.new-lead-age-ok {
    background: #dceafe;
    color: #1d4ed8;
}

.new-lead-age-warn {
    background: #fff0ca;
    color: var(--warning);
}

.new-lead-age-danger {
    background: #fde0e3;
    color: var(--danger);
}

.dashboard-new-lead.new-age-warn {
    border-color: rgba(180, 83, 9, 0.32);
}

.dashboard-new-lead.new-age-danger {
    border-color: rgba(190, 18, 60, 0.34);
    box-shadow: 0 12px 34px rgba(190, 18, 60, 0.08);
}

/* P43: dashboard attention block */
.attention-panel {
    background: var(--surface);
    border: 1px solid rgba(180, 83, 9, 0.24);
    border-radius: 8px;
    box-shadow: var(--shadow);
    margin-bottom: 14px;
    padding: clamp(14px, 4vw, 20px);
}

.attention-list {
    display: grid;
    gap: 10px;
    margin-top: 12px;
}

.attention-card {
    align-items: center;
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--text);
    display: grid;
    gap: 10px;
    grid-template-columns: 1fr auto;
    padding: 12px;
    text-decoration: none;
}

.attention-card strong,
.attention-card span {
    display: block;
}

.attention-card div > span {
    color: var(--muted);
    font-size: 0.9rem;
    margin-top: 4px;
    overflow-wrap: anywhere;
}

.attention-warn {
    border-color: rgba(180, 83, 9, 0.28);
}

.attention-danger,
.attention-critical {
    border-color: rgba(190, 18, 60, 0.34);
}

.attention-badge {
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 900;
    min-height: 30px;
    padding: 7px 10px;
    white-space: nowrap;
}

.attention-badge-warn {
    background: #fff0ca;
    color: var(--warning);
}

.attention-badge-danger,
.attention-badge-critical {
    background: #fde0e3;
    color: var(--danger);
}

@media (max-width: 719px) {
    .attention-card {
        align-items: flex-start;
        grid-template-columns: 1fr;
    }

    .attention-badge {
        justify-self: start;
        white-space: normal;
    }
}

/* P48: lead detail phone visual improvement only */
.hero-phone-main {
    background: #dceafe;
    border-radius: 8px;
    color: #1d4ed8;
    font-size: clamp(1.35rem, 6vw, 2rem);
    font-weight: 950;
    letter-spacing: 0.01em;
    min-height: 48px;
    padding: 8px 12px;
}

.lead-hero .call-link {
    font-size: 1rem;
    font-weight: 950;
}

/* P49: compact client name in lead detail */
.hero-client-name {
    color: var(--text);
    display: grid;
    font-size: clamp(1.08rem, 4.6vw, 1.45rem);
    font-weight: 900;
    gap: 4px;
    line-height: 1.18;
    margin: 0 0 10px;
    overflow-wrap: anywhere;
}

.hero-client-name span {
    color: var(--muted);
    font-size: 0.76rem;
    font-weight: 900;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.lead-hero .eyebrow {
    margin-bottom: 6px;
}

/* P52: recent history in lead detail, template-only */
.recent-history-panel {
    margin-bottom: 14px;
    padding: 16px;
}

.recent-history-head {
    align-items: center;
    display: flex;
    gap: 10px;
    justify-content: space-between;
    margin-bottom: 12px;
}

.recent-history-head h2 {
    margin: 0;
}

.recent-history-head a {
    color: var(--accent-strong);
    font-weight: 900;
}

.recent-event-list {
    display: grid;
    gap: 10px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.recent-event-list li {
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px;
}

.recent-event-list li div {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: space-between;
}

.recent-event-list time,
.recent-event-list small {
    color: var(--muted);
}

.recent-event-list p,
.recent-event-list small {
    display: block;
    margin: 8px 0 0;
    overflow-wrap: anywhere;
}

@media (max-width: 719px) {
    .recent-history-head {
        align-items: flex-start;
        display: grid;
    }
}


/* P85: lead detail useful data first */
.lead-data-panel {
    display: grid;
    gap: 14px;
}

.panel-headline {
    align-items: center;
    display: flex;
    gap: 12px;
    justify-content: space-between;
}

.panel-headline h2 {
    margin: 0;
}

.panel-headline span {
    background: var(--surface-soft);
    border-radius: 999px;
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 800;
    padding: 8px 12px;
}

.lead-data-grid {
    display: grid;
    gap: 10px;
}

.lead-data-card {
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 8px;
    display: grid;
    gap: 6px;
    padding: 14px;
}

.lead-data-card dt {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 900;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.lead-data-card dd {
    font-size: clamp(1.05rem, 3vw, 1.32rem);
    font-weight: 800;
    line-height: 1.25;
    margin: 0;
    white-space: pre-line;
}

.source-panel-compact {
    box-shadow: none;
}

.source-grid-useful dd {
    word-break: break-word;
}

.muted-line {
    color: var(--muted);
    margin: 0;
}

@media (min-width: 900px) {
    .lead-data-panel {
        grid-column: 1 / -1;
    }

    .lead-data-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .lead-data-card:first-child:last-child {
        grid-column: 1 / -1;
    }
}

/* P87B: clean duplicated history and readable quiz snippets */
.lead-snippet-structured {
    white-space: pre-line;
    line-height: 1.45;
}

.lead-card .lead-snippet-structured,
.work-lead-card .lead-snippet-structured {
    font-size: 0.95rem;
}

/* P89: take first before call/open */
.hero-primary-actions {
    display: grid;
    gap: 10px;
    margin-top: 12px;
}

.hero-take-form,
.inline-take-form {
    display: grid;
    margin: 0;
}

.hero-take-form button,
.inline-take-form button {
    background: var(--ink);
    border: 0;
    border-radius: 8px;
    color: #fff;
    cursor: pointer;
    font: inherit;
    font-weight: 900;
    min-height: 44px;
    padding: 12px 14px;
    width: 100%;
}

.dashboard-card-actions-take-first {
    display: grid;
    gap: 10px;
}

@media (min-width: 720px) {
    .hero-primary-actions {
        grid-template-columns: 1fr 1fr;
    }
}

/* P90: take first buttons */
.hero-primary-actions {
    display: grid;
    gap: 10px;
    margin-top: 12px;
}

.hero-take-form,
.inline-take-form {
    display: grid;
    margin: 0;
}

.hero-take-form button,
.inline-take-form button {
    appearance: none;
    background: #111827;
    border: 0;
    border-radius: 8px;
    color: #ffffff;
    cursor: pointer;
    font: inherit;
    font-weight: 900;
    min-height: 44px;
    padding: 12px 14px;
    width: 100%;
}

.dashboard-card-actions {
    gap: 10px;
}

@media (min-width: 720px) {
    .hero-primary-actions {
        grid-template-columns: 1fr 1fr;
    }
}


/* P106: clean bottom search/stat/archive disclosure on leads page */
.lead-tools-details {
    background: transparent;
    border: 0;
    margin: 18px 0 0;
    padding: 0;
}

.lead-tools-details > summary {
    align-items: center;
    background: #eef2f7;
    border: 1px solid #d8e0ea;
    border-radius: 12px;
    color: #334155;
    cursor: pointer;
    display: flex;
    font-size: 0.95rem;
    font-weight: 900;
    gap: 8px;
    justify-content: center;
    min-height: 46px;
    padding: 12px 16px;
    user-select: none;
}

.lead-tools-details > summary::marker {
    color: #64748b;
    font-size: 0.85rem;
}

.lead-tools-details[open] > summary {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    border-bottom-color: transparent;
}

.lead-tools-details .lead-tools {
    background: #ffffff;
    border: 1px solid #d8e0ea;
    border-radius: 0 0 12px 12px;
    box-shadow: 0 14px 32px rgba(15, 23, 42, 0.08);
    display: grid;
    gap: 12px;
    margin: 0;
    padding: 14px;
}

.lead-tools-details .lead-search {
    background: transparent;
    border: 0;
    box-shadow: none;
    display: grid;
    gap: 10px;
    margin: 0;
    padding: 0;
}

.lead-tools-details .lead-search label {
    color: #475569;
    display: grid;
    font-size: 0.82rem;
    font-weight: 900;
    gap: 6px;
}

.lead-tools-details .lead-search input,
.lead-tools-details .lead-search select {
    background: #f8fafc;
    border: 1px solid #d8e0ea;
    border-radius: 10px;
    color: #0f172a;
    font-size: 0.95rem;
    min-height: 44px;
    padding: 10px 12px;
    width: 100%;
}

.lead-tools-details .search-actions {
    display: grid;
    gap: 8px;
}

.lead-tools-details .search-actions button,
.lead-tools-details .search-actions a,
.lead-tools-details .archive-actions a {
    align-items: center;
    border-radius: 10px;
    display: inline-flex;
    font-size: 0.95rem;
    font-weight: 900;
    justify-content: center;
    min-height: 44px;
    padding: 10px 14px;
    text-decoration: none;
}

.lead-tools-details .search-actions button {
    background: #2563eb;
    border: 0;
    color: #ffffff;
}

.lead-tools-details .search-actions a,
.lead-tools-details .archive-actions a {
    background: #f1f5f9;
    border: 1px solid #d8e0ea;
    color: #475569;
}

.lead-tools-details .lead-counters {
    display: grid;
    gap: 8px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin: 0;
}

.lead-tools-details .lead-counters span {
    background: #f8fafc;
    border: 1px solid #d8e0ea;
    border-radius: 10px;
    color: #64748b;
    display: grid;
    font-size: 0.78rem;
    font-weight: 800;
    gap: 2px;
    min-height: 54px;
    padding: 8px 10px;
    text-align: center;
}

.lead-tools-details .lead-counters b {
    color: #0f172a;
    font-size: 1.05rem;
}

.lead-tools-details .archive-actions {
    display: grid;
}

@media (min-width: 760px) {
    .lead-tools-details .lead-search {
        align-items: end;
        grid-template-columns: minmax(280px, 1fr) minmax(220px, 0.8fr) minmax(120px, auto);
    }

    .lead-tools-details .lead-counters {
        grid-template-columns: repeat(6, minmax(0, 1fr));
    }

    .lead-tools-details .archive-actions {
        justify-content: end;
    }

    .lead-tools-details .archive-actions a {
        min-width: 190px;
    }
}

/* P109: richer dashboard attention cards */
.attention-panel-rich {
    overflow: hidden;
}

.attention-list-rich {
    gap: 10px;
}

.attention-card-rich {
    align-items: stretch;
    display: block;
    padding: 12px;
}

.attention-main {
    display: grid;
    gap: 7px;
    min-width: 0;
    width: 100%;
}

.attention-title-row {
    align-items: center;
    display: flex;
    gap: 10px;
    justify-content: space-between;
}

.attention-title-row strong {
    color: #0f172a;
    font-size: 1rem;
    line-height: 1.2;
}

.attention-phone,
.attention-meta,
.attention-date {
    color: #64748b;
    font-size: 0.9rem;
    font-weight: 800;
    line-height: 1.25;
}

.attention-details {
    background: rgba(241, 245, 249, 0.9);
    border-radius: 10px;
    color: #0f172a;
    font-size: 0.92rem;
    font-weight: 800;
    line-height: 1.35;
    padding: 8px 10px;
    white-space: pre-line;
}

.attention-card-rich.attention-danger .attention-details,
.attention-card-rich.attention-critical .attention-details {
    background: rgba(254, 226, 226, 0.65);
}

.attention-card-rich.attention-warn .attention-details {
    background: rgba(254, 243, 199, 0.55);
}

@media (max-width: 640px) {
    .attention-title-row {
        align-items: flex-start;
        display: grid;
    }

    .attention-title-row .attention-badge {
        justify-self: start;
    }
}

/* P92: CRM leads filters and visible stage dates */
.primary-filter-row {
    margin-bottom: 8px;
}

.secondary-filter-row {
    margin-bottom: 14px;
}

.assigned-chips.primary-filter-row a {
    background: #eef4ff;
    border-color: #c8d8f3;
    color: #27476f;
}

.assigned-chips.primary-filter-row .is-active {
    background: var(--text);
    border-color: var(--text);
    color: var(--surface);
}

.lead-date-facts {
    display: grid;
    gap: 7px;
}

.lead-date-facts:empty {
    display: none;
}

.date-fact {
    background: #fff7df;
    border: 1px solid rgba(159, 101, 0, 0.22);
    border-radius: 8px;
    color: #6f4700;
    font-size: 0.95rem;
    font-weight: 900;
    line-height: 1.25;
    margin: 0;
    overflow-wrap: anywhere;
    padding: 10px 12px;
}

.date-fact-measurement {
    background: #eaf2ff;
    border-color: rgba(18, 102, 219, 0.24);
    color: #0d4fae;
}

.date-fact-thinking {
    background: #fff7df;
    border-color: rgba(159, 101, 0, 0.28);
    color: #6f4700;
}

.date-fact-work {
    background: #eaf8f2;
    border-color: rgba(21, 129, 93, 0.24);
    color: #0b6849;
}

.work-mini-card .date-fact {
    font-size: 0.84rem;
    padding: 7px 9px;
}

/* P92B: visible stage date inside lead detail data block */
.lead-stage-date-card {
    border-width: 2px;
    grid-column: 1 / -1;
    padding: 14px 16px;
}

.lead-stage-date-card dt {
    color: inherit;
    font-size: 0.78rem;
    font-weight: 900;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.lead-stage-date-card dd {
    color: inherit;
    font-size: clamp(1.08rem, 2.6vw, 1.45rem);
    font-weight: 950;
    line-height: 1.2;
    margin: 0;
}

/* P93A-2: structured manual lead form */
.manual-form-section {
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 12px;
    display: grid;
    gap: 12px;
    padding: 14px;
}

.manual-form-section h2 {
    font-size: 1rem;
    margin: 0;
}

.manual-checkbox-group {
    border: 1px solid var(--line);
    border-radius: 10px;
    display: grid;
    gap: 8px;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    margin: 0;
    padding: 12px;
}

.manual-checkbox-group legend {
    color: var(--muted);
    font-size: 0.92rem;
    font-weight: 900;
    padding: 0 6px;
}

.manual-checkbox {
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 10px;
    display: grid;
    grid-template-columns: 18px 1fr;
    gap: 10px;
    min-height: 42px;
    padding: 10px 12px;
}

.manual-checkbox input[type="checkbox"] {
    accent-color: var(--accent);
    height: 18px;
    margin: 0;
    min-height: 0;
    padding: 0;
    width: 18px;
}

.manual-checkbox label {
    cursor: pointer;
    display: block;
    font-size: 0.95rem;
    font-weight: 900;
    line-height: 1.2;
    margin: 0;
}

.manual-status-fields {
    display: grid;
    gap: 10px;
}

.manual-status-fields [hidden] {
    display: none !important;
}

.manual-route-selector {
    border: 0;
    margin: 0;
    padding: 0;
}

.manual-route-selector legend {
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 900;
    margin-bottom: 7px;
}

.manual-route-options {
    display: grid;
    gap: 8px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.manual-lead-form .manual-route-option {
    align-items: flex-start;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 10px;
    cursor: pointer;
    display: grid;
    gap: 9px;
    grid-template-columns: 16px minmax(0, 1fr);
    min-height: 74px;
    padding: 10px 11px;
}

.manual-lead-form .manual-route-option:has(input:checked) {
    background: #eef2ff;
    border-color: #6375f2;
    box-shadow: inset 0 0 0 1px #6375f2;
}

.manual-lead-form .manual-route-option input[type="radio"] {
    accent-color: var(--accent);
    height: 16px;
    margin: 2px 0 0;
    min-height: 0;
    padding: 0;
    width: 16px;
}

.manual-route-option span,
.manual-route-option strong,
.manual-route-option small {
    display: block;
}

.manual-route-option strong {
    color: var(--text);
    font-size: 0.9rem;
    line-height: 1.2;
}

.manual-route-option small {
    color: var(--muted);
    font-size: 0.76rem;
    font-weight: 650;
    line-height: 1.3;
    margin-top: 4px;
}

@media (max-width: 640px) {
    .manual-route-options {
        grid-template-columns: 1fr;
    }

    .manual-lead-form .manual-route-option {
        min-height: 0;
    }
}

/* P93A-4: simple category checkboxes */
.manual-category-block {
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 12px;
}

.manual-category-title {
    color: var(--muted);
    font-size: 0.92rem;
    font-weight: 900;
    margin: 0 0 10px;
}

.manual-category-list {
    display: grid;
    gap: 8px;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}

.manual-lead-form .manual-category-row {
    align-items: center !important;
    background: transparent;
    border: 0;
    cursor: pointer;
    display: grid !important;
    gap: 8px !important;
    grid-template-columns: 18px minmax(0, 1fr) !important;
    line-height: 1.2;
    margin: 0 !important;
    min-height: 28px;
    padding: 0 !important;
}

.manual-lead-form .manual-category-row input[type="checkbox"] {
    appearance: auto;
    accent-color: var(--accent);
    display: block !important;
    height: 16px !important;
    margin: 0 !important;
    min-height: 0 !important;
    padding: 0 !important;
    width: 16px !important;
}

.manual-lead-form .manual-category-row span {
    color: var(--text);
    display: block;
    font-size: 0.95rem;
    font-weight: 900;
    overflow-wrap: anywhere;
}

/* P93A-5: final compact manual categories */
.manual-category-block {
    border: 1px solid var(--line) !important;
    border-radius: 10px !important;
    padding: 8px !important;
}

.manual-category-title {
    font-size: 0.82rem !important;
    font-weight: 900 !important;
    margin: 0 0 6px !important;
}

.manual-category-list {
    display: grid !important;
    gap: 4px 8px !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
}

.manual-lead-form .manual-category-row {
    align-items: center !important;
    border: 0 !important;
    display: grid !important;
    grid-template-columns: 14px minmax(0, 1fr) !important;
    gap: 5px !important;
    line-height: 1.05 !important;
    margin: 0 !important;
    min-height: 20px !important;
    padding: 0 !important;
}

.manual-lead-form .manual-category-row input[type="checkbox"] {
    appearance: auto !important;
    accent-color: var(--accent) !important;
    height: 13px !important;
    margin: 0 !important;
    min-height: 0 !important;
    padding: 0 !important;
    width: 13px !important;
}

.manual-lead-form .manual-category-row span {
    font-size: 0.78rem !important;
    font-weight: 800 !important;
    line-height: 1.05 !important;
}



/* System page readable monitoring layout */
.system-page {
    display: grid;
    gap: 16px;
    max-width: min(1240px, 100%);
}

.system-page .record-panel {
    overflow: visible;
}

.system-panel {
    min-width: 0;
}

.system-kpi-grid {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.system-kpi {
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 8px;
    display: grid;
    gap: 6px;
    min-width: 0;
    padding: 13px;
}

.system-kpi span {
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 800;
}

.system-kpi strong {
    display: block;
    font-size: 1.35rem;
    line-height: 1.15;
    overflow-wrap: anywhere;
}

.system-page .table-wrap {
    margin-top: 10px;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.system-page .records-table {
    min-width: 900px;
    table-layout: auto;
}

.system-page .records-table th,
.system-page .records-table td {
    vertical-align: top;
    white-space: normal;
}

.system-page .records-table td.muted {
    overflow-wrap: anywhere;
}

@media (max-width: 719px) {
    .system-kpi-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .system-kpi {
        padding: 11px;
    }

    .system-kpi strong {
        font-size: 1.08rem;
    }

    .system-page .records-table {
        min-width: 820px;
    }
}


/* Backup monitoring block polish */
.system-backup-panel {
    background: linear-gradient(180deg, var(--surface), var(--surface-soft));
}

.backup-hero {
    align-items: stretch;
    display: grid;
    gap: 12px;
    grid-template-columns: minmax(0, 1.45fr) minmax(340px, 0.95fr);
}

.backup-hero-main {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    display: grid;
    gap: 8px;
    min-width: 0;
    padding: 16px;
}

.backup-label {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 900;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.backup-file {
    display: block;
    font-size: 1.18rem;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.backup-meta-line {
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 700;
}

.backup-health-grid {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.backup-health-grid > div {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    display: grid;
    gap: 5px;
    padding: 13px;
}

.backup-health-grid span {
    color: var(--muted);
    font-size: 0.76rem;
    font-weight: 900;
    text-transform: uppercase;
}

.backup-health-grid strong {
    font-size: 1.15rem;
    line-height: 1.15;
}

.backup-table-wrap {
    margin-top: 14px;
}

.system-page .backup-table {
    min-width: 980px;
}

.backup-table th {
    font-size: 0.78rem;
    text-transform: uppercase;
}

.backup-table td {
    font-size: 0.9rem;
}

.backup-time {
    white-space: nowrap !important;
    width: 150px;
}

.backup-file-cell {
    font-weight: 800;
    overflow-wrap: anywhere;
    width: 260px;
}

.backup-git {
    color: var(--text);
    max-width: 360px;
    overflow-wrap: anywhere;
}

.backup-ok {
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 999px;
    display: inline-block;
    font-size: 0.78rem;
    font-weight: 800;
    margin: 2px 4px 2px 0;
    padding: 4px 8px;
    white-space: nowrap;
}

@media (max-width: 920px) {
    .backup-hero {
        grid-template-columns: 1fr;
    }

    .backup-health-grid {
        grid-template-columns: repeat(4, minmax(110px, 1fr));
        overflow-x: auto;
    }
}

@media (max-width: 719px) {
    .backup-hero-main {
        padding: 13px;
    }

    .backup-file {
        font-size: 1rem;
    }

    .backup-health-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        overflow-x: visible;
    }

    .system-page .backup-table {
        min-width: 860px;
    }
}

/* CRM detail: readable lead data values */
.lead-data-edit-fields .inline-field summary {
    min-height: 68px;
    padding: 14px 14px;
}

.lead-data-edit-fields .inline-field summary span {
    gap: 6px;
}

.lead-data-edit-fields .inline-field summary span {
    color: var(--text);
    font-size: clamp(1.08rem, 2.4vw, 1.28rem);
    font-weight: 900;
    line-height: 1.25;
}

.lead-data-edit-fields .inline-field summary b {
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 900;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.lead-data-edit-fields .inline-field summary i {
    font-size: 1rem;
}

.lead-data-edit-fields .inline-field input,
.lead-data-edit-fields .inline-field select,
.lead-data-edit-fields .inline-field textarea {
    font-size: 1.05rem;
    font-weight: 700;
}

.lead-data-edit-fields .inline-field textarea {
    line-height: 1.35;
}

/* Operational telephony queue */
.calls-nav-link {
    align-items: center;
    display: inline-flex !important;
    gap: 4px;
}

.calls-nav-badge {
    color: var(--danger, #b42318);
    font-size: 0.8rem;
    font-weight: 950;
    line-height: 1;
}

.lead-quote-ready-pill {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 5px 10px;
    border: 1px solid #b8c6ff;
    border-radius: 999px;
    background: #edf1ff;
    color: #2445b8;
    font-size: 12px;
    font-weight: 800;
    line-height: 1.15;
}

.calculation-quote-action {
    display: grid;
    gap: 3px;
    margin-top: 12px;
    padding: 12px 14px;
    border: 1px solid #b8c6ff;
    border-radius: 12px;
    background: #edf1ff;
    color: #1f356f;
}

.calculation-quote-action span {
    color: #52658f;
    font-size: 13px;
}

body.profile-spb_zpi .lead-card:has(.lead-quote-ready-pill) {
    border-color: #8fa4ff;
    box-shadow: 0 12px 30px rgba(60, 86, 194, .14);
}

@media (max-width: 719px) {
    .lead-quote-ready-pill {
        width: 100%;
        justify-content: center;
        order: 8;
    }
}

.calls-page-intro {
    align-items: end;
    gap: 20px;
}

.calls-intro-note {
    color: var(--muted);
    margin: 5px 0 0;
}

.calls-quick-search {
    align-items: center;
    display: grid;
    gap: 8px;
    grid-template-columns: minmax(220px, 320px) auto auto;
}

.calls-quick-search input {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 9px;
    color: var(--text);
    min-height: 42px;
    padding: 9px 11px;
    width: 100%;
}

.calls-quick-search button,
.calls-quick-search a {
    align-items: center;
    border-radius: 9px;
    display: inline-flex;
    font-weight: 850;
    justify-content: center;
    min-height: 42px;
    padding: 9px 14px;
    text-decoration: none;
}

.calls-quick-search button {
    background: var(--text);
    border: 1px solid var(--text);
    color: var(--surface);
}

.calls-quick-search a {
    border: 1px solid var(--line);
    color: var(--text);
}

.calls-tabs {
    margin-top: 6px;
}

.calls-tabs a {
    align-items: center;
    display: inline-flex;
    gap: 7px;
}

.calls-tabs b {
    background: rgba(255, 255, 255, 0.75);
    border-radius: 999px;
    font-size: 0.72rem;
    min-width: 20px;
    padding: 2px 6px;
    text-align: center;
}

.calls-tabs .is-active b {
    background: rgba(255, 255, 255, 0.18);
}

.calls-results {
    color: var(--muted);
    font-size: 0.86rem;
    margin: 10px 0;
}

.call-list {
    display: grid;
    gap: 12px;
}

.call-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 13px;
    display: grid;
    gap: 14px;
    padding: 16px;
}

.call-status-unreviewed {
    border-left: 5px solid var(--danger, #b42318);
}

.call-card.is-historical {
    background: var(--surface-soft);
}

.call-card-header {
    align-items: start;
    display: flex;
    gap: 14px;
    justify-content: space-between;
}

.call-card-header > div:first-child {
    display: grid;
    gap: 4px;
}

.call-card-header time {
    color: var(--muted);
    font-size: 0.82rem;
}

.call-statuses {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: flex-end;
}

.call-card-body {
    display: grid;
    gap: 14px;
    grid-template-columns: minmax(240px, 0.8fr) minmax(360px, 1.2fr);
}

.call-primary {
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 11px;
    display: grid;
    gap: 8px;
    padding: 14px;
}

.call-label,
.call-primary-facts span,
.call-facts dt {
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 900;
    text-transform: uppercase;
}

.call-phone {
    color: var(--text);
    font-size: clamp(1.3rem, 2.7vw, 1.75rem);
    font-weight: 950;
    overflow-wrap: anywhere;
    text-decoration: none;
}

.call-primary-facts {
    display: grid;
    gap: 8px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 6px;
}

.call-primary-facts div {
    display: grid;
    gap: 3px;
}

.call-facts {
    display: grid;
    gap: 8px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin: 0;
}

.call-facts div {
    border: 1px solid var(--line);
    border-radius: 10px;
    display: grid;
    gap: 4px;
    padding: 11px 12px;
}

.call-facts dd {
    font-weight: 800;
    margin: 0;
    overflow-wrap: anywhere;
}

.call-card-actions {
    align-items: center;
    border-top: 1px solid var(--line);
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: space-between;
    padding-top: 13px;
}

.call-card-actions form {
    margin: 0;
}

.call-card-actions button {
    background: var(--text);
    border: 1px solid var(--text);
    border-radius: 9px;
    color: var(--surface);
    cursor: pointer;
    font-weight: 900;
    min-height: 42px;
    padding: 9px 18px;
}

.call-note {
    border-left: 3px solid var(--line);
    color: var(--muted);
    margin: 0;
    padding-left: 10px;
}

.status-unreviewed {
    background: #fee4e2;
    color: #b42318;
    font-weight: 950;
}

.status-taken {
    background: #dbeafe;
    color: #1d4ed8;
    font-weight: 950;
}

.call-business-missed {
    background: #fff1f2;
    color: #be123c;
}

.call-business-answered {
    background: #dcfce7;
    color: #166534;
}

@media (max-width: 920px) {
    .calls-page-intro {
        align-items: stretch;
        grid-template-columns: 1fr;
    }

    .call-card-body {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 719px) {
    .calls-quick-search {
        grid-template-columns: 1fr auto;
    }

    .calls-quick-search a {
        grid-column: 1 / -1;
    }

    .calls-tabs {
        display: flex;
        gap: 7px;
        overflow-x: auto;
        padding-bottom: 5px;
    }

    .calls-tabs a {
        flex: 0 0 auto;
        white-space: nowrap;
    }

    .call-card {
        padding: 13px;
    }

    .call-card-header {
        display: grid;
    }

    .call-statuses {
        justify-content: flex-start;
    }

    .call-primary-facts,
    .call-facts {
        grid-template-columns: 1fr;
    }

    .call-card-actions,
    .call-card-actions form,
    .call-card-actions button,
    .call-card-actions .open-link {
        width: 100%;
    }

    .call-card-actions button,
    .call-card-actions .open-link {
        justify-content: center;
        text-align: center;
    }
}


.call-action-primary {
    align-items: center;
    background: var(--text);
    border: 1px solid var(--text);
    border-radius: 9px;
    color: var(--surface);
    display: inline-flex;
    font-weight: 900;
    justify-content: center;
    min-height: 42px;
    padding: 9px 18px;
    text-decoration: none;
}

.call-action-details {
    min-width: 220px;
}

.call-action-details summary {
    border: 1px solid var(--line);
    border-radius: 9px;
    cursor: pointer;
    font-weight: 850;
    list-style: none;
    min-height: 42px;
    padding: 10px 14px;
    text-align: center;
}

.call-action-details summary::-webkit-details-marker {
    display: none;
}

.call-action-details[open] {
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 10px;
}

.call-action-details[open] summary {
    border: 0;
    min-height: auto;
    padding: 0 0 9px;
    text-align: left;
}

.call-action-details form,
.call-action-details label {
    display: grid;
    gap: 8px;
}

.call-action-details form {
    min-width: min(360px, 78vw);
}

.call-action-details input,
.call-action-details select,
.call-action-details textarea {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--text);
    padding: 9px 10px;
    width: 100%;
}

.call-action-details textarea {
    min-height: 76px;
    resize: vertical;
}

.call-related-hints {
    display: grid;
    gap: 6px;
}

.call-related-hints button {
    background: var(--surface);
    border-color: var(--line);
    color: var(--text);
    font-size: 0.78rem;
    min-height: 34px;
    padding: 6px 8px;
    text-align: left;
}

.call-dismiss-details summary {
    color: var(--danger, #b42318);
}

.call-dismiss-details form > button {
    background: var(--danger, #b42318);
    border-color: var(--danger, #b42318);
}

@media (max-width: 719px) {
    .call-action-primary,
    .call-action-details {
        width: 100%;
    }

    .call-action-details form {
        min-width: 0;
        width: 100%;
    }
}

.call-link-dialog-open {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 9px;
    color: var(--text);
    cursor: pointer;
    font-weight: 850;
    min-height: 44px;
    padding: 10px 16px;
}

.call-link-dialog {
    background: transparent;
    border: 0;
    height: min(760px, calc(100dvh - 48px));
    margin: auto;
    max-height: none;
    max-width: none;
    padding: 0;
    width: min(760px, calc(100vw - 40px));
}

.call-link-dialog::backdrop {
    background: rgba(15, 23, 42, 0.62);
    backdrop-filter: blur(2px);
}

.call-link-dialog-shell {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.call-link-dialog-header {
    align-items: flex-start;
    border-bottom: 1px solid var(--line);
    display: flex;
    gap: 16px;
    justify-content: space-between;
    padding: 18px 20px;
}

.call-link-dialog-header h2,
.call-link-dialog-header p {
    margin: 0;
}

.call-link-dialog-header > div {
    display: grid;
    gap: 4px;
}

.call-link-dialog-close {
    align-items: center;
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 10px;
    color: var(--text);
    cursor: pointer;
    display: inline-flex;
    flex: 0 0 44px;
    font-size: 1.6rem;
    height: 44px;
    justify-content: center;
    padding: 0;
}

.call-link-manual-form,
.call-link-search {
    border-bottom: 1px solid var(--line);
    padding: 14px 20px;
}

.call-link-manual-form label,
.call-link-search label {
    display: grid;
    font-size: 0.8rem;
    font-weight: 850;
    gap: 7px;
}

.call-link-manual-form label > span {
    display: grid;
    gap: 8px;
    grid-template-columns: 1fr auto;
}

.call-link-manual-form input,
.call-link-search input {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 9px;
    color: var(--text);
    min-height: 44px;
    padding: 10px 12px;
    width: 100%;
}

.call-link-manual-form button {
    background: var(--text);
    border: 1px solid var(--text);
    border-radius: 9px;
    color: var(--surface);
    cursor: pointer;
    font-weight: 900;
    min-height: 44px;
    padding: 10px 18px;
}

.call-link-results {
    display: grid;
    flex: 1 1 auto;
    gap: 8px;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 12px 20px;
}

.call-link-result {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 11px;
    color: var(--text);
    cursor: pointer;
    display: grid;
    gap: 7px;
    min-height: 44px;
    padding: 12px;
    text-align: left;
    width: 100%;
}

.call-link-result:hover,
.call-link-result:focus-visible {
    border-color: var(--text);
    box-shadow: 0 0 0 2px rgba(15, 23, 42, 0.1);
}

.call-link-result-head,
.call-link-result-client,
.call-link-result-meta {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 7px 12px;
}

.call-link-result-head time {
    color: var(--muted);
    font-size: 0.75rem;
    margin-left: auto;
}

.call-link-match {
    background: #dcfce7;
    border-radius: 999px;
    color: #166534;
    font-size: 0.7rem;
    font-weight: 900;
    padding: 3px 7px;
}

.call-link-result-client span,
.call-link-result-meta,
.call-link-result-preview {
    color: var(--muted);
    font-size: 0.8rem;
}

.call-link-result-preview {
    display: -webkit-box;
    line-height: 1.35;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.call-link-more {
    background: var(--surface-soft);
    border: 0;
    border-top: 1px solid var(--line);
    color: var(--text);
    cursor: pointer;
    font-weight: 900;
    min-height: 52px;
    padding: 12px 20px;
    width: 100%;
}

.call-link-loading,
.call-link-empty,
.call-link-error {
    color: var(--muted);
    margin: auto;
    padding: 28px;
    text-align: center;
}

.call-link-error {
    color: var(--danger, #b42318);
}

body.has-call-link-dialog {
    overflow: hidden;
}

@media (max-width: 719px) {
    .call-link-dialog {
        height: 100dvh;
        width: 100vw;
    }

    .call-link-dialog-shell {
        border: 0;
        border-radius: 0;
    }

    .call-link-dialog-header {
        padding: max(14px, env(safe-area-inset-top))
            14px 12px;
    }

    .call-link-manual-form,
    .call-link-search {
        padding: 12px 14px;
    }

    .call-link-results {
        padding: 10px 12px;
    }

    .call-link-result {
        padding: 12px;
    }

    .call-link-result-head time {
        margin-left: 0;
        width: 100%;
    }

    .call-link-manual-form label > span {
        grid-template-columns: 1fr;
    }

    .call-link-manual-form button {
        width: 100%;
    }
}


/* Lead picker visual correction */
.call-link-dialog {
    height: min(820px, calc(100dvh - 32px));
    width: min(900px, calc(100vw - 32px));
}

.call-link-dialog-shell {
    background: #f8fafc;
}

.call-link-dialog-header {
    background: #ffffff;
    flex: 0 0 auto;
    padding: 18px 22px;
}

.call-link-dialog-header h2 {
    font-size: 1.35rem;
    line-height: 1.15;
}

.call-link-dialog-header p:last-child {
    color: var(--muted);
    font-size: 0.9rem;
}

.call-link-manual-form {
    background: #ffffff;
    padding: 14px 22px;
}

.call-link-search {
    background: #ffffff;
    padding: 14px 22px;
    position: sticky;
    top: 0;
    z-index: 2;
}

.call-link-manual-form label,
.call-link-search label {
    color: var(--text);
    font-size: 0.78rem;
}

.call-link-results {
    align-content: start;
    background: #f1f5f9;
    gap: 10px;
    padding: 14px 18px;
}

/*
 * Важно: более специфичные правила отменяют общий тёмный стиль
 * .call-card-actions button.
 */
.call-card-actions .call-link-result {
    align-items: stretch;
    background: #ffffff;
    border: 1px solid #d8e0ea;
    border-radius: 12px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    color: var(--text);
    display: grid;
    gap: 8px;
    height: auto;
    justify-content: stretch;
    min-height: 118px;
    overflow: visible;
    padding: 13px 15px;
    text-align: left;
    white-space: normal;
    width: 100%;
}

.call-card-actions .call-link-result:hover {
    background: #ffffff;
    border-color: #94a3b8;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
    transform: translateY(-1px);
}

.call-card-actions .call-link-result:focus-visible {
    background: #ffffff;
    border-color: #1e293b;
    box-shadow: 0 0 0 3px rgba(30, 41, 59, 0.14);
    outline: none;
}

.call-link-result-head {
    align-items: center;
    display: grid;
    gap: 8px;
    grid-template-columns: auto auto 1fr;
}

.call-link-result-head strong {
    color: #0f172a;
    font-size: 0.95rem;
    line-height: 1.2;
}

.call-link-result-head time {
    color: #64748b;
    font-size: 0.75rem;
    justify-self: end;
    margin: 0;
}

.call-link-result-client {
    align-items: baseline;
    display: flex;
    gap: 8px 14px;
}

.call-link-result-client b {
    color: #0f172a;
    font-size: 0.9rem;
}

.call-link-result-client span {
    color: #475569;
    font-size: 0.86rem;
}

.call-link-result-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.call-link-result-meta > span {
    background: #e8eef5;
    border-radius: 999px;
    color: #334155;
    font-size: 0.7rem;
    font-weight: 800;
    line-height: 1;
    padding: 5px 8px;
}

.call-link-result-preview {
    color: #475569;
    display: -webkit-box;
    font-size: 0.82rem;
    line-height: 1.4;
    max-height: 2.8em;
    overflow: hidden;
    overflow-wrap: anywhere;
    white-space: normal;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.call-link-match {
    align-self: center;
    background: #dcfce7;
    color: #166534;
    white-space: nowrap;
}

.call-card-actions .call-link-more {
    background: #ffffff;
    border: 0;
    border-top: 1px solid #d8e0ea;
    border-radius: 0;
    color: #0f172a;
    flex: 0 0 auto;
    font-weight: 900;
    min-height: 52px;
    padding: 13px 20px;
    width: 100%;
}

.call-card-actions .call-link-more:hover {
    background: #f8fafc;
}

@media (max-width: 719px) {
    .call-link-dialog {
        height: 100dvh;
        width: 100vw;
    }

    .call-link-dialog-header {
        padding:
            max(12px, env(safe-area-inset-top))
            14px
            12px;
    }

    .call-link-dialog-header h2 {
        font-size: 1.15rem;
    }

    .call-link-manual-form,
    .call-link-search {
        padding: 11px 12px;
    }

    .call-link-results {
        gap: 8px;
        padding: 10px;
    }

    .call-card-actions .call-link-result {
        min-height: 132px;
        padding: 12px;
    }

    .call-link-result-head {
        grid-template-columns: auto 1fr;
    }

    .call-link-result-head time {
        grid-column: 1 / -1;
        justify-self: start;
    }

    .call-link-result-client {
        align-items: flex-start;
        display: grid;
        gap: 3px;
    }

    .call-link-result-preview {
        font-size: 0.8rem;
        -webkit-line-clamp: 3;
        max-height: 4.2em;
    }
}


/* Lead picker Russian status and preview fix */
.call-card-actions .call-link-result {
    align-content: start;
    grid-auto-rows: auto;
    height: auto !important;
    max-height: none !important;
    min-height: 0;
    overflow: visible !important;
    padding: 14px 15px 16px;
}

.call-card-actions .call-link-result > span {
    height: auto;
    max-height: none;
    min-height: 0;
    overflow: visible;
    white-space: normal;
}

.call-link-result-head,
.call-link-result-client,
.call-link-result-meta {
    flex: 0 0 auto;
    min-height: 0;
}

.call-link-result-preview {
    color: #475569;
    display: block !important;
    font-size: 0.82rem;
    line-height: 1.42;
    margin-top: 2px;
    max-height: none !important;
    min-height: 1.42em;
    overflow: visible !important;
    overflow-wrap: anywhere;
    text-overflow: clip;
    white-space: normal !important;
    -webkit-box-orient: initial;
    -webkit-line-clamp: unset !important;
}

.call-link-result-meta > span {
    line-height: 1.15;
}

@media (max-width: 719px) {
    .call-card-actions .call-link-result {
        height: auto !important;
        max-height: none !important;
        min-height: 0;
        padding: 13px 13px 15px;
    }

    .call-link-result-preview {
        display: block !important;
        font-size: 0.8rem;
        line-height: 1.42;
        max-height: none !important;
        overflow: visible !important;
        -webkit-line-clamp: unset !important;
    }
}


/* Lead picker stable flex rows */
.call-link-results {
    align-content: normal !important;
    display: flex !important;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 10px;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
}

.call-card-actions .call-link-result {
    all: unset;
    background: #ffffff;
    border: 1px solid #d8e0ea;
    border-radius: 12px;
    box-sizing: border-box;
    color: #0f172a;
    cursor: pointer;
    display: flex;
    flex: 0 0 auto;
    flex-direction: column;
    gap: 7px;
    min-height: 116px;
    padding: 13px 15px;
    text-align: left;
    width: 100%;
}

.call-card-actions .call-link-result:hover {
    background: #ffffff;
    border-color: #94a3b8;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
}

.call-card-actions .call-link-result:focus-visible {
    background: #ffffff;
    border-color: #0f172a;
    box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.16);
    outline: none;
}

.call-card-actions .call-link-result > span {
    box-sizing: border-box;
    flex: 0 0 auto;
    height: auto;
    min-height: 0;
    width: 100%;
}

.call-link-result-head {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 6px 10px;
}

.call-link-result-head time {
    color: #64748b;
    margin-left: auto;
}

.call-link-result-client {
    align-items: baseline;
    display: flex;
    flex-wrap: wrap;
    gap: 5px 12px;
}

.call-link-result-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.call-link-result-preview {
    color: #475569;
    display: -webkit-box !important;
    font-size: 0.82rem;
    line-height: 1.4;
    margin-top: 1px;
    max-height: 2.8em !important;
    min-height: 0;
    overflow: hidden !important;
    overflow-wrap: anywhere;
    white-space: normal !important;
    -webkit-box-orient: vertical !important;
    -webkit-line-clamp: 2 !important;
}

@media (max-width: 719px) {
    .call-link-results {
        gap: 8px;
    }

    .call-card-actions .call-link-result {
        min-height: 128px;
        padding: 12px;
    }

    .call-link-result-head time {
        margin-left: 0;
        width: 100%;
    }

    .call-link-result-client {
        align-items: flex-start;
        flex-direction: column;
        gap: 2px;
    }

    .call-link-result-preview {
        max-height: 4.2em !important;
        -webkit-line-clamp: 3 !important;
    }
}


/* Structured rejection form */
.reject-drop[open] {
    grid-column: 1 / -1;
}

.reject-drop form {
    align-items: end;
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
}

.reject-drop select {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--text);
    min-height: 46px;
    min-width: 0;
    padding: 10px 12px;
    width: 100%;
}

.reject-drop .danger-button {
    grid-column: 1 / -1;
}

@media (max-width: 719px) {
    .reject-drop form {
        grid-template-columns: 1fr;
    }

    .reject-drop .danger-button {
        grid-column: auto;
    }
}


/* Lead analytics */
.analytics-page {
    display: grid;
    gap: 22px;
}

.analytics-head,
.analytics-section-head {
    align-items: flex-start;
    display: flex;
    gap: 20px;
    justify-content: space-between;
}

.analytics-head h1,
.analytics-section-head h2 {
    margin: 0;
}

.analytics-section-head > p {
    color: var(--muted);
    margin: 0;
    max-width: 520px;
}

.analytics-grid,
.analytics-funnel,
.analytics-quality-grid {
    display: grid;
    gap: 14px;
}

.analytics-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.analytics-funnel,
.analytics-quality-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.analytics-card,
.analytics-funnel article,
.analytics-quality-grid article,
.analytics-panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 14px;
}

.analytics-card,
.analytics-funnel article,
.analytics-quality-grid article {
    display: flex;
    flex-direction: column;
    gap: 7px;
    min-width: 0;
    padding: 18px;
}

.analytics-card span,
.analytics-funnel span,
.analytics-quality-grid span {
    color: var(--muted);
    font-size: 0.9rem;
}

.analytics-card strong,
.analytics-funnel strong,
.analytics-quality-grid strong {
    font-size: 2rem;
    line-height: 1;
}

.analytics-card small,
.analytics-funnel small,
.analytics-quality-grid small {
    color: var(--muted);
    line-height: 1.4;
}

.analytics-card-success {
    border-color: #86b99a;
}

.analytics-panel {
    display: grid;
    gap: 18px;
    padding: 20px;
}

@media (max-width: 900px) {
    .analytics-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .analytics-funnel,
    .analytics-quality-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 719px) {
    .analytics-head,
    .analytics-section-head {
        align-items: stretch;
        flex-direction: column;
    }

    .analytics-grid,
    .analytics-funnel,
    .analytics-quality-grid {
        grid-template-columns: 1fr;
    }
}


/* Analytics card inside settings */
.settings-analytics-section {
    display: grid;
    gap: 12px;
    margin-top: 24px;
}

.settings-section-title h2 {
    margin-bottom: 0;
}

.settings-analytics-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    display: grid;
    gap: 5px;
    min-height: 88px;
    min-width: 0;
    padding: 16px;
    text-decoration: none;
}

.settings-analytics-card span {
    color: var(--muted);
}

/* Mobile-only navigation and settings fixes */
@media (max-width: 719px) {
    .app-nav {
        align-items: center;
        max-width: 100%;
        padding-bottom: 2px;
    }

    .app-nav a,
    .calls-nav-link {
        align-items: center;
        box-sizing: border-box;
        display: inline-flex !important;
        flex: 0 0 auto;
        justify-content: center;
        line-height: 1.2;
        min-height: 38px;
    }

    .app-shell,
    .page-intro,
    .settings-head,
    .directory-grid,
    .directory-list,
    .system-page,
    .record-panel,
    .table-wrap {
        box-sizing: border-box;
        max-width: 100%;
        min-width: 0;
    }

    .directory-grid,
    .directory-list {
        grid-template-columns: minmax(0, 1fr);
        width: 100%;
    }

    .directory-grid a,
    .directory-card,
    .settings-analytics-card,
    .settings-create {
        max-width: 100%;
        overflow-wrap: anywhere;
        width: 100%;
    }

    .settings-create form {
        grid-template-columns: minmax(0, 1fr);
    }

    .settings-head h1,
    .page-intro h1 {
        font-size: clamp(1.8rem, 9vw, 2.35rem);
        overflow-wrap: anywhere;
    }

    .table-wrap,
    .system-page .table-wrap,
    .settings-head + .record-panel .table-wrap {
        max-width: 100%;
        overflow-x: auto;
        width: 100%;
        -webkit-overflow-scrolling: touch;
    }

    .system-page .record-panel {
        overflow: hidden;
    }

    .backup-file,
    .backup-file-cell,
    .backup-git,
    .muted {
        overflow-wrap: anywhere;
        word-break: break-word;
    }
}

/* Preserve manager-entered line breaks in lead comments */
.lead-data-edit-fields .inline-field summary .lead-comment-value {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

/* Lead comment copy action */
.lead-data-edit-fields .inline-field summary .lead-comment-actions {
    align-items: center;
    display: inline-flex;
    flex: 0 0 auto;
    gap: 8px;
    margin-left: auto;
}

.lead-data-edit-fields .inline-field summary .lead-comment-copy-button {
    align-items: center;
    background: #ffffff !important;
    border: 1px solid #d9e2ec !important;
    border-radius: 9px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
    color: #1e40af !important;
    cursor: pointer;
    display: inline-flex;
    flex: 0 0 36px;
    height: 36px;
    justify-content: center;
    min-height: 36px;
    padding: 0;
    transition:
        background-color 0.15s ease,
        border-color 0.15s ease,
        box-shadow 0.15s ease,
        transform 0.15s ease;
    width: 36px;
}

.lead-comment-copy-button svg {
    fill: none;
    pointer-events: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
}

.lead-data-edit-fields .inline-field summary .lead-comment-copy-button:hover {
    background: #f8fafc !important;
    border-color: #b8c7d9 !important;
    box-shadow: 0 2px 5px rgba(15, 23, 42, 0.1);
}

.lead-data-edit-fields .inline-field summary .lead-comment-copy-button:active {
    background: #eef4fb !important;
    box-shadow: none;
    transform: translateY(1px);
}

.lead-data-edit-fields .inline-field summary .lead-comment-copy-button:focus,
.lead-data-edit-fields .inline-field summary .lead-comment-copy-button:focus-visible {
    background: #ffffff !important;
    border-color: #2563eb !important;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
    outline: none;
}

.lead-data-edit-fields .inline-field summary .lead-comment-copy-button.is-copied,
.lead-data-edit-fields .inline-field summary .lead-comment-copy-button:disabled {
    background: #ecfdf3 !important;
    border-color: #86d3a6 !important;
    color: var(--success) !important;
    cursor: default;
    opacity: 1;
}

/* Lead detail: match manual-create category checkbox layout */
.lead-data-edit-fields .lead-category-edit-list {
    display: grid !important;
    gap: 4px 8px !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
}

.lead-data-edit-fields
.lead-category-edit-list
.manual-category-row {
    align-items: center !important;
    background: transparent !important;
    border: 0 !important;
    cursor: pointer;
    display: grid !important;
    gap: 5px !important;
    grid-template-columns: 14px minmax(0, 1fr) !important;
    line-height: 1.05 !important;
    margin: 0 !important;
    min-height: 20px !important;
    padding: 0 !important;
}

.lead-data-edit-fields
.lead-category-edit-list
.manual-category-row
input[type="checkbox"] {
    appearance: auto !important;
    accent-color: var(--accent) !important;
    display: block !important;
    flex: none !important;
    font-size: initial !important;
    height: 13px !important;
    margin: 0 !important;
    min-height: 0 !important;
    padding: 0 !important;
    width: 13px !important;
}

.lead-data-edit-fields
.lead-category-edit-list
.manual-category-row
span {
    color: var(--text);
    display: block;
    font-size: 0.78rem !important;
    font-weight: 800 !important;
    line-height: 1.05 !important;
    min-width: 0;
    overflow-wrap: anywhere;
}


/* Customer card v1 */
.customer-card-link,
.customer-lead-call {
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--text);
    display: inline-flex;
    font-weight: 900;
    justify-content: center;
    min-height: 48px;
    padding: 11px 14px;
    text-decoration: none;
}

.customer-hero {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 10px;
    box-shadow: var(--shadow);
    display: grid;
    gap: 18px;
    margin-bottom: 16px;
    padding: 20px;
}

.customer-hero-head,
.customer-section-head,
.customer-timeline-head {
    align-items: flex-start;
    display: flex;
    gap: 14px;
    justify-content: space-between;
}

.customer-hero h1,
.customer-section-head h2 {
    margin: 0;
}

.customer-main-phone {
    color: var(--accent-strong);
    display: inline-flex;
    font-size: clamp(1.35rem, 6vw, 2rem);
    font-weight: 950;
    margin-top: 10px;
    overflow-wrap: anywhere;
    text-decoration: none;
}

.customer-summary {
    display: grid;
    gap: 8px;
    grid-template-columns: repeat(2, minmax(110px, 1fr));
    min-width: min(360px, 100%);
}

.customer-summary span {
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 8px;
    display: grid;
    font-size: 0.8rem;
    gap: 3px;
    padding: 10px;
}

.customer-summary b {
    color: var(--text);
    font-size: 1.2rem;
}

.customer-workspace {
    align-items: start;
    display: grid;
    gap: 16px;
}

.customer-leads-panel,
.customer-timeline-panel {
    padding: 16px;
}

.customer-section-head {
    margin-bottom: 14px;
}

.customer-section-head > span {
    background: var(--surface-soft);
    border-radius: 999px;
    font-weight: 900;
    min-width: 34px;
    padding: 6px 10px;
    text-align: center;
}

.customer-lead-list,
.customer-timeline {
    display: grid;
    gap: 10px;
}

.customer-lead-card {
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 9px;
    display: grid;
    gap: 8px;
    overflow-wrap: anywhere;
    padding: 13px;
}

.customer-lead-card.is-deleted {
    border-color: #efb0b6;
}

.customer-lead-card p,
.customer-timeline p,
.customer-timeline small {
    margin: 0;
}

.customer-lead-manager,
.customer-lead-source,
.customer-timeline-lead {
    color: var(--muted);
    font-size: 0.86rem;
}

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

.customer-locked-history {
    background: var(--surface);
    border-radius: 8px;
    color: var(--muted);
    font-size: 0.84rem;
    padding: 9px 10px;
}

.customer-timeline {
    list-style: none;
    margin: 0;
    padding: 0;
}

.customer-timeline li {
    border: 1px solid var(--line);
    border-left: 4px solid var(--accent);
    border-radius: 8px;
    display: grid;
    gap: 8px;
    padding: 12px;
}

.customer-timeline li.customer-timeline-call {
    border-left-color: #16a34a;
}

.customer-timeline-head {
    align-items: center;
    flex-wrap: wrap;
}

.customer-timeline time,
.customer-timeline small {
    color: var(--muted);
}

.customer-timeline-empty {
    color: var(--muted);
    text-align: center;
}

@media (min-width: 980px) {
    .customer-workspace {
        grid-template-columns:
            minmax(0, 0.92fr)
            minmax(0, 1.08fr);
    }
}

@media (max-width: 719px) {
    .customer-hero-head,
    .customer-section-head,
    .customer-timeline-head {
        display: grid;
    }

    .customer-summary,
    .customer-lead-actions {
        grid-template-columns: 1fr;
        min-width: 0;
        width: 100%;
    }

    .customer-card-link,
    .customer-lead-call {
        width: 100%;
    }
}

/* Task UI v1 */
.task-work-panel,
.lead-tasks-panel,
.customer-tasks-panel {
    display: grid;
    gap: 14px;
    margin-bottom: 16px;
    padding: 16px;
}

.task-section-head,
.task-group-head,
.task-card-head {
    align-items: flex-start;
    display: flex;
    gap: 12px;
    justify-content: space-between;
}

.task-section-head h2,
.task-group-head h3,
.task-card-head strong {
    margin: 0;
}

.task-section-head > span,
.task-group-head > span {
    background: var(--surface-soft);
    border-radius: 999px;
    font-weight: 900;
    min-width: 34px;
    padding: 6px 10px;
    text-align: center;
}

.task-groups {
    display: grid;
    gap: 12px;
}

.task-group {
    border: 1px solid var(--line);
    border-radius: 9px;
    display: grid;
    gap: 10px;
    min-width: 0;
    padding: 12px;
}

.task-group-overdue {
    border-color: #efb0b6;
}

.task-group-unassigned {
    border-color: #e7c66a;
}

.task-list {
    display: grid;
    gap: 10px;
}

.task-card {
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-left: 4px solid var(--accent);
    border-radius: 8px;
    display: grid;
    gap: 10px;
    min-width: 0;
    overflow-wrap: anywhere;
    padding: 12px;
}

.task-card.is-unassigned {
    border-left-color: #d09300;
}

.task-card.is-closed {
    opacity: 0.72;
}

.task-card-head > div {
    display: grid;
    gap: 5px;
    min-width: 0;
}

.task-card-head time,
.task-card-meta,
.task-card-links {
    color: var(--muted);
    font-size: 0.86rem;
}

.task-type-label {
    color: var(--accent-strong);
    font-size: 0.76rem;
    font-weight: 900;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.task-card-comment,
.task-empty {
    margin: 0;
}

.task-card-comment {
    white-space: pre-wrap;
}

.task-empty {
    color: var(--muted);
    padding: 8px 2px;
}

.task-card-meta,
.task-card-links,
.task-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 12px;
}

.task-card-links a {
    color: var(--accent-strong);
    font-weight: 800;
}

.task-card-actions {
    align-items: end;
}

.task-card-actions form,
.task-reschedule {
    margin: 0;
}

.task-card-actions button,
.task-create-form button,
.task-reschedule summary {
    align-items: center;
    border: 0;
    border-radius: 8px;
    cursor: pointer;
    display: inline-flex;
    font-weight: 900;
    justify-content: center;
    min-height: 42px;
    padding: 10px 13px;
}

.task-card-actions button,
.task-create-form button {
    background: var(--accent);
    color: var(--surface);
}

.task-card-actions .task-complete-button {
    background: var(--success);
}

.task-card-actions .task-cancel-button {
    background: var(--danger);
}

.task-assign-form {
    align-items: end;
    display: grid;
    gap: 7px;
    grid-template-columns: minmax(150px, 1fr) auto;
}

.task-assign-form label,
.task-create-form label,
.task-reschedule label {
    color: var(--muted);
    display: grid;
    font-size: 0.84rem;
    font-weight: 800;
    gap: 6px;
}

.task-assign-form select,
.task-create-form input,
.task-create-form select,
.task-create-form textarea,
.task-reschedule input {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--text);
    min-height: 44px;
    padding: 9px 11px;
    width: 100%;
}

.task-create {
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
}

.task-create > summary,
.task-reschedule > summary {
    cursor: pointer;
    list-style: none;
}

.task-reschedule > summary {
    background: var(--surface-soft);
}

.task-create > summary {
    background: var(--surface);
    color: var(--text);
    font-weight: 900;
    min-height: 48px;
    padding: 13px 14px;
    transition: background-color 120ms ease;
}

.task-create > summary:hover,
.task-create[open] > summary {
    background: #f7f8fa;
}

.task-create > summary:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: -3px;
}

.task-create[open] > summary {
    border-bottom: 1px solid var(--line);
}

.task-create > summary::-webkit-details-marker,
.task-reschedule > summary::-webkit-details-marker {
    display: none;
}

.task-create-form,
.task-reschedule form {
    display: grid;
    gap: 10px;
    padding: 12px;
}

.task-comment-field {
    grid-column: 1 / -1;
}

.task-create-form textarea {
    min-height: 82px;
    resize: vertical;
}

.task-create-form button {
    grid-column: 1 / -1;
}

.task-reschedule {
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
}

.task-reschedule > summary {
    color: var(--text);
}

@media (min-width: 720px) {
    .task-groups {
        grid-template-columns:
            repeat(2, minmax(0, 1fr));
    }

    .task-group-later {
        grid-column: 1 / -1;
    }

    .task-create-form {
        grid-template-columns:
            repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 719px) {
    .task-section-head,
    .task-group-head,
    .task-card-head {
        display: grid;
    }

    .task-card-actions,
    .task-card-links,
    .task-card-meta {
        display: grid;
    }

    .task-card-actions form,
    .task-card-actions button,
    .task-reschedule,
    .task-assign-form {
        width: 100%;
    }

    .task-assign-form {
        grid-template-columns: 1fr;
    }
}

/* CRM status filters should wrap instead of forcing horizontal scroll. */
.status-chips,
.primary-filter-row,
.secondary-filter-row {
    display: flex;
    flex-wrap: wrap;
    overflow-x: visible;
    white-space: normal;
}

.status-chips a,
.status-chips span {
    flex: 0 0 auto;
}


.spb-zpi-request-fields-panel {
    margin-bottom: 16px;
}

.lead-request-fields {
    display: grid;
    gap: 10px;
}

.lead-request-fields p {
    border-bottom: 1px solid var(--line);
    display: grid;
    gap: 4px;
    margin: 0;
    padding: 0 0 10px;
}

.lead-request-fields p:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.lead-request-fields b {
    color: var(--muted);
    font-size: 0.82rem;
}

.lead-request-fields span {
    color: var(--text);
    white-space: pre-line;
}

.spb-zpi-card-summary {
    gap: 10px;
}

.lead-card-primary {
    display: grid;
    gap: 5px;
}

.lead-organization {
    color: var(--muted);
    font-size: 0.94rem;
    font-weight: 800;
    margin: -2px 0 0;
}

.lead-card-contact-lines,
.lead-card-meta-chips {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.lead-email,
.lead-card-meta-chips span,
.lead-file-chip {
    background: #eef4fb;
    border: 1px solid rgba(90, 111, 138, 0.16);
    border-radius: 8px;
    color: var(--muted);
    font-size: 0.84rem;
    font-weight: 850;
    line-height: 1.25;
    padding: 7px 9px;
    text-decoration: none;
}

.lead-email {
    color: var(--text);
    font-size: 0.92rem;
    padding: 9px 11px;
}

.lead-comment-preview {
    -webkit-line-clamp: 3;
}

.lead-detail-preview {
    color: var(--muted);
}

.lead-file-chip {
    background: #eaf7f0;
    border-color: rgba(33, 128, 83, 0.2);
    color: #146c43;
}

.lead-request-files {
    border-top: 1px solid var(--line);
    margin-top: 8px;
    padding-top: 10px;
}

.lead-request-files summary {
    cursor: pointer;
    font-weight: 900;
}

.lead-request-files ul {
    display: grid;
    gap: 8px;
    list-style: none;
    margin: 10px 0 0;
    padding: 0;
}

.lead-request-files li {
    align-items: center;
    background: var(--surface-soft);
    border-radius: 8px;
    display: flex;
    gap: 10px;
    justify-content: space-between;
    padding: 9px 10px;
}

.lead-request-files small {
    color: var(--muted);
    white-space: nowrap;
}

@media (max-width: 640px) {
    .lead-comment-preview,
    .lead-detail-preview {
        -webkit-line-clamp: 2;
    }

    .lead-card-contact-lines,
    .lead-card-meta-chips {
        align-items: stretch;
        flex-direction: column;
    }

    .lead-card-contact-lines > *,
    .lead-card-meta-chips > * {
        width: 100%;
    }
}

.empty-field-value {
    color: #7b8798;
    font-weight: 600;
}

.inline-field summary .empty-field-value {
    color: #7b8798;
}

.lead-data-edit-fields .inline-field summary:has(.empty-field-value) {
    background: #f4f7fb;
}

.lead-data-edit-fields .inline-field summary:has(.empty-field-value) b {
    color: #64748b;
}

.lead-file-download-link {
    color: #0f5fd7;
    font-weight: 700;
    text-decoration: none;
}

.lead-file-download-link:hover {
    text-decoration: underline;
}

.lead-file-unavailable {
    color: #9f3444;
    display: inline-flex;
    flex-wrap: wrap;
    gap: 6px;
    max-width: 100%;
    overflow-wrap: anywhere;
    font-weight: 650;
}
@media (min-width: 900px) {
    .spb-zpi-work-direction-options .manual-category-row {
        font-size: 15px;
        line-height: 1.45;
        gap: 8px;
    }

    .spb-zpi-work-direction-options .manual-category-row input[type="checkbox"] {
        width: 15px;
        height: 15px;
    }
}

@media (max-width: 899px) {
    .spb-zpi-work-direction-options .manual-category-row {
        font-size: 14px;
        line-height: 1.4;
    }
}
.lead-data-edit-field .empty-field-value,
.lead-data-edit-fields .empty-field-value {
    color: #7a8798;
    font-weight: 600;
}
.lead-data-edit-fields .inline-field summary .empty-field-value {
    color: #7b8798;
    font-weight: 600;
}


.spb-zpi-lead-card-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(260px, 0.8fr);
    gap: 18px;
    align-items: start;
}

.spb-zpi-lead-card-primary,
.spb-zpi-lead-card-side {
    display: grid;
    gap: 10px;
}

.spb-zpi-lead-card-side {
    justify-items: end;
    text-align: right;
}

.lead-card-line,
.lead-card-price,
.lead-card-comment {
    margin: 0;
    color: #42526a;
    line-height: 1.35;
}

.lead-card-work {
    color: #111827;
    font-weight: 700;
}

.lead-card-comment {
    max-width: 420px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.lead-document-upload-form {
    display: grid;
    gap: 10px;
}

.lead-document-upload-form input[type="file"] {
    width: 100%;
}

@media (max-width: 720px) {
    .spb-zpi-lead-card-grid {
        grid-template-columns: 1fr;
    }

    .spb-zpi-lead-card-side {
        justify-items: start;
        text-align: left;
    }

    .lead-card-comment {
        display: none;
    }
}
body.profile-spb_zpi .queue-action-filter-control {
    align-items: center;
    background: #fff0f2;
    border: 1px solid #f2b4bc;
    border-radius: 10px;
    color: #a8273b;
    display: flex;
    font-weight: 800;
    gap: 8px;
    min-height: 42px;
    padding: 8px 10px;
}
body.profile-spb_zpi .queue-action-filter-control input {
    accent-color: #d83d54;
    height: 18px;
    margin: 0;
    width: 18px;
}


.spb-zpi-category-grid label,
.lead-category-checkbox-grid label {
    font-size: 15px;
    line-height: 1.35;
}

@media (max-width: 720px) {
    .spb-zpi-category-grid label,
    .lead-category-checkbox-grid label {
        font-size: 16px;
    }
}
.spb-zpi-card-compact {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(260px, 0.75fr);
    gap: 14px;
    align-items: start;
}

.spb-zpi-card-left,
.spb-zpi-card-right {
    min-width: 0;
}

.spb-zpi-card-compact h2 {
    margin: 0 0 10px;
}

.spb-zpi-card-compact .lead-card-line,
.spb-zpi-card-compact .lead-card-price,
.spb-zpi-card-compact .lead-card-comment {
    margin: 7px 0;
}

.spb-zpi-card-compact .lead-card-work {
    font-weight: 700;
}

.spb-zpi-card-compact .lead-card-details,
.spb-zpi-card-compact .lead-card-comment {
    color: #475569;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.spb-zpi-card-compact .lead-card-meta-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 8px 0;
}

@media (max-width: 760px) {
    .spb-zpi-card-compact {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .spb-zpi-card-compact .lead-card-comment {
        display: none;
    }
}

/* SPB-ZPI document field redesign */
.lead-data-edit-fields.spb-zpi-data-grid {
    display: grid;
    gap: 8px;
    grid-template-columns: minmax(0, 1fr);
}

.lead-data-edit-fields.spb-zpi-data-grid > .inline-field {
    min-width: 0;
}

.lead-document-field {
    background: #e8eff8;
    border: 1px solid #d1ddeb;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
}

.lead-document-field:has(.empty-field-value) {
    background: #f4f7fb;
}

.lead-document-field-summary {
    align-items: center;
    display: flex;
    gap: 12px;
    justify-content: space-between;
    min-height: 68px;
    padding: 14px;
}

.lead-document-field-copy {
    display: grid;
    gap: 6px;
    min-width: 0;
}

.lead-document-field-copy > b {
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 900;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.lead-document-field-copy > span,
.lead-document-field-copy > a {
    font-size: 1.08rem;
    font-weight: 900;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.lead-document-upload-button {
    align-items: center;
    background: #ffffff !important;
    border: 1px solid #d9e2ec !important;
    border-radius: 9px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
    color: #1e40af !important;
    cursor: pointer;
    display: inline-flex;
    flex: 0 0 36px;
    height: 36px;
    justify-content: center;
    min-height: 36px;
    padding: 0 !important;
    width: 36px;
}

.lead-document-upload-button svg {
    fill: none;
    height: 19px;
    pointer-events: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
    width: 19px;
}

.lead-document-upload-button:hover {
    background: #f8fafc !important;
    border-color: #b8c7d9 !important;
    box-shadow: 0 2px 5px rgba(15, 23, 42, 0.1);
}

.lead-document-upload-button:focus-visible {
    border-color: #2563eb !important;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
    outline: none;
}

.lead-document-file-list {
    border-top: 1px solid #d1ddeb;
    display: grid;
    gap: 1px;
}

.lead-document-file-list > a {
    align-items: center;
    background: rgba(255, 255, 255, 0.34);
    display: flex;
    gap: 12px;
    justify-content: space-between;
    min-width: 0;
    padding: 10px 14px;
}

.lead-document-file-list > a span {
    min-width: 0;
    overflow-wrap: anywhere;
}

.lead-document-file-list > a small {
    color: var(--muted);
    flex: 0 0 auto;
    font-weight: 600;
}

.lead-data-edit-fields .lead-document-upload-form {
    clip-path: inset(50%);
    display: block;
    height: 1px;
    overflow: hidden;
    position: absolute;
    white-space: nowrap;
    width: 1px;
}

.lead-data-edit-fields
.lead-document-upload-form
.lead-document-file-input {
    height: 1px;
    margin: 0;
    min-height: 0;
    opacity: 0;
    padding: 0;
    pointer-events: none;
    position: absolute;
    width: 1px;
}

@media (min-width: 900px) {
    .lead-data-edit-fields.spb-zpi-data-grid {
        align-items: start;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 899px) {
    .lead-data-edit-fields.spb-zpi-data-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 520px) {
    .lead-document-field-summary {
        min-height: 62px;
        padding: 12px;
    }

    .lead-document-field-copy > span,
    .lead-document-field-copy > a {
        font-size: 1rem;
    }

    .lead-document-file-list > a {
        align-items: flex-start;
        flex-direction: column;
        gap: 3px;
        padding: 9px 12px;
    }
}

/* SPB_ZPI_DETAIL_ORDER_UI */
.lead-data-edit-fields > .spb-zpi-detail-grid {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 12px;
    width: 100%;
    align-items: start;
}

.spb-zpi-detail-column {
    display: grid;
    gap: 10px;
    min-width: 0;
    align-content: start;
}

.lead-identity-fields {
    display: grid;
    gap: 8px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    min-width: 0;
}

.spb-zpi-detail-grid .inline-field,
.spb-zpi-detail-grid .lead-data-cell {
    min-width: 0;
}

.spb-zpi-detail-grid .inline-field summary,
.spb-zpi-detail-grid .lead-static-summary,
.spb-zpi-detail-grid .lead-document-summary {
    min-height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
}

.spb-zpi-detail-grid .inline-field summary > span,
.spb-zpi-detail-grid .lead-static-summary > span,
.spb-zpi-detail-grid .lead-document-summary > span {
    min-width: 0;
    display: grid;
    gap: 5px;
}

.lead-field-secondary {
    display: block;
    color: #64748b;
    font-size: 13px;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.lead-static-field,
.lead-document-field {
    background: #eaf1f9;
    border: 1px solid #ccd9e8;
    border-radius: 8px;
    padding: 0;
    overflow: hidden;
}

.lead-static-summary,
.lead-document-summary {
    padding: 14px;
}

.lead-detail-file-list {
    border-top: 1px solid #ccd9e8;
    display: grid;
    gap: 0;
}

.lead-detail-file-list .lead-file-row {
    padding: 10px 12px;
}

.lead-inline-icon-upload-form {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}

.lead-native-file-input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    overflow: hidden;
    pointer-events: none;
}

.lead-field-action-icon {
    width: 38px;
    height: 38px;
    border: 1px solid #d7e2ef;
    border-radius: 8px;
    background: #ffffff;
    color: #0f5fd7;
    display: inline-grid;
    place-items: center;
    cursor: pointer;
    padding: 0;
}

.lead-field-action-icon:hover {
    background: #eef5ff;
    border-color: #b8cff0;
}

.lead-field-action-icon svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
}

.spb-zpi-detail-grid .empty-field-value {
    color: #7b8798;
    font-weight: 600;
}

@media (max-width: 899px) {
    .lead-data-edit-fields > .spb-zpi-detail-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .spb-zpi-detail-grid .inline-field summary,
    .spb-zpi-detail-grid .lead-static-summary,
    .spb-zpi-detail-grid .lead-document-summary {
        min-height: 58px;
    }

    .lead-field-action-icon {
        width: 40px;
        height: 40px;
    }

    .lead-identity-fields {
        grid-template-columns: 1fr;
    }
}

/* SPB_ZPI_DETAIL_UPLOAD_UI_FIX */
.lead-data-edit-fields .lead-document-upload-form.lead-inline-icon-upload-form {
    clip-path: none;
    display: inline-flex;
    height: auto;
    overflow: visible;
    position: static;
    white-space: normal;
    width: auto;
    margin: 0;
    align-items: center;
    justify-content: flex-end;
    flex: 0 0 auto;
    background: transparent;
    border: 0;
    box-shadow: none;
    gap: 0;
    padding: 0;
}

.lead-data-edit-fields .lead-document-upload-form .lead-document-file-input,
.lead-native-file-input {
    position: absolute;
    width: 1px;
    height: 1px;
    min-height: 0;
    margin: 0;
    padding: 0;
    opacity: 0;
    overflow: hidden;
    pointer-events: none;
}

.lead-document-summary {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 40px;
    align-items: center;
    gap: 12px;
}

.lead-document-summary > span {
    min-width: 0;
}

.lead-field-action-icon,
.lead-document-upload-button {
    width: 38px;
    height: 38px;
    min-height: 38px;
    padding: 0 !important;
    border: 1px solid #d7e2ef !important;
    border-radius: 9px;
    background: #ffffff !important;
    color: #0f5fd7 !important;
    display: inline-grid;
    place-items: center;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

.lead-field-action-icon:hover,
.lead-document-upload-button:hover {
    background: #eef5ff !important;
    border-color: #b8cff0 !important;
}

.lead-field-action-icon svg,
.lead-document-upload-button svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.spb-zpi-file-accordion {
    padding: 0;
    overflow: hidden;
}

.spb-zpi-file-summary {
    cursor: pointer;
    list-style: none;
}

.spb-zpi-file-summary::-webkit-details-marker {
    display: none;
}

.spb-zpi-file-summary::after {
    content: "";
    width: 9px;
    height: 9px;
    border-right: 2px solid #53657f;
    border-bottom: 2px solid #53657f;
    transform: rotate(45deg);
    transition: transform 0.15s ease;
    margin-right: 4px;
}

.spb-zpi-file-accordion[open] .spb-zpi-file-summary::after {
    transform: rotate(225deg);
}

.spb-zpi-file-list {
    border-top: 1px solid #ccd9e8;
    display: grid;
}

.spb-zpi-file-link,
.lead-detail-file-list .lead-file-row.spb-zpi-file-link {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 28px;
    padding: 10px 12px;
    text-decoration: none;
}

.spb-zpi-file-name {
    min-width: 0;
    overflow-wrap: anywhere;
    font-weight: 800;
}

.spb-zpi-file-size {
    color: #50627c;
    white-space: nowrap;
    font-weight: 700;
}

.spb-zpi-large-file-link {
    color: #075fd0;
    font-weight: 800;
    text-decoration: none;
    overflow-wrap: anywhere;
}

.spb-zpi-large-file-link:hover,
.spb-zpi-file-link:hover .spb-zpi-file-name {
    text-decoration: underline;
}

@media (max-width: 760px) {
    .spb-zpi-file-link,
    .lead-detail-file-list .lead-file-row.spb-zpi-file-link {
        grid-template-columns: minmax(0, 1fr);
        gap: 4px;
    }

    .spb-zpi-file-size {
        justify-self: start;
    }
}

.lead-data-edit-fields .lead-document-upload-form:not(.lead-inline-icon-upload-form) {
    clip-path: inset(50%);
    display: block;
    height: 1px;
    overflow: hidden;
    position: absolute;
    white-space: nowrap;
    width: 1px;
}

.lead-data-edit-fields .lead-detail-file-list .lead-file-row {
    align-items: center;
    column-gap: 32px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) max-content;
}

.lead-data-edit-fields .lead-detail-file-list .spb-zpi-file-size {
    color: #64748b;
    justify-self: end;
    margin-left: 24px;
    white-space: nowrap;
}

/* SPB_ZPI_LEAD_LIST_CARD_V2 */
.spb-zpi-lead-card {
    box-shadow: 0 8px 24px rgba(23, 42, 70, 0.08);
    gap: 0;
    overflow: hidden;
    padding: 0;
    transition: border-color 160ms ease, box-shadow 160ms ease;
}

.spb-zpi-lead-card:hover {
    border-color: #b8c8dc;
    box-shadow: 0 12px 30px rgba(23, 42, 70, 0.11);
}

.spb-zpi-lead-card .lead-topline {
    background: #f8fafc;
    border-bottom: 1px solid #dbe4ef;
    min-height: 50px;
    padding: 12px 18px;
}

.spb-zpi-lead-card .spb-zpi-card-compact {
    align-items: stretch;
    display: grid;
    gap: 0;
    grid-template-columns: minmax(220px, 0.84fr) minmax(300px, 1.25fr) minmax(220px, 0.76fr);
    padding: 0;
}

.spb-zpi-card-client,
.spb-zpi-card-request,
.spb-zpi-card-rail {
    min-width: 0;
    padding: 18px;
}

.spb-zpi-card-request,
.spb-zpi-card-rail {
    border-left: 1px solid #dbe4ef;
}

.spb-zpi-lead-card .spb-zpi-card-rail {
    align-items: stretch;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    gap: 14px;
    justify-items: stretch;
    text-align: left;
}

.spb-zpi-card-kicker,
.spb-zpi-card-label {
    color: #60738d;
    display: block;
    font-size: 0.72rem;
    font-weight: 900;
    letter-spacing: 0;
    line-height: 1.25;
    text-transform: uppercase;
}

.spb-zpi-card-name {
    color: #13233a;
    font-size: 1.28rem;
    line-height: 1.2;
    margin: 5px 0 10px;
    overflow-wrap: anywhere;
}

.spb-zpi-card-organization {
    display: grid;
    gap: 3px;
    margin: 0 0 8px;
}

.spb-zpi-card-organization strong {
    color: #33445c;
    font-size: 0.94rem;
}

.spb-zpi-card-contacts {
    border-top: 1px solid #e2e8f0;
    display: grid;
    margin-top: 12px;
}

.spb-zpi-card-contact-link,
.spb-zpi-lead-card .spb-zpi-card-contact-link.lead-call {
    align-items: baseline;
    background: transparent;
    border-bottom: 1px solid #e2e8f0;
    border-radius: 0;
    display: grid;
    gap: 10px;
    grid-template-columns: 64px minmax(0, 1fr);
    min-height: 0;
    padding: 8px 0;
    text-decoration: none;
}

.spb-zpi-card-contact-link span {
    color: #708198;
    font-size: 0.75rem;
    font-weight: 800;
}

.spb-zpi-card-contact-link strong {
    color: #075fc5;
    font-size: 0.91rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.spb-zpi-card-field {
    min-width: 0;
}

.spb-zpi-card-direction {
    border-left: 3px solid #1f6fe5;
    padding-left: 13px;
}

.spb-zpi-card-value {
    color: #13233a;
    display: block;
    font-size: 1.07rem;
    line-height: 1.35;
    margin-top: 6px;
    overflow-wrap: anywhere;
}

.spb-zpi-card-details {
    border-top: 1px solid #e2e8f0;
    margin-top: 16px;
    padding-top: 14px;
}

.spb-zpi-card-details p,
.spb-zpi-card-comment-block p {
    color: #42526a;
    display: -webkit-box;
    line-height: 1.45;
    margin: 6px 0 0;
    overflow: hidden;
    overflow-wrap: anywhere;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
}

.spb-zpi-card-price {
    border-bottom: 1px solid #dbe4ef;
    display: grid;
    gap: 4px;
    padding-bottom: 12px;
}

.spb-zpi-card-price strong {
    color: #13233a;
    font-size: 1.18rem;
}

.spb-zpi-card-price.is-empty > :last-child {
    color: #7b8798;
    font-size: 0.9rem;
    font-weight: 650;
}

.spb-zpi-card-documents {
    display: grid;
    gap: 7px;
}

.spb-zpi-lead-card .spb-zpi-card-document-links {
    align-items: flex-start;
    display: flex;
    gap: 7px;
    margin: 0;
}

.spb-zpi-lead-card .spb-zpi-doc-link {
    background: #edf6f2;
    border-color: #cce5d8;
    border-radius: 6px;
    color: #146c43;
    padding: 6px 8px;
}

.spb-zpi-lead-card .spb-zpi-doc-link:hover {
    background: #dff1e8;
    border-color: #9fcdb5;
}

.spb-zpi-card-comment-block {
    min-width: 0;
}

.spb-zpi-card-comment-block .lead-card-comment {
    -webkit-line-clamp: 2;
}

.spb-zpi-lead-card .spb-zpi-card-open {
    align-items: center;
    align-self: stretch;
    background: #1668d8;
    color: #fff;
    font-weight: 850;
    justify-content: center;
    margin-top: auto;
    min-height: 42px;
    padding: 10px 14px;
}

.spb-zpi-lead-card .spb-zpi-card-open:hover {
    background: #0d57bc;
}

@media (max-width: 980px) {
    .spb-zpi-lead-card .spb-zpi-card-compact {
        grid-template-columns: minmax(220px, 0.82fr) minmax(0, 1.18fr);
    }

    .spb-zpi-card-rail {
        border-left: 0;
        border-top: 1px solid #dbe4ef;
        flex-direction: row;
        flex-wrap: wrap;
        grid-column: 1 / -1;
    }

    .spb-zpi-card-price {
        border-bottom: 0;
        flex: 0 0 170px;
        padding: 0;
    }

    .spb-zpi-card-documents,
    .spb-zpi-card-comment-block {
        flex: 1 1 240px;
    }

    .spb-zpi-lead-card .spb-zpi-card-open {
        align-self: center;
        margin-left: auto;
        margin-top: 0;
    }
}

@media (max-width: 720px) {
    .spb-zpi-lead-card .spb-zpi-card-compact {
        grid-template-columns: minmax(0, 1fr);
    }

    .spb-zpi-card-request,
    .spb-zpi-card-rail {
        border-left: 0;
        border-top: 1px solid #dbe4ef;
    }

    .spb-zpi-card-rail {
        align-items: stretch;
        flex-direction: column;
        grid-column: auto;
    }

    .spb-zpi-card-comment-block {
        display: none;
    }

    .spb-zpi-lead-card .spb-zpi-card-open {
        align-self: stretch;
        margin-left: 0;
        width: 100%;
    }
}

/* SPB_ZPI_REQUEST_TEXT_AND_COMPACT_CARDS_V4 */
.spb-zpi-lead-card .spb-zpi-card-rail {
    justify-content: flex-start;
}

.spb-zpi-lead-card .spb-zpi-card-price,
.spb-zpi-lead-card .spb-zpi-card-documents,
.spb-zpi-lead-card .spb-zpi-card-rail-fact {
    flex: 0 0 auto;
    min-height: 0;
}

.spb-zpi-lead-card .spb-zpi-card-rail-fact {
    display: grid;
    gap: 4px;
    padding-top: 12px;
    border-top: 1px solid #d7e0ec;
    color: #344861;
}

.spb-zpi-lead-card .spb-zpi-card-text-row {
    display: grid;
    align-content: center;
    gap: 6px;
    min-width: 0;
    min-height: 70px;
    padding: 12px 0;
    border-top: 1px solid #d7e0ec;
}

.spb-zpi-lead-card .spb-zpi-card-text-preview {
    display: -webkit-box;
    overflow: hidden;
    color: #344861;
    line-height: 1.45;
    overflow-wrap: anywhere;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.spb-zpi-lead-card .spb-zpi-card-open {
    margin-top: 0;
}

.lead-data-edit-fields .lead-details-field > summary,
.lead-data-edit-fields .lead-comment-field > summary {
    min-height: 76px;
}

.lead-data-edit-fields .lead-field-value-preview {
    display: -webkit-box;
    overflow: hidden;
    margin-top: 5px;
    line-height: 1.35;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.lead-data-edit-fields .lead-details-field[open] > summary,
.lead-data-edit-fields .lead-comment-field[open] > summary {
    align-items: start;
}

.lead-data-edit-fields .lead-details-field[open] > summary .lead-field-value-preview,
.lead-data-edit-fields .lead-comment-field[open] > summary .lead-field-value-preview {
    display: block;
    max-height: 260px;
    overflow: auto;
    padding-right: 6px;
    -webkit-line-clamp: unset;
}

@media (max-width: 720px) {
    .spb-zpi-lead-card .spb-zpi-card-client,
    .spb-zpi-lead-card .spb-zpi-card-request,
    .spb-zpi-lead-card .spb-zpi-card-rail {
        padding: 16px 18px;
    }

    .spb-zpi-lead-card .spb-zpi-card-rail {
        display: grid;
        gap: 0;
        align-content: start;
    }

    .spb-zpi-lead-card .spb-zpi-card-price,
    .spb-zpi-lead-card .spb-zpi-card-documents,
    .spb-zpi-lead-card .spb-zpi-card-rail-fact {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: center;
        gap: 12px;
        min-height: 64px;
        padding: 12px 0;
        border-top: 0;
        border-bottom: 1px solid #d7e0ec;
    }

    .spb-zpi-lead-card .spb-zpi-card-document-links {
        display: flex;
        flex-flow: row wrap;
        justify-content: flex-end;
        align-items: center;
        gap: 7px;
        width: auto;
    }

    .spb-zpi-lead-card .spb-zpi-card-document-links > * {
        width: auto;
    }

    .spb-zpi-lead-card .spb-zpi-card-text-row {
        min-height: 66px;
    }

    .spb-zpi-lead-card .spb-zpi-card-open {
        width: 100%;
        margin: 14px 0 0;
    }

    .lead-data-edit-fields .lead-details-field > summary,
    .lead-data-edit-fields .lead-comment-field > summary {
        min-height: 72px;
    }
}


/* SPB_ZPI_STAGE_REMINDERS_V1 */
.quick-actions .stage-reminder-action {
    position: relative;
    min-width: 0;
}

.quick-actions .stage-reminder-action > summary {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 10px 14px;
    border-radius: 8px;
    background: #1769dc;
    color: #fff;
    cursor: pointer;
    text-align: center;
    list-style: none;
}

.quick-actions .stage-reminder-action > summary::-webkit-details-marker {
    display: none;
}

.quick-actions .stage-reminder-action[open] {
    grid-column: 1 / -1;
    padding: 10px;
    border: 1px solid #c7d7ed;
    border-radius: 8px;
    background: #eef4fc;
}

.quick-actions .stage-reminder-action[open] > summary {
    min-height: 40px;
    background: #dce9fb;
    color: #0c4fae;
}

.quick-actions .stage-reminder-action form {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) auto;
    gap: 8px 12px;
    align-items: end;
    margin-top: 10px;
}

.quick-actions .stage-reminder-action label,
.quick-actions .stage-reminder-action small {
    grid-column: 1;
}

.quick-actions .stage-reminder-action button {
    grid-column: 2;
    grid-row: 1 / span 2;
    min-height: 48px;
}

@media (max-width: 720px) {
    .quick-actions .stage-reminder-action form {
        grid-template-columns: 1fr;
    }

    .quick-actions .stage-reminder-action button,
    .quick-actions .stage-reminder-action label,
    .quick-actions .stage-reminder-action small {
        grid-column: 1;
        grid-row: auto;
    }
}


/* SPB-ZPI automatic dashboard tasks v1 */
.dashboard-task-panel {
    display: grid;
    gap: 14px;
    margin-bottom: 16px;
    padding: 16px;
}

.dashboard-task-head { align-items: end; }
.dashboard-task-head .eyebrow,
.dashboard-task-head h2,
.dashboard-task-group h3 { margin: 0; }

.dashboard-task-groups {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.dashboard-task-group {
    border: 1px solid var(--line);
    border-left: 4px solid var(--accent);
    border-radius: 8px;
    display: grid;
    gap: 8px;
    min-width: 0;
    padding: 12px;
}

.dashboard-task-group-overdue { border-left-color: var(--danger); }
.dashboard-task-group-unassigned { border-left-color: #d09300; }
.dashboard-task-group-tomorrow,
.dashboard-task-group-later { border-left-color: #728096; }

.dashboard-task-group-head,
.dashboard-task-item {
    align-items: center;
    display: flex;
    gap: 12px;
    justify-content: space-between;
}

.dashboard-task-group-head span {
    background: var(--surface-soft);
    border-radius: 999px;
    font-weight: 900;
    min-width: 30px;
    padding: 5px 9px;
    text-align: center;
}

.dashboard-task-list { display: grid; }
.dashboard-task-item {
    border-top: 1px solid var(--line);
    color: var(--text);
    min-width: 0;
    padding: 10px 0;
    text-decoration: none;
}

.dashboard-task-item:hover strong,
.dashboard-task-item:focus-visible strong { color: var(--accent-strong); }
.dashboard-task-item-main {
    display: grid;
    gap: 3px;
    min-width: 0;
}

.dashboard-task-item-main small,
.dashboard-task-item time,
.dashboard-task-more,
.dashboard-task-empty {
    color: var(--muted);
    font-size: 0.84rem;
}

.dashboard-task-item time {
    flex: 0 0 auto;
    text-align: right;
}
.dashboard-task-more { font-weight: 800; justify-self: end; }
.dashboard-task-empty { margin: 0; }

@media (max-width: 719px) {
    .dashboard-task-groups { grid-template-columns: 1fr; }
    .dashboard-task-item { align-items: start; display: grid; }
    .dashboard-task-item time { text-align: left; }
}


/* SPB_ZPI_ANALYTICS_FUNNEL */
.analytics-funnel-spb {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

@media (max-width: 900px) {
    .analytics-funnel-spb {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 719px) {
    .analytics-funnel-spb {
        grid-template-columns: 1fr;
    }
}


/* CUSTOMER_HISTORY_SPLIT */
.customer-history-stack {
    display: grid;
    gap: 12px;
    min-width: 0;
}

.customer-history-panel {
    overflow: hidden;
    padding: 0;
}

.customer-history-summary {
    align-items: center;
    cursor: pointer;
    display: flex;
    gap: 12px;
    justify-content: space-between;
    list-style-position: inside;
    padding: 16px;
}

.customer-history-summary::marker {
    color: var(--muted);
}

.customer-history-summary-copy {
    display: inline-grid;
    gap: 3px;
    min-width: 0;
}

.customer-history-summary-copy .eyebrow {
    margin: 0;
}

.customer-history-summary-copy strong {
    color: var(--text);
    font-size: 1.05rem;
}

.customer-history-count {
    background: var(--surface-soft);
    border-radius: 999px;
    color: var(--text);
    flex: 0 0 auto;
    font-weight: 900;
    min-width: 34px;
    padding: 6px 10px;
    text-align: center;
}

.customer-history-panel[open] .customer-history-summary {
    border-bottom: 1px solid var(--line);
}

.customer-history-body {
    padding: 14px 16px 16px;
}

@media (max-width: 719px) {
    .customer-history-summary {
        padding: 14px;
    }

    .customer-history-body {
        padding: 12px 14px 14px;
    }
}
.sr-only {
    height: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute;
    width: 1px;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
}

.chat-app-shell {
    max-width: 1500px;
    padding-top: 26px;
}

.chat-page-heading {
    align-items: flex-end;
    display: flex;
    gap: 24px;
    justify-content: space-between;
    margin-bottom: 20px;
}

.chat-page-heading h1 {
    font-size: clamp(2rem, 4vw, 3rem);
    margin-bottom: 8px;
}

.chat-page-heading p:last-child {
    color: var(--muted);
    margin: 0;
}

.chat-heading-summary {
    align-items: flex-end;
    display: grid;
    gap: 8px;
    justify-items: end;
}

.chat-heading-summary > span:first-child {
    color: var(--muted);
    font-size: .84rem;
}

.chat-heading-summary b {
    color: var(--text);
    font-size: 1.1rem;
}

.chat-live-dot {
    align-items: center;
    color: var(--success);
    display: inline-flex;
    font-size: .82rem;
    font-weight: 800;
    gap: 7px;
}

.chat-live-dot::before {
    background: #22a06b;
    border: 3px solid #d9f6e9;
    border-radius: 50%;
    content: "";
    height: 12px;
    width: 12px;
}

.chat-live-dot.is-offline {
    color: var(--danger);
}

.chat-live-dot.is-offline::before {
    background: var(--danger);
    border-color: #fde2e2;
}

.chat-channel-tab-email .chat-channel-icon {
    background: #fff0d8;
    color: #9a5a00;
}

.chat-preview-email.is-selected::before {
    background: #d98a16;
}

.chat-notice {
    border-radius: 12px;
    margin: 0 0 16px;
}

.chat-controls {
    align-items: center;
    display: flex;
    gap: 16px;
    justify-content: space-between;
    margin-bottom: 12px;
}

.chat-channel-tabs,
.chat-status-tabs {
    align-items: center;
    display: flex;
    gap: 8px;
}

.chat-channel-tabs {
    background: #e9eef6;
    border: 1px solid #dbe3ee;
    border-radius: 14px;
    padding: 5px;
}

.chat-channel-tab {
    align-items: center;
    border: 1px solid transparent;
    border-radius: 10px;
    color: var(--muted);
    display: inline-flex;
    font-size: .88rem;
    font-weight: 800;
    gap: 8px;
    min-height: 42px;
    padding: 6px 11px;
    text-decoration: none;
    transition: background .16s ease, border-color .16s ease, color .16s ease, box-shadow .16s ease;
}

.chat-channel-tab:hover,
.chat-channel-tab.is-active {
    background: #fff;
    border-color: #d7e0ec;
    box-shadow: 0 5px 15px rgba(31, 49, 76, .08);
    color: var(--text);
}

.chat-channel-tab b {
    align-items: center;
    background: #eef2f7;
    border-radius: 999px;
    display: inline-flex;
    font-size: .73rem;
    justify-content: center;
    min-width: 23px;
    padding: 3px 7px;
}

.chat-channel-icon {
    align-items: center;
    background: #6b7c93;
    border-radius: 8px;
    color: #fff;
    display: inline-flex;
    font-size: .76rem;
    font-style: normal;
    font-weight: 900;
    height: 26px;
    justify-content: center;
    width: 26px;
}

.chat-channel-tab-telegram .chat-channel-icon {
    background: #229ed9;
}

.chat-channel-tab-max .chat-channel-icon {
    background: linear-gradient(135deg, #7058f6, #b44bd8);
}

.chat-channel-tab-whatsapp .chat-channel-icon {
    background: #25d366;
}

.chat-search {
    align-items: stretch;
    display: flex;
    gap: 8px;
    min-width: min(100%, 390px);
}

.chat-search label {
    display: flex;
    flex: 1 1 auto;
}

.chat-search input {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 11px;
    min-height: 44px;
    padding: 0 14px;
    width: 100%;
}

.chat-search input:focus,
.chat-composer textarea:focus,
.chat-action-menu input:focus,
.chat-action-menu select:focus,
.chat-action-menu textarea:focus {
    border-color: #6aa2ec;
    box-shadow: 0 0 0 3px rgba(18, 102, 219, .12);
    outline: 0;
}

.chat-search button,
.chat-composer button,
.chat-action-menu button {
    background: var(--text);
    border: 0;
    border-radius: 11px;
    color: #fff;
    cursor: pointer;
    font-weight: 800;
    padding: 0 18px;
}

.chat-status-tabs {
    margin: 0 0 16px;
    overflow-x: auto;
    padding: 2px 0;
}

.chat-status-tabs a {
    align-items: center;
    border: 1px solid transparent;
    border-radius: 999px;
    color: var(--muted);
    display: inline-flex;
    flex: 0 0 auto;
    font-size: .84rem;
    font-weight: 800;
    gap: 8px;
    padding: 8px 13px;
    text-decoration: none;
}

.chat-status-tabs a:hover {
    background: #e9eef6;
    color: var(--text);
}

.chat-status-tabs a.is-active {
    background: #172a46;
    color: #fff;
}

.chat-status-tabs b {
    background: rgba(96, 112, 134, .12);
    border-radius: 999px;
    font-size: .74rem;
    min-width: 23px;
    padding: 3px 7px;
    text-align: center;
}

.chat-status-tabs .is-active b {
    background: rgba(255, 255, 255, .18);
}

.chat-lifecycle-tabs {
    align-items: center;
    display: flex;
    gap: 8px;
    margin: 0 0 12px;
}

.chat-lifecycle-tabs a {
    background: rgba(255, 255, 255, .68);
    border: 1px solid #d8e1ed;
    border-radius: 10px;
    color: #617188;
    font-size: .8rem;
    font-weight: 800;
    padding: 7px 12px;
    text-decoration: none;
}

.chat-lifecycle-tabs a:hover,
.chat-lifecycle-tabs a.is-active {
    background: #fff;
    border-color: #9fb7d6;
    color: #172a46;
    box-shadow: 0 5px 14px rgba(31, 49, 76, .07);
}

.chat-workspace {
    background: #fff;
    border: 1px solid #d7e0ec;
    border-radius: 18px;
    box-shadow: 0 20px 55px rgba(30, 51, 83, .12);
    display: grid;
    grid-template-columns: minmax(300px, 365px) minmax(0, 1fr);
    min-height: 670px;
    overflow: hidden;
}

.chat-sidebar {
    background: #fbfcfe;
    border-right: 1px solid #dce4ef;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.chat-sidebar-heading {
    align-items: center;
    border-bottom: 1px solid #e3e9f2;
    display: flex;
    justify-content: space-between;
    min-height: 70px;
    padding: 14px 16px;
}

.chat-sidebar-heading > div {
    display: grid;
    gap: 3px;
}

.chat-sidebar-heading strong {
    font-size: 1rem;
}

.chat-sidebar-heading span {
    color: var(--muted);
    font-size: .78rem;
}

.chat-filter-pill {
    background: #e9eef6;
    border-radius: 999px;
    color: var(--text) !important;
    font-weight: 800;
    padding: 5px 9px;
}

.chat-conversation-list {
    display: grid;
    overflow-y: auto;
}

.chat-preview {
    border-bottom: 1px solid #e7ecf3;
    color: inherit;
    display: grid;
    gap: 11px;
    grid-template-columns: 42px minmax(0, 1fr);
    padding: 15px 16px;
    position: relative;
    text-decoration: none;
    transition: background .14s ease;
}

.chat-preview::before {
    background: transparent;
    content: "";
    inset: 0 auto 0 0;
    position: absolute;
    width: 4px;
}

.chat-preview:hover {
    background: #f2f6fb;
}

.chat-preview.is-selected {
    background: #eef5ff;
}

.chat-preview-telegram.is-selected::before {
    background: #229ed9;
}

.chat-preview-max.is-selected::before {
    background: linear-gradient(#7058f6, #b44bd8);
}

.chat-preview-whatsapp.is-selected::before {
    background: #25d366;
}

.chat-preview-avatar,
.chat-thread-avatar,
.chat-message-avatar {
    align-items: center;
    border-radius: 12px;
    display: inline-flex;
    flex: 0 0 auto;
    font-weight: 900;
    justify-content: center;
}

.chat-preview-avatar {
    background: #e8eef7;
    color: #38506e;
    height: 42px;
    width: 42px;
}

.chat-preview-telegram .chat-preview-avatar {
    background: #dff3fc;
    color: #087caf;
}

.chat-preview-max .chat-preview-avatar {
    background: #eee8ff;
    color: #6e45cc;
}

.chat-preview-whatsapp .chat-preview-avatar {
    background: #dcf8e7;
    color: #087f3e;
}

.chat-preview-body,
.chat-preview-topline,
.chat-preview-channel,
.chat-preview-text,
.chat-preview-footer {
    min-width: 0;
}

.chat-preview-body {
    display: grid;
    gap: 6px;
}

.chat-preview-topline,
.chat-preview-footer {
    align-items: center;
    display: flex;
    gap: 8px;
    justify-content: space-between;
}

.chat-preview-topline strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-preview-topline time,
.chat-preview-footer,
.chat-preview-channel {
    color: var(--muted);
    font-size: .72rem;
}

.chat-preview-topline time {
    flex: 0 0 auto;
}

.chat-preview-channel {
    align-items: center;
    display: flex;
    font-weight: 800;
    gap: 5px;
}

.chat-preview-channel i,
.chat-thread-channel i {
    background: #6b7c93;
    border-radius: 50%;
    display: inline-block;
    height: 7px;
    width: 7px;
}

.chat-preview-telegram .chat-preview-channel i,
.chat-thread-header-telegram .chat-thread-channel i {
    background: #229ed9;
}

.chat-preview-max .chat-preview-channel i,
.chat-thread-header-max .chat-thread-channel i {
    background: #8b56e9;
}

.chat-preview-whatsapp .chat-preview-channel i,
.chat-thread-header-whatsapp .chat-thread-channel i {
    background: #25d366;
}

.chat-preview-channel span {
    font-weight: 500;
}

.chat-preview-text {
    display: block;
    font-size: .86rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-preview-text b {
    color: var(--accent);
}

.chat-preview-status {
    border-radius: 999px;
    font-size: .66rem;
    font-weight: 900;
    padding: 3px 7px;
    text-transform: uppercase;
}

.chat-preview-status.status-unreviewed,
.chat-preview-status.status-taken {
    background: #fff0d5;
    color: #9b5d00;
}

.chat-preview-status.status-converted,
.chat-preview-status.status-linked {
    background: #ddf5e9;
    color: #14724f;
}

.chat-preview-status.status-dismissed {
    background: #edf0f4;
    color: #66758a;
}

.chat-preview-footer > span:first-child {
    align-items: flex-start;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.chat-preview-unanswered,
.status-pill.status-unanswered,
.chat-preview-delivery-blocked,
.status-pill.status-delivery-blocked {
    background: #fee4e2;
    border: 1px solid #f4b9b5;
    border-radius: 999px;
    color: #b42318;
    font-size: .66rem;
    font-weight: 950;
    letter-spacing: .01em;
    padding: 3px 7px;
    text-transform: uppercase;
}

/* Analytics dashboard v2 */
.report-page-modern {
    --report-ink: #132238;
    --report-muted: #64748b;
    --report-line: #dfe7f2;
    gap: 20px;
    max-width: 1280px;
    width: 100%;
}

.report-hero {
    align-items: center;
    background:
        radial-gradient(circle at 86% 18%, rgba(255, 255, 255, .22), transparent 28%),
        linear-gradient(125deg, #17233a 0%, #263d6f 55%, #5267db 100%);
    border-radius: 24px;
    box-shadow: 0 20px 50px rgba(24, 42, 78, .18);
    color: #fff;
    display: flex;
    justify-content: space-between;
    min-height: 170px;
    overflow: hidden;
    padding: 30px 34px;
    position: relative;
}

.report-hero::after {
    border: 1px solid rgba(255, 255, 255, .14);
    border-radius: 50%;
    content: "";
    height: 210px;
    position: absolute;
    right: -42px;
    top: -72px;
    width: 210px;
}

.report-hero-director { background: linear-gradient(125deg, #17233a 0%, #304a89 58%, #6a70ed 100%); }
.report-hero-marketing { background: linear-gradient(125deg, #17233a 0%, #43317d 58%, #9a5ce5 100%); }
.report-hero-operations { background: linear-gradient(125deg, #14293d 0%, #17617c 58%, #2aa8d8 100%); }
.report-hero-funnel { background: linear-gradient(125deg, #17233a 0%, #31547d 56%, #24a27d 100%); }
.report-hero h1 { color: #fff; font-size: clamp(2.1rem, 4vw, 3.3rem); letter-spacing: -.035em; line-height: 1; margin: 8px 0 12px; }
.report-hero p { color: rgba(255,255,255,.78); font-size: 1rem; margin: 0; max-width: 690px; }
.report-hero-kicker { color: #c9d7ff; font-size: .73rem; font-weight: 900; letter-spacing: .1em; text-transform: uppercase; }
.report-hero-status, .report-readonly-badge {
    align-items: center;
    backdrop-filter: blur(10px);
    background: rgba(255,255,255,.11);
    border: 1px solid rgba(255,255,255,.2);
    border-radius: 16px;
    display: grid;
    gap: 2px 10px;
    grid-template-columns: auto 1fr;
    min-width: 195px;
    padding: 14px 16px;
    position: relative;
    z-index: 1;
}
.report-hero-status > span { background: #48d29a; border: 4px solid rgba(72,210,154,.2); border-radius: 50%; grid-row: 1 / 3; height: 10px; width: 10px; }
.report-hero-status small, .report-readonly-badge small { color: rgba(255,255,255,.7); }
.report-readonly-badge > span { align-items: center; background: #4ad9a2; border-radius: 50%; color: #14362b; display: flex; font-weight: 900; grid-row: 1 / 3; height: 30px; justify-content: center; width: 30px; }
.report-hero-link { align-items: center; background: #fff; border-radius: 12px; color: #173052; display: flex; font-weight: 850; gap: 18px; padding: 13px 16px; position: relative; text-decoration: none; z-index: 1; }
.report-hero-link span { font-size: 1.25rem; }

.report-page-modern .report-tabs {
    background: #e9eef7;
    border: 1px solid #d8e1ee;
    border-radius: 18px;
    gap: 5px;
    padding: 5px;
}
.report-page-modern .report-tabs a { align-items: center; background: transparent; border: 0; border-radius: 13px; display: flex; flex: 1 0 170px; gap: 10px; padding: 10px 13px; transition: background .18s ease, box-shadow .18s ease, transform .18s ease; }
.report-page-modern .report-tabs a:hover { background: rgba(255,255,255,.7); transform: translateY(-1px); }
.report-page-modern .report-tabs a.is-active { background: #fff; box-shadow: 0 5px 18px rgba(31, 51, 83, .1); color: #16243a; }
.report-tab-icon { align-items: center; background: #dce5f4; border-radius: 10px; color: #40577a; display: flex; height: 34px; justify-content: center; width: 34px; }
.report-tabs a.is-active .report-tab-icon { background: #5368f0; color: #fff; }
.report-tabs a > span:last-child { display: grid; gap: 1px; }
.report-tabs a strong { font-size: .9rem; }
.report-tabs a small { color: #7a8ba5; font-size: .69rem; font-weight: 600; }

.report-toolbar-modern { background: rgba(255,255,255,.78); border-color: var(--report-line); border-radius: 18px; box-shadow: 0 10px 30px rgba(38, 56, 83, .06); padding: 14px 16px; }
.report-toolbar-modern .report-period { flex: 1 1 560px; }
.report-period label > span, .report-email-form label > span { color: #657792; font-size: .7rem; font-weight: 850; letter-spacing: .04em; text-transform: uppercase; }
.report-period select, .report-period input, .report-email-form input { border-color: #d4deeb; border-radius: 11px; box-shadow: 0 1px 2px rgba(19,34,56,.03); min-height: 44px; }
.report-apply {
    align-items: center;
    background: linear-gradient(135deg, #405de6, #596ff2);
    border: 0;
    border-radius: 11px;
    box-shadow: 0 7px 18px rgba(64, 93, 230, .22);
    color: #fff;
    cursor: pointer;
    display: inline-flex;
    font: inherit;
    font-weight: 800;
    gap: 8px;
    justify-content: center;
    min-height: 44px;
    padding: 0 17px;
    transition: box-shadow .18s ease, transform .18s ease;
}
.report-apply:hover { box-shadow: 0 10px 24px rgba(64, 93, 230, .3); transform: translateY(-1px); }
.report-apply:focus-visible { outline: 3px solid rgba(64, 93, 230, .28); outline-offset: 2px; }
.report-email-form { align-items: end; display: flex; flex: 1 1 390px; gap: 9px; justify-content: flex-end; }
.report-email-form label { display: grid; flex: 1 1 250px; gap: 5px; max-width: 330px; }
.report-email-form input { min-width: 0; padding: 8px 11px; width: 100%; }
.report-email-button { align-items: center; background: linear-gradient(135deg, #5267e9, #7956d8); border: 0; color: #fff; display: inline-flex; gap: 8px; min-height: 44px; }

.report-kpis-modern { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.report-kpis-modern article { align-items: center; border: 0; border-left: 3px solid var(--kpi-accent, #5468ff); box-shadow: 0 12px 32px rgba(31,51,83,.08); display: grid; gap: 13px; grid-template-columns: auto 1fr; min-height: 120px; padding: 18px; }
.report-kpis-modern article > div { display: grid; gap: 5px; min-width: 0; }
.report-kpis-modern article > div > span { font-size: .75rem; font-weight: 800; letter-spacing: .035em; text-transform: uppercase; }
.report-kpis-modern article strong { color: var(--report-ink); font-size: clamp(1.8rem, 3vw, 2.45rem); }
.report-kpis-modern article .kpi-text-value { font-size: 1.35rem; }
.report-kpi-icon { align-items: center; background: color-mix(in srgb, var(--kpi-accent) 13%, white); border-radius: 14px; color: var(--kpi-accent); display: flex; font-size: 1.05rem; font-weight: 900; height: 46px; justify-content: center; width: 46px; }
.kpi-indigo { --kpi-accent: #5468ff; }.kpi-cyan { --kpi-accent: #2aa8d8; }.kpi-violet { --kpi-accent: #a855f7; }.kpi-green { --kpi-accent: #24b47e; }.kpi-amber { --kpi-accent: #f2a443; }.kpi-rose { --kpi-accent: #ec6376; }
.report-kpis-modern article.is-alert { background: linear-gradient(135deg, #fff, #fff6f4); border-left-color: #ef695f; }
.report-kpis-marketing { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.report-kpis-marketing article { min-height: 116px; }

.report-dashboard-grid { display: grid; gap: 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.report-dashboard-grid-main { grid-template-columns: minmax(0, 1.65fr) minmax(320px, .85fr); }
.report-page-modern .report-panel { border: 1px solid var(--report-line); border-radius: 20px; box-shadow: 0 12px 34px rgba(31,51,83,.065); padding: 24px; }
.report-page-modern .report-panel > .analytics-section-head { margin-bottom: 18px; }
.report-page-modern .analytics-section-head h2 { color: var(--report-ink); font-size: 1.15rem; }
.report-page-modern .analytics-section-head .eyebrow { color: #6578a0; font-size: .68rem; margin: 0 0 5px; }
.report-page-modern .analytics-section-head > p { font-size: .76rem; }
.report-chart-panel { min-width: 0; }
.report-chart-legend { display: flex; flex-wrap: wrap; gap: 14px; margin: 14px 0 2px; }
.report-chart-legend span { align-items: center; color: #6c7b91; display: inline-flex; font-size: .72rem; gap: 6px; }
.report-chart-legend span::before { background: var(--legend, #5468ff); border-radius: 50%; content: ""; height: 8px; width: 8px; }
.legend-leads { --legend: #5468ff; }.legend-calls { --legend: #2aa8d8; }.legend-messenger { --legend: #a855f7; }.legend-spend { --legend: #5468ff; }.legend-visits { --legend: #a855f7; }

.activity-chart { align-items: stretch; display: flex; gap: 5px; min-height: 230px; overflow-x: auto; padding: 18px 4px 0; }
.activity-column { display: grid; flex: 1 0 28px; gap: 7px; grid-template-rows: 190px auto; min-width: 28px; }
.activity-bars { align-items: end; border-bottom: 1px solid #dfe7f2; display: flex; gap: 2px; justify-content: center; min-height: 190px; }
.activity-bars i { background: var(--bar-color); border-radius: 5px 5px 1px 1px; display: block; height: max(3px, var(--bar-height)); min-width: 5px; transition: height .2s ease; width: 22%; }
.activity-bars .bar-leads, .activity-bars .bar-spend { --bar-color: #5468ff; }.activity-bars .bar-calls { --bar-color: #2aa8d8; }.activity-bars .bar-messenger, .activity-bars .bar-visits { --bar-color: #a855f7; }
.activity-column small { color: #8a98ab; font-size: .6rem; text-align: center; white-space: nowrap; }
.activity-chart-marketing .activity-column { flex-basis: 24px; }

.donut-layout { align-items: center; display: grid; gap: 20px; grid-template-columns: minmax(145px, .8fr) minmax(180px, 1.2fr); margin-top: 17px; }
.donut-layout-compact { grid-template-columns: minmax(160px, .8fr) minmax(210px, 1.2fr); }
.donut-chart { align-items: center; aspect-ratio: 1; background: var(--donut); border-radius: 50%; display: flex; justify-content: center; margin: auto; max-width: 190px; padding: 22px; position: relative; width: 100%; }
.donut-chart::after { background: #fff; border-radius: 50%; box-shadow: inset 0 0 0 1px #edf1f7; content: ""; inset: 24%; position: absolute; }
.donut-chart > div { display: grid; line-height: 1; position: relative; text-align: center; z-index: 1; }
.donut-chart strong { color: var(--report-ink); font-size: 2rem; }.donut-chart span { color: #7a899d; font-size: .72rem; margin-top: 5px; }
.chart-legend-list { display: grid; gap: 8px; list-style: none; margin: 0; padding: 0; }
.chart-legend-list li { align-items: center; display: grid; gap: 7px; grid-template-columns: 8px 1fr auto auto; }
.chart-legend-list li > i { background: var(--legend-color); border-radius: 50%; height: 8px; width: 8px; }.chart-legend-list li span { color: #60718a; font-size: .78rem; }.chart-legend-list li strong { color: var(--report-ink); font-size: .85rem; }.chart-legend-list li small { color: #9aa6b7; font-size: .7rem; min-width: 38px; text-align: right; }

.horizontal-chart { display: grid; gap: 13px; margin-top: 16px; }
.horizontal-chart-row { align-items: center; display: grid; gap: 8px; grid-template-columns: minmax(120px, 1fr) minmax(110px, 1.4fr) auto; }
.horizontal-chart-row > div:first-child { align-items: center; display: flex; gap: 10px; justify-content: space-between; min-width: 0; }
.horizontal-chart-row span { color: #586b86; font-size: .78rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }.horizontal-chart-row strong { color: var(--report-ink); font-size: .82rem; white-space: nowrap; }.horizontal-chart-row > small { color: #8b99ac; font-size: .68rem; min-width: 44px; text-align: right; }
.horizontal-track { background: #edf1f7; border-radius: 999px; height: 8px; min-width: 0; overflow: hidden; }
.horizontal-track i { background: var(--bar-color, #5468ff); border-radius: inherit; display: block; height: 100%; min-width: 2px; width: var(--bar-width); }
.campaign-chart .horizontal-chart-row { grid-template-columns: minmax(220px, 1.3fr) minmax(180px, 1fr) minmax(145px, auto); }

.report-facts-modern { gap: 10px; }
.report-facts-modern div { background: #f7f9fc; border: 0; border-radius: 11px; margin: 0; padding: 14px 16px; }.report-facts-modern dt { color: #63748c; }.report-facts-modern dd { color: var(--report-ink); }
.report-facts-inline { border-top: 1px solid #e7edf5; grid-template-columns: repeat(3, 1fr); margin-top: 18px; padding-top: 9px; }.report-facts-inline div { align-items: flex-start; border: 0; flex-direction: column; gap: 4px; }.report-facts-inline dd { text-align: left; }
.week-chart { display: grid; gap: 10px; margin-top: 16px; }.week-chart article { align-items: center; display: grid; gap: 12px; grid-template-columns: 120px 1fr 32px; }.week-chart article > div:first-child { display: grid; }.week-chart article span { color: var(--report-ink); font-weight: 800; }.week-chart article small { color: #7e8da2; }.week-chart article strong { text-align: right; }

.report-table-modern th { background: #f6f8fc; color: #71819a; font-size: .68rem; letter-spacing: .045em; }.report-table-modern th:first-child { border-radius: 10px 0 0 10px; }.report-table-modern th:last-child { border-radius: 0 10px 10px 0; }.report-table-modern td { color: #42536c; }.table-status-dot { background: #5468ff; border-radius: 50%; display: inline-block; height: 7px; margin-right: 7px; width: 7px; }.table-status-dot-green { background: #24b47e; }
.report-quality-panel { background: linear-gradient(135deg, #fff, #f8faff) !important; }
.report-page-modern .report-source-grid div { border: 1px solid #e9eef5; padding: 14px; }.report-page-modern .report-source-grid strong { color: var(--report-ink); }
.report-empty { align-self: center; color: #8a98ab; margin: auto; padding: 28px; text-align: center; }
.report-context-note { background: #f7f9fc; border-left: 3px solid #5468ff; border-radius: 8px; margin: 0; padding: 10px 13px; }

.report-funnel-period { background: #fff; border: 1px solid var(--report-line); border-radius: 18px; box-shadow: 0 10px 30px rgba(38,56,83,.06); padding: 14px 16px; }
.report-funnel-period .search-actions { align-self: end; display: flex; gap: 8px; }.report-funnel-period .search-actions button { background: #17243a; min-height: 44px; }.report-funnel-period .search-actions a { align-items: center; background: #eef2f8; border-radius: 9px; color: #5f7087; display: flex; justify-content: center; min-height: 44px; padding: 0 18px; text-decoration: none; }
.report-kpis-funnel { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.funnel-explainer { display: grid; gap: 15px; margin-top: 16px; }.funnel-explainer > div { align-items: center; background: #f6f8fc; border-radius: 13px; display: flex; gap: 13px; padding: 14px; }.funnel-explainer i { align-items: center; border-radius: 11px; display: flex; flex: 0 0 36px; font-style: normal; font-weight: 900; height: 36px; justify-content: center; }.explainer-current { background: #e6ebff; color: #4960e8; }.explainer-history { background: #dff6ed; color: #14805e; }.funnel-explainer p { display: grid; gap: 3px; margin: 0; }.funnel-explainer span { color: #718098; font-size: .76rem; }
.visual-funnel { align-items: center; display: flex; flex-direction: column; gap: 8px; margin-top: 20px; }.visual-funnel article { background: color-mix(in srgb, var(--funnel-color) 10%, white); border-left: 4px solid var(--funnel-color); border-radius: 12px; display: grid; gap: 5px; max-width: 100%; padding: 11px 15px; width: var(--funnel-width); }.visual-funnel article > div { align-items: center; display: flex; justify-content: space-between; }.visual-funnel article span { color: #40516a; font-weight: 750; }.visual-funnel article strong { color: var(--funnel-color); font-size: 1.35rem; }.visual-funnel article p { color: #75849a; font-size: .74rem; margin: 0; }.visual-funnel article small { color: #667791; font-size: .7rem; font-weight: 700; }
.loss-chart { display: grid; gap: 12px; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-top: 17px; }.loss-chart article { background: #f7f9fc; border: 1px solid #e9eef5; border-radius: 13px; display: grid; gap: 10px; padding: 13px; }.loss-value { align-items: center; display: grid; gap: 7px; grid-template-columns: 8px 1fr auto; }.loss-value i { background: var(--loss-color); border-radius: 50%; height: 8px; width: 8px; }.loss-value span { color: #5e7089; font-size: .76rem; }.loss-value strong { color: var(--report-ink); }.loss-chart article > small { color: #8b99ac; text-align: right; }

.settings-analytics-grid { grid-template-columns: minmax(0, 1fr); }
.settings-analytics-card-main { align-items: center; background: linear-gradient(125deg, #fff 0%, #f3f6ff 100%); border-color: #d9e2f1; border-radius: 16px; display: grid; gap: 14px; grid-template-columns: auto 1fr auto; min-height: 104px; padding: 18px 20px; }
.settings-analytics-icon { align-items: center; background: linear-gradient(135deg, #5368ef, #7657da); border-radius: 14px; color: #fff !important; display: flex; font-size: 1.25rem; height: 48px; justify-content: center; width: 48px; }.settings-analytics-copy { display: grid; gap: 4px; }.settings-analytics-copy strong { color: #17243a; font-size: 1.05rem; }.settings-analytics-copy > span { color: #687a94; }.settings-analytics-arrow { color: #5368ef !important; font-size: 1.45rem; }

@media (max-width: 1100px) {
    .report-kpis-marketing { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .report-dashboard-grid-main { grid-template-columns: minmax(0, 1.25fr) minmax(300px, .85fr); }
}

@media (max-width: 900px) {
    .report-kpis-modern, .report-kpis-marketing { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .report-dashboard-grid, .report-dashboard-grid-main { grid-template-columns: minmax(0, 1fr); }
    .loss-chart { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 719px) {
    .report-page-modern { gap: 14px; }
    .report-hero { align-items: flex-start; border-radius: 18px; flex-direction: column; gap: 18px; min-height: 0; padding: 22px 19px; }
    .report-hero h1 { font-size: 2rem; }
    .report-hero-status, .report-readonly-badge { min-width: 0; width: 100%; }
    .report-hero-link { width: 100%; }
    .report-page-modern .report-tabs { border-radius: 14px; }
    .report-page-modern .report-tabs a { flex-basis: 145px; }
    .report-kpis-modern, .report-kpis-marketing, .report-kpis-funnel { grid-template-columns: minmax(0, 1fr); }
    .report-kpis-modern article { min-height: 104px; }
    .report-email-form { align-items: stretch; flex-direction: column; width: 100%; }.report-email-form label { max-width: none; width: 100%; }
    .donut-layout, .donut-layout-compact { grid-template-columns: minmax(0, 1fr); }
    .horizontal-chart-row, .campaign-chart .horizontal-chart-row { grid-template-columns: minmax(120px, 1fr) minmax(90px, 1fr); }.horizontal-chart-row > small { grid-column: 1 / -1; text-align: left; }
    .report-facts-inline { grid-template-columns: 1fr; }
    .week-chart article { grid-template-columns: 90px 1fr 28px; }
    .loss-chart { grid-template-columns: minmax(0, 1fr); }
    .visual-funnel article { width: 100% !important; }
    .report-funnel-period { align-items: stretch; display: grid; grid-template-columns: 1fr; }.report-funnel-period .search-actions { display: grid; grid-template-columns: 1fr 1fr; }
}

/* SPB-ZPI director, marketing and operations reports */
.settings-analytics-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.report-page {
    display: grid;
    gap: 18px;
}

.report-tabs {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 2px;
}

.report-tabs a {
    flex: 0 0 auto;
    padding: 10px 14px;
    border: 1px solid #ccd8e8;
    border-radius: 999px;
    color: #4c607d;
    font-weight: 700;
    text-decoration: none;
    background: #fff;
}

.report-tabs a.is-active {
    color: #fff;
    background: #172235;
    border-color: #172235;
}

.report-toolbar,
.report-period {
    display: flex;
    align-items: end;
    gap: 10px;
    flex-wrap: wrap;
}

.report-toolbar {
    justify-content: space-between;
    padding: 14px;
    background: #fff;
    border: 1px solid #d8e1ec;
    border-radius: 16px;
}

.report-period label {
    display: grid;
    gap: 5px;
    color: #5b6d87;
    font-size: 12px;
    font-weight: 700;
}

.report-period select,
.report-period input {
    min-height: 42px;
    padding: 8px 10px;
    border: 1px solid #c9d5e5;
    border-radius: 10px;
    background: #fff;
    color: #172235;
}

.report-kpis {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.report-kpis article,
.report-panel {
    background: #fff;
    border: 1px solid #d8e1ec;
    border-radius: 16px;
    box-shadow: 0 7px 24px rgba(36, 57, 86, .05);
}

.report-kpis article {
    display: grid;
    gap: 5px;
    padding: 16px;
}

.report-kpis article.is-alert {
    border-color: #f2b5ac;
    background: #fff8f6;
}

.report-kpis span,
.report-source-grid span {
    color: #60728d;
    font-size: 13px;
}

.report-kpis strong {
    font-size: clamp(24px, 4vw, 34px);
    line-height: 1.05;
}

.report-kpis small {
    color: #78879d;
}

.report-panel {
    padding: 18px;
}

.report-panel h2 {
    margin: 0 0 14px;
}

.report-two-columns {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.report-source-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

.report-source-grid div {
    display: grid;
    gap: 4px;
    padding: 12px;
    border-radius: 12px;
    background: #f4f7fb;
}

.report-source-grid strong {
    font-size: 24px;
}

.report-facts {
    display: grid;
    gap: 0;
    margin: 0;
}

.report-facts div {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 10px 0;
    border-bottom: 1px solid #e5ebf3;
}

.report-facts div:last-child { border-bottom: 0; }
.report-facts dt { color: #60728d; }
.report-facts dd { margin: 0; font-weight: 800; text-align: right; }
.table-scroll { overflow-x: auto; }
.report-table { width: 100%; border-collapse: collapse; }
.report-table th, .report-table td { padding: 10px; border-bottom: 1px solid #e5ebf3; text-align: left; white-space: nowrap; }
.report-table th { color: #60728d; font-size: 12px; text-transform: uppercase; }
.report-table td.wrap { white-space: normal; min-width: 260px; word-break: break-word; }
.report-note { color: #60728d; font-size: 13px; }

@media (max-width: 900px) {
    .report-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .report-source-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 719px) {
    .settings-analytics-grid,
    .report-kpis,
    .report-two-columns { grid-template-columns: minmax(0, 1fr); }
    .report-source-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .report-toolbar, .report-period { align-items: stretch; }
    .report-period label, .report-period select, .report-period input,
    .report-toolbar form, .report-toolbar .button { width: 100%; }
}

.chat-preview-delivery-blocked,
.status-pill.status-delivery-blocked {
    background: #fff0f0;
    border-color: #efaaa5;
    color: #9f1c14;
}

.chat-thread-state .status-pill {
    font-size: .72rem;
    min-height: 28px;
    padding: 5px 10px;
}

.chat-thread-state .status-unreviewed {
    background: #fff5df;
    border-color: #efd6a3;
    color: #8a5a00;
    font-weight: 900;
}

.chat-sidebar-empty,
.chat-thread-empty,
.chat-thread-placeholder {
    color: var(--muted);
    display: grid;
    gap: 7px;
    justify-items: center;
    padding: 42px 24px;
    text-align: center;
}

.chat-sidebar-empty strong,
.chat-thread-placeholder strong {
    color: var(--text);
}

.chat-pagination {
    border-top: 1px solid #e3e9f2;
    display: flex;
    gap: 8px;
    justify-content: space-between;
    margin-top: auto;
    padding: 12px 16px;
}

.chat-pagination a,
.chat-pagination span {
    color: var(--muted);
    font-size: .8rem;
    font-weight: 800;
    text-decoration: none;
}

.chat-pagination span {
    opacity: .45;
}

.chat-thread-panel {
    background: #f4f7fb;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.chat-thread-header {
    align-items: center;
    background: rgba(255, 255, 255, .96);
    border-bottom: 1px solid #dce4ef;
    display: grid;
    gap: 13px;
    grid-template-columns: 46px minmax(0, 1fr) auto 40px;
    min-height: 82px;
    padding: 14px 20px;
}

.chat-thread-avatar {
    background: #e8eef7;
    color: #38506e;
    height: 46px;
    width: 46px;
}

.chat-thread-header-telegram .chat-thread-avatar {
    background: #dff3fc;
    color: #087caf;
}

.chat-thread-header-max .chat-thread-avatar {
    background: #eee8ff;
    color: #6e45cc;
}

.chat-thread-identity {
    display: grid;
    gap: 4px;
    min-width: 0;
}

.chat-thread-identity > div {
    align-items: center;
    display: flex;
    gap: 10px;
}

.chat-thread-identity strong {
    font-size: 1.02rem;
}

.chat-thread-channel {
    align-items: center;
    background: #f0f3f7;
    border-radius: 999px;
    color: var(--muted);
    display: inline-flex;
    font-size: .72rem;
    font-weight: 800;
    gap: 5px;
    padding: 4px 8px;
}

.chat-thread-identity p {
    color: var(--muted);
    font-size: .78rem;
    margin: 0;
}

.chat-thread-state {
    align-items: flex-end;
    display: grid;
    gap: 5px;
    justify-items: end;
}

.chat-thread-state time {
    color: var(--muted);
    font-size: .72rem;
}

.chat-thread-more {
    align-self: center;
    position: relative;
}

.chat-thread-more > summary {
    align-items: center;
    background: #eef3f9;
    border: 1px solid #d7e0ec;
    border-radius: 11px;
    color: #52647c;
    cursor: pointer;
    display: flex;
    font-size: 1rem;
    font-weight: 900;
    height: 38px;
    justify-content: center;
    list-style: none;
    padding: 0;
    transition: background .16s ease, border-color .16s ease, box-shadow .16s ease, color .16s ease;
    width: 42px;
}

.chat-thread-more > summary span {
    font-size: 1.45rem;
    line-height: 1;
    transform: translateY(-3px);
}

.chat-thread-more > summary:hover {
    background: #fff;
    border-color: #b8c7da;
    box-shadow: 0 5px 14px rgba(25, 43, 70, .11);
}

.chat-thread-more > summary::-webkit-details-marker {
    display: none;
}

.chat-thread-more[open] > summary {
    background: #172a46;
    color: #fff;
}

.chat-thread-more-menu {
    background: #fff;
    border: 1px solid #d7e0ec;
    border-radius: 13px;
    box-shadow: 0 18px 42px rgba(25, 43, 70, .19);
    display: grid;
    gap: 4px;
    min-width: 220px;
    padding: 7px;
    position: absolute;
    right: 0;
    top: 46px;
    z-index: 30;
}

.chat-thread-more-menu > p {
    border-bottom: 1px solid #e7ecf3;
    color: #73839a;
    font-size: .68rem;
    font-weight: 900;
    letter-spacing: .045em;
    margin: 0 0 4px;
    padding: 5px 10px 9px;
    text-transform: uppercase;
}

.chat-thread-more-menu form {
    margin: 0;
}

.chat-thread-more-menu button {
    background: transparent;
    border: 0;
    border-radius: 8px;
    color: #253b58;
    cursor: pointer;
    font: inherit;
    font-size: .8rem;
    font-weight: 750;
    padding: 9px 10px;
    text-align: left;
    width: 100%;
}

.chat-thread-more-menu button:hover {
    background: #eef4fb;
}

.chat-thread-more-menu button.is-danger {
    color: #bd3340;
}

.chat-thread-more-menu button.is-danger:hover {
    background: #fff0f1;
}

.chat-readonly-note {
    background: #fff9e9;
    border-top: 1px solid #ead9aa;
    color: #725719;
    font-size: .82rem;
    font-weight: 700;
    padding: 14px 20px;
}

.chat-workspace.is-loading .chat-thread-panel {
    opacity: .62;
    pointer-events: none;
    transition: opacity .12s ease;
}

.chat-thread-panel .chat-transcript {
    align-content: start;
    display: grid;
    flex: 1 1 auto;
    gap: 12px;
    max-height: 510px;
    min-height: 300px;
    overflow-y: auto;
    padding: 20px;
}

.chat-message-row {
    align-items: start;
    display: grid;
    gap: 11px;
    grid-template-columns: 36px minmax(0, 1fr);
    width: 100%;
}

.chat-message-avatar {
    background: #e2e8f1;
    color: #47617f;
    font-size: .78rem;
    height: 36px;
    width: 36px;
}

.chat-message-row.is-outbound .chat-message-avatar {
    background: #dcecff;
    color: #1266db;
}

.chat-message-card {
    background: #fff;
    border: 1px solid #dde5ef;
    border-left: 4px solid #9fb0c5;
    border-radius: 5px 13px 13px 5px;
    box-shadow: 0 5px 16px rgba(31, 49, 76, .05);
    min-width: 0;
    padding: 12px 14px;
}

.chat-message-row.is-outbound .chat-message-card {
    background: #edf6ff;
    border-color: #cfe3f8;
    border-left-color: #3b8eea;
}

.chat-message-row.is-automated .chat-message-avatar {
    background: #eee8ff;
    color: #6e45cc;
}

.chat-message-row.is-automated .chat-message-card {
    background: #f7f4ff;
    border-color: #dfd6fa;
    border-left-color: #8b56e9;
}

.chat-message-row.is-automated .chat-message-role {
    background: #e9e1ff;
    color: #6841be;
}

.chat-message-card header {
    align-items: center;
    display: flex;
    gap: 12px;
    justify-content: space-between;
}

.chat-message-card header > div {
    align-items: center;
    display: flex;
    gap: 8px;
    min-width: 0;
}

.chat-message-card strong {
    font-size: .82rem;
}

.chat-message-role {
    background: #edf0f4;
    border-radius: 999px;
    color: var(--muted);
    font-size: .64rem;
    font-weight: 900;
    padding: 3px 6px;
    text-transform: uppercase;
}

.chat-message-row.is-outbound .chat-message-role {
    background: #d9eaff;
    color: #155da9;
}

.chat-message-card time {
    color: var(--muted);
    flex: 0 0 auto;
    font-size: .7rem;
}

.chat-message-card p {
    line-height: 1.5;
    margin: 8px 0 0;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

.chat-attachment-count {
    color: var(--muted);
    display: inline-block;
    font-size: .72rem;
    margin-top: 8px;
}

.chat-email-attachments {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 10px;
}

.chat-email-attachments a {
    background: #fff4df;
    border: 1px solid #f0d5a5;
    border-radius: 8px;
    color: #7a4b00;
    font-size: .75rem;
    font-weight: 800;
    padding: 6px 9px;
    text-decoration: none;
}

.chat-mail-readonly {
    background: #fff8e8;
    border-top: 1px solid #eed7aa;
    display: grid;
    gap: 4px;
    padding: 16px 20px;
}

.chat-mail-readonly span {
    color: var(--muted);
    font-size: .78rem;
}

.chat-composer {
    background: #fff;
    border-top: 1px solid #dce4ef;
    display: grid;
    gap: 8px;
    padding: 16px 20px 12px;
}

.chat-composer > label {
    color: var(--text);
    font-size: .78rem;
    font-weight: 900;
}

.chat-composer > .chat-composer-row {
    align-items: stretch;
    display: grid;
    gap: 10px;
    grid-template-columns: minmax(0, 1fr) 46px auto;
}

.chat-composer textarea {
    border: 1px solid var(--line);
    border-radius: 12px;
    min-height: 76px;
    padding: 12px 14px;
    resize: vertical;
}

.chat-composer button {
    align-self: stretch;
    min-width: 118px;
}

.chat-composer small {
    color: var(--muted);
    font-size: .7rem;
}

.chat-composer-hint {
    display: flex;
    gap: 12px;
    justify-content: space-between;
}

.chat-composer button:disabled {
    cursor: wait;
    opacity: .65;
}

.chat-attachment-picker {
    align-items: center;
    background: #f4f7fb;
    border: 1px solid #ced9e8;
    border-radius: 11px;
    color: #274361;
    cursor: pointer;
    display: flex;
    justify-content: center;
    min-height: 46px;
    transition: background .16s ease, border-color .16s ease, color .16s ease;
}

.chat-attachment-picker:hover,
.chat-attachment-picker:focus-within {
    background: #eaf2ff;
    border-color: #6aa2ec;
    color: #1266db;
}

.chat-attachment-picker input {
    height: 1px;
    opacity: 0;
    overflow: hidden;
    position: absolute;
    width: 1px;
}

.chat-attachment-picker svg {
    fill: currentColor;
    height: 21px;
    width: 21px;
}

.chat-composer > .chat-attachment-selection {
    align-items: center;
    background: #eef5ff;
    border: 1px solid #d2e2f7;
    border-radius: 10px;
    color: #29425f;
    display: grid;
    font-size: .75rem;
    gap: 8px;
    grid-template-columns: auto minmax(0, 1fr) 28px;
    max-width: min(100%, 560px);
    padding: 6px 7px 6px 10px;
}

.chat-composer > .chat-attachment-selection[hidden] {
    display: none;
}

.chat-attachment-selection > span {
    color: #5f7591;
    font-size: .68rem;
    font-weight: 800;
    text-transform: uppercase;
}

.chat-attachment-selection strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-attachment-selection button,
.chat-composer .chat-attachment-selection button {
    align-items: center;
    background: transparent;
    border: 0;
    border-radius: 7px;
    color: #5c708b;
    display: flex;
    font-size: 1.2rem;
    justify-content: center;
    min-height: 28px;
    min-width: 28px;
    padding: 0;
}

.chat-attachment-selection button:hover {
    background: #dae9fb;
    color: #17324f;
}

.chat-thread-actions {
    align-items: center;
    background: #fff;
    border-top: 1px solid #edf0f4;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 20px 16px;
    position: relative;
    z-index: 4;
}

.chat-action-primary,
.chat-action-link,
.chat-action-menu > summary {
    align-items: center;
    border-radius: 10px;
    cursor: pointer;
    display: inline-flex;
    font-size: .8rem;
    font-weight: 900;
    justify-content: center;
    min-height: 40px;
    padding: 8px 13px;
    text-decoration: none;
}

.chat-action-primary {
    background: #172a46;
    color: #fff;
}

.chat-action-inline {
    margin: 0;
}

.chat-action-dismiss,
.chat-action-read {
    align-items: center;
    background: #fff5f5;
    border: 1px solid #f1d3d7;
    border-radius: 10px;
    color: var(--danger);
    cursor: pointer;
    display: inline-flex;
    font: inherit;
    font-size: .8rem;
    font-weight: 900;
    justify-content: center;
    min-height: 40px;
    padding: 8px 13px;
}

.chat-action-read {
    background: #eef4ff;
    border-color: #cddaff;
    color: #3153bd;
    gap: 7px;
}

.chat-action-read:hover {
    background: #e2ebff;
    border-color: #b9c9fa;
}

.chat-action-read > span {
    align-items: center;
    background: #4965dd;
    border-radius: 999px;
    color: #fff;
    display: inline-flex;
    font-size: .68rem;
    height: 19px;
    justify-content: center;
    width: 19px;
}

.chat-action-dismiss:hover {
    background: #ffecee;
    border-color: #e8b8bf;
}

.chat-action-link,
.chat-action-menu > summary {
    background: #f1f4f8;
    border: 1px solid #dbe3ee;
    color: var(--text);
    list-style: none;
}

.chat-action-menu {
    position: relative;
}

.chat-action-menu > summary::-webkit-details-marker {
    display: none;
}

.chat-action-danger > summary {
    color: var(--danger);
}

.chat-action-menu form {
    background: #fff;
    border: 1px solid #d7e0ec;
    border-radius: 12px;
    box-shadow: 0 18px 44px rgba(30, 51, 83, .18);
    display: grid;
    gap: 9px;
    bottom: calc(100% + 7px);
    left: 0;
    max-height: min(360px, calc(100vh - 180px));
    min-width: 260px;
    overflow-y: auto;
    padding: 12px;
    position: absolute;
    top: auto;
    z-index: 3;
}

.chat-action-menu input,
.chat-action-menu select,
.chat-action-menu textarea {
    border: 1px solid var(--line);
    border-radius: 9px;
    min-height: 40px;
    padding: 8px 10px;
}

.chat-action-menu textarea {
    min-height: 66px;
    resize: vertical;
}

.chat-action-menu button {
    min-height: 40px;
}

.chat-thread-placeholder {
    margin: auto;
}

.chat-thread-placeholder > span {
    align-items: center;
    background: #e7edf6;
    border-radius: 18px;
    color: #667b97;
    display: inline-flex;
    font-size: 1.5rem;
    height: 58px;
    justify-content: center;
    width: 58px;
}

.phone-history-panel .chat-transcript {
    background: #f7f8fa;
    border: 1px solid var(--line);
    border-radius: 12px;
    display: grid;
    gap: 9px;
    max-height: 32rem;
    overflow: auto;
    padding: 12px;
}

.phone-history-panel .chat-message {
    background: #fff;
    border: 1px solid #e2e6eb;
    border-radius: 12px;
    max-width: 86%;
    padding: 10px 12px;
}

.phone-history-panel .chat-message.is-outbound {
    background: #eaf5ff;
    justify-self: end;
}

.phone-history-panel .chat-message > div {
    display: flex;
    font-size: .8rem;
    gap: 12px;
    justify-content: space-between;
}

.phone-history-panel .chat-message p {
    margin: 6px 0 0;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

@media (max-width: 980px) {
    .chat-workspace {
        grid-template-columns: 1fr;
    }

    .chat-sidebar {
        border-bottom: 1px solid #dce4ef;
        border-right: 0;
    }

    .chat-conversation-list {
        max-height: 350px;
    }

    .chat-thread-panel .chat-transcript {
        max-height: 520px;
    }
}

@media (max-width: 720px) {
    .chat-app-shell {
        padding-left: 12px;
        padding-right: 12px;
        padding-top: 16px;
    }

    .chat-page-heading {
        align-items: flex-start;
        margin-bottom: 16px;
    }

    .chat-heading-summary {
        display: none;
    }

    .chat-page-heading h1 {
        font-size: 2rem;
    }

    .chat-page-heading p:last-child {
        font-size: .84rem;
    }

    .chat-controls {
        align-items: stretch;
        display: grid;
    }

    .chat-channel-tabs {
        overflow-x: auto;
    }

    .chat-channel-tab {
        flex: 1 0 auto;
        justify-content: center;
    }

    .chat-search {
        min-width: 0;
        width: 100%;
    }

    .chat-workspace {
        border-radius: 14px;
        min-height: 0;
    }

    .chat-sidebar-heading {
        min-height: 60px;
    }

    .chat-conversation-list {
        max-height: 310px;
    }

    .chat-preview {
        padding: 13px 14px;
    }

    .chat-thread-panel {
        scroll-margin-top: 120px;
    }

    .chat-thread-header {
        gap: 10px;
        grid-template-columns: 42px minmax(0, 1fr);
        padding: 13px 14px;
    }

    .chat-thread-avatar {
        height: 42px;
        width: 42px;
    }

    .chat-thread-state {
        align-items: center;
        display: flex;
        grid-column: 1 / -1;
        justify-content: space-between;
        justify-items: stretch;
    }

    .chat-thread-more {
        grid-column: 1 / -1;
        justify-self: end;
        margin-top: -48px;
    }

    .chat-thread-more-menu {
        max-width: calc(100vw - 52px);
    }

    .chat-thread-panel .chat-transcript {
        gap: 10px;
        max-height: none;
        min-height: 240px;
        padding: 14px;
    }

    .chat-message-row {
        gap: 8px;
        grid-template-columns: 32px minmax(0, 1fr);
    }

    .chat-message-avatar {
        height: 32px;
        width: 32px;
    }

    .chat-message-card {
        padding: 10px 11px;
    }

    .chat-message-card header {
        align-items: flex-start;
    }

    .chat-message-card header > div {
        align-items: flex-start;
        display: grid;
        gap: 4px;
    }

    .chat-composer {
        padding: 14px;
    }

    .chat-composer > .chat-composer-row {
        gap: 7px;
        grid-template-columns: minmax(0, 1fr) 44px auto;
    }

    .chat-composer-row > button {
        min-height: 46px;
        min-width: 0;
        padding-inline: 12px;
    }

    .chat-composer textarea {
        min-height: 62px;
        padding: 10px 11px;
    }

    .chat-composer-hint > span:first-child {
        line-height: 1.35;
    }

    .chat-desktop-shortcut {
        display: none;
    }

    .chat-thread-actions {
        align-items: stretch;
        display: grid;
        grid-template-columns: 1fr;
        padding: 12px 14px 16px;
    }

    .chat-action-menu > summary,
    .chat-action-primary,
    .chat-action-link,
    .chat-action-dismiss,
    .chat-action-read {
        width: 100%;
    }

    .chat-action-inline {
        width: 100%;
    }

    .chat-action-menu form {
        margin-top: 8px;
        min-width: 0;
        position: static;
        width: 100%;
    }
}

/* Keep dashboard v2 overrides after legacy analytics rules. */
body .settings-analytics-grid { grid-template-columns: minmax(0, 1fr); }
body .report-page-modern { gap: 20px; }
body .report-toolbar-modern { background: rgba(255,255,255,.84); border-radius: 18px; }
body .report-kpis-modern article { border-left: 3px solid var(--kpi-accent, #5468ff); border-radius: 18px; }
body .report-page-modern .report-tabs a.is-active { background: #fff; color: #16243a; }

@media (max-width: 719px) {
    body .report-page-modern { gap: 14px; }
    body .settings-analytics-grid { grid-template-columns: minmax(0, 1fr); }
    body .report-page-modern .report-tabs {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        overflow: visible;
        padding-bottom: 5px;
    }
    body .report-page-modern .report-tabs a {
        box-sizing: border-box;
        flex: none;
        min-width: 0;
        width: 100%;
    }
    body .report-page-modern .report-apply { width: 100%; }
    body .report-page-modern .report-panel { padding: 18px; }
    body .report-page-modern .report-panel > .analytics-section-head { gap: 10px; margin-bottom: 15px; }
}

@media (max-width: 420px) {
    body .report-page-modern .report-tabs a { gap: 7px; padding: 9px; }
    body .report-page-modern .report-tabs a small { display: none; }
}

/* SPB-ZPI unified visual system v1
   Presentation-only layer. It intentionally preserves document structure,
   form behavior, route contracts and all application content. */
body.profile-spb_zpi {
    --ui-ink: #132238;
    --ui-muted: #667892;
    --ui-line: #dbe4f0;
    --ui-panel: rgba(255, 255, 255, .94);
    --ui-panel-soft: #f6f8fc;
    --ui-indigo: #5569ef;
    --ui-indigo-deep: #304a89;
    --ui-cyan: #28a9d8;
    --ui-violet: #9b57e8;
    --ui-green: #22b480;
    --ui-amber: #f1a340;
    --ui-rose: #eb6476;
    --ui-radius-lg: 22px;
    --ui-radius-md: 16px;
    --ui-shadow: 0 14px 38px rgba(31, 51, 83, .075);
    --ui-shadow-hover: 0 20px 46px rgba(31, 51, 83, .13);
    background:
        radial-gradient(circle at 8% 4%, rgba(85, 105, 239, .065), transparent 27rem),
        radial-gradient(circle at 94% 24%, rgba(40, 169, 216, .06), transparent 31rem),
        #f4f7fb;
    color: var(--ui-ink);
}

body.profile-spb_zpi::before {
    background: linear-gradient(90deg, #5569ef, #28a9d8, #9b57e8);
    content: "";
    height: 3px;
    left: 0;
    position: fixed;
    right: 0;
    top: 0;
    z-index: 120;
}

body.profile-spb_zpi .app-header {
    backdrop-filter: blur(18px) saturate(145%);
    background: rgba(255, 255, 255, .88);
    border-bottom: 1px solid rgba(209, 220, 235, .85);
    box-shadow: 0 6px 24px rgba(31, 51, 83, .055);
    min-height: 72px;
    padding-left: max(24px, calc((100vw - 1440px) / 2));
    padding-right: max(24px, calc((100vw - 1440px) / 2));
    position: sticky;
    top: 0;
    z-index: 100;
}

body.profile-spb_zpi .brand {
    align-items: center;
    color: var(--ui-ink);
    display: inline-flex;
    font-size: 1rem;
    font-weight: 900;
    gap: 10px;
    letter-spacing: -.02em;
}

body.profile-spb_zpi .brand::before {
    background: linear-gradient(135deg, #5368ef, #7657da);
    border-radius: 10px;
    box-shadow: 0 7px 18px rgba(83, 104, 239, .26);
    content: "Z";
    color: #fff;
    display: grid;
    font-size: .76rem;
    height: 31px;
    letter-spacing: 0;
    place-items: center;
    width: 31px;
}

body.profile-spb_zpi .app-nav {
    align-items: center;
    gap: 4px;
}

body.profile-spb_zpi .app-nav a {
    border-radius: 10px;
    color: #5c6e88;
    font-weight: 650;
    padding: 10px 12px;
    position: relative;
    transition: background-color .18s ease, color .18s ease, transform .18s ease;
}

body.profile-spb_zpi .app-nav a:hover {
    background: #edf1fb;
    color: #304a89;
    transform: translateY(-1px);
}

body.profile-spb_zpi .app-nav a::after {
    background: linear-gradient(90deg, #5368ef, #8b63e7);
    border-radius: 999px;
    bottom: 4px;
    content: "";
    height: 2px;
    left: 50%;
    position: absolute;
    transform: translateX(-50%) scaleX(0);
    transition: transform .18s ease;
    width: calc(100% - 24px);
}

body.profile-spb_zpi .app-nav a:hover::after { transform: translateX(-50%) scaleX(1); }

body.profile-spb_zpi .icon-action {
    background: #edf2f9;
    border: 1px solid #dfe7f1;
    border-radius: 11px;
    box-shadow: none;
    color: #263a58;
    min-height: 42px;
    padding: 0 16px;
}

body.profile-spb_zpi .icon-action:hover {
    background: #17243a;
    border-color: #17243a;
    color: #fff;
}

body.profile-spb_zpi .calls-nav-badge {
    background: linear-gradient(135deg, #ef6374, #d9465f);
    border: 2px solid #fff;
    box-shadow: 0 4px 11px rgba(217, 70, 95, .28);
}

body.profile-spb_zpi .app-shell {
    animation: spb-page-in .34s cubic-bezier(.2, .75, .25, 1) both;
    max-width: 1280px;
    padding: 34px 28px 56px;
    width: 100%;
}

body.profile-spb_zpi .page-intro,
body.profile-spb_zpi .lead-hero,
body.profile-spb_zpi .customer-hero,
body.profile-spb_zpi .engineer-hero,
body.profile-spb_zpi .engineer-lead-hero,
body.profile-spb_zpi .manual-lead-intro,
body.profile-spb_zpi .calls-page-intro,
body.profile-spb_zpi .chat-page-heading {
    background:
        radial-gradient(circle at 88% 12%, rgba(255, 255, 255, .2), transparent 27%),
        linear-gradient(125deg, #17233a 0%, #304a89 58%, #656ded 100%);
    border: 0;
    border-radius: 24px;
    box-shadow: 0 20px 48px rgba(24, 42, 78, .17);
    color: #fff;
    margin-bottom: 20px;
    min-height: 140px;
    overflow: hidden;
    padding: 27px 32px;
    position: relative;
}

body.profile-spb_zpi .page-intro::after,
body.profile-spb_zpi .lead-hero::after,
body.profile-spb_zpi .customer-hero::after,
body.profile-spb_zpi .engineer-hero::after,
body.profile-spb_zpi .engineer-lead-hero::after,
body.profile-spb_zpi .manual-lead-intro::after,
body.profile-spb_zpi .calls-page-intro::after,
body.profile-spb_zpi .chat-page-heading::after {
    border: 1px solid rgba(255, 255, 255, .15);
    border-radius: 50%;
    content: "";
    height: 190px;
    pointer-events: none;
    position: absolute;
    right: -38px;
    top: -72px;
    width: 190px;
}

body.profile-spb_zpi .page-intro > *,
body.profile-spb_zpi .lead-hero > *,
body.profile-spb_zpi .customer-hero > *,
body.profile-spb_zpi .engineer-hero > *,
body.profile-spb_zpi .engineer-lead-hero > *,
body.profile-spb_zpi .manual-lead-intro > *,
body.profile-spb_zpi .calls-page-intro > *,
body.profile-spb_zpi .chat-page-heading > * { position: relative; z-index: 1; }

body.profile-spb_zpi :is(.page-intro, .lead-hero, .customer-hero, .engineer-hero, .engineer-lead-hero, .manual-lead-intro, .calls-page-intro, .chat-page-heading) h1,
body.profile-spb_zpi :is(.page-intro, .lead-hero, .customer-hero, .engineer-hero, .engineer-lead-hero, .manual-lead-intro, .calls-page-intro, .chat-page-heading) h2 { color: #fff; letter-spacing: -.03em; }

body.profile-spb_zpi :is(.page-intro, .lead-hero, .customer-hero, .engineer-hero, .engineer-lead-hero, .manual-lead-intro, .calls-page-intro, .chat-page-heading) p,
body.profile-spb_zpi :is(.page-intro, .lead-hero, .customer-hero, .engineer-hero, .engineer-lead-hero, .manual-lead-intro, .calls-page-intro, .chat-page-heading) span,
body.profile-spb_zpi :is(.page-intro, .lead-hero, .customer-hero, .engineer-hero, .engineer-lead-hero, .manual-lead-intro, .calls-page-intro, .chat-page-heading) .eyebrow { color: rgba(255, 255, 255, .78); }

body.profile-spb_zpi :is(.page-intro, .lead-hero, .customer-hero, .engineer-hero, .engineer-lead-hero, .manual-lead-intro, .calls-page-intro, .chat-page-heading) a:not(.primary-link) { color: #fff; }

body.profile-spb_zpi .eyebrow {
    color: #64779a;
    font-size: .7rem;
    font-weight: 900;
    letter-spacing: .075em;
}

body.profile-spb_zpi .primary-link,
body.profile-spb_zpi .open-link,
body.profile-spb_zpi button:not(.icon-action):not(.lead-comment-copy-button),
body.profile-spb_zpi input[type="submit"] {
    background: linear-gradient(135deg, #455fe8, #6173f2);
    border: 0;
    border-radius: 11px;
    box-shadow: 0 8px 20px rgba(69, 95, 232, .2);
    color: #fff;
    font-weight: 800;
    transition: box-shadow .18s ease, filter .18s ease, transform .18s ease;
}

body.profile-spb_zpi .primary-link:hover,
body.profile-spb_zpi .open-link:hover,
body.profile-spb_zpi button:not(.icon-action):not(.lead-comment-copy-button):hover,
body.profile-spb_zpi input[type="submit"]:hover {
    box-shadow: 0 12px 27px rgba(69, 95, 232, .29);
    filter: saturate(1.08);
    transform: translateY(-1px);
}

body.profile-spb_zpi :is(button, a, input, select, textarea, summary):focus-visible {
    outline: 3px solid rgba(83, 104, 239, .27);
    outline-offset: 3px;
}

body.profile-spb_zpi :is(input:not([type="checkbox"]):not([type="radio"]), select, textarea) {
    background: #fff;
    border: 1px solid #d6e0ed;
    border-radius: 11px;
    box-shadow: 0 1px 2px rgba(19, 34, 56, .025);
    color: var(--ui-ink);
    min-height: 44px;
    transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}

body.profile-spb_zpi :is(input:not([type="checkbox"]):not([type="radio"]), select, textarea):hover { border-color: #b8c7da; }
body.profile-spb_zpi :is(input:not([type="checkbox"]):not([type="radio"]), select, textarea):focus {
    border-color: #7182ee;
    box-shadow: 0 0 0 4px rgba(83, 104, 239, .11);
}

body.profile-spb_zpi :is(.record-panel, .dashboard-inbox, .attention-panel, .lead-card, .empty-state, .queue-panel, .source-panel, .analytics-panel, .history-panel, .owner-panel, .locked-panel, .system-panel, .system-backup-panel, .customer-history-panel, .customer-profile-panel, .customer-leads-panel, .customer-tasks-panel, .lead-data-panel, .lead-tasks-panel, .production-panel, .production-comments-panel, .production-files-panel) {
    background: var(--ui-panel);
    border: 1px solid var(--ui-line);
    border-radius: var(--ui-radius-lg);
    box-shadow: var(--ui-shadow);
}

body.profile-spb_zpi :is(.record-panel, .dashboard-inbox, .attention-panel, .lead-card, .empty-state, .queue-panel, .source-panel, .analytics-panel, .history-panel, .customer-history-panel, .customer-profile-panel, .customer-leads-panel, .customer-tasks-panel, .lead-data-panel, .lead-tasks-panel, .production-panel, .production-comments-panel, .production-files-panel) {
    transition: border-color .2s ease, box-shadow .22s ease, transform .22s ease;
}

body.profile-spb_zpi :is(.lead-card, .attention-card, .queue-lead, .work-mini-card, .work-lead-card, .engineer-job-card, .customer-lead-card):hover {
    border-color: rgba(83, 104, 239, .34);
    box-shadow: var(--ui-shadow-hover);
    transform: translateY(-3px);
}

body.profile-spb_zpi .impersonation-panel {
    background: linear-gradient(125deg, #fff, #f4f6ff);
    border-color: #d9e1f2;
    overflow: hidden;
    position: relative;
}

body.profile-spb_zpi .impersonation-panel::before {
    background: linear-gradient(180deg, #5368ef, #9a5ce5);
    bottom: 0;
    content: "";
    left: 0;
    position: absolute;
    top: 0;
    width: 4px;
}

body.profile-spb_zpi .dashboard-inbox-clear {
    background:
        radial-gradient(circle at 88% 12%, rgba(255, 255, 255, .2), transparent 27%),
        linear-gradient(125deg, #17233a 0%, #304a89 58%, #656ded 100%);
}

body.profile-spb_zpi .dashboard-inbox {
    background:
        radial-gradient(circle at 88% 12%, rgba(255, 255, 255, .2), transparent 27%),
        linear-gradient(125deg, #17233a 0%, #304a89 58%, #656ded 100%);
    border: 0;
    box-shadow: 0 20px 48px rgba(24, 42, 78, .17);
    color: #fff;
    min-height: 142px;
    overflow: hidden;
    padding: 27px 32px;
    position: relative;
}

body.profile-spb_zpi .dashboard-inbox::after {
    border: 1px solid rgba(255, 255, 255, .15);
    border-radius: 50%;
    content: "";
    height: 190px;
    pointer-events: none;
    position: absolute;
    right: -38px;
    top: -72px;
    width: 190px;
}

body.profile-spb_zpi .dashboard-inbox > * { position: relative; z-index: 1; }
body.profile-spb_zpi .dashboard-inbox > .inbox-head :is(h1, h2) { color: #fff; letter-spacing: -.03em; }
body.profile-spb_zpi .dashboard-inbox > .inbox-head :is(p, .eyebrow) { color: rgba(255, 255, 255, .78); }
body.profile-spb_zpi .dashboard-new-lead {
    color: var(--ui-ink);
}
body.profile-spb_zpi .dashboard-new-lead .lead-card-main h2,
body.profile-spb_zpi .dashboard-new-lead .lead-snippet {
    color: var(--ui-ink);
}
body.profile-spb_zpi .dashboard-new-lead :is(.lead-card-main p, .lead-source) {
    color: var(--ui-muted);
}
body.profile-spb_zpi .dashboard-inbox .primary-link {
    background: #fff;
    box-shadow: 0 9px 24px rgba(13, 26, 52, .17);
    color: #1d3150;
}

body.profile-spb_zpi .attention-panel { border-color: #efdbc6; }
body.profile-spb_zpi .attention-card-rich {
    background: linear-gradient(135deg, #f7f9fd, #f2f5fb);
    border: 1px solid #e1e7f0;
    border-left: 3px solid var(--ui-amber);
    border-radius: 14px;
}

body.profile-spb_zpi .attention-badge {
    border: 0;
    box-shadow: inset 0 0 0 1px rgba(190, 93, 93, .12);
}

body.profile-spb_zpi .lead-counters,
body.profile-spb_zpi .engineer-summary,
body.profile-spb_zpi .system-kpi-grid {
    gap: 12px;
}

body.profile-spb_zpi .lead-counters > *,
body.profile-spb_zpi .engineer-summary > *,
body.profile-spb_zpi .system-kpi {
    background: rgba(255, 255, 255, .95);
    border: 1px solid var(--ui-line);
    border-radius: 16px;
    box-shadow: 0 9px 26px rgba(31, 51, 83, .055);
    overflow: hidden;
    position: relative;
    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}

body.profile-spb_zpi .lead-counters > *::before,
body.profile-spb_zpi .engineer-summary > *::before,
body.profile-spb_zpi .system-kpi::before {
    background: linear-gradient(90deg, #5368ef, #28a9d8);
    content: "";
    height: 3px;
    left: 0;
    opacity: .8;
    position: absolute;
    right: 0;
    top: 0;
}

body.profile-spb_zpi .lead-counters > *:hover,
body.profile-spb_zpi .engineer-summary > *:hover {
    border-color: rgba(83, 104, 239, .32);
    box-shadow: 0 15px 34px rgba(31, 51, 83, .11);
    transform: translateY(-2px);
}

body.profile-spb_zpi .dashboard-actions,
body.profile-spb_zpi .status-chips,
body.profile-spb_zpi .work-tabs,
body.profile-spb_zpi .calls-tabs,
body.profile-spb_zpi .chat-channel-tabs,
body.profile-spb_zpi .chat-status-tabs,
body.profile-spb_zpi .chat-lifecycle-tabs {
    background: #e9eef7;
    border: 1px solid #d8e1ee;
    border-radius: 16px;
    gap: 5px;
    padding: 5px;
}

body.profile-spb_zpi :is(.dashboard-actions, .status-chips, .work-tabs, .calls-tabs, .chat-channel-tabs, .chat-status-tabs, .chat-lifecycle-tabs) a,
body.profile-spb_zpi :is(.chat-channel-tab, .chat-filter-pill) {
    background: transparent;
    border: 0;
    border-radius: 11px;
    box-shadow: none;
    color: #5b6d87;
    transition: background .18s ease, box-shadow .18s ease, color .18s ease, transform .18s ease;
}

body.profile-spb_zpi :is(.dashboard-actions, .status-chips, .work-tabs, .calls-tabs, .chat-channel-tabs, .chat-status-tabs, .chat-lifecycle-tabs) a:hover,
body.profile-spb_zpi :is(.chat-channel-tab, .chat-filter-pill):hover {
    background: rgba(255, 255, 255, .72);
    color: var(--ui-ink);
    transform: translateY(-1px);
}

body.profile-spb_zpi :is(.dashboard-actions, .status-chips, .work-tabs, .calls-tabs, .chat-channel-tabs, .chat-status-tabs, .chat-lifecycle-tabs) .is-active,
body.profile-spb_zpi :is(.chat-channel-tab, .chat-filter-pill).is-active {
    background: #fff;
    box-shadow: 0 5px 17px rgba(31, 51, 83, .1);
    color: #243957;
}

body.profile-spb_zpi .lead-card {
    border-left: 3px solid #cbd6e6;
    overflow: hidden;
}
body.profile-spb_zpi .lead-card.status-new,
body.profile-spb_zpi .lead-card.new-age-ok { border-left-color: var(--ui-green); }
body.profile-spb_zpi .lead-card.new-age-warn { border-left-color: var(--ui-amber); }
body.profile-spb_zpi .lead-card.new-age-danger { border-left-color: var(--ui-rose); }

body.profile-spb_zpi .lead-topline {
    border-bottom: 1px solid #e8edf4;
    padding-bottom: 10px;
}

body.profile-spb_zpi .spb-zpi-card-rail,
body.profile-spb_zpi .lead-static-summary,
body.profile-spb_zpi .customer-lead-fields > div,
body.profile-spb_zpi .customer-profile-grid > div,
body.profile-spb_zpi .call-facts > div,
body.profile-spb_zpi .stage-facts > div {
    background: var(--ui-panel-soft);
    border-color: #e4eaf2;
    border-radius: 12px;
}

body.profile-spb_zpi .status-pill,
body.profile-spb_zpi .new-lead-age,
body.profile-spb_zpi .lead-card-meta-chips span,
body.profile-spb_zpi .task-type-label {
    border-radius: 999px;
    font-weight: 850;
    letter-spacing: .015em;
}

body.profile-spb_zpi .queue-head,
body.profile-spb_zpi .section-head,
body.profile-spb_zpi .task-section-head,
body.profile-spb_zpi .customer-section-head,
body.profile-spb_zpi .panel-headline {
    border-bottom-color: #e7edf5;
    padding-bottom: 14px;
}

body.profile-spb_zpi .task-card,
body.profile-spb_zpi .dashboard-task-item,
body.profile-spb_zpi .queue-lead,
body.profile-spb_zpi .work-mini-card,
body.profile-spb_zpi .engineer-job-card,
body.profile-spb_zpi .customer-lead-card,
body.profile-spb_zpi .phone-history-card {
    background: linear-gradient(135deg, #fff, #f9fbfe);
    border: 1px solid #e1e8f1;
    border-radius: 14px;
    box-shadow: 0 7px 20px rgba(31, 51, 83, .045);
}

body.profile-spb_zpi .engineer-job-grid { gap: 10px; }

body.profile-spb_zpi .engineer-job-card {
    border-left-width: 5px;
    font-family: inherit;
    overflow: hidden;
}

body.profile-spb_zpi .engineer-job-card.status-queued { border-left-color: #596fe5; }
body.profile-spb_zpi .engineer-job-card.status-preparing_files { border-left-color: #d89b18; }
body.profile-spb_zpi .engineer-job-card.status-production { border-left-color: #1473e6; }
body.profile-spb_zpi .engineer-job-card.status-ready { border-left-color: #27a361; }
body.profile-spb_zpi .engineer-job-card.status-completed { border-left-color: #7d8b9e; }

body.profile-spb_zpi .task-card { border-left: 3px solid #7384eb; }
body.profile-spb_zpi .task-card.is-overdue,
body.profile-spb_zpi .dashboard-task-item.is-overdue { border-left-color: var(--ui-rose); }

body.profile-spb_zpi .work-board,
body.profile-spb_zpi .dashboard-queues,
body.profile-spb_zpi .task-groups,
body.profile-spb_zpi .dashboard-task-groups,
body.profile-spb_zpi .engineer-job-grid {
    gap: 16px;
}

body.profile-spb_zpi .settings-section-title {
    align-items: end;
    display: flex;
    justify-content: space-between;
    margin: 28px 0 12px;
}

body.profile-spb_zpi .directory-grid { gap: 14px; }
body.profile-spb_zpi .directory-grid a,
body.profile-spb_zpi .directory-card,
body.profile-spb_zpi .settings-create {
    background: linear-gradient(135deg, #fff, #f8faff);
    border: 1px solid var(--ui-line);
    border-radius: 16px;
    box-shadow: 0 10px 28px rgba(31, 51, 83, .06);
    transition: border-color .18s ease, box-shadow .2s ease, transform .2s ease;
}

body.profile-spb_zpi .directory-grid a:hover,
body.profile-spb_zpi .directory-card:hover {
    border-color: rgba(83, 104, 239, .32);
    box-shadow: 0 16px 36px rgba(31, 51, 83, .11);
    transform: translateY(-3px);
}

body.profile-spb_zpi .settings-create > summary,
body.profile-spb_zpi details > summary {
    border-radius: 12px;
    transition: background .18s ease, color .18s ease;
}
body.profile-spb_zpi details > summary:hover { background: #f0f3fb; color: #304a89; }

body.profile-spb_zpi .records-table,
body.profile-spb_zpi .backup-table,
body.profile-spb_zpi .report-table {
    border-collapse: separate;
    border-spacing: 0;
    overflow: hidden;
}

body.profile-spb_zpi :is(.records-table, .backup-table, .report-table) th {
    background: #f4f7fb;
    color: #667894;
    font-size: .69rem;
    letter-spacing: .055em;
    text-transform: uppercase;
}

body.profile-spb_zpi :is(.records-table, .backup-table, .report-table) td {
    border-bottom-color: #e8edf4;
    transition: background .16s ease;
}
body.profile-spb_zpi :is(.records-table, .backup-table, .report-table) tr:hover td { background: #f8faff; }

body.profile-spb_zpi .calls-quick-search,
body.profile-spb_zpi .lead-search,
body.profile-spb_zpi .deleted-search,
body.profile-spb_zpi .chat-controls {
    background: rgba(255, 255, 255, .88);
    border: 1px solid var(--ui-line);
    border-radius: 17px;
    box-shadow: 0 10px 30px rgba(31, 51, 83, .055);
    padding: 12px;
}

body.profile-spb_zpi .call-card {
    background: #fff;
    border: 1px solid var(--ui-line);
    border-left: 3px solid var(--ui-cyan);
    border-radius: 18px;
    box-shadow: var(--ui-shadow);
    overflow: hidden;
    transition: border-color .2s ease, box-shadow .22s ease, transform .22s ease;
}
body.profile-spb_zpi .call-card:hover {
    border-color: rgba(40, 169, 216, .38);
    box-shadow: var(--ui-shadow-hover);
    transform: translateY(-2px);
}
body.profile-spb_zpi .call-card.is-historical { border-left-color: #a9b6c8; opacity: .92; }

body.profile-spb_zpi .call-card-header,
body.profile-spb_zpi .call-card-actions { background: #f8faff; border-color: #e7edf5; }

body.profile-spb_zpi .chat-workspace {
    background: rgba(255, 255, 255, .96);
    border: 1px solid var(--ui-line);
    border-radius: 22px;
    box-shadow: 0 18px 44px rgba(31, 51, 83, .09);
    overflow: hidden;
}

body.profile-spb_zpi .chat-sidebar { background: #f7f9fc; border-color: #e2e8f1; }
body.profile-spb_zpi .chat-sidebar-heading,
body.profile-spb_zpi .chat-thread-header,
body.profile-spb_zpi .chat-thread-actions,
body.profile-spb_zpi .chat-composer { background: rgba(255, 255, 255, .94); border-color: #e4eaf2; }

body.profile-spb_zpi .chat-preview {
    border-left: 3px solid transparent;
    transition: background .16s ease, border-color .16s ease, transform .16s ease;
}
body.profile-spb_zpi .chat-preview:hover { background: #edf2fa; transform: translateX(2px); }
body.profile-spb_zpi .chat-preview.is-active { background: #e9effd; border-left-color: var(--ui-indigo); }

body.profile-spb_zpi .chat-transcript {
    background:
        radial-gradient(circle at 10% 10%, rgba(83, 104, 239, .045), transparent 18rem),
        #f4f7fb;
}

body.profile-spb_zpi .chat-message-card {
    border-radius: 16px;
    box-shadow: 0 6px 18px rgba(31, 51, 83, .045);
}

body.profile-spb_zpi .chat-message-row.is-manager .chat-message-card,
body.profile-spb_zpi .chat-message-row.is-outbound .chat-message-card {
    background: linear-gradient(135deg, #eaf2ff, #edf0ff);
    border-color: #ccdafa;
}

body.profile-spb_zpi .chat-live-dot,
body.profile-spb_zpi .report-hero-status > span {
    animation: spb-status-pulse 2.2s ease-in-out infinite;
}

body.profile-spb_zpi .notice,
body.profile-spb_zpi .flash,
body.profile-spb_zpi .chat-notice {
    border: 0;
    border-left: 4px solid currentColor;
    border-radius: 14px;
    box-shadow: 0 8px 24px rgba(31, 51, 83, .06);
    padding: 14px 16px;
}

body.profile-spb_zpi .empty-state {
    background:
        radial-gradient(circle at 92% 0, rgba(83, 104, 239, .07), transparent 30%),
        #fff;
    padding: 28px;
}

body.profile-spb_zpi .pagination,
body.profile-spb_zpi .lead-pagination,
body.profile-spb_zpi .chat-pagination { gap: 6px; }
body.profile-spb_zpi :is(.pagination, .lead-pagination, .chat-pagination) a {
    background: #fff;
    border: 1px solid var(--ui-line);
    border-radius: 10px;
    box-shadow: 0 4px 13px rgba(31, 51, 83, .045);
}

body.profile-spb_zpi .danger-button,
body.profile-spb_zpi .chat-action-dismiss,
body.profile-spb_zpi .delete-lead-form button {
    background: linear-gradient(135deg, #df5368, #c83f58) !important;
    box-shadow: 0 8px 20px rgba(207, 65, 89, .2) !important;
}

body.profile-spb_zpi .chat-action-read {
    background: linear-gradient(135deg, #edf3ff, #e5ecff) !important;
    border: 1px solid #c9d6ff !important;
    box-shadow: none !important;
    color: #304fba !important;
}

body.profile-spb_zpi .secondary-link,
body.profile-spb_zpi .button-dark,
body.profile-spb_zpi .secondary-actions button,
body.profile-spb_zpi .search-actions a {
    background: #edf2f8;
    border: 1px solid #dce5ef;
    border-radius: 10px;
    box-shadow: none;
    color: #40536f;
}

body.profile-spb_zpi .report-page-modern { animation: none; }
body.profile-spb_zpi .report-panel,
body.profile-spb_zpi .report-kpis-modern article,
body.profile-spb_zpi .report-toolbar-modern { backdrop-filter: blur(8px); }

body.page-login {
    background:
        radial-gradient(circle at 16% 15%, rgba(108, 118, 239, .34), transparent 28rem),
        radial-gradient(circle at 86% 82%, rgba(40, 169, 216, .2), transparent 30rem),
        linear-gradient(135deg, #111c31 0%, #263d70 56%, #4d5fd0 100%);
}

body.page-login .login-shell { position: relative; }
body.page-login .login-shell::before,
body.page-login .login-shell::after {
    border: 1px solid rgba(255, 255, 255, .09);
    border-radius: 50%;
    content: "";
    pointer-events: none;
    position: fixed;
}
body.page-login .login-shell::before { height: 360px; right: -110px; top: -140px; width: 360px; }
body.page-login .login-shell::after { bottom: -170px; height: 420px; left: -130px; width: 420px; }

body.page-login .login-panel {
    animation: spb-page-in .45s cubic-bezier(.2, .75, .25, 1) both;
    backdrop-filter: blur(18px) saturate(130%);
    background: rgba(255, 255, 255, .94);
    border: 1px solid rgba(255, 255, 255, .7);
    border-radius: 26px;
    box-shadow: 0 30px 80px rgba(5, 16, 38, .3);
    position: relative;
    z-index: 1;
}

body.page-login .login-copy {
    align-content: center;
    display: grid;
}
body.page-login .login-logo {
    border-radius: 18px;
    box-shadow: 0 14px 34px rgba(31, 51, 83, .14);
    max-height: 92px;
}
body.page-login .login-copy h1 { color: #14233a; letter-spacing: -.035em; }
body.page-login .login-form {
    background: linear-gradient(135deg, #f5f7fd, #eef2fb);
    border: 1px solid #dfe6f1;
    border-radius: 18px;
    padding: 22px;
}
body.page-login .login-form input {
    background: #fff;
    border: 1px solid #d4deeb;
    border-radius: 11px;
    box-shadow: 0 1px 2px rgba(19, 34, 56, .03);
}
body.page-login .login-form input:focus {
    border-color: #7182ee;
    box-shadow: 0 0 0 4px rgba(83, 104, 239, .11);
    outline: 0;
}
body.page-login .login-form button {
    background: linear-gradient(135deg, #455fe8, #7359dd);
    border: 0;
    border-radius: 11px;
    box-shadow: 0 10px 24px rgba(69, 95, 232, .25);
    color: #fff;
    font-weight: 850;
    transition: box-shadow .18s ease, transform .18s ease;
}
body.page-login .login-form button:hover { box-shadow: 0 14px 30px rgba(69, 95, 232, .34); transform: translateY(-1px); }

@keyframes spb-page-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes spb-status-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(34, 180, 128, .28); }
    50% { box-shadow: 0 0 0 7px rgba(34, 180, 128, 0); }
}

@media (max-width: 900px) {
    body.profile-spb_zpi .app-header {
        padding-left: 18px;
        padding-right: 18px;
    }

    body.profile-spb_zpi .app-shell { padding: 24px 18px 44px; }
}

@media (max-width: 719px) {
    body.profile-spb_zpi .app-header {
        align-items: center;
        display: grid;
        gap: 10px;
        grid-template-columns: minmax(0, 1fr) auto;
        padding: 12px 14px;
    }

    body.profile-spb_zpi .brand::before { height: 28px; width: 28px; }
    body.profile-spb_zpi .app-nav {
        display: flex;
        gap: 4px;
        grid-column: 1 / -1;
        overflow-x: auto;
        padding: 2px 0 5px;
        scrollbar-width: none;
    }
    body.profile-spb_zpi .app-nav::-webkit-scrollbar { display: none; }
    body.profile-spb_zpi .app-nav a { flex: 0 0 auto; padding: 8px 10px; }
    body.profile-spb_zpi .app-shell { padding: 18px 12px 38px; }

    body.profile-spb_zpi .page-intro,
    body.profile-spb_zpi .lead-hero,
    body.profile-spb_zpi .customer-hero,
    body.profile-spb_zpi .engineer-hero,
    body.profile-spb_zpi .engineer-lead-hero,
    body.profile-spb_zpi .manual-lead-intro,
    body.profile-spb_zpi .calls-page-intro,
    body.profile-spb_zpi .chat-page-heading {
        align-items: flex-start;
        border-radius: 18px;
        min-height: 0;
        padding: 22px 19px;
    }

    body.profile-spb_zpi :is(.page-intro, .lead-hero, .customer-hero, .engineer-hero, .engineer-lead-hero, .manual-lead-intro, .calls-page-intro, .chat-page-heading) h1 { font-size: clamp(1.8rem, 9vw, 2.35rem); }

    body.profile-spb_zpi .dashboard-actions,
    body.profile-spb_zpi .status-chips,
    body.profile-spb_zpi .work-tabs,
    body.profile-spb_zpi .calls-tabs,
    body.profile-spb_zpi .chat-channel-tabs,
    body.profile-spb_zpi .chat-status-tabs,
    body.profile-spb_zpi .chat-lifecycle-tabs {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        overflow: visible;
    }

    body.profile-spb_zpi :is(.dashboard-actions, .status-chips, .work-tabs, .calls-tabs, .chat-channel-tabs, .chat-status-tabs, .chat-lifecycle-tabs) > * {
        justify-content: center;
        min-width: 0;
        text-align: center;
        width: 100%;
    }

    body.profile-spb_zpi :is(.record-panel, .dashboard-inbox, .attention-panel, .lead-card, .empty-state, .queue-panel, .source-panel, .analytics-panel, .history-panel, .owner-panel, .locked-panel, .system-panel, .system-backup-panel, .customer-history-panel, .customer-profile-panel, .customer-leads-panel, .customer-tasks-panel, .lead-data-panel, .lead-tasks-panel, .production-panel, .production-comments-panel, .production-files-panel) {
        border-radius: 17px;
    }

    body.profile-spb_zpi .chat-workspace { border-radius: 17px; }
    body.profile-spb_zpi .directory-grid { grid-template-columns: minmax(0, 1fr); }
    body.page-login .login-panel { border-radius: 20px; padding: 20px; }
    body.page-login .login-form { padding: 17px; }
}

@media (prefers-reduced-motion: reduce) {
    body.profile-spb_zpi .app-shell,
    body.profile-spb_zpi .chat-live-dot,
    body.profile-spb_zpi .report-hero-status > span { animation: none; }
body.profile-spb_zpi *,
body.profile-spb_zpi *::before,
body.profile-spb_zpi *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}

/* Keep the engineer archive toggle readable on the dark hero. */
body.profile-spb_zpi .engineer-hero .secondary-link {
    align-items: center;
    background: #fff;
    border: 1px solid rgba(255, 255, 255, .72);
    border-radius: 11px;
    box-shadow: 0 8px 20px rgba(15, 28, 57, .2);
    color: #243b72 !important;
    display: inline-flex;
    font-weight: 800;
    min-height: 42px;
    padding: 9px 15px;
    text-decoration: none;
}

body.profile-spb_zpi .engineer-hero .secondary-link:hover,
body.profile-spb_zpi .engineer-hero a.secondary-link:focus-visible,
body.profile-spb_zpi .engineer-hero a.secondary-link:active {
    background: #f2f5ff;
    color: #172a5c !important;
    transform: translateY(-1px);
}

/* Preserve semantic production-stage contrast inside the dark engineer hero. */
body.profile-spb_zpi .engineer-lead-hero .production-stage {
    border: 1px solid rgba(20, 35, 58, .12);
    color: #30445f;
}

body.profile-spb_zpi .engineer-lead-hero .production-stage.stage-preparing_files {
    background: #fff1c2;
    color: #7d5800;
}

body.profile-spb_zpi .engineer-lead-hero .production-stage.stage-production {
    background: #dcecff;
    color: #13559c;
}

body.profile-spb_zpi .engineer-lead-hero .production-stage.stage-ready {
    background: #dff6e8;
    color: #17643a;
}

body.profile-spb_zpi .engineer-lead-hero .production-stage.stage-completed {
    background: #e9edf2;
    color: #465467;
}

/* Engineer workspace: keep every production control in the shared CRM system. */
body.profile-spb_zpi .engineer-control-panel {
    padding: 22px;
}

body.profile-spb_zpi .engineer-control-panel .queue-head {
    align-items: center;
    margin-bottom: 18px;
}

body.profile-spb_zpi .engineer-control-panel .queue-head > span,
body.profile-spb_zpi .lead-tasks-panel .task-section-head > span {
    align-items: center;
    background: #edf2f9;
    border: 1px solid #dfe7f1;
    border-radius: 999px;
    color: #425571;
    display: inline-flex;
    font-size: .75rem;
    font-weight: 850;
    justify-content: center;
    min-height: 32px;
    min-width: 32px;
    padding: 5px 9px;
}

body.profile-spb_zpi .engineer-control-panel :is(.production-inline-form, .production-upload-form, .production-comment-form) {
    align-items: end;
    display: grid;
    gap: 12px;
    grid-template-columns: minmax(0, 1fr) minmax(180px, .48fr);
}

body.profile-spb_zpi .engineer-control-panel :is(.production-inline-form, .production-upload-form, .production-comment-form) label {
    color: #31445f;
    display: grid;
    font-size: .78rem;
    font-weight: 800;
    gap: 7px;
    min-width: 0;
}

body.profile-spb_zpi .engineer-control-panel :is(input[type="datetime-local"], input[type="file"], textarea) {
    padding: 11px 13px;
    width: 100%;
}

body.profile-spb_zpi .engineer-control-panel input[type="file"] {
    background: #f7f9fd;
    border: 1px dashed #b9c7da;
    cursor: pointer;
    min-height: 50px;
    padding: 6px;
}

body.profile-spb_zpi .engineer-control-panel input[type="file"]::file-selector-button {
    background: #e9efff;
    border: 0;
    border-radius: 8px;
    color: #334fba;
    cursor: pointer;
    font-weight: 800;
    margin-right: 12px;
    padding: 9px 13px;
}

body.profile-spb_zpi .engineer-control-panel textarea {
    line-height: 1.45;
    min-height: 92px;
    resize: vertical;
}

body.profile-spb_zpi .engineer-control-panel :is(.production-inline-form, .production-upload-form, .production-comment-form) > button {
    align-items: center;
    cursor: pointer;
    display: inline-flex;
    justify-content: center;
    min-height: 48px;
    padding: 11px 18px;
    width: 100%;
}

body.profile-spb_zpi .production-file-list {
    display: grid;
    gap: 8px;
}

body.profile-spb_zpi .production-file-list > p,
body.profile-spb_zpi .production-comments > p {
    color: #6a7890;
    margin: 0;
}

@media (max-width: 760px) {
    body.profile-spb_zpi .production-file-row {
        align-items: stretch;
    }

    body.profile-spb_zpi .production-file-row > a {
        align-items: flex-start;
        flex-direction: column;
        gap: 3px;
    }

    body.profile-spb_zpi .production-file-delete-button {
        min-height: 42px;
    }
}

/* SPB-ZPI production workspace visual polish v3 */
body.profile-spb_zpi {
    --production-accent: #5568f4;
    --production-accent-dark: #3348cf;
    --production-ink: #17243b;
    --production-soft: #f4f7fc;
    --production-line: #dbe4f2;
    --production-shadow: 0 9px 24px rgba(35, 58, 96, .08);
}

body.profile-spb_zpi .engineer-workspace-shell {
    padding-top: 14px;
    padding-bottom: 28px;
}

body.profile-spb_zpi :is(.engineer-detail-head, .production-overview, .operations-overview) {
    background:
        radial-gradient(circle at 93% 10%, rgba(112, 126, 255, .13), transparent 28%),
        linear-gradient(135deg, #ffffff 0%, #f7f9ff 100%);
    border: 1px solid #d8e1f2;
    box-shadow: var(--production-shadow);
}

body.profile-spb_zpi :is(.engineer-compact-panel, .engineer-current-stage, .engineer-compact-details, .production-workspace-panel) {
    border: 1px solid var(--production-line);
    box-shadow: 0 5px 16px rgba(35, 58, 96, .055);
}

body.profile-spb_zpi .production-queue-card {
    background: #fff;
    border: 1px solid var(--production-line);
    border-left: 3px solid var(--production-accent);
    border-radius: 16px;
    box-shadow: var(--production-shadow);
    overflow: hidden;
    transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}

body.profile-spb_zpi .production-queue-card:hover {
    border-color: #c7d3eb;
    box-shadow: 0 12px 28px rgba(35, 58, 96, .11);
    transform: translateY(-1px);
}

body.profile-spb_zpi .production-queue-card.status-ready {
    border-left-color: #1b9a70;
}

body.profile-spb_zpi .production-queue-card.status-production,
body.profile-spb_zpi .production-queue-card.status-in_progress {
    border-left-color: #2e76de;
}

body.profile-spb_zpi .production-queue-card-head h2 a {
    text-decoration-color: #aebbf0;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}

body.profile-spb_zpi .production-queue-card-head h2 a:hover {
    color: var(--production-accent-dark);
    text-decoration-color: currentColor;
}

body.profile-spb_zpi .production-stage,
body.profile-spb_zpi .production-chat-unread {
    border: 1px solid rgba(61, 80, 132, .09);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .65);
    letter-spacing: .01em;
}

body.profile-spb_zpi .production-stage.stage-preparing_files {
    background: #fff1ca;
    color: #785100;
}

body.profile-spb_zpi .production-stage.stage-production,
body.profile-spb_zpi .production-stage.stage-in_progress {
    background: #e5efff;
    color: #1955ad;
}

body.profile-spb_zpi .production-stage.stage-ready,
body.profile-spb_zpi .production-stage.stage-returned,
body.profile-spb_zpi .production-stage.stage-completed {
    background: #ddf6ec;
    color: #116f50;
}

body.profile-spb_zpi .production-queue-spec p,
body.profile-spb_zpi .production-queue-notes p,
body.profile-spb_zpi .engineer-request-grid-compact > :is(p, div),
body.profile-spb_zpi .engineer-production-summary > div {
    background: linear-gradient(145deg, #f7f9fd, #f1f5fb);
    border: 1px solid #e0e7f2;
}

body.profile-spb_zpi .production-queue-spec strong,
body.profile-spb_zpi .production-queue-notes strong,
body.profile-spb_zpi .engineer-request-grid-compact strong,
body.profile-spb_zpi .production-summary dt {
    color: #61728d;
    letter-spacing: .035em;
}

body.profile-spb_zpi .production-queue-actions {
    border-top: 1px solid #e6ebf4;
}

body.profile-spb_zpi .production-queue-actions :is(.primary-link, button),
body.profile-spb_zpi .engineer-control-panel .primary-button,
body.profile-spb_zpi .production-chat-send {
    background: linear-gradient(135deg, var(--production-accent-dark), #6574f8);
    border-color: transparent;
    box-shadow: 0 5px 13px rgba(73, 88, 224, .19);
    color: #fff;
}

body.profile-spb_zpi .production-queue-actions :is(.primary-link, button):hover,
body.profile-spb_zpi .engineer-control-panel .primary-button:hover,
body.profile-spb_zpi .production-chat-send:hover {
    box-shadow: 0 7px 17px rgba(73, 88, 224, .26);
    filter: brightness(1.025);
}

body.profile-spb_zpi .production-work-file-card {
    background: linear-gradient(150deg, #fff 0%, #f7f9fe 100%);
    border: 1px solid #d9e3f2;
    box-shadow: 0 4px 12px rgba(44, 64, 100, .055);
    transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}

body.profile-spb_zpi .production-work-file-card:hover {
    border-color: #bac9e5;
    box-shadow: 0 7px 18px rgba(44, 64, 100, .1);
    transform: translateY(-1px);
}

body.profile-spb_zpi .production-work-file-link {
    color: #174fae;
    text-decoration: none;
}

body.profile-spb_zpi .production-work-file-link::before {
    color: #6a7df2;
    content: "↗";
    font-size: .7rem;
    margin-right: 5px;
}

body.profile-spb_zpi .compact-file-action span {
    background: #fff;
    border-color: #c7d3e8;
    color: #27466f;
    transition: background .15s ease, border-color .15s ease, color .15s ease;
}

body.profile-spb_zpi .compact-file-action:hover span {
    background: #edf2ff;
    border-color: #92a5e5;
    color: #2649c8;
}

body.profile-spb_zpi .production-files-add-picker {
    background: linear-gradient(135deg, #f7f9ff, #eef3ff);
    border-color: #aebde3;
}

body.profile-spb_zpi .production-files-add-picker:hover {
    background: #eaf0ff;
    border-color: #788de0;
}

body.profile-spb_zpi .production-chat-panel {
    background:
        radial-gradient(circle at 100% 0, rgba(96, 112, 245, .08), transparent 32%),
        #fff;
}

body.profile-spb_zpi .production-chat-panel .panel-headline {
    border-bottom: 1px solid #e5eaf3;
    padding-bottom: 7px;
}

body.profile-spb_zpi .production-chat-stream {
    scrollbar-color: #aab8d0 transparent;
    scrollbar-width: thin;
}

body.profile-spb_zpi .production-chat-message {
    background: #f7f9fd;
    border-color: #dce5f2;
    border-left: 3px solid #9badf3;
    box-shadow: 0 2px 7px rgba(44, 64, 100, .035);
}

body.profile-spb_zpi .production-chat-message > div > strong {
    color: var(--production-ink);
}

body.profile-spb_zpi .production-chat-attachments {
    align-items: stretch;
}

body.profile-spb_zpi .production-chat-attachments a {
    text-decoration: none;
}

body.profile-spb_zpi .production-chat-image-attachment {
    align-items: center;
    background: #fff;
    border: 1px solid #d4dff0;
    display: grid;
    gap: 7px;
    grid-template-columns: 54px minmax(0, 1fr);
    max-width: min(100%, 310px);
    min-width: 0;
    padding: 4px;
    transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}

body.profile-spb_zpi .production-chat-image-attachment:hover {
    border-color: #94a8e5;
    box-shadow: 0 6px 15px rgba(44, 64, 100, .12);
    transform: translateY(-1px);
}

body.profile-spb_zpi .production-chat-image-attachment img {
    background: #edf1f7;
    border-radius: 5px;
    height: 44px;
    object-fit: cover;
    width: 54px;
}

body.profile-spb_zpi .production-chat-image-attachment > span {
    display: grid;
    gap: 1px;
    min-width: 0;
}

body.profile-spb_zpi .production-chat-image-attachment strong {
    color: #224b99;
    font-size: .7rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

body.profile-spb_zpi .production-chat-image-attachment small {
    color: #7b899e;
    font-size: .6rem;
}

body.profile-spb_zpi .production-chat-file-attachment {
    align-items: center;
    background: #eef3ff;
    border: 1px solid #cfdaef;
    display: inline-flex;
    gap: 5px;
    max-width: 100%;
}

body.profile-spb_zpi .production-chat-file-attachment strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

body.profile-spb_zpi .production-chat-form {
    background: #f6f8fc;
    border: 1px solid #e0e7f2;
    border-radius: 11px;
    padding: 5px;
}

body.profile-spb_zpi .production-chat-message-field textarea {
    background: #fff;
    border-color: transparent;
    box-shadow: inset 0 0 0 1px #d4deed;
}

body.profile-spb_zpi .production-chat-message-field textarea:focus {
    box-shadow: inset 0 0 0 2px #7d90e8;
    outline: none;
}

body.profile-spb_zpi .production-screenshot-item a[data-production-image-preview] {
    cursor: zoom-in;
}

body.profile-spb_zpi.production-image-viewer-open {
    overflow: hidden;
}

body.profile-spb_zpi .production-image-viewer[hidden] {
    display: none !important;
}

body.profile-spb_zpi .production-image-viewer {
    align-items: center;
    display: grid;
    inset: 0;
    justify-items: center;
    padding: 22px;
    position: fixed;
    z-index: 10000;
}

body.profile-spb_zpi .production-image-viewer-backdrop {
    backdrop-filter: blur(7px);
    background: rgba(12, 22, 42, .72);
    border: 0;
    cursor: zoom-out;
    inset: 0;
    padding: 0;
    position: absolute;
    width: 100%;
}

body.profile-spb_zpi .production-image-viewer-card {
    background: #fff;
    border: 1px solid rgba(255, 255, 255, .55);
    border-radius: 16px;
    box-shadow: 0 28px 80px rgba(5, 14, 32, .42);
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    margin: 0;
    max-height: calc(100vh - 44px);
    max-width: min(1180px, calc(100vw - 44px));
    min-height: min(520px, calc(100vh - 44px));
    overflow: hidden;
    position: relative;
    width: min(1180px, calc(100vw - 44px));
    z-index: 1;
}

body.profile-spb_zpi .production-image-viewer-head,
body.profile-spb_zpi .production-image-viewer-actions {
    align-items: center;
    display: flex;
    gap: 10px;
    justify-content: space-between;
    min-width: 0;
    padding: 10px 13px;
}

body.profile-spb_zpi .production-image-viewer-head {
    border-bottom: 1px solid #e2e8f2;
}

body.profile-spb_zpi .production-image-viewer-head figcaption {
    color: var(--production-ink);
    font-size: .85rem;
    font-weight: 790;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

body.profile-spb_zpi .production-image-viewer-controls {
    align-items: center;
    display: inline-flex;
    flex: none;
    gap: 5px;
}

body.profile-spb_zpi .production-image-viewer-controls button {
    align-items: center;
    background: #edf1f7;
    border: 1px solid #d6dfed;
    border-radius: 9px;
    color: #36465e;
    cursor: pointer;
    display: inline-flex;
    font-size: 1.25rem;
    height: 32px;
    justify-content: center;
    min-height: 32px;
    padding: 0;
    width: 32px;
}

body.profile-spb_zpi .production-image-viewer-controls button:hover {
    background: #e2e9f5;
    border-color: #bdcbe0;
}

body.profile-spb_zpi .production-image-viewer-controls button:disabled {
    cursor: default;
    opacity: .42;
}

body.profile-spb_zpi .production-image-viewer-controls .production-image-zoom-reset {
    color: #294ba8;
    font-size: .72rem;
    font-weight: 800;
    min-width: 52px;
    width: auto;
}

body.profile-spb_zpi .production-image-viewer-controls .production-image-close {
    background: #fff1f3;
    border-color: #f0d0d6;
    color: #ad3048;
    margin-left: 3px;
}

body.profile-spb_zpi .production-image-viewer-canvas {
    align-items: center;
    background:
        linear-gradient(45deg, #e9edf3 25%, transparent 25%),
        linear-gradient(-45deg, #e9edf3 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #e9edf3 75%),
        linear-gradient(-45deg, transparent 75%, #e9edf3 75%),
        #f4f6f9;
    background-position: 0 0, 0 8px, 8px -8px, -8px 0;
    background-size: 16px 16px;
    display: grid;
    justify-items: center;
    min-height: 0;
    overflow: hidden;
    padding: 12px;
    position: relative;
    touch-action: none;
    user-select: none;
}

body.profile-spb_zpi .production-image-viewer.is-ready .production-image-viewer-canvas {
    cursor: zoom-in;
}

body.profile-spb_zpi .production-image-viewer.is-zoomed .production-image-viewer-canvas {
    cursor: grab;
}

body.profile-spb_zpi .production-image-viewer.is-panning .production-image-viewer-canvas {
    cursor: grabbing;
}

body.profile-spb_zpi .production-image-viewer-canvas > span {
    background: rgba(255, 255, 255, .9);
    border-radius: 999px;
    color: #596a82;
    font-size: .78rem;
    padding: 6px 10px;
    position: absolute;
}

body.profile-spb_zpi .production-image-viewer.is-ready .production-image-viewer-canvas > span {
    display: none;
}

body.profile-spb_zpi .production-image-viewer.is-error .production-image-viewer-canvas > span {
    color: #a22e43;
}

body.profile-spb_zpi .production-image-viewer.is-error .production-image-viewer-canvas > span::after {
    content: " Не удалось открыть файл";
}

body.profile-spb_zpi .production-image-viewer-canvas img {
    display: block;
    height: 100%;
    max-height: calc(100vh - 155px);
    max-width: 100%;
    object-fit: contain;
    opacity: 0;
    pointer-events: none;
    transform: translate3d(0, 0, 0) scale(1);
    transform-origin: center center;
    transition: opacity .14s ease, transform .12s ease-out;
    will-change: transform;
    width: 100%;
}

body.profile-spb_zpi .production-image-viewer.is-panning .production-image-viewer-canvas img {
    transition: opacity .14s ease;
}

body.profile-spb_zpi .production-image-viewer.is-ready .production-image-viewer-canvas img {
    opacity: 1;
}

body.profile-spb_zpi .production-image-viewer-actions {
    border-top: 1px solid #e2e8f2;
    justify-content: space-between;
}

body.profile-spb_zpi .production-image-viewer-actions > small {
    color: #6d7d94;
    font-size: .7rem;
    line-height: 1.25;
}

body.profile-spb_zpi .production-image-viewer-actions > div {
    display: flex;
    flex: none;
    gap: 7px;
}

body.profile-spb_zpi .production-image-viewer-actions a {
    border: 1px solid #ccd7ea;
    border-radius: 8px;
    color: #294ba8;
    font-size: .74rem;
    font-weight: 760;
    padding: 7px 10px;
    text-decoration: none;
}

body.profile-spb_zpi .production-image-viewer-actions a:last-child {
    background: linear-gradient(135deg, var(--production-accent-dark), #6574f8);
    border-color: transparent;
    color: #fff;
}

@media (max-width: 700px) {
    body.profile-spb_zpi .engineer-workspace-shell {
        padding-top: 7px;
        padding-bottom: 18px;
    }

    body.profile-spb_zpi .production-queue-card:hover,
    body.profile-spb_zpi .production-work-file-card:hover,
    body.profile-spb_zpi .production-chat-image-attachment:hover {
        transform: none;
    }

    body.profile-spb_zpi .production-chat-image-attachment {
        max-width: 100%;
        width: 100%;
    }

    body.profile-spb_zpi .production-image-viewer {
        padding: 8px;
    }

    body.profile-spb_zpi .production-image-viewer-card {
        border-radius: 13px;
        max-height: calc(100dvh - 16px);
        max-width: calc(100vw - 16px);
        min-height: 0;
        width: calc(100vw - 16px);
    }

    body.profile-spb_zpi .production-image-viewer-canvas {
        min-height: 52vh;
        padding: 6px;
    }

    body.profile-spb_zpi .production-image-viewer-canvas img {
        max-height: calc(100dvh - 142px);
    }

    body.profile-spb_zpi .production-image-viewer-actions {
        display: grid;
        gap: 7px;
        grid-template-columns: minmax(0, 1fr);
    }

    body.profile-spb_zpi .production-image-viewer-actions > small {
        text-align: center;
    }

    body.profile-spb_zpi .production-image-viewer-actions > div {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    body.profile-spb_zpi .production-image-viewer-actions a {
        text-align: center;
    }

    body.profile-spb_zpi .production-image-viewer-controls {
        gap: 3px;
    }

    body.profile-spb_zpi .production-image-viewer-controls button {
        border-radius: 8px;
        height: 34px;
        min-height: 34px;
        width: 34px;
    }

    body.profile-spb_zpi .production-image-viewer-controls .production-image-zoom-reset {
        min-width: 48px;
    }
}

@media (prefers-reduced-motion: reduce) {
    body.profile-spb_zpi .production-queue-card,
    body.profile-spb_zpi .production-work-file-card,
    body.profile-spb_zpi .production-chat-image-attachment,
    body.profile-spb_zpi .production-image-viewer-canvas img {
        transition: none;
    }
}

body.profile-spb_zpi [data-production-order-submit][hidden],
body.profile-spb_zpi .production-workspace-panel button.visually-hidden {
    display: none !important;
}

body.profile-spb_zpi .engineer-control-panel button.production-file-remove {
    background: transparent;
    border: 1px solid transparent;
    box-shadow: none;
    color: #b03b50;
    font-size: .68rem;
    min-height: 28px;
    padding: 6px 8px;
    width: auto;
}

body.profile-spb_zpi .engineer-control-panel button.production-file-remove:hover {
    background: #fff0f2;
    border-color: #efc8cf;
}

body.profile-spb_zpi .production-comments-panel .production-comments {
    margin-bottom: 16px;
}

body.profile-spb_zpi .production-stage-controls .task-create {
    margin-top: 12px;
}

@media (max-width: 760px) {
    body.profile-spb_zpi .engineer-control-panel {
        padding: 18px;
    }

    body.profile-spb_zpi .engineer-control-panel :is(.production-inline-form, .production-upload-form, .production-comment-form) {
        grid-template-columns: minmax(0, 1fr);
    }

    body.profile-spb_zpi .engineer-control-panel :is(.production-inline-form, .production-upload-form, .production-comment-form) > button {
        min-height: 46px;
    }
}

/* SPB-ZPI mobile density and quiet status system v3 */
body.profile-spb_zpi .app-nav a {
    align-items: center;
    box-sizing: border-box;
    display: inline-flex;
    justify-content: center;
    line-height: 1.2;
    min-height: 42px;
    white-space: nowrap;
}

body.profile-spb_zpi .app-nav a.nav-count-link {
    padding-right: 36px;
}

body.profile-spb_zpi .app-nav a[href="/crm/work"] {
    display: none;
}

body.profile-spb_zpi .calls-nav-badge {
    background: #fff1f3;
    border: 1px solid #f3cbd1;
    border-radius: 999px;
    box-shadow: none;
    color: #b33e52;
    font-variant-numeric: tabular-nums;
    font-size: .66rem;
    font-weight: 850;
    height: 20px;
    line-height: 1;
    min-width: 20px;
    padding: 0 5px;
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
}

body.profile-spb_zpi .calls-nav-badge:not([hidden]) {
    align-items: center;
    display: inline-grid;
    justify-content: center;
}

body.profile-spb_zpi .lead-filter-count {
    align-items: center;
    background: #fff0f2;
    border: 1px solid #f1c9d0;
    border-radius: 999px;
    color: #b84054;
    display: inline-flex;
    font-size: .68rem;
    font-variant-numeric: tabular-nums;
    font-weight: 850;
    height: 21px;
    justify-content: center;
    line-height: 1;
    margin-left: 6px;
    min-width: 21px;
    padding: 0 6px;
}

body.profile-spb_zpi .secondary-filter-row a.is-active .lead-filter-count {
    background: #f8e8ec;
    border-color: #edbdc6;
}

@media (min-width: 720px) and (max-width: 1350px) {
    body.profile-spb_zpi .app-header {
        gap: 4px 16px;
        grid-template-columns: minmax(0, 1fr) auto;
        grid-template-rows: auto auto;
        padding-bottom: 10px;
        padding-top: 10px;
    }

    body.profile-spb_zpi .brand {
        grid-column: 1;
        grid-row: 1;
    }

    body.profile-spb_zpi .app-header > form {
        grid-column: 2;
        grid-row: 1;
        justify-self: end;
    }

    body.profile-spb_zpi .app-nav {
        grid-column: 1 / -1;
        grid-row: 2;
        justify-content: center;
        overflow-x: visible;
    }
}

body.profile-spb_zpi .calls-tabs b,
body.profile-spb_zpi .dashboard-task-group-head span,
body.profile-spb_zpi .task-group-head > span {
    background: #f6f8fb;
    border: 1px solid #e2e8f0;
    box-shadow: none;
    color: #65758c;
    font-size: .68rem;
    font-weight: 800;
    min-width: 22px;
    padding: 3px 6px;
}

body.profile-spb_zpi .calls-tabs .is-active b {
    background: #eef1ff;
    border-color: #d9defa;
    color: #4659c9;
}

body.profile-spb_zpi .call-statuses .status-pill {
    background: #fff;
    border: 1px solid #dfe6ef;
    box-shadow: none;
    color: #57677d;
    font-size: .68rem;
    font-weight: 800;
    letter-spacing: .025em;
    min-height: 0;
    padding: 6px 10px;
}

body.profile-spb_zpi .call-statuses .status-unreviewed {
    background: #fffaf4;
    border-color: #efd8bd;
    color: #9b5c18;
}

body.profile-spb_zpi .call-statuses .status-taken {
    background: #f6f8ff;
    border-color: #d8dff5;
    color: #4d5f9d;
}

body.profile-spb_zpi .call-statuses .call-business-answered {
    background: #f4fbf7;
    border-color: #cce8d8;
    color: #347557;
}

body.profile-spb_zpi .call-statuses .call-business-missed {
    background: #fff7f8;
    border-color: #efcfd5;
    color: #a34859;
}

body.profile-spb_zpi .call-primary {
    background: linear-gradient(135deg, #f8fafc, #f4f7fb);
    border-color: #e1e8f1;
    border-radius: 13px;
}

body.profile-spb_zpi .call-facts div {
    background: #fafbfd;
    border-color: #e5eaf1;
}

body.profile-spb_zpi .attention-panel {
    border-color: #e4e9f0;
    padding: 18px;
}

body.profile-spb_zpi .attention-panel .queue-head {
    border-bottom: 0;
    padding-bottom: 4px;
}

body.profile-spb_zpi .attention-list-rich { margin-top: 10px; }

body.profile-spb_zpi .attention-card-rich,
body.profile-spb_zpi .attention-card-rich.attention-danger,
body.profile-spb_zpi .attention-card-rich.attention-critical,
body.profile-spb_zpi .attention-card-rich.attention-warn {
    background: #fff;
    border-color: #e1e7ef;
    border-left-color: #dba04e;
    border-left-width: 3px;
    box-shadow: 0 6px 18px rgba(31, 51, 83, .04);
}

body.profile-spb_zpi .attention-card-rich.attention-danger,
body.profile-spb_zpi .attention-card-rich.attention-critical { border-left-color: #c95a6b; }

body.profile-spb_zpi .attention-badge,
body.profile-spb_zpi .attention-badge-danger,
body.profile-spb_zpi .attention-badge-critical,
body.profile-spb_zpi .attention-badge-warn {
    background: #fff;
    border: 1px solid #dfe5ed;
    box-shadow: none;
    color: #65758b;
    font-size: .68rem;
    font-weight: 800;
    min-height: 0;
    padding: 6px 9px;
}

body.profile-spb_zpi .attention-badge-danger,
body.profile-spb_zpi .attention-badge-critical {
    background: #fff8f9;
    border-color: #efcdd3;
    color: #a94758;
}

body.profile-spb_zpi .attention-badge-warn {
    background: #fffbf4;
    border-color: #eddcc1;
    color: #936326;
}

body.profile-spb_zpi .attention-details,
body.profile-spb_zpi .attention-card-rich.attention-danger .attention-details,
body.profile-spb_zpi .attention-card-rich.attention-critical .attention-details,
body.profile-spb_zpi .attention-card-rich.attention-warn .attention-details {
    background: #f7f9fc;
    border: 1px solid #e8edf3;
    border-radius: 10px;
    color: #4b5d75;
    font-weight: 700;
    padding: 8px 10px;
}

body.profile-spb_zpi .dashboard-task-group {
    background: #fff;
    border: 1px solid #e0e7f0;
    border-left: 3px solid #7183e8;
    border-radius: 15px;
    gap: 9px;
    padding: 14px;
}

body.profile-spb_zpi .dashboard-task-group-overdue { border-left-color: #c95668; }
body.profile-spb_zpi .dashboard-task-group-unassigned { border-left-color: #d29a42; }
body.profile-spb_zpi .dashboard-task-group-tomorrow,
body.profile-spb_zpi .dashboard-task-group-later { border-left-color: #8492a6; }

body.profile-spb_zpi .dashboard-task-list {
    background: #fafbfd;
    border: 1px solid #e8edf3;
    border-radius: 11px;
    overflow: hidden;
    padding: 0 12px;
}

body.profile-spb_zpi .dashboard-task-item {
    background: transparent;
    border: 0;
    border-bottom: 1px solid #e7ecf2;
    border-radius: 0;
    box-shadow: none;
    padding: 12px 0;
    transform: none;
}

body.profile-spb_zpi .dashboard-task-item:last-child { border-bottom: 0; }
body.profile-spb_zpi .dashboard-task-item:hover {
    background: transparent;
    border-color: #e7ecf2;
    box-shadow: none;
    transform: none;
}

body.profile-spb_zpi .dashboard-task-item strong { line-height: 1.24; }
body.profile-spb_zpi .dashboard-task-item-main small { line-height: 1.35; }

@media (max-width: 719px) {
    body.profile-spb_zpi .app-header {
        gap: 9px 12px;
        grid-template-columns: minmax(0, 1fr) auto;
        grid-template-rows: auto auto;
        padding: 12px 14px 10px;
    }

    body.profile-spb_zpi .brand {
        grid-column: 1;
        grid-row: 1;
        min-width: 0;
    }

    body.profile-spb_zpi .app-header > form {
        grid-column: 2;
        grid-row: 1;
        justify-self: end;
        margin: 0;
    }

    body.profile-spb_zpi .app-header .icon-action {
        font-size: .76rem;
        min-height: 36px;
        padding: 0 11px;
    }

    body.profile-spb_zpi .app-nav {
        grid-column: 1 / -1;
        grid-row: 2;
        margin: 0 -2px;
        max-width: calc(100vw - 28px);
        padding: 1px 2px 4px;
        scroll-snap-type: x proximity;
        white-space: nowrap;
    }

    body.profile-spb_zpi .app-nav a {
        font-size: .78rem;
        min-height: 34px;
        padding: 7px 9px;
        scroll-snap-align: start;
    }

    body.profile-spb_zpi .app-nav a.nav-count-link {
        padding-right: 34px;
    }

    body.profile-spb_zpi .calls-nav-badge {
        height: 18px;
        min-width: 18px;
        right: 7px;
    }

    body.profile-spb_zpi .brand::before { border-radius: 9px; height: 28px; width: 28px; }
    body.profile-spb_zpi .brand span { font-size: .9rem; white-space: nowrap; }

    body.profile-spb_zpi .app-shell { padding: 14px 12px 34px; }

    body.profile-spb_zpi .dashboard-inbox,
    body.profile-spb_zpi .page-intro,
    body.profile-spb_zpi .lead-hero,
    body.profile-spb_zpi .customer-hero,
    body.profile-spb_zpi .engineer-hero,
    body.profile-spb_zpi .engineer-lead-hero,
    body.profile-spb_zpi .manual-lead-intro,
    body.profile-spb_zpi .calls-page-intro,
    body.profile-spb_zpi .chat-page-heading {
        border-radius: 17px;
        margin-bottom: 14px;
        padding: 20px 18px;
    }

    body.profile-spb_zpi .dashboard-inbox { min-height: 0; }
    body.profile-spb_zpi .calls-page-intro { gap: 15px; }
    body.profile-spb_zpi .calls-quick-search { padding: 10px; width: 100%; }
    body.profile-spb_zpi .calls-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); }

    body.profile-spb_zpi .call-list { gap: 10px; }
    body.profile-spb_zpi .call-card { gap: 11px; padding: 14px; }
    body.profile-spb_zpi .call-card-header { gap: 10px; }
    body.profile-spb_zpi .call-statuses { gap: 5px; }
    body.profile-spb_zpi .call-card-body { gap: 10px; }
    body.profile-spb_zpi .call-primary { gap: 7px; padding: 12px; }
    body.profile-spb_zpi .call-facts { gap: 7px; }
    body.profile-spb_zpi .call-facts div { padding: 10px 11px; }

    body.profile-spb_zpi .attention-panel { padding: 15px; }
    body.profile-spb_zpi .attention-list-rich { margin-top: 8px; }
    body.profile-spb_zpi .attention-card-rich { padding: 13px; }
    body.profile-spb_zpi .attention-main { gap: 8px; }
    body.profile-spb_zpi .attention-title-row { gap: 8px; }
    body.profile-spb_zpi .attention-phone,
    body.profile-spb_zpi .attention-meta,
    body.profile-spb_zpi .attention-date { font-size: .82rem; line-height: 1.35; }

    body.profile-spb_zpi .dashboard-task-panel { gap: 11px; padding: 15px; }
    body.profile-spb_zpi .dashboard-task-groups { gap: 10px; }
    body.profile-spb_zpi .dashboard-task-group { padding: 12px; }
    body.profile-spb_zpi .dashboard-task-list { padding: 0 10px; }
    body.profile-spb_zpi .dashboard-task-item { gap: 5px; padding: 11px 0; }
}

/* SPB-ZPI lead detail parity with the final Garage CRM refinements v1. */
body.profile-spb_zpi .lead-data-edit-fields .lead-field-row,
body.profile-spb_zpi .lead-data-edit-fields .lead-field-value {
    box-sizing: border-box;
    max-width: 100%;
    min-width: 0;
}

body.profile-spb_zpi .lead-data-edit-fields .lead-field-value {
    color: var(--ui-ink);
    font-size: .95rem;
    font-weight: 760;
    line-height: 1.32;
    overflow-wrap: anywhere;
}

body.profile-spb_zpi .lead-data-edit-fields .lead-field-value .empty-field-value {
    font-size: inherit;
}

body.profile-spb_zpi .lead-edit-icon {
    align-items: center;
    display: inline-flex;
    justify-content: center;
}

body.profile-spb_zpi .lead-edit-icon svg {
    fill: none;
    pointer-events: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
}

body.profile-spb_zpi .lead-data-edit-fields .lead-details-field {
    background: linear-gradient(135deg, #f7f9ff 0%, #fbfdff 100%);
    border-color: rgba(88, 111, 232, .22);
}

body.profile-spb_zpi .lead-data-edit-fields .lead-details-value {
    background: rgba(255, 255, 255, .78);
    border-left: 3px solid rgba(69, 95, 232, .7);
    border-radius: 8px;
    padding: 7px 9px;
}

body.profile-spb_zpi .lead-data-edit-fields .lead-details-value.is-empty {
    border-left-color: #cbd5e1;
    color: var(--ui-muted);
    font-weight: 650;
}

@media (min-width: 900px) {
    body.profile-spb_zpi .lead-data-panel {
        gap: 12px;
        padding: 18px;
    }

    body.profile-spb_zpi .lead-data-edit-fields > .spb-zpi-detail-grid {
        gap: 10px;
    }

    body.profile-spb_zpi .spb-zpi-detail-column {
        gap: 8px;
    }

    body.profile-spb_zpi .spb-zpi-detail-grid .inline-field summary,
    body.profile-spb_zpi .spb-zpi-detail-grid .lead-static-summary,
    body.profile-spb_zpi .spb-zpi-detail-grid .lead-document-summary {
        min-height: 56px;
        padding: 10px 12px;
    }

    body.profile-spb_zpi .lead-data-edit-fields .lead-details-field > summary,
    body.profile-spb_zpi .lead-data-edit-fields .lead-comment-field > summary {
        min-height: 62px;
    }
}

/* Hard containment must come after all legacy mobile overrides. */
@media (max-width: 719px) {
    body.profile-spb_zpi .app-shell,
    body.profile-spb_zpi .compact-workspace,
    body.profile-spb_zpi .lead-data-panel,
    body.profile-spb_zpi .lead-data-edit-fields,
    body.profile-spb_zpi .lead-data-edit-fields > .spb-zpi-detail-grid,
    body.profile-spb_zpi .spb-zpi-detail-column,
    body.profile-spb_zpi .lead-identity-fields,
    body.profile-spb_zpi .lead-data-edit-fields .inline-field {
        box-sizing: border-box;
        max-width: 100%;
        min-width: 0;
        width: 100%;
    }

    body.profile-spb_zpi .app-shell {
        overflow-x: clip;
    }

    body.profile-spb_zpi .compact-workspace,
    body.profile-spb_zpi .lead-data-panel,
    body.profile-spb_zpi .lead-data-edit-fields,
    body.profile-spb_zpi .lead-data-edit-fields > .spb-zpi-detail-grid {
        grid-template-columns: minmax(0, 1fr) !important;
    }

    body.profile-spb_zpi .lead-data-panel > *,
    body.profile-spb_zpi .lead-data-edit-fields > .spb-zpi-detail-grid > * {
        max-width: 100%;
        min-width: 0;
    }

    body.profile-spb_zpi .lead-data-panel {
        gap: 10px;
        padding: 14px;
    }

    body.profile-spb_zpi .lead-data-panel .panel-headline {
        gap: 8px;
    }

    body.profile-spb_zpi .lead-data-edit-fields > .spb-zpi-detail-grid,
    body.profile-spb_zpi .spb-zpi-detail-column {
        gap: 8px;
    }

    body.profile-spb_zpi .spb-zpi-detail-grid .inline-field summary {
        box-sizing: border-box;
        display: grid;
        gap: 6px;
        grid-template-columns: minmax(0, 1fr) 31px;
        min-height: 43px;
        overflow: hidden;
        padding: 6px 8px;
        position: relative;
        width: 100%;
    }

    body.profile-spb_zpi .spb-zpi-detail-grid .lead-static-summary,
    body.profile-spb_zpi .spb-zpi-detail-grid .lead-document-summary {
        box-sizing: border-box;
        gap: 6px;
        min-height: 43px;
        padding: 6px 8px;
        width: 100%;
    }

    body.profile-spb_zpi .spb-zpi-detail-grid .lead-static-summary {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
    }

    body.profile-spb_zpi .spb-zpi-detail-grid .lead-document-summary {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 31px;
    }

    body.profile-spb_zpi .lead-data-edit-fields .lead-next-action-field summary {
        grid-template-columns: minmax(0, 1fr);
    }

    body.profile-spb_zpi .lead-data-edit-fields .lead-field-row {
        align-items: center;
        display: grid;
        gap: 6px;
        grid-template-columns: minmax(76px, 30%) minmax(0, 1fr);
        overflow: hidden;
        width: 100%;
    }

    body.profile-spb_zpi .lead-data-edit-fields .lead-field-row > b {
        font-size: .62rem;
        letter-spacing: .045em;
        line-height: 1.2;
    }

    body.profile-spb_zpi .lead-data-edit-fields .lead-field-value {
        display: block;
        font-size: .84rem;
        font-weight: 800;
        line-height: 1.2;
        overflow: hidden;
        overflow-wrap: anywhere;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    body.profile-spb_zpi .lead-data-edit-fields .lead-field-secondary {
        font-size: .7rem;
        line-height: 1.2;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    body.profile-spb_zpi .lead-data-edit-fields .lead-field-phone {
        font-variant-numeric: tabular-nums;
        letter-spacing: -.015em;
    }

    body.profile-spb_zpi .lead-data-edit-fields .lead-details-field > summary,
    body.profile-spb_zpi .lead-data-edit-fields .lead-comment-field > summary {
        min-height: 43px;
    }

    body.profile-spb_zpi .lead-data-edit-fields .lead-details-value {
        border-left-width: 2px;
        border-radius: 6px;
        padding: 5px 7px;
    }

    body.profile-spb_zpi .lead-data-edit-fields .lead-field-value-preview {
        display: block;
        margin: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    body.profile-spb_zpi .lead-data-edit-fields .inline-field summary > .lead-edit-icon {
        align-self: center;
        background: #fff;
        border: 1px solid #d7e2f0;
        border-radius: 8px;
        box-sizing: border-box;
        color: #0d4fae !important;
        display: inline-flex !important;
        flex: 0 0 27px;
        height: 27px;
        justify-self: end;
        margin: 0;
        max-width: 27px;
        min-width: 27px;
        opacity: 1 !important;
        overflow: visible;
        padding: 0 !important;
        visibility: visible !important;
        width: 27px;
        z-index: 2;
    }

    body.profile-spb_zpi .lead-data-edit-fields .inline-field summary > .lead-edit-icon svg {
        display: block !important;
        flex: 0 0 16px;
        height: 16px;
        stroke: #0d4fae;
        width: 16px;
    }

    body.profile-spb_zpi .lead-data-edit-fields .lead-comment-actions {
        align-items: center;
        box-sizing: border-box;
        display: flex;
        justify-content: flex-end;
        margin-left: 0;
        max-width: 31px;
        min-width: 0;
        width: 100%;
    }

    body.profile-spb_zpi .lead-data-edit-fields .lead-comment-actions .lead-edit-icon {
        background: #fff;
        border: 1px solid #d7e2f0;
        border-radius: 8px;
        color: #0d4fae;
        display: inline-flex;
        flex: 0 0 27px;
        height: 27px;
        padding: 0 !important;
        width: 27px;
    }

    body.profile-spb_zpi .lead-data-edit-fields .lead-comment-summary {
        grid-template-columns: minmax(0, 1fr) 31px;
    }

    body.profile-spb_zpi .lead-data-edit-fields .inline-field form {
        gap: 8px;
        padding: 9px;
    }

    body.profile-spb_zpi .lead-data-edit-fields .inline-field :is(input, select, textarea, button) {
        min-height: 41px;
    }

    body.profile-spb_zpi .lead-inline-icon-upload-form .lead-field-action-icon {
        height: 27px;
        min-height: 27px;
        width: 27px;
    }
}

@media (max-width: 390px) {
    body.profile-spb_zpi .lead-data-edit-fields .lead-field-row {
        grid-template-columns: minmax(70px, 32%) minmax(0, 1fr);
    }
}

/* SPB-ZPI lead readability and compact mobile queue parity v2. */
body.profile-spb_zpi :is(.lead-hero, .lead-data-panel, .spb-zpi-lead-card) {
    font-family: inherit;
}

body.profile-spb_zpi .lead-hero .hero-phone-main {
    background: rgba(255, 255, 255, .96);
    border: 1px solid rgba(255, 255, 255, .82);
    box-shadow: 0 8px 24px rgba(12, 28, 58, .2);
    color: #14243c !important;
    font-variant-numeric: tabular-nums;
    text-shadow: none;
}

body.profile-spb_zpi .lead-hero .status-pill {
    background: rgba(255, 255, 255, .94);
    border: 1px solid rgba(255, 255, 255, .8);
    box-shadow: 0 6px 18px rgba(12, 28, 58, .16);
    color: #263954 !important;
    text-shadow: none;
}

body.profile-spb_zpi .lead-hero .status-new {
    background: #e9f2ff;
    border-color: #c8dbf7;
    color: #1f5b9e !important;
}

body.profile-spb_zpi .lead-hero .status-in_work,
body.profile-spb_zpi .lead-hero .status-quote_sent {
    background: #fff1b8;
    border-color: #efd77c;
    color: #704b00 !important;
}

body.profile-spb_zpi .lead-hero .status-contract {
    background: #e8edff;
    border-color: #cbd4fb;
    color: #334a9c !important;
}

body.profile-spb_zpi .lead-hero .status-production {
    background: #e5f6f2;
    border-color: #bee4d9;
    color: #176a56 !important;
}

body.profile-spb_zpi .lead-hero .status-postponed {
    background: #f0f3f7;
    border-color: #d8e0ea;
    color: #53657d !important;
}

body.profile-spb_zpi .lead-hero .status-done {
    background: #e4f7ee;
    border-color: #bee6d2;
    color: #176a4b !important;
}

body.profile-spb_zpi .lead-hero .status-rejected {
    background: #fff0f2;
    border-color: #efc8cf;
    color: #9e374a !important;
}

body.profile-spb_zpi .lead-data-edit-fields .lead-field-row > b,
body.profile-spb_zpi .spb-zpi-card-kicker,
body.profile-spb_zpi .spb-zpi-card-label {
    font-family: inherit;
    font-weight: 780;
    letter-spacing: .025em;
}

body.profile-spb_zpi .lead-data-edit-fields .lead-field-value {
    font-family: inherit;
    font-weight: 680;
}

body.profile-spb_zpi .lead-data-edit-fields .empty-field-value {
    color: #7b8798;
    font-weight: 620;
}

@media (min-width: 721px) {
    body.profile-spb_zpi .spb-zpi-lead-card .spb-zpi-card-request {
        align-content: center;
        display: grid;
        gap: 0;
    }

    body.profile-spb_zpi .spb-zpi-lead-card .spb-zpi-card-request > :is(.spb-zpi-card-direction, .spb-zpi-card-text-row) {
        align-items: baseline;
        border-left: 0;
        border-top: 1px solid #e2e8f0;
        display: grid;
        gap: 12px;
        grid-template-columns: 188px minmax(0, 1fr);
        margin: 0;
        min-height: 0;
        padding: 10px 0;
    }

    body.profile-spb_zpi .spb-zpi-lead-card .spb-zpi-card-request > .spb-zpi-card-direction {
        border-top: 0;
    }

    body.profile-spb_zpi .spb-zpi-lead-card .spb-zpi-card-request :is(.spb-zpi-card-value, .spb-zpi-card-text-preview) {
        display: block;
        font-size: .86rem;
        line-height: 1.3;
        margin: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        -webkit-line-clamp: unset;
    }
}

@media (max-width: 719px) {
    body.profile-spb_zpi .secondary-filter-row {
        -webkit-overflow-scrolling: touch;
        align-items: center;
        display: flex;
        flex-wrap: nowrap;
        gap: 6px;
        margin: 0 0 7px;
        overflow-x: auto;
        overflow-y: hidden;
        overscroll-behavior-inline: contain;
        padding: 5px;
        scrollbar-width: none;
        scroll-snap-type: x proximity;
    }

    body.profile-spb_zpi .secondary-filter-row::-webkit-scrollbar {
        display: none;
    }

    body.profile-spb_zpi .secondary-filter-row > a {
        flex: 0 0 auto;
        font-size: .73rem;
        line-height: 1.1;
        min-height: 34px;
        padding: 8px 11px;
        scroll-snap-align: start;
        white-space: nowrap;
        width: auto;
    }

    body.profile-spb_zpi .lead-results {
        margin-top: 5px;
    }

    body.profile-spb_zpi .lead-hero {
        gap: 10px;
        padding: 17px;
    }

    body.profile-spb_zpi .lead-hero-head {
        gap: 9px;
    }

    body.profile-spb_zpi .hero-client-name {
        font-size: 1.22rem;
        font-weight: 760;
        line-height: 1.14;
    }

    body.profile-spb_zpi .lead-hero .hero-phone-main {
        align-items: center;
        display: inline-flex;
        font-size: 1.08rem;
        font-weight: 820;
        justify-content: center;
        letter-spacing: .005em;
        margin-top: 8px;
        max-width: 100%;
        min-height: 42px;
        padding: 8px 12px;
        width: auto;
    }

    body.profile-spb_zpi .lead-hero .status-pill {
        font-size: .69rem;
        line-height: 1.1;
        min-height: 30px;
        padding: 7px 10px;
    }

    body.profile-spb_zpi .lead-hero .hero-address {
        color: rgba(255, 255, 255, .86);
        font-size: .86rem;
        font-weight: 650;
    }

    body.profile-spb_zpi .spb-zpi-lead-card .lead-topline {
        display: grid;
        gap: 7px;
        grid-template-columns: max-content minmax(0, 1fr) max-content;
        min-height: 0;
        padding: 9px 11px;
    }

    body.profile-spb_zpi .spb-zpi-lead-card .lead-topline > strong {
        font-size: .9rem;
    }

    body.profile-spb_zpi .spb-zpi-lead-card .lead-topline .status-pill {
        font-size: .6rem;
        justify-self: start;
        max-width: 100%;
        min-height: 0;
        overflow: hidden;
        padding: 5px 7px;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    body.profile-spb_zpi .spb-zpi-lead-card .lead-topline time {
        font-size: .68rem;
    }

    body.profile-spb_zpi .spb-zpi-lead-card .spb-zpi-card-client,
    body.profile-spb_zpi .spb-zpi-lead-card .spb-zpi-card-request,
    body.profile-spb_zpi .spb-zpi-lead-card .spb-zpi-card-rail {
        padding: 12px 13px;
    }

    body.profile-spb_zpi .spb-zpi-card-name {
        font-size: 1.02rem;
        font-weight: 760;
        line-height: 1.16;
        margin: 4px 0 7px;
    }

    body.profile-spb_zpi .spb-zpi-card-contacts {
        margin-top: 8px;
    }

    body.profile-spb_zpi .spb-zpi-card-contact-link,
    body.profile-spb_zpi .spb-zpi-lead-card .spb-zpi-card-contact-link.lead-call {
        gap: 7px;
        grid-template-columns: 57px minmax(0, 1fr);
        padding: 6px 0;
    }

    body.profile-spb_zpi .spb-zpi-card-contact-link span {
        font-size: .68rem;
        font-weight: 720;
    }

    body.profile-spb_zpi .spb-zpi-card-contact-link strong {
        font-size: .82rem;
        font-weight: 740;
    }

    body.profile-spb_zpi .spb-zpi-lead-card .spb-zpi-card-request {
        background: #fbfcfe;
        display: grid;
        gap: 8px;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    body.profile-spb_zpi .spb-zpi-lead-card :is(.spb-zpi-card-direction, .spb-zpi-card-text-row) {
        align-content: start;
        background: #fff;
        border: 1px solid #e5ebf2;
        border-radius: 10px;
        display: grid;
        gap: 5px;
        margin: 0;
        min-height: 0;
        min-width: 0;
        padding: 9px;
    }

    body.profile-spb_zpi .spb-zpi-lead-card .spb-zpi-card-direction {
        border-left: 3px solid #2c74df;
    }

    body.profile-spb_zpi .spb-zpi-card-value,
    body.profile-spb_zpi .spb-zpi-card-text-preview {
        font-size: .76rem;
        font-weight: 650;
        line-height: 1.3;
        margin-top: 0;
        -webkit-line-clamp: 3;
    }

    body.profile-spb_zpi .spb-zpi-card-manager-comment {
        grid-column: 1 / -1;
    }

    body.profile-spb_zpi .spb-zpi-lead-card .spb-zpi-card-rail {
        align-content: start;
        background: #f7f9fc;
        display: grid;
        gap: 8px;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    body.profile-spb_zpi .spb-zpi-lead-card :is(.spb-zpi-card-price, .spb-zpi-card-documents, .spb-zpi-card-rail-fact) {
        align-content: start;
        background: #fff;
        border: 1px solid #e4eaf2;
        border-radius: 10px;
        display: grid;
        gap: 5px;
        grid-template-columns: minmax(0, 1fr);
        min-height: 0;
        padding: 9px;
    }

    body.profile-spb_zpi .spb-zpi-lead-card .spb-zpi-card-document-links {
        justify-content: flex-start;
    }

    body.profile-spb_zpi .spb-zpi-lead-card .spb-zpi-card-open {
        grid-column: 1 / -1;
        margin: 2px 0 0;
        min-height: 40px;
    }

    body.profile-spb_zpi .lead-data-edit-fields .lead-field-row {
        grid-template-columns: minmax(92px, 34%) minmax(0, 1fr);
    }

    body.profile-spb_zpi .lead-data-edit-fields .lead-field-row > b {
        font-size: .58rem;
        font-weight: 720;
        letter-spacing: .02em;
        overflow-wrap: normal;
        word-break: normal;
    }

    body.profile-spb_zpi .lead-data-edit-fields .lead-field-value {
        font-size: .78rem;
        font-weight: 650;
    }

    body.profile-spb_zpi .lead-data-edit-fields .lead-field-value > *,
    body.profile-spb_zpi .lead-data-edit-fields .lead-field-value-preview {
        font-size: inherit;
        font-weight: inherit;
        line-height: inherit;
    }

    body.profile-spb_zpi .lead-data-edit-fields .lead-field-phone {
        font-size: .8rem;
        font-weight: 700;
    }

    body.profile-spb_zpi .lead-data-edit-fields .lead-details-value,
    body.profile-spb_zpi .lead-data-edit-fields .lead-comment-text {
        background: transparent;
        border: 0;
        border-radius: 0;
        padding: 0;
    }

    body.profile-spb_zpi .lead-data-edit-fields :is(.lead-details-value, .lead-comment-text) .lead-field-value-preview {
        display: block;
        line-height: 1.25;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        -webkit-line-clamp: unset;
    }

    body.profile-spb_zpi .spb-zpi-detail-grid details.inline-field:not([open]) > summary,
    body.profile-spb_zpi .spb-zpi-detail-grid .lead-static-summary,
    body.profile-spb_zpi .spb-zpi-detail-grid .lead-document-summary {
        height: 43px;
        max-height: 43px;
        min-height: 43px;
    }

    body.profile-spb_zpi .spb-zpi-detail-grid details.inline-field[open] > summary {
        height: auto;
        max-height: none;
    }
}

@media (max-width: 374px) {
    body.profile-spb_zpi .lead-data-edit-fields .lead-field-row {
        grid-template-columns: minmax(88px, 36%) minmax(0, 1fr);
    }
}

@media (max-width: 320px) {
    body.profile-spb_zpi .spb-zpi-lead-card .spb-zpi-card-request,
    body.profile-spb_zpi .spb-zpi-lead-card .spb-zpi-card-rail {
        grid-template-columns: minmax(0, 1fr);
    }

    body.profile-spb_zpi .spb-zpi-card-manager-comment,
    body.profile-spb_zpi .spb-zpi-lead-card .spb-zpi-card-open {
        grid-column: auto;
    }
}

/* SPB_ZPI_LEAD_CARD_CONTENT_PRIORITY_V1 */
body.profile-spb_zpi .spb-zpi-lead-card .spb-zpi-card-primary-text {
    border-left: 3px solid #5968f2;
}

body.profile-spb_zpi .spb-zpi-lead-card .spb-zpi-card-manager-comment {
    border-left: 3px solid #9a59df;
}

body.profile-spb_zpi .spb-zpi-lead-card .spb-zpi-card-text-preview {
    white-space: pre-line;
}

body.profile-spb_zpi .spb-zpi-lead-card .spb-zpi-card-rail-fact > :last-child {
    color: #243852;
    font-size: .84rem;
    font-weight: 680;
    line-height: 1.3;
    overflow-wrap: anywhere;
}

body.profile-spb_zpi .dashboard-lead-priority-text,
body.profile-spb_zpi .dashboard-lead-manager-comment,
body.profile-spb_zpi .dashboard-lead-directions {
    margin: 8px 0 0;
    white-space: pre-line;
}

/* SPB_ZPI_WHATSAPP_MOBILE_STABILITY_V1 */
body.profile-spb_zpi .chat-email-attachments,
body.profile-spb_zpi .chat-email-attachments :is(a, span) {
    box-sizing: border-box;
    min-width: 0;
    max-width: 100%;
}

body.profile-spb_zpi .chat-email-attachments :is(a, span) {
    display: block;
    overflow-wrap: anywhere;
    word-break: break-word;
}

@media (max-width: 719px) {
    body.profile-spb_zpi .chat-thread-header {
        grid-template-columns: 42px minmax(0, 1fr) 42px;
    }

    body.profile-spb_zpi .chat-thread-identity {
        grid-column: 2;
        min-width: 0;
    }

    body.profile-spb_zpi .chat-thread-identity > div {
        align-items: flex-start;
        flex-wrap: wrap;
        gap: 5px 8px;
    }

    body.profile-spb_zpi .chat-thread-identity strong {
        overflow-wrap: anywhere;
    }

    body.profile-spb_zpi .chat-thread-state {
        flex-wrap: wrap;
        gap: 7px;
        justify-content: flex-start;
    }

    body.profile-spb_zpi .chat-thread-state time {
        margin-left: auto;
    }

    body.profile-spb_zpi .chat-thread-more {
        align-self: center;
        grid-column: 3;
        grid-row: 1;
        justify-self: end;
        margin-top: 0;
    }

    body.profile-spb_zpi .chat-email-attachments {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        width: 100%;
    }
}

body.profile-spb_zpi .dashboard-lead-manager-comment {
    border-left-color: #9a59df;
}

body.profile-spb_zpi .dashboard-lead-directions {
    color: #40536d;
    font-size: .86rem;
    line-height: 1.35;
}

@media (min-width: 981px) {
    body.profile-spb_zpi .spb-zpi-lead-card .spb-zpi-card-compact.is-without-request {
        grid-template-columns: minmax(280px, .9fr) minmax(300px, 1.1fr);
    }

    body.profile-spb_zpi .spb-zpi-lead-card .spb-zpi-card-rail {
        align-content: start;
        display: grid;
        gap: 7px;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        padding: 12px;
    }

    body.profile-spb_zpi .spb-zpi-lead-card :is(.spb-zpi-card-price, .spb-zpi-card-documents, .spb-zpi-card-rail-fact) {
        align-content: start;
        background: #fff;
        border: 1px solid #e2e8f0;
        border-radius: 9px;
        display: grid;
        gap: 4px;
        min-width: 0;
        padding: 8px;
    }

    body.profile-spb_zpi .spb-zpi-lead-card .spb-zpi-card-price {
        border-bottom: 1px solid #e2e8f0;
    }

    body.profile-spb_zpi .spb-zpi-lead-card .spb-zpi-card-rail-fact {
        border-top: 1px solid #e2e8f0;
    }

    body.profile-spb_zpi .spb-zpi-lead-card .spb-zpi-card-open {
        grid-column: 1 / -1;
        justify-self: stretch;
        min-height: 38px;
        width: 100%;
    }

    body.profile-spb_zpi .spb-zpi-lead-card .spb-zpi-doc-link {
        font-size: .66rem;
        padding: 4px 6px;
    }
}

@media (min-width: 721px) {
    body.profile-spb_zpi .spb-zpi-lead-card .spb-zpi-card-request > :is(.spb-zpi-card-direction, .spb-zpi-card-text-row) {
        grid-template-columns: 158px minmax(0, 1fr);
        padding: 9px 0;
    }

    body.profile-spb_zpi .spb-zpi-lead-card .spb-zpi-card-request > :first-child {
        border-top: 0;
    }

    body.profile-spb_zpi .spb-zpi-lead-card .spb-zpi-card-request > .spb-zpi-card-direction:not(:first-child) {
        border-top: 1px solid #e2e8f0;
    }

    body.profile-spb_zpi .spb-zpi-lead-card .spb-zpi-card-primary-text,
    body.profile-spb_zpi .spb-zpi-lead-card .spb-zpi-card-manager-comment {
        border-left: 0;
    }

    body.profile-spb_zpi .spb-zpi-lead-card .spb-zpi-card-request :is(.spb-zpi-card-primary-text, .spb-zpi-card-manager-comment) .spb-zpi-card-text-preview {
        text-overflow: clip;
        white-space: pre-line;
        -webkit-line-clamp: 3;
    }
}

@media (max-width: 719px) {
    body.profile-spb_zpi .spb-zpi-lead-card .spb-zpi-card-request {
        gap: 7px;
        grid-template-columns: minmax(0, 1fr);
        padding: 10px 12px;
    }

    body.profile-spb_zpi .spb-zpi-lead-card :is(.spb-zpi-card-direction, .spb-zpi-card-text-row) {
        grid-column: auto;
        padding: 8px 10px;
    }

    body.profile-spb_zpi .spb-zpi-lead-card .spb-zpi-card-text-preview,
    body.profile-spb_zpi .spb-zpi-lead-card .spb-zpi-card-value {
        -webkit-line-clamp: 4;
    }

    body.profile-spb_zpi .spb-zpi-lead-card .spb-zpi-card-rail {
        padding: 10px 12px 12px;
    }

    body.profile-spb_zpi .spb-zpi-lead-card .spb-zpi-card-rail > :nth-last-child(2):nth-child(odd) {
        grid-column: 1 / -1;
    }

    body.profile-spb_zpi .spb-zpi-lead-card :is(.spb-zpi-card-price, .spb-zpi-card-documents, .spb-zpi-card-rail-fact) {
        min-height: 54px;
        padding: 8px 9px;
    }
}

/* SPB-ZPI lead stage controls: one shape, one hierarchy, semantic rejection. */
body.profile-spb_zpi .lead-stage-panel {
    --stage-control-bg: linear-gradient(135deg, #f7f9fd, #edf2f9);
    --stage-control-border: #d7e1ee;
    --stage-control-text: #344963;
}

body.profile-spb_zpi .lead-stage-panel .quick-actions,
body.profile-spb_zpi .lead-stage-panel .secondary-actions {
    gap: 10px;
}

body.profile-spb_zpi .lead-stage-panel .lead-stage-control {
    box-sizing: border-box;
    min-width: 0;
}

body.profile-spb_zpi .lead-stage-panel .quick-actions > form.lead-stage-control > button,
body.profile-spb_zpi .lead-stage-panel .quick-actions > details.lead-stage-control > summary,
body.profile-spb_zpi .lead-stage-panel .quick-actions > a.lead-stage-control,
body.profile-spb_zpi .lead-stage-panel .secondary-actions > details.lead-stage-control > summary {
    align-items: center;
    background: var(--stage-control-bg) !important;
    border: 1px solid var(--stage-control-border);
    border-radius: 13px;
    box-shadow: none !important;
    box-sizing: border-box;
    color: var(--stage-control-text) !important;
    display: flex;
    font: inherit;
    font-size: .93rem;
    font-weight: 760;
    justify-content: center;
    line-height: 1.15;
    min-height: 52px;
    padding: 10px 12px;
    text-align: center;
    text-decoration: none;
    text-shadow: none;
    width: 100%;
}

body.profile-spb_zpi .lead-stage-panel .quick-actions > .lead-stage-control:not(.is-current) > :is(button, summary):hover,
body.profile-spb_zpi .lead-stage-panel .quick-actions > a.lead-stage-control:not(.is-current):hover {
    background: linear-gradient(135deg, #eef2ff, #e7edfb) !important;
    border-color: #becbf0;
    color: #304a89 !important;
    box-shadow: 0 7px 18px rgba(43, 65, 112, .1) !important;
    filter: none;
    transform: translateY(-1px);
}

body.profile-spb_zpi .lead-stage-panel .quick-actions > form.lead-stage-control.is-current > button,
body.profile-spb_zpi .lead-stage-panel .quick-actions > details.lead-stage-control.is-current > summary,
body.profile-spb_zpi .lead-stage-panel .quick-actions > a.lead-stage-control.is-current {
    background: linear-gradient(135deg, #455fe8, #6173f2) !important;
    border-color: transparent;
    box-shadow: 0 9px 22px rgba(69, 95, 232, .24) !important;
    color: #fff !important;
}

body.profile-spb_zpi .lead-stage-panel .quick-actions > details.lead-stage-control[open] {
    background: #f5f7fc;
    border: 1px solid #d7e1ee;
    border-radius: 13px;
    padding: 9px;
}

body.profile-spb_zpi .lead-stage-panel .quick-actions > details.lead-stage-control[open] > summary {
    background: #e8edfb !important;
    border-color: #cbd6ee;
    color: #304a89 !important;
    min-height: 44px;
}

body.profile-spb_zpi .lead-stage-panel .secondary-actions {
    grid-template-columns: minmax(0, 1fr);
}

body.profile-spb_zpi .lead-stage-panel .secondary-actions > details.lead-stage-control.reject-drop {
    width: 100%;
}

body.profile-spb_zpi .lead-stage-panel .secondary-actions > details.lead-stage-control.reject-drop > summary {
    background: linear-gradient(135deg, #fff6f7, #fff0f2) !important;
    border-color: #efc8cf;
    color: #a2384b !important;
}

body.profile-spb_zpi .lead-stage-panel .secondary-actions > details.lead-stage-control.reject-drop > summary:hover {
    background: linear-gradient(135deg, #fff0f2, #ffe7eb) !important;
    border-color: #e5aeb8;
    box-shadow: 0 7px 18px rgba(186, 57, 78, .1) !important;
    transform: translateY(-1px);
}

body.profile-spb_zpi .lead-stage-panel .secondary-actions > details.lead-stage-control.reject-drop.is-current > summary {
    background: linear-gradient(135deg, #d94d63, #c43c54) !important;
    border-color: transparent;
    box-shadow: 0 9px 22px rgba(196, 60, 84, .22) !important;
    color: #fff !important;
}

body.profile-spb_zpi .lead-stage-panel .lead-stage-control :is(button, summary, a):focus-visible {
    outline: 3px solid rgba(83, 104, 239, .24);
    outline-offset: 2px;
}

/* Linked messenger conversations use the same compact card language as CRM records. */
body.profile-spb_zpi .linked-chat-list {
    display: grid;
    gap: 10px;
}

body.profile-spb_zpi .linked-chat-card {
    align-items: center;
    background: linear-gradient(135deg, #f8faff, #f1f5fc);
    border: 1px solid #dce5f1;
    border-radius: 14px;
    color: #17233a;
    display: grid;
    gap: 12px;
    grid-template-columns: auto minmax(0, 1fr) auto;
    min-height: 68px;
    padding: 11px 14px;
    text-decoration: none;
    transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

body.profile-spb_zpi .linked-chat-card:hover {
    border-color: #b9c8ee;
    box-shadow: 0 9px 22px rgba(43, 65, 112, .1);
    color: #17233a;
    transform: translateY(-1px);
}

body.profile-spb_zpi .linked-chat-card:focus-visible {
    outline: 3px solid rgba(83, 104, 239, .24);
    outline-offset: 2px;
}

body.profile-spb_zpi .linked-chat-icon {
    align-items: center;
    background: #66758b;
    border-radius: 11px;
    color: #fff;
    display: inline-flex;
    font-size: .8rem;
    font-weight: 900;
    height: 38px;
    justify-content: center;
    width: 38px;
}

body.profile-spb_zpi .linked-chat-card-telegram .linked-chat-icon { background: #229ed9; }
body.profile-spb_zpi .linked-chat-card-max .linked-chat-icon { background: linear-gradient(135deg, #7058f6, #a54fd7); }
body.profile-spb_zpi .linked-chat-card-whatsapp .linked-chat-icon { background: #1fae55; }
body.profile-spb_zpi .linked-chat-card-email .linked-chat-icon { background: #c7790d; }

body.profile-spb_zpi .linked-chat-copy {
    display: grid;
    gap: 3px;
    min-width: 0;
}

body.profile-spb_zpi .linked-chat-copy strong {
    color: #17233a;
    font-size: .94rem;
}

body.profile-spb_zpi .linked-chat-copy small {
    color: #63738c;
    font-size: .78rem;
}

body.profile-spb_zpi .linked-chat-arrow {
    align-items: center;
    background: #fff;
    border: 1px solid #d8e1ef;
    border-radius: 10px;
    color: #405bd8;
    display: inline-flex;
    font-size: 1.05rem;
    font-weight: 900;
    height: 36px;
    justify-content: center;
    width: 36px;
}

@media (max-width: 719px) {
    body.profile-spb_zpi .lead-stage-panel {
        padding: 14px;
    }

    body.profile-spb_zpi .lead-stage-panel > h2 {
        font-size: 1.18rem;
        margin-bottom: 12px;
    }

    body.profile-spb_zpi .lead-stage-panel .quick-actions,
    body.profile-spb_zpi .lead-stage-panel .secondary-actions {
        gap: 8px;
    }

    body.profile-spb_zpi .lead-stage-panel .quick-actions > form.lead-stage-control > button,
    body.profile-spb_zpi .lead-stage-panel .quick-actions > details.lead-stage-control > summary,
    body.profile-spb_zpi .lead-stage-panel .quick-actions > a.lead-stage-control,
    body.profile-spb_zpi .lead-stage-panel .secondary-actions > details.lead-stage-control > summary {
        border-radius: 12px;
        font-size: .82rem;
        min-height: 48px;
        padding: 9px 8px;
    }
}

/* SPB-ZPI persistent contrast for light controls nested in dark page heroes. */
body.profile-spb_zpi .customer-hero .customer-summary span {
    background: rgba(255, 255, 255, .94);
    border-color: rgba(218, 227, 242, .96);
    color: #52637c;
}

body.profile-spb_zpi .customer-hero .customer-summary b {
    color: #17233a;
}

body.profile-spb_zpi :is(.pagination, .lead-pagination, .chat-pagination) a {
    background: #fff;
    border-color: #d7e0ee;
    color: #27499f;
    font-weight: 850;
    transition: background-color .16s ease, border-color .16s ease, box-shadow .16s ease, color .16s ease, transform .16s ease;
}

body.profile-spb_zpi :is(.pagination, .lead-pagination, .chat-pagination) a:hover {
    background: #eef3ff;
    border-color: #aebff0;
    box-shadow: 0 7px 18px rgba(39, 73, 159, .1);
    color: #1d3a82;
    transform: translateY(-1px);
}

body.profile-spb_zpi :is(.pagination, .lead-pagination, .chat-pagination) a:focus-visible {
    outline: 3px solid rgba(83, 104, 239, .24);
    outline-offset: 2px;
}

body.profile-spb_zpi :is(.pagination, .lead-pagination, .chat-pagination) span {
    background: #eef2f7;
    border: 1px solid #dfe6ef;
    color: #7a8799;
}

/* Unified production workspace */
body.profile-spb_zpi .production-overview {
    align-items: center;
    background: linear-gradient(135deg, #fff 0%, #f5f7ff 100%);
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 24px;
    margin-bottom: 18px;
    padding: 24px 28px;
}

body.profile-spb_zpi .production-overview h1 {
    color: var(--ui-ink);
    font-size: clamp(1.75rem, 3vw, 2.25rem);
    letter-spacing: -.035em;
    margin: 3px 0 6px;
}

body.profile-spb_zpi .production-overview-copy > p:last-child {
    color: var(--ui-muted);
    margin: 0;
}

body.profile-spb_zpi .production-overview-stats {
    display: flex;
    gap: 8px;
}

body.profile-spb_zpi .production-overview-stats span {
    background: #eef2fa;
    border: 1px solid #dce5f1;
    border-radius: 12px;
    color: #5c6f8b;
    display: grid;
    font-size: .72rem;
    font-weight: 800;
    min-width: 74px;
    padding: 8px 12px;
    text-align: center;
    text-transform: uppercase;
}

body.profile-spb_zpi .production-overview-stats strong {
    color: var(--ui-ink);
    font-size: 1.35rem;
    line-height: 1.1;
}

body.profile-spb_zpi .production-archive-link {
    align-items: center;
    background: #ffffff;
    border: 1px solid #cbd8ea;
    border-radius: 11px;
    box-shadow: 0 5px 14px rgba(39, 73, 159, .08);
    color: #27499f !important;
    display: inline-flex;
    font-weight: 850;
    justify-content: center;
    min-height: 44px;
    padding: 9px 14px;
    text-decoration: none;
    white-space: nowrap;
}

body.profile-spb_zpi .production-archive-link:hover {
    background: #eef3ff;
    border-color: #aebff0;
    color: #1d3a82 !important;
}

body.profile-spb_zpi .production-queue-card {
    border-left-width: 4px;
    overflow: hidden;
    padding: 20px 22px;
}

body.profile-spb_zpi .production-contact-line {
    color: var(--ui-muted);
    display: flex;
    flex-wrap: wrap;
    gap: 7px 16px;
    margin-top: 6px;
}

body.profile-spb_zpi .production-contact-line a { color: #304fba; font-weight: 750; }

body.profile-spb_zpi .production-queue-spec {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    margin: 16px 0 12px;
}

body.profile-spb_zpi .production-queue-spec p,
body.profile-spb_zpi .engineer-request-grid > p,
body.profile-spb_zpi .engineer-materials {
    background: #f4f7fb;
    border: 1px solid #e7edf5;
    border-radius: 11px;
    display: grid;
    gap: 4px;
    margin: 0;
    min-width: 0;
    padding: 10px 12px;
}

body.profile-spb_zpi :is(.production-queue-spec, .production-queue-notes, .engineer-request-grid) strong {
    color: #60738e;
    font-size: .72rem;
    letter-spacing: .035em;
    text-transform: uppercase;
}

body.profile-spb_zpi .production-queue-notes {
    display: grid;
    gap: 8px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin: 0 0 14px;
}

body.profile-spb_zpi .production-queue-notes p {
    border-left: 3px solid #7a89ef;
    display: grid;
    gap: 4px;
    margin: 0;
    padding: 8px 11px;
}

body.profile-spb_zpi .production-queue-notes span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

body.profile-spb_zpi .production-queue-actions {
    align-items: end;
    border-top: 1px solid #e6ecf4;
    display: grid;
    gap: 10px;
    grid-template-columns: auto minmax(280px, 1fr) minmax(210px, .55fr);
    padding-top: 14px;
}

body.profile-spb_zpi .production-queue-actions > .primary-link { align-self: end; min-height: 44px; }
body.profile-spb_zpi .production-queue-actions :is(.primary-link, button),
body.profile-spb_zpi .engineer-control-panel button,
body.profile-spb_zpi :is(.production-transfer, .production-reassign, .production-emergency) button {
    align-items: center;
    border-radius: 11px;
    display: inline-flex;
    font-weight: 850;
    justify-content: center;
    min-height: 44px;
    padding: 10px 16px;
}

body.profile-spb_zpi .production-engineer-actions {
    align-items: center;
    grid-template-columns: auto auto minmax(0, 1fr);
}

body.profile-spb_zpi .production-claim-form { margin: 0; }
body.profile-spb_zpi .production-claim-form button { min-width: 158px; }
body.profile-spb_zpi :is(.production-assignee-inline, .production-priority-inline) {
    align-items: end;
    display: grid;
    gap: 8px;
    grid-template-columns: minmax(0, 1fr) auto;
    margin: 0;
}

body.profile-spb_zpi :is(.production-assignee-inline, .production-priority-inline) label {
    display: grid;
    gap: 4px;
    min-width: 0;
}

body.profile-spb_zpi :is(.production-assignee-inline, .production-priority-inline) label > span {
    color: #647790;
    font-size: .72rem;
    font-weight: 850;
}

body.profile-spb_zpi :is(.production-assignee-inline, .production-priority-inline) button {
    min-height: 44px;
    padding-inline: 15px;
}

body.profile-spb_zpi .production-detail-head {
    align-items: center;
    background: linear-gradient(135deg, #fff, #f5f7ff);
    display: flex;
    justify-content: space-between;
    margin-bottom: 18px;
    padding: 22px 26px;
}

body.profile-spb_zpi .production-detail-head h1 { color: var(--ui-ink); margin: 4px 0 0; }
body.profile-spb_zpi .production-detail-head .back-link { color: #304fba; }
body.profile-spb_zpi .engineer-request-panel { margin-bottom: 18px; }
body.profile-spb_zpi .engineer-request-grid { display: grid; gap: 9px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
body.profile-spb_zpi .engineer-request-grid span { overflow-wrap: anywhere; }
body.profile-spb_zpi .engineer-request-grid small { color: var(--ui-muted); display: block; margin-top: 3px; }
body.profile-spb_zpi .engineer-request-wide { grid-column: 1 / -1; }
body.profile-spb_zpi .engineer-materials { display: block; }
body.profile-spb_zpi .engineer-materials > strong { display: block; margin-bottom: 7px; }
body.profile-spb_zpi .production-subhead { border-top: 1px solid var(--ui-line); margin-top: 16px; padding-top: 16px; }
body.profile-spb_zpi .production-subhead h3 { margin: 0; }

body.profile-spb_zpi :is(.production-transfer, .production-reassign, .production-emergency) {
    background: #f7f9fd;
    border: 1px solid #dfe7f1;
    border-radius: 13px;
    margin-top: 14px;
    overflow: hidden;
}

body.profile-spb_zpi :is(.production-transfer, .production-reassign, .production-emergency) > summary {
    background: #f2f5fa;
    color: var(--ui-ink);
    cursor: pointer;
    font-weight: 850;
    min-height: 46px;
    padding: 13px 15px;
}

body.profile-spb_zpi .production-emergency { background: #fff9fa; border-color: #f1c8cf; }
body.profile-spb_zpi .production-emergency > summary { background: #fff0f2; color: #a42d43; }
body.profile-spb_zpi :is(.production-transfer-form, .production-emergency form) { align-items: end; display: grid; gap: 10px; grid-template-columns: minmax(0, 1fr) auto; padding: 14px; }
body.profile-spb_zpi .production-emergency .production-hint { color: #7e5260; margin: 12px 14px 0; }
body.profile-spb_zpi .production-emergency form button { background: linear-gradient(135deg, #df5368, #c83f58); }
body.profile-spb_zpi .more-panel > .more-emergency { margin: 0 0 12px; }
body.profile-spb_zpi .more-panel > .more-emergency:last-child { margin-bottom: 0; }
body.profile-spb_zpi .more-panel > .more-emergency form {
    align-items: stretch;
    grid-template-columns: minmax(0, 1fr);
}
body.profile-spb_zpi .production-emergency form label {
    color: #6e4350;
    display: grid;
    font-size: .8rem;
    font-weight: 850;
    gap: 7px;
    min-width: 0;
}
body.profile-spb_zpi .production-emergency form textarea {
    background: #fff;
    border: 1px solid #e6b9c2;
    border-radius: 10px;
    box-sizing: border-box;
    color: var(--ui-ink);
    min-height: 76px;
    padding: 10px 12px;
    resize: vertical;
    width: 100%;
}
body.profile-spb_zpi .production-emergency form button {
    min-height: 44px;
}
body.profile-spb_zpi .more-panel > .more-emergency form button { width: 100%; }

body.profile-spb_zpi .stage-emergency-action {
    margin-top: 12px;
}

body.profile-spb_zpi .stage-emergency-action > summary {
    min-height: 44px;
}

body.profile-spb_zpi .lead-request-upload-form {
    align-items: end;
    border-top: 1px solid #e3eaf3;
    display: grid;
    gap: 10px;
    grid-template-columns: minmax(0, 1fr) auto;
    margin-top: 10px;
    padding: 12px;
}

body.profile-spb_zpi .lead-request-upload-form label { display: grid; gap: 5px; }
body.profile-spb_zpi .lead-request-upload-form label > span { color: #60738e; font-size: .76rem; font-weight: 850; }
body.profile-spb_zpi .lead-request-upload-form input[type="file"] { min-height: 44px; padding: 4px; }

body.profile-spb_zpi .material-entry {
    grid-template-columns: minmax(200px, 1.7fr) minmax(90px, .55fr) minmax(140px, .8fr) auto;
    padding: 10px;
}
body.profile-spb_zpi .material-entry :is(input, select) { min-height: 42px; }
body.profile-spb_zpi .material-entry .material-custom { grid-column: 1 / -1; }
body.profile-spb_zpi .material-entry .material-custom[hidden] { display: none !important; }
body.profile-spb_zpi .material-remove { min-height: 42px; padding: 0 14px; }
body.profile-spb_zpi .material-add { width: auto; }

@media (max-width: 1050px) {
    body.profile-spb_zpi .production-overview { grid-template-columns: minmax(0, 1fr) auto; }
    body.profile-spb_zpi .production-archive-link { grid-column: 1 / -1; justify-self: start; }
    body.profile-spb_zpi .production-queue-spec { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    body.profile-spb_zpi .production-queue-actions { grid-template-columns: auto minmax(260px, 1fr); }
    body.profile-spb_zpi .production-priority-inline { grid-column: 2; }
}

@media (max-width: 700px) {
    body.profile-spb_zpi .production-overview { display: block; padding: 18px; }
    body.profile-spb_zpi .production-overview-stats { margin: 16px 0 12px; }
    body.profile-spb_zpi .production-overview-stats span { flex: 1; min-width: 0; padding-inline: 6px; }
    body.profile-spb_zpi .production-overview .production-archive-link { width: 100%; }
    body.profile-spb_zpi .production-queue-card { padding: 0; }
    body.profile-spb_zpi .production-queue-card-head {
        align-items: flex-start;
        background: #f8fafc;
        border-bottom: 1px solid #dbe4ef;
        display: grid;
        gap: 10px;
        padding: 14px 15px;
    }
    body.profile-spb_zpi .production-queue-card-head > div:first-child { min-width: 0; }
    body.profile-spb_zpi .production-queue-card-head h2 { font-size: 1.12rem; }
    body.profile-spb_zpi .production-contact-line { gap: 5px 12px; }
    body.profile-spb_zpi .production-queue-badges { justify-content: flex-start; }
    body.profile-spb_zpi .production-queue-spec {
        gap: 8px;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        margin: 0;
        padding: 14px 15px 10px;
    }
    body.profile-spb_zpi .production-queue-spec .production-spec-primary { grid-column: 1 / -1; }
    body.profile-spb_zpi .production-queue-spec p { min-height: 68px; padding: 9px 10px; }
    body.profile-spb_zpi .production-queue-notes { grid-template-columns: minmax(0, 1fr); margin: 0; padding: 0 15px 12px; }
    body.profile-spb_zpi .production-queue-notes span { white-space: normal; }
    body.profile-spb_zpi .production-queue-actions { display: grid; grid-template-columns: minmax(0, 1fr); margin: 0 15px 15px; }
    body.profile-spb_zpi .production-queue-actions > * { grid-column: 1; width: 100%; }
    body.profile-spb_zpi .production-queue-actions :is(.primary-link, button) { min-height: 48px; width: 100%; }
    body.profile-spb_zpi :is(.production-assignee-inline, .production-priority-inline) { grid-template-columns: minmax(0, 1fr); }
    body.profile-spb_zpi .production-detail-head { align-items: flex-start; display: grid; gap: 12px; padding: 18px; }
    body.profile-spb_zpi .engineer-request-grid { grid-template-columns: minmax(0, 1fr); }
    body.profile-spb_zpi .engineer-request-wide { grid-column: 1; }
    body.profile-spb_zpi :is(.production-transfer-form, .production-emergency form, .lead-request-upload-form) { grid-template-columns: minmax(0, 1fr); }
    body.profile-spb_zpi :is(.production-transfer-form, .production-emergency form, .lead-request-upload-form) button { width: 100%; }
    body.profile-spb_zpi .material-entry { grid-template-columns: repeat(2, minmax(0, 1fr)); position: relative; }
    body.profile-spb_zpi .material-name-field { grid-column: 1 / -1; padding-right: 80px; }
    body.profile-spb_zpi .material-custom { grid-column: 1 / -1; }
    body.profile-spb_zpi .material-remove { min-height: 34px; padding: 0 10px; position: absolute; right: 10px; top: 10px; width: auto; }
    body.profile-spb_zpi .material-add { width: 100%; }
}

/* SPB-ZPI organizations, calculations and document operations */
body.profile-spb_zpi :is(.operations-overview, .operations-search, .operations-panel, .organization-form) {
    background: linear-gradient(135deg, #fff 0%, #f7f9ff 100%);
    border-color: #d9e3f0;
}
body.profile-spb_zpi .operations-overview {
    align-items: center; display: flex; gap: 24px; justify-content: space-between;
    margin-bottom: 18px; padding: 24px 28px;
}
body.profile-spb_zpi .operations-overview h1 { color: var(--ui-ink); font-size: clamp(1.7rem,3vw,2.25rem); margin: 3px 0 6px; }
body.profile-spb_zpi .operations-overview p:last-child { color: var(--ui-muted); margin: 0; }
body.profile-spb_zpi :is(.primary-link,.primary-button,.secondary-button,.danger-secondary,.compact-button) {
    align-items: center; border-radius: 11px; display: inline-flex; font-weight: 850;
    justify-content: center; min-height: 44px; padding: 10px 16px; text-decoration: none;
}
body.profile-spb_zpi .secondary-button { background: #eef3ff; border: 1px solid #c8d5ef; color: #28499f; }
body.profile-spb_zpi .danger-secondary { background: #fff1f3; border: 1px solid #efc8cf; color: #a2384b; }
body.profile-spb_zpi .compact-button { min-height: 38px; padding: 7px 12px; }
body.profile-spb_zpi .operations-search { align-items: center; display: grid; gap: 10px; grid-template-columns: minmax(0,1fr) auto; margin-bottom: 16px; padding: 14px; }
body.profile-spb_zpi .operations-search :is(input,button) { min-height: 46px; }
body.profile-spb_zpi .organization-overview { margin-bottom: 12px; padding: 15px 18px; }
body.profile-spb_zpi .organization-overview h1 { font-size: clamp(1.45rem,2.4vw,1.8rem); }
body.profile-spb_zpi .organization-toolbar { display: grid; gap: 11px; margin-bottom: 12px; padding: 12px 14px; }
body.profile-spb_zpi .organization-search-row { align-items: center; display: grid; gap: 8px; grid-template-columns: minmax(0,1fr) minmax(150px,190px) auto; }
body.profile-spb_zpi .organization-search-row :is(input,select,button) { min-height: 42px; }
body.profile-spb_zpi .organization-filter-chips { display: flex; flex-wrap: wrap; gap: 7px; }
body.profile-spb_zpi .organization-filter-chips a { align-items: center; background: #f3f6fb; border: 1px solid #dce5f2; border-radius: 999px; color: #526782; display: inline-flex; font-size: .78rem; font-weight: 800; gap: 7px; min-height: 32px; padding: 5px 10px; text-decoration: none; }
body.profile-spb_zpi .organization-filter-chips a:hover { background: #eaf0ff; border-color: #b9c9ec; color: #29499e; }
body.profile-spb_zpi .organization-filter-chips a.is-active { background: #4e67ee; border-color: #4e67ee; color: #fff; box-shadow: 0 5px 13px rgba(78,103,238,.2); }
body.profile-spb_zpi .organization-filter-chips strong { background: rgba(82,103,130,.1); border-radius: 999px; color: inherit; font-size: .72rem; line-height: 1; min-width: 21px; padding: 4px 6px; text-align: center; }
body.profile-spb_zpi .organization-filter-chips .is-active strong { background: rgba(255,255,255,.2); }
body.profile-spb_zpi .organization-grid { display: grid; gap: 10px; grid-template-columns: repeat(2,minmax(0,1fr)); }
body.profile-spb_zpi .organization-card { color: var(--ui-ink); display: grid; gap: 9px; min-width: 0; padding: 13px 15px; text-decoration: none; }
body.profile-spb_zpi .organization-card:hover { border-color: #b7c7ed; box-shadow: 0 14px 32px rgba(31,51,83,.11); transform: translateY(-1px); }
body.profile-spb_zpi .organization-card-header { align-items: flex-start; display: flex; gap: 10px; justify-content: space-between; min-width: 0; }
body.profile-spb_zpi .organization-card-identity { min-width: 0; }
body.profile-spb_zpi .organization-requisites-status { align-items: center; border-radius: 999px; display: inline-flex; font-size: .64rem; font-weight: 850; letter-spacing: .02em; line-height: 1; min-height: 21px; padding: 4px 8px; text-transform: uppercase; }
body.profile-spb_zpi .organization-requisites-status.is-ready { background: #e5f6ed; color: #247049; }
body.profile-spb_zpi .organization-requisites-status.is-missing { background: #fff1cb; color: #805d0c; }
body.profile-spb_zpi .organization-card h2 { font-size: 1.02rem; line-height: 1.25; margin: 6px 0 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
body.profile-spb_zpi .organization-card-identity > p { color: var(--ui-muted); font-size: .78rem; margin: 3px 0 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
body.profile-spb_zpi .organization-card-arrow { align-items: center; background: #f1f5fc; border-radius: 50%; color: #6077aa; display: inline-flex; flex: 0 0 28px; font-size: 1.25rem; height: 28px; justify-content: center; transition: background .16s ease,transform .16s ease; }
body.profile-spb_zpi .organization-card:hover .organization-card-arrow { background: #e3eaff; transform: translateX(2px); }
body.profile-spb_zpi .organization-card-footer { align-items: center; border-top: 1px solid #e5ebf4; display: grid; gap: 10px; grid-template-columns: minmax(0,1fr) auto; min-width: 0; padding-top: 8px; }
body.profile-spb_zpi .organization-card-contact { font-size: .82rem; margin: 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
body.profile-spb_zpi .organization-card-contact.is-empty { color: #8997aa; }
body.profile-spb_zpi .organization-card-metrics { display: flex; gap: 5px; margin: 0; }
body.profile-spb_zpi .organization-card-metrics div { align-items: center; background: #f1f4f9; border-radius: 8px; display: inline-flex; gap: 5px; min-height: 28px; padding: 5px 7px; }
body.profile-spb_zpi .organization-card-metrics dt { color: #687a92; font-size: .63rem; font-weight: 800; text-transform: uppercase; }
body.profile-spb_zpi .organization-card-metrics dd { font-size: .82rem; font-weight: 850; margin: 0; }
body.profile-spb_zpi .organization-card-metrics div.is-empty { opacity: .52; }
body.profile-spb_zpi .organization-form { display: grid; gap: 20px; padding: 22px; }
body.profile-spb_zpi .organization-form section { display: grid; gap: 12px; }
body.profile-spb_zpi .organization-form h2 { margin: 0; }
body.profile-spb_zpi .operations-form-grid { display: grid; gap: 10px; grid-template-columns: repeat(2,minmax(0,1fr)); }
body.profile-spb_zpi :is(.operations-form-grid,.operations-stack,.operations-inline,.organization-contact-row) label { color: #60738e; display: grid; font-size: .78rem; font-weight: 850; gap: 5px; }
body.profile-spb_zpi .organization-contact-row { align-items: end; background: #f4f7fb; border: 1px solid #e0e8f3; border-radius: 13px; display: grid; gap: 9px; grid-template-columns: repeat(4,minmax(0,1fr)) auto; margin-bottom: 9px; padding: 11px; }
body.profile-spb_zpi .organization-save { justify-self: start; }
body.profile-spb_zpi .organization-invoice-history { margin-top: 16px; }
body.profile-spb_zpi .organization-invoice-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
body.profile-spb_zpi .organization-picker { display: grid; gap: 8px; position: relative; }
body.profile-spb_zpi .organization-suggestions { background: #fff; border: 1px solid #c8d5ef; border-radius: 12px; box-shadow: 0 15px 34px rgba(31,51,83,.16); display: grid; left: 0; max-height: 280px; overflow: auto; padding: 6px; position: absolute; right: 0; top: calc(100% - 58px); z-index: 20; }
body.profile-spb_zpi .organization-suggestions[hidden] { display: none; }
body.profile-spb_zpi .organization-suggestions button { background: #fff; border: 0; border-radius: 8px; color: var(--ui-ink); display: grid; gap: 2px; justify-items: start; min-height: 48px; padding: 8px 10px; text-align: left; }
body.profile-spb_zpi .organization-suggestions button:hover { background: #eef3ff; }
body.profile-spb_zpi .organization-suggestions span { color: var(--ui-muted); font-size: .74rem; }
body.profile-spb_zpi .organization-new-link { justify-self: start; }
body.profile-spb_zpi .operations-panel { margin-top: 18px; }
body.profile-spb_zpi .operations-stack { display: grid; gap: 10px; padding: 14px; }
body.profile-spb_zpi .operations-inline { align-items: end; display: flex; flex-wrap: wrap; gap: 10px; margin: 12px 0; }
body.profile-spb_zpi .operations-inline label { flex: 1 1 260px; }
body.profile-spb_zpi .operations-summary { display: grid; gap: 9px; grid-template-columns: repeat(2,minmax(0,1fr)); margin-bottom: 12px; }
body.profile-spb_zpi .operations-summary p { background: #f2f5fa; border: 1px solid #e3e9f2; border-radius: 11px; display: grid; gap: 4px; margin: 0; padding: 10px 12px; }
body.profile-spb_zpi .operations-summary strong { color: #60738e; font-size: .72rem; text-transform: uppercase; }
body.profile-spb_zpi .preserve-lines { white-space: pre-line; }
body.profile-spb_zpi .hero-organization, body.profile-spb_zpi .queue-organization { color: #526782; display: inline-block; font-size: .82em; margin-left: 10px; }
body.profile-spb_zpi .production-queue-spec-secondary { grid-template-columns: repeat(3,minmax(0,1fr)); margin-top: -3px; }
body.profile-spb_zpi .production-card-alert { margin: 0 0 12px; }
body.profile-spb_zpi .production-delay-alert { display: grid; gap: 6px; }
body.profile-spb_zpi .production-delay-alert p { margin: 0; }
body.profile-spb_zpi .notice-warning { background: #fff7df; border: 1px solid #efd07a; color: #714f04; }

@media (max-width: 780px) {
 body.profile-spb_zpi .operations-overview { align-items: stretch; display: grid; padding: 18px; }
 body.profile-spb_zpi .operations-overview > :is(a,.primary-link) { width: 100%; }
 body.profile-spb_zpi .organization-overview { padding: 15px; }
 body.profile-spb_zpi .organization-search-row { grid-template-columns: minmax(0,1fr) auto; }
 body.profile-spb_zpi .organization-search-row input { grid-column: 1/-1; }
 body.profile-spb_zpi .organization-grid { grid-template-columns: minmax(0,1fr); }
 body.profile-spb_zpi .operations-form-grid { grid-template-columns: minmax(0,1fr); }
 body.profile-spb_zpi .organization-contact-row { grid-template-columns: repeat(2,minmax(0,1fr)); }
 body.profile-spb_zpi .organization-contact-row button { grid-column: 1/-1; width: 100%; }
 body.profile-spb_zpi .operations-summary { grid-template-columns: minmax(0,1fr); }
 body.profile-spb_zpi .operations-inline { align-items: stretch; display: grid; }
 body.profile-spb_zpi .operations-inline > * { width: 100%; }
 body.profile-spb_zpi .production-queue-spec-secondary { grid-template-columns: repeat(2,minmax(0,1fr)); }
 body.profile-spb_zpi .hero-organization, body.profile-spb_zpi .queue-organization { display: block; margin: 3px 0 0; }
}

@media (max-width: 520px) {
 body.profile-spb_zpi .organization-toolbar { padding: 10px; }
 body.profile-spb_zpi .organization-filter-chips { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); }
 body.profile-spb_zpi .organization-filter-chips a { justify-content: space-between; }
 body.profile-spb_zpi .organization-card { padding: 12px; }
 body.profile-spb_zpi .organization-card h2 { display: -webkit-box; overflow: hidden; white-space: normal; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
 body.profile-spb_zpi .organization-card-footer { align-items: start; grid-template-columns: minmax(0,1fr); }
 body.profile-spb_zpi .organization-card-metrics { width: 100%; }
 body.profile-spb_zpi .organization-card-metrics div { flex: 1 1 0; justify-content: center; }
}

/* SPB-ZPI operations visual parity v2: one type scale, one button system, strict mobile containment. */
body.profile-spb_zpi .lead-hero .hero-client-name {
    display: grid;
    font-family: inherit;
    gap: 0;
}

body.profile-spb_zpi .lead-hero .hero-invoice-label {
    color: rgba(255, 255, 255, .76);
    font-family: inherit;
    font-size: .72rem;
    font-weight: 850;
    letter-spacing: .055em;
    margin: 0 0 5px;
    line-height: 1.2;
    text-transform: uppercase;
}

body.profile-spb_zpi .lead-hero .lead-hero-side {
    align-items: end;
    align-self: stretch;
    display: grid;
    gap: 14px;
    justify-items: end;
}

body.profile-spb_zpi .lead-hero .hero-organization-action {
    align-items: center;
    background: rgba(255, 255, 255, .12);
    border: 1px solid rgba(255, 255, 255, .72);
    border-radius: 11px;
    color: #fff;
    display: inline-flex;
    font-family: inherit;
    font-size: .88rem;
    font-weight: 850;
    justify-content: center;
    min-height: 44px;
    padding: 9px 16px;
    text-decoration: none;
    transition: background .16s ease, transform .16s ease;
}

body.profile-spb_zpi .lead-hero .hero-organization-action:is(:hover, :focus-visible) {
    background: rgba(255, 255, 255, .22);
    transform: translateY(-1px);
}

body.profile-spb_zpi .lead-hero .hero-client-identity {
    align-items: baseline;
    color: #fff;
    display: flex;
    flex-wrap: wrap;
    font-family: inherit;
    font-size: clamp(1.2rem, 2vw, 1.45rem);
    font-weight: 850;
    gap: 3px 10px;
    letter-spacing: normal;
    line-height: 1.18;
    text-transform: none;
}

body.profile-spb_zpi .lead-hero .hero-client-identity > :is(strong, .hero-organization) {
    color: #fff;
    display: inline;
    font-family: inherit;
    font-size: inherit;
    font-weight: inherit;
    line-height: inherit;
    margin: 0;
}

body.profile-spb_zpi .lead-hero .hero-client-identity > .hero-organization::before {
    color: rgba(255, 255, 255, .52);
    content: "·";
    margin-right: 10px;
}

body.profile-spb_zpi .lead-data-edit-fields :is(.lead-field-value, .lead-field-value a, .lead-details-value, .lead-comment-text, .lead-field-value-preview) {
    font-family: inherit;
    font-size: .92rem;
    font-weight: 720;
    line-height: 1.3;
}

body.profile-spb_zpi .lead-data-edit-fields .lead-field-value > .material-summary-item {
    color: inherit;
    font-family: inherit;
    font-size: inherit;
    font-weight: inherit;
    line-height: inherit;
}

body.profile-spb_zpi .lead-data-edit-fields .lead-field-row > b {
    font-family: inherit;
    font-size: .7rem;
    font-weight: 820;
    letter-spacing: .035em;
    line-height: 1.2;
}

body.profile-spb_zpi :is(.primary-link, .primary-button, button.primary-button) {
    background: linear-gradient(135deg, #4b61ea 0%, #6170f2 100%);
    border: 1px solid transparent;
    box-shadow: 0 9px 20px rgba(69, 88, 222, .2);
    color: #fff;
    cursor: pointer;
    font-family: inherit;
    font-size: .92rem;
    font-weight: 850;
    line-height: 1.2;
}

body.profile-spb_zpi :is(.primary-link, .primary-button, button.primary-button):is(:hover, :focus-visible) {
    background: linear-gradient(135deg, #4057dd 0%, #5365eb 100%);
    box-shadow: 0 11px 24px rgba(69, 88, 222, .26);
}

body.profile-spb_zpi :is(.secondary-button, a.secondary-button) {
    background: #eef3ff;
    border: 1px solid #c8d5ef;
    box-shadow: none;
    color: #28499f;
    cursor: pointer;
    font-family: inherit;
    font-size: .9rem;
    font-weight: 820;
    line-height: 1.2;
}

body.profile-spb_zpi .operations-panel > .task-create > summary {
    align-items: center;
    background: #f7f9fd;
    border: 1px solid #d8e2ef;
    border-radius: 11px;
    color: #233650;
    cursor: pointer;
    display: flex;
    font-family: inherit;
    font-size: .9rem;
    font-weight: 820;
    min-height: 44px;
    padding: 10px 13px;
}

body.profile-spb_zpi .operations-panel .operations-stack > .operations-primary-button {
    width: 100%;
}

body.profile-spb_zpi .operations-panel .operations-document-link {
    grid-column: 1 / -1;
    justify-self: start;
    width: auto;
}

body.profile-spb_zpi .self-role-card .primary-button {
    white-space: nowrap;
}

@media (max-width: 719px) {
    body.profile-spb_zpi .lead-hero .lead-hero-side {
        align-items: stretch;
        gap: 8px;
        justify-items: stretch;
        width: 100%;
    }

    body.profile-spb_zpi .lead-hero .lead-hero-side .status-pill {
        justify-self: start;
    }

    body.profile-spb_zpi .lead-hero .hero-organization-action {
        width: 100%;
    }

    body.profile-spb_zpi .lead-hero .hero-client-identity {
        font-size: 1.16rem;
        gap: 2px 8px;
    }

    body.profile-spb_zpi .lead-hero .hero-client-identity > .hero-organization {
        display: inline;
        margin: 0;
    }

    body.profile-spb_zpi .lead-hero .hero-client-identity > .hero-organization::before {
        margin-right: 8px;
    }

    body.profile-spb_zpi .lead-data-edit-fields :is(.lead-field-value, .lead-field-value a, .lead-details-value, .lead-comment-text, .lead-field-value-preview) {
        font-size: .79rem;
        font-weight: 720;
        line-height: 1.25;
    }

    body.profile-spb_zpi .lead-data-edit-fields .lead-field-row > b {
        font-size: .6rem;
        font-weight: 820;
    }

    body.profile-spb_zpi .spb-zpi-detail-grid .lead-document-summary {
        box-sizing: border-box;
        grid-template-columns: minmax(0, 1fr) 31px;
        gap: 7px;
        min-width: 0;
        overflow: hidden;
        width: 100%;
    }

    body.profile-spb_zpi .spb-zpi-detail-grid .lead-document-summary > .lead-field-row {
        max-width: 100%;
        min-width: 0;
        overflow: hidden;
    }

    body.profile-spb_zpi .spb-zpi-detail-grid .lead-document-summary :is(.lead-field-value, .lead-file-download-link) {
        display: block;
        max-width: 100%;
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    body.profile-spb_zpi :where(.lead-data-edit-fields) .lead-document-upload-form.lead-inline-icon-upload-form {
        box-sizing: border-box;
        justify-self: end;
        max-width: 31px;
        min-width: 31px;
        width: 31px;
    }

    body.profile-spb_zpi .operations-panel .operations-document-link,
    body.profile-spb_zpi .operations-panel .primary-button,
    body.profile-spb_zpi .self-role-card .primary-button {
        min-height: 46px;
        width: 100%;
    }
}

/* SPB-ZPI operations visual parity v3: compact panels, readable uploads, stable actions. */
body.profile-spb_zpi .compact-workspace {
    align-items: start;
}

body.profile-spb_zpi .compact-workspace > .operations-panel {
    margin-top: 0;
}

body.profile-spb_zpi #calculation-panel {
    grid-column: 1 / -1;
}

body.profile-spb_zpi .operations-panel > .task-create {
    margin-top: 10px;
    overflow: hidden;
}

body.profile-spb_zpi .operations-panel > .task-create[open] > summary {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

body.profile-spb_zpi :is(.operations-panel, .lead-request-upload-form, .production-panel) input[type="file"] {
    background: #fff;
    border: 1px solid #ccd9ea;
    border-radius: 11px;
    box-sizing: border-box;
    color: #31435e;
    font-family: inherit;
    font-size: .82rem;
    min-height: 46px;
    min-width: 0;
    padding: 4px 6px;
    width: 100%;
}

body.profile-spb_zpi :is(.operations-panel, .lead-request-upload-form, .production-panel) input[type="file"]::file-selector-button {
    background: #edf3ff;
    border: 0;
    border-radius: 8px;
    color: #28499f;
    cursor: pointer;
    font-family: inherit;
    font-size: .82rem;
    font-weight: 820;
    margin-right: 10px;
    min-height: 36px;
    padding: 8px 12px;
}

body.profile-spb_zpi .lead-request-upload-form {
    align-items: end;
    grid-template-columns: minmax(0, 1fr) auto;
}

body.profile-spb_zpi .lead-request-upload-form .primary-button {
    min-width: 130px;
}

body.profile-spb_zpi .production-queue-card {
    padding: 16px 18px;
}

body.profile-spb_zpi .production-queue-spec {
    gap: 8px;
    margin: 12px 0 9px;
}

body.profile-spb_zpi .production-queue-spec-secondary {
    margin: 0 0 9px;
}

body.profile-spb_zpi .production-queue-notes {
    margin-bottom: 10px;
}

body.profile-spb_zpi .production-queue-actions {
    padding-top: 10px;
}

body.profile-spb_zpi .production-queue-actions button.primary-button {
    min-height: 44px;
}

@media (min-width: 720px) {
    body.profile-spb_zpi #calculation-panel .calculation-assignment-form {
        align-items: start;
        grid-template-columns: minmax(230px, .72fr) minmax(0, 1.5fr);
    }

    body.profile-spb_zpi #calculation-panel .calculation-assignment-form > .operations-primary-button {
        grid-column: 1 / -1;
        min-height: 46px;
        width: 100%;
    }
}

@media (max-width: 719px) {
    body.profile-spb_zpi .lead-request-upload-form {
        grid-template-columns: minmax(0, 1fr);
        padding: 11px;
    }

    body.profile-spb_zpi .lead-request-upload-form .primary-button {
        min-width: 0;
        width: 100%;
    }

    body.profile-spb_zpi :is(.operations-panel, .lead-request-upload-form, .production-panel) input[type="file"] {
        font-size: .76rem;
        max-width: 100%;
    }

    body.profile-spb_zpi :is(.operations-panel, .lead-request-upload-form, .production-panel) input[type="file"]::file-selector-button {
        font-size: .76rem;
        margin-right: 7px;
        padding-inline: 9px;
    }
}

/* Keep the staged engineer workspace authoritative after legacy operations rules. */
body.profile-spb_zpi .engineer-request-grid.engineer-request-grid-compact {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

body.profile-spb_zpi .engineer-request-grid.engineer-request-grid-compact > .engineer-request-wide {
    grid-column: 1 / -1;
}

@media (max-width: 719px) {
    body.profile-spb_zpi .engineer-request-grid.engineer-request-grid-compact,
    body.profile-spb_zpi .engineer-calculation-form,
    body.profile-spb_zpi .engineer-secondary-actions,
    body.profile-spb_zpi .engineer-file-columns,
    body.profile-spb_zpi .engineer-production-summary,
    body.profile-spb_zpi .engineer-upload-form {
        grid-template-columns: minmax(0, 1fr);
    }

    body.profile-spb_zpi .engineer-request-grid.engineer-request-grid-compact > .engineer-request-wide,
    body.profile-spb_zpi .engineer-form-wide {
        grid-column: 1;
    }
}

/* Organization autocomplete and auto-create fields stay in the normal form flow. */
body.profile-spb_zpi .organization-picker .organization-suggestions {
    inset: auto;
    position: static;
}

body.profile-spb_zpi .organization-auto-hint {
    background: #f3f7ff;
    border-left: 3px solid #6274f6;
    border-radius: 8px;
    margin: 0;
    padding: 9px 11px;
}

body.profile-spb_zpi .organization-requisites {
    margin: 0;
}

body.profile-spb_zpi .organization-match-notice {
    background: #eef3ff;
    border-radius: 8px;
    color: #314b86;
    font-size: .78rem;
    font-weight: 720;
    margin: 0 0 4px;
    padding: 9px 10px;
}

body.profile-spb_zpi .lead-engineer-files-pill {
    background: #eaf8f3;
    border: 1px solid #b8e5d5;
    border-radius: 999px;
    color: #13745a;
    font-size: .72rem;
    font-weight: 820;
    padding: 5px 9px;
}

body.profile-spb_zpi .engineer-delivery-panel {
    border-color: #cfdaee;
    display: grid;
    gap: 10px;
}

body.profile-spb_zpi .engineer-delivery-panel.is-unread {
    border-color: #66c4a5;
    box-shadow: 0 12px 28px rgba(25, 119, 91, .11);
}

body.profile-spb_zpi .engineer-delivery-count {
    align-items: center;
    background: #eaf1fb;
    border-radius: 999px;
    color: #385271;
    display: inline-flex;
    font-size: .75rem;
    font-weight: 850;
    height: 30px;
    justify-content: center;
    min-width: 30px;
}

body.profile-spb_zpi .engineer-delivery-alert {
    background: #eaf8f3;
    border-radius: 9px;
    color: #176d57;
    font-size: .82rem;
    font-weight: 740;
    margin: 0;
    padding: 9px 11px;
}

body.profile-spb_zpi .engineer-delivery-list {
    display: grid;
    gap: 7px;
}

body.profile-spb_zpi .engineer-delivery-list > .production-file-row {
    align-items: stretch;
    background: #f5f8fd;
    border: 1px solid #d8e2f0;
    border-radius: 10px;
}

body.profile-spb_zpi .engineer-delivery-list > .production-file-row > a {
    align-items: center;
    color: #1757b8;
    display: flex;
    flex: 1 1 auto;
    gap: 12px;
    justify-content: space-between;
    min-width: 0;
    padding: 10px 12px;
    text-decoration: none;
}

body.profile-spb_zpi .engineer-delivery-list > .production-file-row strong {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

body.profile-spb_zpi .engineer-delivery-list > .production-file-row span {
    color: #71809a;
    flex: 0 0 auto;
    font-size: .72rem;
}

body.profile-spb_zpi .engineer-delivery-upload {
    align-items: center;
    background: #f5f8fd;
    border-radius: 12px;
    display: grid;
    gap: 10px;
    grid-template-columns: minmax(0, 1fr) auto;
    padding: 10px;
}

body.profile-spb_zpi .planned-shipment-row {
    align-items: end;
    background: #f5f8fd;
    border: 1px solid #d8e2f0;
    border-radius: 12px;
    display: grid;
    gap: 12px;
    grid-template-columns: minmax(190px, .8fr) minmax(300px, 1.2fr);
    padding: 11px 12px;
}

body.profile-spb_zpi .planned-shipment-row > div {
    display: grid;
    gap: 3px;
}

body.profile-spb_zpi .planned-shipment-row > div span {
    color: #687894;
    font-size: .68rem;
    font-weight: 820;
    text-transform: uppercase;
}

body.profile-spb_zpi .planned-shipment-row form {
    align-items: center;
    display: grid;
    gap: 8px;
    grid-template-columns: minmax(0, 1fr) auto;
}

body.profile-spb_zpi .planned-shipment-row input {
    min-height: 42px;
}

body.profile-spb_zpi .organization-bulk-invoice-import {
    align-items: center;
    display: grid;
    gap: 24px;
    grid-template-columns: minmax(0, 1fr) minmax(360px, .9fr);
    margin-top: 18px;
}

body.profile-spb_zpi .organization-bulk-invoice-import h2,
body.profile-spb_zpi .organization-bulk-invoice-import p {
    margin-bottom: 6px;
    margin-top: 0;
}

body.profile-spb_zpi .organization-bulk-invoice-import form,
body.profile-spb_zpi .organization-card-invoice-add form {
    background: #f5f8fd;
    border: 1px solid #d8e2f0;
    border-radius: 12px;
    display: grid;
    gap: 10px;
    padding: 12px;
}

body.profile-spb_zpi .organization-bulk-file {
    align-items: center;
    background: #fff;
    border: 1px dashed #b9c8dd;
    border-radius: 11px;
    cursor: pointer;
    display: grid;
    gap: 10px;
    grid-template-columns: auto minmax(0, 1fr) auto;
    min-height: 66px;
    padding: 9px 10px;
    position: relative;
    transition: background .16s ease,border-color .16s ease,box-shadow .16s ease;
}

body.profile-spb_zpi .organization-bulk-file:hover,
body.profile-spb_zpi .organization-bulk-file:focus-within {
    background: #f9fbff;
    border-color: #7187eb;
    box-shadow: 0 0 0 3px rgba(78,103,238,.09);
}

body.profile-spb_zpi .organization-bulk-file.is-selected {
    border-color: #8bbca3;
    border-style: solid;
}

body.profile-spb_zpi .organization-bulk-file-input {
    height: 1px;
    inset: 0 auto auto 0;
    opacity: 0;
    overflow: hidden;
    position: absolute;
    width: 1px;
}

body.profile-spb_zpi .organization-bulk-file-icon {
    align-items: center;
    background: #e9eeff;
    border-radius: 9px;
    color: #4058c8;
    display: inline-flex;
    font-size: .68rem;
    font-weight: 900;
    height: 42px;
    justify-content: center;
    letter-spacing: .02em;
    width: 42px;
}

body.profile-spb_zpi .organization-bulk-file-copy {
    display: grid;
    gap: 3px;
    min-width: 0;
}

body.profile-spb_zpi .organization-bulk-file-copy strong {
    color: var(--ui-ink);
    font-size: .84rem;
}

body.profile-spb_zpi .organization-bulk-file-copy small {
    color: #718097;
    font-size: .73rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

body.profile-spb_zpi .organization-bulk-file-action {
    background: #edf1ff;
    border-radius: 8px;
    color: #3e57cb;
    font-size: .75rem;
    font-weight: 850;
    padding: 8px 10px;
}

body.profile-spb_zpi .organization-bulk-submit {
    gap: 10px;
    justify-self: start;
    min-width: 220px;
}

body.profile-spb_zpi .organization-bulk-submit span:last-child {
    font-size: 1.05rem;
}

body.profile-spb_zpi .organization-card-invoice-add {
    margin: 10px 0 14px;
}

body.profile-spb_zpi .organization-card-invoice-add > summary,
body.profile-spb_zpi .invoice-requisites-review > summary {
    align-items: center;
    background: #f3f6fb;
    border: 1px solid #d8e2f0;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    font-weight: 790;
    justify-content: space-between;
    list-style: none;
    padding: 10px 12px;
}

body.profile-spb_zpi .organization-card-invoice-add > summary::-webkit-details-marker,
body.profile-spb_zpi .invoice-requisites-review > summary::-webkit-details-marker {
    display: none;
}

body.profile-spb_zpi .organization-card-invoice-add[open] > summary,
body.profile-spb_zpi .invoice-requisites-review[open] > summary {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

body.profile-spb_zpi .organization-invoice-list > article {
    display: grid;
    gap: 8px;
}

body.profile-spb_zpi .invoice-requisites-review {
    width: 100%;
}

body.profile-spb_zpi .invoice-requisites-review > summary b {
    background: #e8f5ef;
    border-radius: 999px;
    color: #187157;
    font-size: .68rem;
    padding: 5px 8px;
}

body.profile-spb_zpi .invoice-requisites-review.is-warning > summary b {
    background: #fff1cf;
    color: #8b6000;
}

body.profile-spb_zpi .invoice-requisites-warning {
    background: #fff8e8;
    color: #765618;
    font-size: .78rem;
    margin: 0;
    padding: 10px 12px;
}

body.profile-spb_zpi .invoice-requisites-form {
    background: #f8faff;
    border: 1px solid #d8e2f0;
    border-top: 0;
    border-radius: 0 0 10px 10px;
    display: grid;
    gap: 9px;
    grid-template-columns: minmax(0, 1.5fr) minmax(120px, .55fr) minmax(110px, .45fr);
    padding: 12px;
}

body.profile-spb_zpi .invoice-requisites-form label {
    display: grid;
    gap: 5px;
}

body.profile-spb_zpi .invoice-requisites-form label > span {
    color: #5c6f8b;
    font-size: .68rem;
    font-weight: 820;
    text-transform: uppercase;
}

body.profile-spb_zpi .invoice-requisites-address,
body.profile-spb_zpi .invoice-requisites-form button {
    grid-column: 1 / -1;
}

@media (min-width: 720px) {
    body.profile-spb_zpi .organization-requisites .manual-extra-fields {
        grid-template-columns: minmax(0, 1.7fr) minmax(130px, .65fr) minmax(120px, .55fr);
    }
}

@media (max-width: 719px) {
    body.profile-spb_zpi .engineer-delivery-upload,
    body.profile-spb_zpi .planned-shipment-row,
    body.profile-spb_zpi .planned-shipment-row form,
    body.profile-spb_zpi .organization-bulk-invoice-import,
    body.profile-spb_zpi .invoice-requisites-form {
        grid-template-columns: minmax(0, 1fr);
    }

    body.profile-spb_zpi .engineer-delivery-upload .primary-button,
    body.profile-spb_zpi .planned-shipment-row button {
        min-height: 46px;
        width: 100%;
    }

    body.profile-spb_zpi .engineer-delivery-list > .production-file-row > a {
        align-items: flex-start;
        flex-direction: column;
        gap: 4px;
    }

    body.profile-spb_zpi .organization-bulk-invoice-import {
        gap: 14px;
    }

    body.profile-spb_zpi .organization-bulk-file {
        grid-template-columns: auto minmax(0, 1fr);
    }

    body.profile-spb_zpi .organization-bulk-file-action {
        display: none;
    }

    body.profile-spb_zpi .organization-bulk-submit {
        justify-self: stretch;
        width: 100%;
    }

    body.profile-spb_zpi .invoice-requisites-form > *,
    body.profile-spb_zpi .invoice-requisites-address,
    body.profile-spb_zpi .invoice-requisites-form button {
        grid-column: 1;
    }
}

/* Production collaboration: compact file cards, screenshots, chat and audit. */
.engineer-head-organization {
    display: block;
    margin-top: .25rem;
    color: #64748b;
    font-size: .82rem;
    font-weight: 700;
}

.production-work-file-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .75rem;
    margin-top: .75rem;
}

.production-work-file-card {
    min-width: 0;
    padding: .8rem;
    border: 1px solid #d7e1f0;
    border-radius: 14px;
    background: #f8fbff;
}

.production-work-file-card[draggable="true"] { cursor: grab; }
.production-work-file-card.is-dragging { opacity: .55; box-shadow: 0 10px 28px rgba(38, 69, 140, .18); }
.production-work-file-link { display: block; overflow-wrap: anywhere; color: #164fc8; }
.production-screenshot-strip { display: flex; gap: .5rem; overflow-x: auto; margin-top: .65rem; padding-bottom: .2rem; }
.production-screenshot-item { position: relative; flex: 0 0 86px; height: 66px; }
.production-screenshot-strip a { display: block; width: 100%; height: 100%; border: 1px solid #cbd8ea; border-radius: 9px; overflow: hidden; background: #fff; }
.production-screenshot-strip img { width: 100%; height: 100%; object-fit: cover; }
.production-screenshot-item form { position: absolute; top: 3px; right: 3px; }
.production-screenshot-item form button { width: 24px; height: 24px; padding: 0; border: 0; border-radius: 50%; background: rgba(153, 27, 27, .92); color: #fff; font-size: 18px; line-height: 1; }

.production-file-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .45rem;
    margin-top: .7rem;
    padding-top: .65rem;
    border-top: 1px solid #dce5f2;
}
.production-file-card-actions form { display: flex; gap: .35rem; align-items: center; }
.compact-file-action input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.compact-file-action span { display: inline-flex; align-items: center; min-height: 34px; padding: .4rem .65rem; border: 1px solid #b8c8df; border-radius: 9px; background: #fff; color: #27466f; font-weight: 700; cursor: pointer; }
.production-reorder-form { display: flex; justify-content: flex-end; margin-top: .75rem; }
.production-manager-file-block { margin-top: .8rem; }
.production-manager-file-delete { margin-top: .65rem; padding-top: .65rem; border-top: 1px solid #dce5f2; }
.production-queue-statuses { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .4rem; }
.production-chat-unread { display: inline-flex; align-items: center; min-height: 30px; padding: .3rem .65rem; border-radius: 999px; background: #e7efff; color: #174fc2; font-size: .75rem; font-weight: 800; }

.production-chat-stream { display: grid; gap: .6rem; max-height: 460px; overflow-y: auto; margin-top: .7rem; }
.production-chat-message { padding: .7rem .8rem; border: 1px solid #d9e3f1; border-radius: 12px; background: #f7f9fd; }
.production-chat-message > div { display: flex; justify-content: space-between; gap: .75rem; }
.production-chat-message time { color: #70819a; font-size: .78rem; white-space: nowrap; }
.production-chat-message p { margin: .35rem 0 0; white-space: pre-wrap; }
.production-chat-attachments { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .55rem; }
.production-chat-attachments a { padding: .38rem .55rem; border-radius: 8px; background: #e9f0ff; color: #164fc8; font-weight: 700; overflow-wrap: anywhere; }
.production-chat-form { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: end; gap: .65rem; margin-top: .8rem; }
.production-chat-form > label:first-of-type { min-width: 0; }

.production-activity-list { display: grid; gap: 0; margin-top: .7rem; }
.production-activity-list article { display: grid; grid-template-columns: 145px minmax(0, 1fr); gap: .7rem; padding: .65rem 0; border-top: 1px solid #e0e7f1; }
.production-activity-list time { color: #70819a; font-size: .8rem; }
.production-activity-list article div { display: flex; flex-wrap: wrap; gap: .3rem .6rem; }
.production-activity-list article span { color: #243b5a; }
.production-activity-list article small { flex-basis: 100%; color: #64748b; overflow-wrap: anywhere; }

@media (max-width: 760px) {
    .production-work-file-grid { grid-template-columns: minmax(0, 1fr); }
    .production-file-card-actions { display: grid; grid-template-columns: 1fr; }
    .production-file-card-actions form { display: grid; grid-template-columns: minmax(0, 1fr) auto; }
    .production-chat-form { grid-template-columns: minmax(0, 1fr); }
    .production-chat-form .engineer-file-picker { width: 100%; }
    .production-activity-list article { grid-template-columns: minmax(0, 1fr); gap: .2rem; }
}

/* SPB-ZPI compact production workspace v2 */
body.profile-spb_zpi .engineer-workspace-shell,
body.profile-spb_zpi .engineer-workspace-shell > *,
body.profile-spb_zpi .production-workspace-panel,
body.profile-spb_zpi .production-work-file-grid,
body.profile-spb_zpi .production-work-file-card {
    box-sizing: border-box;
    max-width: 100%;
    min-width: 0;
}

body.profile-spb_zpi .engineer-workspace-shell {
    gap: 8px;
    overflow-x: clip;
    width: min(100%, 1224px);
}

body.profile-spb_zpi .engineer-detail-head {
    gap: 12px;
    margin: 0;
    padding: 11px 14px;
}

body.profile-spb_zpi .engineer-detail-head h1 {
    font-size: clamp(1.08rem, 1.7vw, 1.32rem);
    line-height: 1.2;
    margin-top: 2px;
}

body.profile-spb_zpi .engineer-head-organization {
    font-size: .74rem;
    margin-top: 2px;
}

body.profile-spb_zpi .engineer-compact-details,
body.profile-spb_zpi .engineer-compact-panel,
body.profile-spb_zpi .engineer-current-stage {
    margin: 0;
}

body.profile-spb_zpi .engineer-compact-details > summary {
    min-height: 44px;
    padding: 8px 12px;
}

body.profile-spb_zpi .engineer-compact-details > summary > span:first-child {
    gap: 1px;
}

body.profile-spb_zpi .engineer-compact-details > summary strong {
    font-size: .92rem;
}

body.profile-spb_zpi .engineer-compact-details > summary small,
body.profile-spb_zpi .engineer-form-label {
    font-size: .61rem;
}

body.profile-spb_zpi .engineer-details-toggle,
body.profile-spb_zpi .engineer-compact-details > summary > span:last-child,
body.profile-spb_zpi .engineer-delivery-count {
    font-size: .66rem;
    min-height: 24px;
    min-width: 24px;
    height: 24px;
    padding: 3px 7px;
}

body.profile-spb_zpi .engineer-request-grid-compact {
    gap: 5px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    padding: 0 12px 8px;
}

body.profile-spb_zpi .engineer-request-grid-compact > :is(p, div) {
    border-radius: 8px;
    gap: 2px;
    padding: 6px 8px;
}

body.profile-spb_zpi .engineer-request-grid-compact > .engineer-request-wide {
    grid-column: span 2;
}

body.profile-spb_zpi .engineer-request-grid-compact strong,
body.profile-spb_zpi .production-queue-spec strong,
body.profile-spb_zpi .production-queue-notes strong {
    font-size: .61rem;
}

body.profile-spb_zpi .engineer-request-grid-compact span,
body.profile-spb_zpi .engineer-request-grid-compact p,
body.profile-spb_zpi .engineer-materials {
    font-size: .8rem;
    line-height: 1.3;
}

body.profile-spb_zpi .engineer-source-files,
body.profile-spb_zpi .engineer-result-files {
    padding: 7px 12px 9px;
}

body.profile-spb_zpi .engineer-section-title {
    font-size: .8rem;
    margin-bottom: 5px;
}

body.profile-spb_zpi .engineer-file-list {
    gap: 5px;
}

body.profile-spb_zpi .engineer-file-list a {
    border-radius: 7px;
    font-size: .75rem;
    padding: 5px 7px;
}

body.profile-spb_zpi .engineer-current-stage,
body.profile-spb_zpi .engineer-compact-panel,
body.profile-spb_zpi .production-workspace-panel {
    padding: 10px 12px;
}

body.profile-spb_zpi .engineer-stage-head,
body.profile-spb_zpi .panel-headline {
    margin-bottom: 7px;
}

body.profile-spb_zpi .panel-headline h2,
body.profile-spb_zpi .engineer-stage-head h2 {
    font-size: .98rem;
    line-height: 1.2;
    margin: 1px 0 0;
}

body.profile-spb_zpi .engineer-stage-head > strong {
    font-size: .78rem;
}

body.profile-spb_zpi .engineer-production-summary {
    gap: 6px;
    margin: 6px 0;
}

body.profile-spb_zpi .engineer-production-summary > div {
    min-height: 0;
    padding: 7px 9px;
}

body.profile-spb_zpi .engineer-secondary-action,
body.profile-spb_zpi .engineer-secondary-actions {
    margin-top: 7px;
}

body.profile-spb_zpi .engineer-secondary-actions {
    gap: 6px;
}

body.profile-spb_zpi :is(.production-transfer, .production-reassign, .production-emergency) {
    border-radius: 9px;
    margin-top: 0;
}

body.profile-spb_zpi :is(.production-transfer, .production-reassign, .production-emergency) > summary {
    min-height: 34px;
    padding: 8px 10px;
}

body.profile-spb_zpi .production-work-file-grid {
    gap: 7px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-top: 6px;
}

body.profile-spb_zpi .production-work-file-card {
    border-radius: 9px;
    overflow: hidden;
    padding: 7px 8px;
}

body.profile-spb_zpi .production-work-file-link {
    align-items: center;
    display: flex;
    font-size: .78rem;
    gap: 7px;
    justify-content: space-between;
    min-width: 0;
    text-decoration: none;
}

body.profile-spb_zpi .production-work-file-link > strong {
    color: #164fc8;
    min-width: 0;
    overflow: hidden;
    text-decoration: underline;
    text-overflow: ellipsis;
    white-space: nowrap;
}

body.profile-spb_zpi .production-work-file-link > span {
    background: #e9f0ff;
    border-radius: 999px;
    color: #365a9c;
    flex: none;
    font-size: .58rem;
    font-weight: 800;
    padding: 4px 6px;
}

body.profile-spb_zpi .production-screenshot-strip {
    gap: 4px;
    margin-top: 5px;
    padding-bottom: 0;
}

body.profile-spb_zpi .production-screenshot-item {
    flex-basis: 64px;
    height: 48px;
}

body.profile-spb_zpi .production-screenshot-strip a {
    border-radius: 6px;
}

body.profile-spb_zpi .production-screenshot-item form button {
    font-size: 14px;
    height: 19px;
    width: 19px;
}

body.profile-spb_zpi .production-file-card-actions {
    align-items: center;
    border-top: 0;
    gap: 4px;
    margin-top: 5px;
    padding-top: 0;
}

body.profile-spb_zpi .production-file-card-actions form {
    display: inline-flex;
}

body.profile-spb_zpi .compact-file-action span,
body.profile-spb_zpi .production-file-remove {
    border-radius: 7px;
    box-sizing: border-box;
    font-size: .68rem;
    font-weight: 790;
    line-height: 1;
    min-height: 28px;
    padding: 6px 8px;
}

body.profile-spb_zpi .production-file-remove {
    background: transparent;
    border: 1px solid transparent;
    box-shadow: none;
    color: #b03b50;
    width: auto;
}

body.profile-spb_zpi .production-file-remove:hover {
    background: #fff0f2;
    border-color: #efc8cf;
}

body.profile-spb_zpi .production-reorder-form {
    margin-top: 6px;
}

body.profile-spb_zpi .production-files-add-form {
    border-top: 1px solid #dce5f1;
    margin-top: 7px;
    padding-top: 7px;
}

body.profile-spb_zpi .production-files-add-picker {
    align-items: center;
    border: 1px dashed #b8c8df;
    border-radius: 8px;
    color: #28499f;
    cursor: pointer;
    display: flex;
    gap: 8px;
    min-height: 34px;
    overflow: hidden;
    padding: 5px 8px;
}

body.profile-spb_zpi .production-files-add-picker input {
    height: 1px;
    opacity: 0;
    pointer-events: none;
    position: absolute;
    width: 1px;
}

body.profile-spb_zpi .production-files-add-picker span {
    flex: 0 0 auto;
    font-size: .76rem;
    font-weight: 820;
}

body.profile-spb_zpi .production-files-add-picker small {
    color: #75849a;
    font-size: .68rem;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

body.profile-spb_zpi .production-chat-head-meta {
    align-items: center;
    display: flex;
    gap: 6px;
}

body.profile-spb_zpi .production-chat-live {
    align-items: center;
    color: #187157;
    display: inline-flex;
    font-size: .67rem;
    font-weight: 790;
    gap: 4px;
}

body.profile-spb_zpi .production-chat-live::before {
    background: #21a67a;
    border-radius: 50%;
    content: "";
    height: 6px;
    width: 6px;
}

body.profile-spb_zpi .production-chat-live.is-offline {
    color: #9a5b25;
}

body.profile-spb_zpi .production-chat-live.is-offline::before {
    background: #db873c;
}

body.profile-spb_zpi .production-chat-stream {
    gap: 4px;
    margin-top: 5px;
    max-height: 320px;
    overscroll-behavior: contain;
}

body.profile-spb_zpi .production-chat-message {
    border-radius: 8px;
    font-size: .78rem;
    line-height: 1.35;
    padding: 6px 8px;
}

body.profile-spb_zpi .production-chat-message > div {
    gap: 8px;
}

body.profile-spb_zpi .production-chat-message time {
    font-size: .66rem;
}

body.profile-spb_zpi .production-chat-message p {
    margin-top: 2px;
}

body.profile-spb_zpi .production-chat-attachments {
    gap: 3px;
    margin-top: 4px;
}

body.profile-spb_zpi .production-chat-attachments a {
    border-radius: 6px;
    font-size: .7rem;
    padding: 4px 6px;
}

body.profile-spb_zpi .production-chat-form {
    align-items: center;
    gap: 5px;
    grid-template-columns: minmax(0, 1fr) 34px auto;
    margin-top: 6px;
}

body.profile-spb_zpi .production-chat-message-field textarea {
    border: 1px solid #cbd8e9;
    border-radius: 9px;
    box-sizing: border-box;
    font: inherit;
    font-size: .8rem;
    line-height: 1.3;
    max-height: 96px;
    min-height: 36px;
    padding: 8px 9px;
    resize: vertical;
    width: 100%;
}

body.profile-spb_zpi .production-chat-file-picker {
    align-items: center;
    background: #eef3ff;
    border: 1px solid #c8d5ef;
    border-radius: 9px;
    color: #28499f;
    cursor: pointer;
    display: flex;
    height: 34px;
    justify-content: center;
    position: relative;
    width: 34px;
}

body.profile-spb_zpi .production-chat-file-picker input {
    height: 1px;
    opacity: 0;
    pointer-events: none;
    position: absolute;
    width: 1px;
}

body.profile-spb_zpi .production-chat-file-picker span {
    font-size: 1.05rem;
    line-height: 1;
}

body.profile-spb_zpi .production-chat-file-picker small {
    align-items: center;
    background: #304fba;
    border-radius: 999px;
    color: #fff;
    display: flex;
    font-size: .56rem;
    height: 15px;
    justify-content: center;
    min-width: 15px;
    padding: 1px 3px;
    position: absolute;
    right: -4px;
    top: -5px;
}

body.profile-spb_zpi .production-chat-file-picker small:empty {
    display: none;
}

body.profile-spb_zpi .production-chat-send,
body.profile-spb_zpi .production-workspace-panel .compact-button {
    border-radius: 8px;
    font-size: .74rem;
    min-height: 34px;
    padding: 7px 11px;
}

body.profile-spb_zpi .production-activity-list {
    margin-top: 0;
}

body.profile-spb_zpi .production-activity-list article {
    font-size: .76rem;
    grid-template-columns: 125px minmax(0, 1fr);
    padding: 5px 0;
}

/* Queue pages use the same visual density as lead cards. */
body.profile-spb_zpi :is(.production-overview, .operations-overview) {
    gap: 12px;
    margin-bottom: 9px;
    padding: 12px 15px;
}

body.profile-spb_zpi :is(.production-overview, .operations-overview) h1 {
    font-size: clamp(1.3rem, 2.2vw, 1.65rem);
    margin: 1px 0 2px;
}

body.profile-spb_zpi :is(.production-overview, .operations-overview) p:last-child {
    font-size: .78rem;
}

body.profile-spb_zpi .production-overview-stats {
    gap: 5px;
}

body.profile-spb_zpi .production-overview-stats span {
    border-radius: 8px;
    font-size: .6rem;
    min-width: 58px;
    padding: 5px 7px;
}

body.profile-spb_zpi .production-overview-stats strong {
    font-size: 1.05rem;
}

body.profile-spb_zpi .production-archive-link {
    border-radius: 8px;
    font-size: .75rem;
    min-height: 34px;
    padding: 7px 10px;
}

body.profile-spb_zpi .production-queue-list {
    gap: 8px;
}

body.profile-spb_zpi .production-queue-card {
    padding: 10px 12px;
}

body.profile-spb_zpi .production-queue-card-head {
    gap: 8px;
}

body.profile-spb_zpi .production-queue-card-head h2 {
    font-size: .98rem;
    line-height: 1.2;
}

body.profile-spb_zpi .production-contact-line {
    font-size: .74rem;
    gap: 3px 10px;
    margin-top: 3px;
}

body.profile-spb_zpi .production-queue-badges {
    gap: 4px;
}

body.profile-spb_zpi .production-queue-spec {
    gap: 5px;
    margin: 7px 0 5px;
}

body.profile-spb_zpi .production-queue-spec p,
body.profile-spb_zpi .production-queue-notes p {
    border-radius: 8px;
    font-size: .75rem;
    gap: 2px;
    min-height: 0;
    padding: 6px 7px;
}

body.profile-spb_zpi .production-queue-spec-secondary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

body.profile-spb_zpi .production-queue-notes {
    gap: 5px;
    margin-bottom: 6px;
}

body.profile-spb_zpi .production-queue-actions {
    gap: 6px;
    padding-top: 7px;
}

body.profile-spb_zpi .production-queue-actions > .primary-link,
body.profile-spb_zpi .production-queue-actions :is(.primary-link, button),
body.profile-spb_zpi .engineer-control-panel button,
body.profile-spb_zpi :is(.production-transfer, .production-reassign, .production-emergency) button {
    border-radius: 8px;
    font-size: .76rem;
    min-height: 34px;
    padding: 7px 10px;
}

body.profile-spb_zpi :is(.production-assignee-inline, .production-priority-inline) {
    gap: 5px;
}

body.profile-spb_zpi :is(.production-assignee-inline, .production-priority-inline) select {
    min-height: 34px;
}

body.profile-spb_zpi .queue-filter-panel {
    align-items: end;
    display: grid;
    gap: 8px 12px;
    grid-template-columns: auto minmax(0, 1fr) auto;
    margin-bottom: 8px;
    padding: 8px 10px;
}

body.profile-spb_zpi .queue-scope-tabs {
    align-items: center;
    background: #edf2fb;
    border: 1px solid #d8e1f0;
    border-radius: 9px;
    display: flex;
    gap: 2px;
    box-sizing: border-box;
    height: 44px;
    padding: 3px;
}

body.profile-spb_zpi .queue-scope-tab {
    align-items: center;
    border-radius: 6px;
    color: #4e607a;
    font-size: .74rem;
    font-weight: 800;
    display: inline-flex;
    box-sizing: border-box;
    height: 36px;
    justify-content: center;
    line-height: 1;
    padding: 0 11px;
    text-decoration: none;
    white-space: nowrap;
}

body.profile-spb_zpi .queue-scope-tab:hover {
    background: rgba(255, 255, 255, .72);
    color: #243b74;
}

body.profile-spb_zpi .queue-scope-tab.is-active {
    background: #fff;
    box-shadow: 0 2px 7px rgba(38, 61, 114, .12);
    color: #2449b8;
}

body.profile-spb_zpi .queue-filter-form {
    align-items: end;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

body.profile-spb_zpi .queue-filter-form > label {
    display: grid;
    flex: 1 1 125px;
    gap: 2px;
    min-width: 0;
}

body.profile-spb_zpi .queue-filter-form > .queue-filter-search { flex: 1.65 1 220px; }

body.profile-spb_zpi .queue-filter-form > label > span {
    color: #6b7d98;
    font-size: .58rem;
    font-weight: 900;
    letter-spacing: .035em;
    padding-left: 2px;
    text-transform: uppercase;
}

body.profile-spb_zpi .queue-filter-form :is(input:not([type="checkbox"]), select) {
    background: #fff;
    border: 1px solid #ccd8ea;
    border-radius: 7px;
    color: #1f304d;
    font-size: .74rem;
    font-weight: 700;
    box-sizing: border-box;
    height: 44px;
    min-height: 44px;
    min-width: 0;
    padding: 0 28px 0 8px;
    width: 100%;
}

body.profile-spb_zpi .queue-filter-form input { padding-right: 9px; }

body.profile-spb_zpi .queue-filter-actions {
    align-items: center;
    display: flex;
    gap: 5px;
}

body.profile-spb_zpi .queue-filter-actions button,
body.profile-spb_zpi .queue-filter-actions a {
    align-items: center;
    border-radius: 7px;
    display: inline-flex;
    font-size: .72rem;
    font-weight: 800;
    box-sizing: border-box;
    height: 44px;
    justify-content: center;
    min-height: 44px;
    min-width: 86px;
    padding: 0 12px;
    text-decoration: none;
    white-space: nowrap;
}

body.profile-spb_zpi .queue-filter-actions button {
    background: linear-gradient(135deg, #4566ef, #5c69ee);
    border: 0;
    color: #fff;
}

body.profile-spb_zpi .queue-filter-actions a {
    background: #f3f6fb;
    border: 1px solid #cbd7e8;
    color: #52647e;
}

body.profile-spb_zpi .queue-filter-actions a:hover {
    background: #e9eff8;
    border-color: #b8c7dd;
    color: #294481;
}

body.profile-spb_zpi .queue-filter-result {
    color: #71819a;
    font-size: .7rem;
    margin: 0;
    padding-bottom: 8px;
    white-space: nowrap;
}

body.profile-spb_zpi .queue-filter-result strong {
    color: #253654;
}

@media (max-width: 980px) {
    body.profile-spb_zpi .queue-filter-panel {
        align-items: stretch;
        grid-template-columns: 1fr;
    }

    body.profile-spb_zpi .queue-filter-result {
        padding: 0;
    }

    body.profile-spb_zpi .production-work-file-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    body.profile-spb_zpi .engineer-request-grid-compact {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 700px) {
    body.profile-spb_zpi .queue-filter-panel {
        gap: 7px;
        padding: 7px;
    }

    body.profile-spb_zpi .queue-scope-tabs {
        overflow-x: auto;
        scrollbar-width: none;
    }

    body.profile-spb_zpi .queue-scope-tabs::-webkit-scrollbar {
        display: none;
    }

    body.profile-spb_zpi .queue-scope-tab {
        flex: 1 0 auto;
        text-align: center;
    }

    body.profile-spb_zpi .queue-filter-form {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    body.profile-spb_zpi .queue-filter-form > label:first-of-type,
    body.profile-spb_zpi .queue-filter-actions {
        grid-column: 1 / -1;
    }

    body.profile-spb_zpi .queue-filter-actions button {
        flex: 1;
    }

    body.profile-spb_zpi .queue-filter-actions a {
        flex: 1;
    }

    body.profile-spb_zpi .engineer-workspace-shell {
        gap: 6px;
        padding-inline: 7px;
    }

    body.profile-spb_zpi .engineer-detail-head {
        align-items: center;
        display: flex;
        padding: 9px 10px;
    }

    body.profile-spb_zpi .engineer-detail-head > div {
        min-width: 0;
    }

    body.profile-spb_zpi .engineer-request-grid-compact {
        gap: 4px;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        padding: 0 8px 7px;
    }

    body.profile-spb_zpi .engineer-request-grid-compact > .engineer-request-wide {
        grid-column: 1 / -1;
    }

    body.profile-spb_zpi .engineer-source-files,
    body.profile-spb_zpi .engineer-result-files,
    body.profile-spb_zpi .engineer-current-stage,
    body.profile-spb_zpi .engineer-compact-panel,
    body.profile-spb_zpi .production-workspace-panel {
        padding: 8px;
    }

    body.profile-spb_zpi .production-work-file-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    body.profile-spb_zpi .production-file-card-actions {
        display: flex;
        grid-template-columns: none;
    }

    body.profile-spb_zpi .production-file-card-actions form {
        display: inline-flex;
        grid-template-columns: none;
    }

    body.profile-spb_zpi .production-files-add-picker {
        align-items: flex-start;
        flex-direction: column;
        gap: 1px;
    }

    body.profile-spb_zpi .production-files-add-picker small {
        max-width: 100%;
    }

    body.profile-spb_zpi .production-chat-stream {
        max-height: 280px;
    }

    body.profile-spb_zpi .production-chat-form {
        grid-template-columns: minmax(0, 1fr) 34px auto;
    }

    body.profile-spb_zpi .production-chat-send {
        width: auto;
    }

    body.profile-spb_zpi :is(.production-overview, .operations-overview) {
        display: grid;
        gap: 8px;
        grid-template-columns: minmax(0, 1fr);
        padding: 10px;
    }

    body.profile-spb_zpi .production-overview-stats {
        margin: 0;
    }

    body.profile-spb_zpi .production-overview .production-archive-link,
    body.profile-spb_zpi .operations-overview .production-archive-link {
        grid-column: 1;
        justify-self: start;
        width: auto;
    }

    body.profile-spb_zpi .production-queue-card {
        padding: 0;
    }

    body.profile-spb_zpi .production-queue-card-head {
        gap: 6px;
        padding: 9px 10px 7px;
    }

    body.profile-spb_zpi .production-queue-spec {
        gap: 4px;
        margin: 0;
        padding: 7px 10px 4px;
    }

    body.profile-spb_zpi .production-queue-spec .production-spec-primary {
        grid-column: auto;
    }

    body.profile-spb_zpi .production-queue-spec p {
        min-height: 0;
        padding: 5px 6px;
    }

    body.profile-spb_zpi .production-queue-spec-secondary {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    body.profile-spb_zpi .production-queue-notes {
        gap: 4px;
        grid-template-columns: minmax(0, 1fr);
        margin: 0;
        padding: 3px 10px 5px;
    }

    body.profile-spb_zpi .production-queue-actions {
        display: flex;
        flex-wrap: wrap;
        margin: 0 10px 9px;
        padding-top: 6px;
    }

    body.profile-spb_zpi .production-queue-actions > *,
    body.profile-spb_zpi .production-queue-actions > .primary-link {
        grid-column: auto;
        width: auto;
    }

    body.profile-spb_zpi .production-queue-actions :is(.primary-link, button) {
        min-height: 34px;
        width: auto;
    }

    body.profile-spb_zpi :is(.production-assignee-inline, .production-priority-inline) {
        flex: 1 1 260px;
        grid-template-columns: minmax(0, 1fr) auto;
    }
}

@media (max-width: 420px) {
    body.profile-spb_zpi .engineer-request-grid-compact {
        grid-template-columns: minmax(0, 1fr);
    }

    body.profile-spb_zpi .engineer-request-grid-compact > .engineer-request-wide {
        grid-column: 1;
    }

    body.profile-spb_zpi .production-chat-form {
        grid-template-columns: minmax(0, 1fr) 32px;
    }

    body.profile-spb_zpi .production-chat-send {
        grid-column: 1 / -1;
        justify-self: end;
    }
}

/* SPB_ZPI_INVOICE_IDENTITY_V1: persistent order identity on every lead card. */
body.profile-spb_zpi .lead-invoice-number {
    align-items: center;
    background: #eef3ff;
    border: 1px solid #cbd8f3;
    border-radius: 999px;
    color: #294aa3;
    display: inline-flex;
    font-size: .72rem;
    font-weight: 850;
    justify-content: center;
    letter-spacing: 0;
    line-height: 1.15;
    max-width: 100%;
    min-height: 26px;
    padding: 4px 9px;
    text-transform: none;
    white-space: nowrap;
}

body.profile-spb_zpi .lead-invoice-number.is-missing {
    background: #f3f5f8;
    border-color: #dce3ec;
    color: #69778b;
}

body.profile-spb_zpi .lead-hero .lead-invoice-number {
    color: #294aa3;
}

body.profile-spb_zpi .lead-hero .lead-invoice-number.is-missing {
    color: #69778b;
}

body.profile-spb_zpi .spb-zpi-card-contacts > .lead-invoice-number {
    justify-self: start;
    margin-top: 8px;
}

body.profile-spb_zpi :is(.engineer-job-card, .lead-topline) .lead-invoice-number {
    flex: 0 1 auto;
}

@media (max-width: 700px) {
    body.profile-spb_zpi .lead-invoice-number {
        font-size: .68rem;
        min-height: 24px;
        padding: 4px 8px;
        white-space: normal;
    }

body.profile-spb_zpi .production-contact-line .lead-invoice-number {
        order: 2;
    }
}

/* SPB_ZPI_PRODUCTION_CUSTOMER_WORKSPACE_V1
   Compact production workspace, readable source names and customer-first operator queue. */
body.profile-spb_zpi .engineer-workspace-shell {
    gap: 8px;
    width: min(100%, 1180px);
}

body.profile-spb_zpi .engineer-detail-head,
body.profile-spb_zpi .engineer-compact-details,
body.profile-spb_zpi .engineer-compact-panel,
body.profile-spb_zpi .engineer-current-stage,
body.profile-spb_zpi .production-workspace-panel {
    border: 1px solid #d8e2f1;
    border-radius: 13px;
    box-shadow: 0 7px 20px rgba(35, 58, 105, .055);
}

body.profile-spb_zpi .engineer-detail-head {
    align-items: center;
    background: linear-gradient(135deg, #fbfcff, #f5f8ff);
    min-height: 0;
    padding: 11px 13px;
}

body.profile-spb_zpi .engineer-detail-head h1 {
    color: #182741;
    font-size: clamp(1.08rem, 1.5vw, 1.3rem);
    margin: 2px 0 0;
}

body.profile-spb_zpi .engineer-head-meta {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 5px;
}

body.profile-spb_zpi .engineer-head-meta span {
    background: #eaf0fb;
    border: 1px solid #d3def0;
    border-radius: 999px;
    color: #52647e;
    font-size: .68rem;
    font-weight: 760;
    line-height: 1.2;
    max-width: 100%;
    overflow-wrap: anywhere;
    padding: 4px 7px;
}

body.profile-spb_zpi .engineer-collapsible-body {
    padding: 0 10px 9px;
}

body.profile-spb_zpi .production-work-file-grid {
    display: grid;
    gap: 6px;
    grid-template-columns: minmax(0, 1fr);
    margin-top: 6px;
}

body.profile-spb_zpi .production-work-file-card {
    background: #f8faff;
    border: 1px solid #d9e3f1;
    border-radius: 10px;
    box-shadow: none;
    overflow: visible;
    padding: 7px 8px;
}

body.profile-spb_zpi .production-work-file-card:hover {
    background: #f4f7ff;
    border-color: #bfcfee;
    box-shadow: 0 5px 14px rgba(43, 72, 133, .07);
    transform: none;
}

body.profile-spb_zpi .production-work-file-head {
    align-items: start;
    display: grid;
    gap: 10px;
    grid-template-columns: minmax(0, 1fr) auto;
    min-width: 0;
}

body.profile-spb_zpi .production-work-file-info {
    display: grid;
    gap: 2px;
    min-width: 0;
    padding-top: 2px;
}

body.profile-spb_zpi .production-work-file-name {
    display: block;
    min-width: 0;
    text-decoration: none;
}

body.profile-spb_zpi .production-work-file-name > strong {
    color: #174eb7;
    font-size: .79rem;
    font-weight: 820;
    line-height: 1.25;
    min-width: 0;
    overflow: visible;
    overflow-wrap: anywhere;
    text-decoration: none;
    text-overflow: clip;
    white-space: normal;
    word-break: break-word;
}

body.profile-spb_zpi .production-work-file-meta {
    color: #76849a;
    display: block;
    font-size: .62rem;
    line-height: 1.2;
}

body.profile-spb_zpi .production-file-download-button {
    align-items: center;
    background: #e7efff;
    border: 1px solid #ccd9f5;
    border-radius: 7px;
    box-sizing: border-box;
    color: #315aaf;
    display: inline-flex;
    font-size: .64rem;
    font-weight: 830;
    height: 30px;
    justify-content: center;
    min-height: 30px;
    padding: 0 8px;
    text-decoration: none;
    white-space: nowrap;
    width: 64px;
}

body.profile-spb_zpi .production-file-card-actions {
    align-items: start;
    border: 0;
    display: grid;
    gap: 5px;
    grid-template-columns: 64px 86px 32px;
    margin: 0;
    padding: 0;
}

body.profile-spb_zpi .production-file-card-actions.is-readonly,
body.profile-spb_zpi .production-file-card-actions.production-manager-file-actions {
    display: flex;
    flex-wrap: nowrap;
}

body.profile-spb_zpi .production-file-card-actions form {
    display: inline-flex;
    margin: 0;
    width: 100%;
}

body.profile-spb_zpi .compact-file-action span {
    align-items: center;
    background: #fff;
    border-color: #bdcae0;
    box-sizing: border-box;
    height: 30px;
    justify-content: center;
    min-height: 30px;
    padding: 0 8px;
    white-space: nowrap;
    width: 86px;
}

body.profile-spb_zpi .production-file-more {
    position: relative;
}

body.profile-spb_zpi .production-file-more > summary {
    align-items: center;
    background: #fff;
    border: 1px solid #bdcae0;
    border-radius: 7px;
    color: #415675;
    cursor: pointer;
    display: flex;
    font-size: .78rem;
    font-weight: 900;
    box-sizing: border-box;
    height: 30px;
    justify-content: center;
    list-style: none;
    min-width: 32px;
    padding: 0;
    width: 32px;
}

body.profile-spb_zpi .production-file-more > summary::-webkit-details-marker {
    display: none;
}

body.profile-spb_zpi .production-file-more > div {
    background: #fff;
    border: 1px solid #cbd7e8;
    border-radius: 9px;
    box-shadow: 0 12px 26px rgba(31, 51, 95, .17);
    display: grid;
    gap: 3px;
    min-width: 154px;
    padding: 5px;
    position: absolute;
    right: 0;
    top: calc(100% + 4px);
    z-index: 20;
}

body.profile-spb_zpi .production-file-more .compact-file-action span,
body.profile-spb_zpi .production-file-more .production-file-remove {
    border: 0;
    border-radius: 6px;
    justify-content: flex-start;
    min-height: 31px;
    padding: 7px 8px;
    width: 100%;
}

body.profile-spb_zpi .production-file-more .compact-file-action span:hover {
    background: #eef3ff;
}

body.profile-spb_zpi .production-screenshot-strip {
    border-top: 1px solid #e1e8f3;
    gap: 6px;
    margin-top: 7px;
    padding-top: 7px;
}

body.profile-spb_zpi .production-screenshot-item {
    flex: 0 0 84px;
    height: 60px;
}

body.profile-spb_zpi .production-screenshot-strip a {
    border-radius: 7px;
}

body.profile-spb_zpi .production-manager-file-delete {
    border: 0;
    margin: 0;
    padding: 0;
}

body.profile-spb_zpi .production-manager-file-delete button {
    height: 30px;
    min-height: 30px;
}

body.profile-spb_zpi .production-activity-list {
    gap: 0;
    margin: 0;
    padding: 3px 10px 9px;
}

body.profile-spb_zpi .production-activity-list .production-activity-item {
    border: 0;
    display: grid;
    font-size: .74rem;
    gap: 10px;
    grid-template-columns: 116px minmax(0, 1fr);
    padding: 7px 0 7px 16px;
    position: relative;
}

body.profile-spb_zpi .production-activity-list .production-activity-item:not(:last-child)::after {
    background: #d9e3f2;
    bottom: -3px;
    content: "";
    left: 4px;
    position: absolute;
    top: 18px;
    width: 1px;
}

body.profile-spb_zpi .production-activity-list .production-activity-item::before {
    background: #5572e8;
    border: 3px solid #eef3ff;
    border-radius: 50%;
    content: "";
    height: 7px;
    left: 0;
    position: absolute;
    top: 11px;
    width: 7px;
    z-index: 1;
}

body.profile-spb_zpi .production-activity-list time {
    color: #728098;
    font-size: .66rem;
    padding-top: 2px;
    white-space: nowrap;
}

body.profile-spb_zpi .production-activity-list .production-activity-content {
    display: grid;
    gap: 4px;
    min-width: 0;
}

body.profile-spb_zpi .production-activity-heading {
    align-items: baseline;
    display: flex;
    flex-wrap: wrap;
    gap: 3px 7px;
}

body.profile-spb_zpi .production-activity-heading strong {
    color: #1f304c;
    font-size: .73rem;
}

body.profile-spb_zpi .production-activity-heading span {
    color: #586b87;
    font-size: .72rem;
}

body.profile-spb_zpi .production-activity-subject {
    color: #64748b;
    font-size: .68rem;
    margin: 0;
    overflow-wrap: anywhere;
}

body.profile-spb_zpi .production-activity-files {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

body.profile-spb_zpi .production-activity-files span {
    background: #edf3ff;
    border: 1px solid #d4e0f5;
    border-radius: 6px;
    color: #31528e;
    font-size: .66rem;
    font-weight: 720;
    max-width: 100%;
    overflow-wrap: anywhere;
    padding: 3px 6px;
}

body.profile-spb_zpi .production-activity-files span.is-deleted {
    background: #fff1f3;
    border-color: #f0cdd3;
    color: #ae4050;
}

body.profile-spb_zpi .production-activity-change {
    align-items: center;
    color: #66768e;
    display: flex;
    flex-wrap: wrap;
    font-size: .66rem;
    gap: 4px;
    overflow-wrap: anywhere;
}

body.profile-spb_zpi .production-view-switcher {
    align-items: center;
    background: #eaf0fa;
    border: 1px solid #d5dfed;
    border-radius: 10px;
    display: flex;
    gap: 3px;
    margin: -1px 0 8px;
    padding: 3px;
    width: fit-content;
}

body.profile-spb_zpi .production-view-switcher a {
    border-radius: 7px;
    color: #52647d;
    font-size: .73rem;
    font-weight: 820;
    min-height: 31px;
    padding: 7px 11px;
    text-decoration: none;
}

body.profile-spb_zpi .production-view-switcher a.is-active {
    background: #fff;
    box-shadow: 0 2px 7px rgba(38, 61, 114, .13);
    color: #244ab6;
}

body.profile-spb_zpi .production-customer-browser {
    display: grid;
    gap: 8px;
}

body.profile-spb_zpi .production-customer-search {
    background: #fff;
    border: 1px solid #d7e1ef;
    border-radius: 10px;
    display: grid;
    gap: 3px;
    padding: 7px 9px;
}

body.profile-spb_zpi .production-customer-search > span {
    color: #718099;
    font-size: .59rem;
    font-weight: 900;
    letter-spacing: .035em;
    text-transform: uppercase;
}

body.profile-spb_zpi .production-customer-search input {
    border: 0;
    box-shadow: none;
    font-size: .8rem;
    min-height: 27px;
    outline: none;
    padding: 0;
}

body.profile-spb_zpi .production-customer-grid {
    align-items: start;
    display: grid;
    gap: 8px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

body.profile-spb_zpi .production-customer-card {
    border: 1px solid #d7e1ef;
    border-radius: 12px;
    box-shadow: 0 6px 17px rgba(39, 62, 108, .055);
    min-width: 0;
    overflow: hidden;
    padding: 0;
}

body.profile-spb_zpi .production-customer-card[open] {
    grid-column: 1 / -1;
}

body.profile-spb_zpi .production-customer-card > summary {
    align-items: center;
    cursor: pointer;
    display: grid;
    gap: 8px;
    grid-template-columns: 34px minmax(0, 1fr) auto;
    list-style: none;
    min-height: 65px;
    padding: 9px 10px;
}

body.profile-spb_zpi .production-customer-card > summary::-webkit-details-marker {
    display: none;
}

body.profile-spb_zpi .production-customer-avatar {
    align-items: center;
    background: linear-gradient(135deg, #4b65ed, #6c67ee);
    border-radius: 9px;
    color: #fff;
    display: flex;
    font-size: .9rem;
    font-weight: 900;
    height: 34px;
    justify-content: center;
    width: 34px;
}

body.profile-spb_zpi .production-customer-copy {
    display: grid;
    gap: 3px;
    min-width: 0;
}

body.profile-spb_zpi .production-customer-copy strong {
    color: #1c2c48;
    font-size: .82rem;
    line-height: 1.22;
    overflow-wrap: anywhere;
}

body.profile-spb_zpi .production-customer-copy small {
    color: #6f7e94;
    font-size: .66rem;
}

body.profile-spb_zpi .production-customer-order-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    min-width: 0;
}

body.profile-spb_zpi .production-customer-order-badge {
    align-items: center;
    background: #f0f4ff;
    border: 1px solid #d6e0f5;
    border-radius: 999px;
    color: #36579d;
    display: inline-flex;
    font-size: .58rem;
    font-weight: 800;
    gap: 4px;
    max-width: 100%;
    min-width: 0;
    padding: 3px 6px;
    white-space: normal;
}

body.profile-spb_zpi .production-customer-order-badge > span {
    min-width: 0;
    overflow-wrap: anywhere;
}

body.profile-spb_zpi .production-customer-order-badge small {
    color: #71809a;
    font-size: .55rem;
    font-weight: 700;
    flex: 0 0 auto;
}

body.profile-spb_zpi .production-customer-meta {
    align-items: flex-end;
    display: grid;
    gap: 3px;
    justify-items: end;
}

body.profile-spb_zpi .production-customer-meta b {
    background: #e8f7f1;
    border-radius: 999px;
    color: #147358;
    font-size: .58rem;
    padding: 3px 6px;
}

body.profile-spb_zpi .production-customer-meta small {
    color: #708098;
    font-size: .58rem;
    line-height: 1.25;
    text-align: right;
}

body.profile-spb_zpi .production-customer-meta i {
    color: #76849b;
    font-style: normal;
    font-weight: 900;
    line-height: .6;
}

body.profile-spb_zpi .production-customer-card[open] .production-customer-meta i {
    transform: rotate(180deg);
}

body.profile-spb_zpi .production-customer-orders {
    border-top: 1px solid #dce5f1;
    display: grid;
    gap: 5px;
    padding: 7px;
}

body.profile-spb_zpi .production-customer-order {
    align-items: center;
    background: #f7f9fd;
    border: 1px solid #dce5f1;
    border-radius: 9px;
    display: grid;
    gap: 8px;
    grid-template-columns: minmax(0, 1fr) auto auto;
    min-width: 0;
    padding: 7px 8px;
}

body.profile-spb_zpi .production-customer-order-main {
    display: grid;
    gap: 2px;
    min-width: 0;
}

body.profile-spb_zpi .production-order-number {
    color: #4561a3;
    font-size: .61rem;
    font-weight: 900;
    text-transform: uppercase;
}

body.profile-spb_zpi .production-customer-order-main strong {
    color: #1f304c;
    font-size: .77rem;
    overflow-wrap: anywhere;
}

body.profile-spb_zpi .production-customer-order-main small,
body.profile-spb_zpi .production-customer-order-facts {
    color: #6e7c91;
    font-size: .65rem;
}

body.profile-spb_zpi .production-customer-order-facts {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 4px 9px;
    justify-content: flex-end;
}

body.profile-spb_zpi .production-customer-order-facts > span:not(.production-chat-unread) {
    white-space: nowrap;
}

body.profile-spb_zpi .production-customer-order .primary-link {
    border-radius: 7px;
    font-size: .7rem;
    min-height: 31px;
    padding: 7px 9px;
    white-space: nowrap;
}

body.profile-spb_zpi .production-customer-empty {
    color: #708098;
    font-size: .78rem;
    margin: 0;
    padding: 12px;
    text-align: center;
}

@media (max-width: 980px) {
    body.profile-spb_zpi .production-customer-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 700px) {
    body.profile-spb_zpi .engineer-detail-head {
        align-items: flex-start;
        padding: 9px 10px;
    }

    body.profile-spb_zpi .engineer-head-meta {
        align-items: flex-start;
        flex-direction: column;
    }

    body.profile-spb_zpi .production-work-file-head {
        align-items: stretch;
        grid-template-columns: minmax(0, 1fr);
    }

    body.profile-spb_zpi .production-file-card-actions {
        justify-content: flex-start;
    }

    body.profile-spb_zpi .production-file-more > div {
        left: 0;
        right: auto;
    }

    body.profile-spb_zpi .production-activity-list {
        padding-inline: 8px;
    }

    body.profile-spb_zpi .production-activity-list .production-activity-item {
        gap: 2px;
        grid-template-columns: minmax(0, 1fr);
        padding-left: 15px;
    }

    body.profile-spb_zpi .production-customer-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    body.profile-spb_zpi .production-view-switcher {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        width: 100%;
    }

    body.profile-spb_zpi .production-view-switcher a {
        text-align: center;
    }

    body.profile-spb_zpi .production-customer-order {
        align-items: start;
        gap: 6px;
        grid-template-columns: minmax(0, 1fr) auto;
    }

    body.profile-spb_zpi .production-customer-order-facts {
        grid-column: 1 / -1;
        grid-row: 2;
        justify-content: flex-start;
    }

    body.profile-spb_zpi .production-customer-order .primary-link {
        grid-column: 2;
        grid-row: 1;
    }
}

@media (max-width: 420px) {
    body.profile-spb_zpi .production-customer-card > summary {
        grid-template-columns: 30px minmax(0, 1fr);
    }

    body.profile-spb_zpi .production-customer-avatar {
        height: 30px;
        width: 30px;
    }

    body.profile-spb_zpi .production-customer-meta {
        align-items: center;
        grid-column: 1 / -1;
        grid-template-columns: auto minmax(0, 1fr) auto;
        justify-items: start;
        padding-left: 38px;
        width: 100%;
    }

    body.profile-spb_zpi .production-customer-meta small {
        text-align: left;
    }

    body.profile-spb_zpi .production-customer-order {
        grid-template-columns: minmax(0, 1fr);
    }

    body.profile-spb_zpi .production-customer-order .primary-link {
        grid-column: 1;
        grid-row: auto;
        justify-self: start;
    }

    body.profile-spb_zpi .production-customer-order-facts {
        grid-column: 1;
        grid-row: auto;
    }
}

/* SPB-ZPI compact calculation queue and dashboard tiles v1. */
body.profile-spb_zpi .calculation-tile-grid {
    align-items: stretch;
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 330px), 1fr));
    min-width: 0;
}

body.profile-spb_zpi .calculation-tile {
    background: #fff;
    border: 1px solid #d9e2ed;
    border-left: 4px solid #7587a3;
    border-radius: 14px;
    box-shadow: 0 7px 20px rgba(38, 55, 80, .07);
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
    scroll-margin: 88px;
    transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}

body.profile-spb_zpi .calculation-tile.status-queued { border-left-color: #5972e8; }
body.profile-spb_zpi .calculation-tile.status-in_progress { border-left-color: #d0942e; }
body.profile-spb_zpi .calculation-tile.status-returned,
body.profile-spb_zpi .calculation-tile.status-completed { border-left-color: #26946c; }
body.profile-spb_zpi .calculation-tile.status-cancelled { border-left-color: #a4afbd; }

body.profile-spb_zpi .calculation-tile:hover {
    border-color: #aebfe0;
    border-left-color: #5570df;
    box-shadow: 0 11px 26px rgba(38, 55, 80, .11);
    transform: translateY(-1px);
}

body.profile-spb_zpi .calculation-tile:focus { outline: none; }
body.profile-spb_zpi .calculation-tile.is-return-target {
    border-color: #4169d8;
    box-shadow: 0 0 0 3px rgba(65, 105, 216, .2), 0 12px 28px rgba(38, 55, 80, .13);
}

body.profile-spb_zpi .calculation-tile-head {
    align-items: center;
    background: #f7f9fc;
    border-bottom: 1px solid #e1e7ef;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px 10px;
}

body.profile-spb_zpi .calculation-tile-number {
    color: #536681;
    font-size: .72rem;
    font-weight: 900;
    letter-spacing: .025em;
    text-transform: uppercase;
}

body.profile-spb_zpi .calculation-tile-head .production-stage {
    font-size: .64rem;
    min-height: 23px;
    padding: 4px 7px;
}

body.profile-spb_zpi .calculation-tile-head time {
    color: #6e7f94;
    font-size: .68rem;
    margin-left: auto;
    white-space: nowrap;
}

body.profile-spb_zpi .calculation-tile-body {
    display: grid;
    gap: 9px;
    grid-template-columns: minmax(0, 1.35fr) minmax(105px, .75fr);
    padding: 11px 11px 8px;
}

body.profile-spb_zpi .calculation-tile-identity,
body.profile-spb_zpi .calculation-tile-direction { min-width: 0; }

body.profile-spb_zpi .calculation-tile-label {
    color: #78889b;
    display: block;
    font-size: .59rem;
    font-weight: 900;
    letter-spacing: .055em;
    margin-bottom: 3px;
    text-transform: uppercase;
}

body.profile-spb_zpi .calculation-tile h2 {
    font-size: 1rem;
    line-height: 1.18;
    margin: 0;
    overflow-wrap: anywhere;
}

body.profile-spb_zpi .calculation-tile h2 a { color: #14243c; text-decoration: none; }
body.profile-spb_zpi .calculation-tile h2 a:hover { color: #2f57c5; }

body.profile-spb_zpi .calculation-tile-invoice {
    font-size: .68rem;
    margin-top: 5px;
}

body.profile-spb_zpi .calculation-tile-direction {
    background: #f4f7fb;
    border: 1px solid #e4eaf2;
    border-radius: 9px;
    padding: 7px 8px;
}

body.profile-spb_zpi .calculation-tile-direction strong {
    color: #293e5b;
    display: block;
    font-size: .75rem;
    line-height: 1.3;
    overflow-wrap: anywhere;
}

body.profile-spb_zpi .calculation-tile-facts {
    display: grid;
    gap: 5px;
    grid-template-columns: minmax(0, 1.6fr) repeat(3, minmax(62px, .7fr));
    margin: 0;
    padding: 0 11px 7px;
}

body.profile-spb_zpi .calculation-tile-facts > div {
    background: #f7f9fc;
    border: 1px solid #e8edf3;
    border-radius: 8px;
    min-width: 0;
    padding: 5px 6px;
}

body.profile-spb_zpi .calculation-tile-facts dt {
    color: #7a899c;
    font-size: .56rem;
    font-weight: 900;
    letter-spacing: .04em;
    text-transform: uppercase;
}

body.profile-spb_zpi .calculation-tile-facts dd {
    color: #334a69;
    font-size: .68rem;
    font-weight: 750;
    line-height: 1.25;
    margin: 2px 0 0;
    overflow-wrap: anywhere;
}

body.profile-spb_zpi .calculation-tile-brief {
    border-top: 1px solid #edf1f6;
    margin: 0 11px;
    padding: 7px 0;
}

body.profile-spb_zpi .calculation-tile-brief p {
    color: #465a75;
    display: -webkit-box;
    font-size: .72rem;
    line-height: 1.32;
    margin: 0;
    overflow: hidden;
    overflow-wrap: anywhere;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

body.profile-spb_zpi .calculation-tile-brief small {
    color: #24735a;
    display: block;
    font-size: .64rem;
    font-weight: 800;
    margin-top: 4px;
}

body.profile-spb_zpi .calculation-tile-foot {
    align-items: center;
    border-top: 1px solid #e4eaf1;
    display: grid;
    gap: 7px;
    grid-template-columns: minmax(0, 1fr) auto;
    margin-top: auto;
    padding: 8px 10px 9px;
}

body.profile-spb_zpi .calculation-tile-manager { display: grid; min-width: 0; }
body.profile-spb_zpi .calculation-tile-manager small { color: #7a899b; font-size: .61rem; }
body.profile-spb_zpi .calculation-tile-manager strong { color: #394d68; font-size: .72rem; overflow-wrap: anywhere; }

body.profile-spb_zpi .calculation-tile-buttons {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    justify-content: flex-end;
}

body.profile-spb_zpi .calculation-tile-buttons form { margin: 0; }
body.profile-spb_zpi .calculation-tile-open,
body.profile-spb_zpi .calculation-tile-buttons button,
body.profile-spb_zpi .calculation-tile-assignee button {
    align-items: center;
    border-radius: 8px;
    box-sizing: border-box;
    display: inline-flex;
    font-size: .7rem;
    font-weight: 900;
    justify-content: center;
    min-height: 34px;
    padding: 6px 9px;
    text-decoration: none;
}

body.profile-spb_zpi .calculation-tile-open {
    background: #edf2ff;
    border: 1px solid #cad6f5;
    color: #2f52b3;
}

body.profile-spb_zpi .calculation-tile-assignee {
    align-items: end;
    display: grid;
    gap: 5px;
    grid-column: 1 / -1;
    grid-template-columns: minmax(0, 1fr) auto;
    margin: 0;
}

body.profile-spb_zpi .calculation-tile-assignee label { display: grid; gap: 2px; min-width: 0; }
body.profile-spb_zpi .calculation-tile-assignee label > span {
    color: #718198;
    font-size: .56rem;
    font-weight: 900;
    letter-spacing: .035em;
    text-transform: uppercase;
}

body.profile-spb_zpi .calculation-tile-assignee select {
    border-radius: 8px;
    font-size: .72rem;
    min-height: 34px;
    padding-block: 5px;
}

body.profile-spb_zpi .dashboard-inbox {
    margin-bottom: 10px;
    padding: 14px 15px;
}

body.profile-spb_zpi .dashboard-inbox .inbox-head h1 { font-size: clamp(1.35rem, 3vw, 1.8rem); }
body.profile-spb_zpi .dashboard-inbox .intro-note { font-size: .8rem; margin-top: 3px; }
body.profile-spb_zpi .dashboard-lead-grid { gap: 9px; margin-top: 10px; }
body.profile-spb_zpi .dashboard-lead-tile .lead-tile-head { padding: 7px 9px; }
body.profile-spb_zpi .dashboard-lead-tile .lead-tile-body { gap: 8px; padding: 10px; }
body.profile-spb_zpi .dashboard-lead-tile .lead-tile-phone { margin-top: 4px; min-height: 25px; padding: 3px 0; }
body.profile-spb_zpi .dashboard-lead-tile-summary { padding: 7px 8px; }
body.profile-spb_zpi .dashboard-lead-tile-summary small {
    color: #6d7d92;
    display: block;
    font-size: .64rem;
    line-height: 1.25;
    margin-top: 4px;
}

body.profile-spb_zpi .dashboard-lead-tile-comment {
    color: #52647d;
    display: -webkit-box;
    font-size: .7rem;
    line-height: 1.3;
    margin: 0 10px 7px;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

body.profile-spb_zpi .dashboard-lead-tile-foot { gap: 7px; padding: 7px 9px; }
body.profile-spb_zpi .dashboard-lead-tile-actions { align-items: center; display: flex; flex-wrap: wrap; gap: 5px; justify-content: flex-end; }
body.profile-spb_zpi .dashboard-lead-tile-actions form { margin: 0; }
body.profile-spb_zpi .dashboard-lead-tile-actions button,
body.profile-spb_zpi .dashboard-lead-tile-actions .lead-tile-open {
    border-radius: 8px;
    font-size: .7rem;
    min-height: 34px;
    padding: 6px 9px;
}

body.profile-spb_zpi .attention-panel,
body.profile-spb_zpi .dashboard-task-panel,
body.profile-spb_zpi .feedback-queue,
body.profile-spb_zpi .dashboard-queues .queue-panel { padding: 12px; }

body.profile-spb_zpi .attention-list-rich,
body.profile-spb_zpi .feedback-queue .queue-list {
    display: grid;
    gap: 7px;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
    margin-top: 7px;
}

body.profile-spb_zpi .attention-card-rich { padding: 10px; }
body.profile-spb_zpi .attention-main { gap: 5px; }
body.profile-spb_zpi .attention-details { font-size: .72rem; padding: 6px 7px; }
body.profile-spb_zpi .attention-phone,
body.profile-spb_zpi .attention-meta,
body.profile-spb_zpi .attention-date { font-size: .72rem; }

body.profile-spb_zpi .dashboard-task-groups {
    gap: 8px;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 285px), 1fr));
}

body.profile-spb_zpi .dashboard-task-group { gap: 6px; padding: 9px; }
body.profile-spb_zpi .dashboard-task-list { padding: 0 8px; }
body.profile-spb_zpi .dashboard-task-item { padding: 8px 0; }
body.profile-spb_zpi .dashboard-queues { gap: 9px; }
body.profile-spb_zpi .dashboard-queues .queue-head { padding-bottom: 8px; }
body.profile-spb_zpi .dashboard-queues .queue-list { gap: 5px; }
body.profile-spb_zpi .dashboard-queues .queue-lead { padding: 8px 9px; }

@media (max-width: 700px) {
    body.profile-spb_zpi .calculation-tile-grid,
    body.profile-spb_zpi .dashboard-lead-grid { grid-template-columns: minmax(0, 1fr); }
    body.profile-spb_zpi .calculation-tile-body { grid-template-columns: minmax(0, 1fr); }
    body.profile-spb_zpi .calculation-tile-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    body.profile-spb_zpi .calculation-tile-facts > div:first-child { grid-column: 1 / -1; }
    body.profile-spb_zpi .calculation-tile-foot { align-items: stretch; grid-template-columns: minmax(0, 1fr); }
    body.profile-spb_zpi .calculation-tile-buttons { justify-content: stretch; }
    body.profile-spb_zpi .calculation-tile-buttons > *,
    body.profile-spb_zpi .calculation-tile-buttons .calculation-tile-open { flex: 1; }
    body.profile-spb_zpi .calculation-tile-assignee { grid-column: 1; }
    body.profile-spb_zpi .dashboard-inbox { padding: 11px; }
    body.profile-spb_zpi .dashboard-lead-tile-foot { align-items: stretch; }
    body.profile-spb_zpi .dashboard-lead-tile-actions { justify-content: stretch; }
    body.profile-spb_zpi .dashboard-lead-tile-actions > * { flex: 1; }
    body.profile-spb_zpi .dashboard-lead-tile-actions button,
    body.profile-spb_zpi .dashboard-lead-tile-actions .lead-tile-open { min-height: 40px; width: 100%; }
}

/* Final lifecycle and compact manual-create layout. */
body.profile-spb_zpi .lead-stage-current {
    align-items: center;
    background: #f4f7fb;
    border: 1px solid #e1e8f1;
    border-radius: 10px;
    display: flex;
    gap: 10px;
    justify-content: space-between;
    margin: 8px 0 12px;
    padding: 9px 11px;
}

body.profile-spb_zpi .lead-stage-current > span {
    color: #6f7f94;
    font-size: .72rem;
    font-weight: 900;
    letter-spacing: .045em;
    text-transform: uppercase;
}

body.profile-spb_zpi .lead-stage-current .status-pill {
    font-size: .76rem;
    margin: 0;
}

body.profile-spb_zpi .lead-stage-panel .quick-actions {
    align-items: stretch;
    display: grid;
    gap: 8px;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

body.profile-spb_zpi .lead-stage-panel .lead-stage-control {
    margin: 0;
    min-width: 0;
}

body.profile-spb_zpi .lead-stage-panel .lead-stage-control > button,
body.profile-spb_zpi .lead-stage-panel .lead-stage-control > summary,
body.profile-spb_zpi .lead-stage-panel .stage-link-button {
    box-sizing: border-box;
    min-height: 44px;
    width: 100%;
}

body.profile-spb_zpi .manual-lead-intro {
    min-height: 0;
    padding-block: 22px;
}

body.profile-spb_zpi .manual-lead-intro h1 {
    font-size: clamp(2rem, 5vw, 3.15rem);
}

body.profile-spb_zpi .manual-lead-form {
    max-width: 1180px;
}

body.profile-spb_zpi .manual-route-options {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

@media (min-width: 860px) {
    body.profile-spb_zpi .manual-lead-form {
        display: grid;
        gap: 12px;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        padding: 14px;
    }

    body.profile-spb_zpi .manual-form-section-client,
    body.profile-spb_zpi .manual-form-section-work {
        align-content: start;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    body.profile-spb_zpi .manual-form-section h2,
    body.profile-spb_zpi .manual-form-section-client .organization-picker,
    body.profile-spb_zpi .manual-form-section-work .manual-category-block,
    body.profile-spb_zpi .manual-form-section-work > label:last-child,
    body.profile-spb_zpi .manual-form-section-status,
    body.profile-spb_zpi .manual-form-actions,
    body.profile-spb_zpi .manual-lead-form > .field-hint,
    body.profile-spb_zpi .manual-lead-form > input[type="hidden"] {
        grid-column: 1 / -1;
    }

    body.profile-spb_zpi .manual-form-section-client .organization-picker {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    body.profile-spb_zpi .organization-picker > label:first-child,
    body.profile-spb_zpi .organization-picker .organization-suggestions,
    body.profile-spb_zpi .organization-picker .organization-auto-hint,
    body.profile-spb_zpi .organization-picker .organization-requisites {
        grid-column: 1 / -1;
    }

    body.profile-spb_zpi .manual-category-list {
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    }
}

@media (max-width: 859px) {
    body.profile-spb_zpi .manual-route-options {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 700px) {
    body.profile-spb_zpi .manual-lead-intro {
        margin-bottom: 10px;
        padding: 16px 18px;
    }

    body.profile-spb_zpi .manual-lead-intro h1 {
        font-size: 1.85rem;
    }

    body.profile-spb_zpi .manual-lead-form {
        gap: 9px;
        padding: 10px;
    }

    body.profile-spb_zpi .manual-form-section {
        gap: 9px;
        padding: 11px;
    }

    body.profile-spb_zpi .manual-lead-form label {
        gap: 5px;
    }

    body.profile-spb_zpi .manual-lead-form input,
    body.profile-spb_zpi .manual-lead-form select,
    body.profile-spb_zpi .manual-lead-form textarea {
        font-size: 16px;
        min-height: 44px;
        padding: 9px 10px;
    }

    body.profile-spb_zpi .manual-category-list {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }

    body.profile-spb_zpi .manual-form-actions {
        background: rgba(255, 255, 255, .96);
        bottom: 0;
        box-shadow: 0 -8px 20px rgba(25, 45, 78, .1);
        margin: 0 -10px -10px;
        padding: 9px 10px;
        position: sticky;
        z-index: 5;
    }
}
/* Role-aware workflow attention. A status stays truthful; this layer shows who must act next. */
body.profile-spb_zpi .needs-action {
    border-color: #f3a0aa !important;
    box-shadow: 0 10px 26px rgba(190, 36, 58, .10), inset 4px 0 0 #d83d54;
    position: relative;
}
body.profile-spb_zpi .needs-action::after {
    background: #d83d54;
    border: 3px solid #fff;
    border-radius: 50%;
    box-shadow: 0 0 0 3px rgba(216, 61, 84, .14);
    content: "";
    height: 10px;
    position: absolute;
    right: 12px;
    top: 12px;
    width: 10px;
    z-index: 2;
}
body.profile-spb_zpi .workflow-action-badge,
body.profile-spb_zpi .lead-tile-event.is-action {
    align-items: center;
    background: #fff0f2;
    border: 1px solid #f2b4bc;
    border-radius: 999px;
    color: #aa263c;
    display: inline-flex;
    font-family: inherit;
    font-size: .78rem;
    font-weight: 800;
    line-height: 1.2;
    gap: 6px;
    padding: 5px 9px;
}
body.profile-spb_zpi .workflow-action-badge::before,
body.profile-spb_zpi .lead-tile-event.is-action::before {
    background: #d83d54;
    border-radius: 50%;
    content: "";
    flex: 0 0 7px;
    height: 7px;
    width: 7px;
}
@media (max-width: 720px) {
    body.profile-spb_zpi .needs-action::after { right: 8px; top: 8px; }
    body.profile-spb_zpi .workflow-action-badge,
    body.profile-spb_zpi .lead-tile-event.is-action { white-space: normal; }
}

/* Final UI consistency pass: attention, filters, actions and one detailed audit. */
body.profile-spb_zpi .needs-action::after {
    content: none;
    display: none;
}

body.profile-spb_zpi .lead-tile.needs-action .lead-tile-head time,
body.profile-spb_zpi .dashboard-lead-tile.needs-action .lead-tile-head time {
    margin-right: 0;
}

body.profile-spb_zpi .queue-filter-panel {
    align-items: stretch;
    gap: 9px;
    grid-template-columns: minmax(0, 1fr) auto;
    padding: 10px 12px;
}

body.profile-spb_zpi .queue-scope-tabs {
    grid-column: 1 / -1;
    height: 42px;
    justify-self: start;
}

body.profile-spb_zpi .queue-filter-form {
    display: grid;
    gap: 7px;
    grid-template-columns: minmax(230px, 1.65fr) repeat(3, minmax(130px, 1fr)) minmax(150px, .9fr) auto;
    min-width: 0;
}

body.profile-spb_zpi .queue-filter-form > label,
body.profile-spb_zpi .queue-filter-form > .queue-filter-search,
body.profile-spb_zpi .queue-filter-form > .queue-action-filter { min-width: 0; }

body.profile-spb_zpi .queue-action-filter-control {
    box-sizing: border-box;
    height: 44px;
    min-height: 44px;
    white-space: nowrap;
}

body.profile-spb_zpi .queue-action-filter-control input[type="checkbox"] {
    appearance: auto;
    box-shadow: none;
    flex: 0 0 18px;
    min-height: 18px;
    padding: 0;
}

body.profile-spb_zpi .queue-filter-result {
    align-self: end;
    padding: 0 0 10px;
}

body.profile-spb_zpi .task-reschedule {
    border: 0;
    border-radius: 9px;
    overflow: visible;
}

body.profile-spb_zpi .task-reschedule > summary {
    background: #f3f6fb;
    border: 1px solid #cdd8e8;
    border-radius: 9px;
    box-shadow: none;
    min-height: 42px;
    padding: 9px 13px;
}

body.profile-spb_zpi .task-reschedule[open] {
    background: #f8faff;
    border: 1px solid #d8e1ee;
    overflow: hidden;
}

body.profile-spb_zpi .task-reschedule[open] > summary {
    border: 0;
    border-bottom: 1px solid #d8e1ee;
    border-radius: 0;
}

body.profile-spb_zpi :is(
    .task-card-actions button,
    .task-reschedule > summary,
    .queue-filter-actions button,
    .queue-filter-actions a,
    .lead-tile-open,
    .production-file-download-button
) {
    box-sizing: border-box;
    font-family: inherit;
    line-height: 1.15;
    outline-offset: 2px;
}

body.profile-spb_zpi .unified-history-panel {
    grid-column: 1 / -1;
    overflow: hidden;
    padding: 0;
}

body.profile-spb_zpi .unified-history-panel > summary {
    align-items: center;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    list-style: none;
    min-height: 58px;
    padding: 12px 15px;
}

body.profile-spb_zpi .unified-history-panel > summary::-webkit-details-marker { display: none; }
body.profile-spb_zpi .unified-history-panel > summary > span:first-child { display: grid; gap: 2px; }
body.profile-spb_zpi .unified-history-panel > summary small {
    color: #71829b;
    font-size: .66rem;
    font-weight: 900;
    letter-spacing: .065em;
    text-transform: uppercase;
}
body.profile-spb_zpi .unified-history-panel > summary strong { color: #182b49; font-size: .98rem; }
body.profile-spb_zpi .unified-history-panel > summary > span:last-child {
    align-items: center;
    background: #edf2ff;
    border-radius: 999px;
    color: #3555b5;
    display: inline-flex;
    font-size: .75rem;
    font-weight: 850;
    min-height: 28px;
    padding: 4px 9px;
}

body.profile-spb_zpi .unified-history-list {
    background: #fbfcfe;
    border-top: 1px solid #dce4ef;
    display: grid;
    gap: 7px;
    list-style: none;
    margin: 0;
    max-height: 560px;
    overflow: auto;
    padding: 11px 13px 13px;
}

body.profile-spb_zpi .unified-history-list > li {
    background: #fff;
    border: 1px solid #e0e7f1;
    border-left: 3px solid #7184e8;
    border-radius: 10px;
    display: grid;
    gap: 7px;
    padding: 9px 11px;
}

body.profile-spb_zpi .unified-history-list > li.history-event-source-production { border-left-color: #36a17e; }
body.profile-spb_zpi .history-event-head { align-items: start; display: flex; gap: 12px; justify-content: space-between; }
body.profile-spb_zpi .history-event-head > span { display: grid; gap: 2px; }
body.profile-spb_zpi .history-event-head strong { color: #192b48; font-size: .84rem; }
body.profile-spb_zpi .history-event-head small { color: #526984; font-size: .72rem; font-weight: 800; }
body.profile-spb_zpi .history-event-head time { color: #7c8ba1; flex: none; font-size: .7rem; }
body.profile-spb_zpi :is(.history-event-comment, .history-event-subject) { color: #4f617b; font-size: .76rem; line-height: 1.35; margin: 0; }
body.profile-spb_zpi .history-event-files { display: flex; flex-wrap: wrap; gap: 5px; }
body.profile-spb_zpi .history-event-files span { background: #edf3ff; border-radius: 7px; color: #3153a8; font-size: .7rem; overflow-wrap: anywhere; padding: 5px 7px; }
body.profile-spb_zpi .history-event-changes { display: grid; gap: 5px; margin: 0; }
body.profile-spb_zpi .history-event-changes > div {
    align-items: start;
    background: #f5f7fb;
    border-radius: 8px;
    display: grid;
    gap: 7px;
    grid-template-columns: minmax(105px, .45fr) minmax(0, 1fr);
    padding: 6px 8px;
}
body.profile-spb_zpi .history-event-changes dt { color: #71819a; font-size: .66rem; font-weight: 850; }
body.profile-spb_zpi .history-event-changes dd { align-items: baseline; color: #263b5c; display: grid; font-size: .72rem; gap: 6px; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); margin: 0; }
body.profile-spb_zpi .history-event-changes dd span { overflow-wrap: anywhere; white-space: pre-wrap; }
body.profile-spb_zpi .history-event-changes dd b { color: #8a99ad; }

@media (max-width: 1180px) {
    body.profile-spb_zpi .queue-filter-form { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    body.profile-spb_zpi .queue-filter-form > .queue-filter-search { grid-column: span 2; }
}

@media (max-width: 700px) {
    body.profile-spb_zpi .needs-action::after { left: -5px; right: auto; top: 13px; }
    body.profile-spb_zpi .queue-filter-panel { grid-template-columns: minmax(0, 1fr); }
    body.profile-spb_zpi .queue-filter-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    body.profile-spb_zpi .queue-filter-form > .queue-filter-search,
    body.profile-spb_zpi .queue-filter-actions { grid-column: 1 / -1; }
    body.profile-spb_zpi .queue-filter-result { padding: 0; }
    body.profile-spb_zpi .history-event-head { display: grid; gap: 5px; }
    body.profile-spb_zpi .history-event-changes > div { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 440px) {
    body.profile-spb_zpi .queue-filter-form { grid-template-columns: minmax(0, 1fr); }
    body.profile-spb_zpi .queue-filter-form > .queue-filter-search,
    body.profile-spb_zpi .queue-filter-actions { grid-column: 1; }
    body.profile-spb_zpi .queue-filter-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
    body.profile-spb_zpi .history-event-changes dd { grid-template-columns: minmax(0, 1fr); }
    body.profile-spb_zpi .history-event-changes dd b { transform: rotate(90deg); width: max-content; }
}

/* Production controls and lead cards share one compact visual rhythm. */
body.profile-spb_zpi .queue-filter-panel {
    background: #fff;
    border: 1px solid #d8e2ef;
    border-radius: 15px;
    box-shadow: 0 8px 24px rgba(27, 48, 86, .06);
    display: grid;
    gap: 10px;
    grid-template-columns: minmax(0, 1fr) auto;
    margin-bottom: 10px;
    padding: 11px 12px 10px;
}

body.profile-spb_zpi .queue-filter-toolbar {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    grid-column: 1 / -1;
}

body.profile-spb_zpi .queue-filter-toolbar .production-view-switcher {
    flex: 0 0 auto;
    margin: 0;
}

body.profile-spb_zpi .queue-filter-toolbar .queue-scope-tabs {
    flex: 0 1 auto;
    grid-column: auto;
    height: 39px;
    justify-self: auto;
}

body.profile-spb_zpi .queue-filter-toolbar .production-view-switcher a,
body.profile-spb_zpi .queue-filter-toolbar .queue-scope-tab {
    align-items: center;
    box-sizing: border-box;
    display: inline-flex;
    height: 31px;
    justify-content: center;
    line-height: 1;
    min-height: 31px;
    padding: 0 11px;
}

body.profile-spb_zpi .queue-filter-form {
    align-items: end;
    display: grid;
    gap: 7px;
    grid-template-columns: minmax(230px, 1.65fr) repeat(3, minmax(130px, 1fr)) minmax(155px, .9fr) auto;
    min-width: 0;
}

body.profile-spb_zpi .queue-action-filter {
    display: grid;
    gap: 2px;
    min-height: 0;
    padding: 0;
}

body.profile-spb_zpi .queue-action-filter > span {
    color: #6b7d98;
    font-size: .58rem;
    font-weight: 900;
    letter-spacing: .035em;
    padding-left: 2px;
    text-transform: uppercase;
}

body.profile-spb_zpi .queue-action-filter:has(input:checked) {
    background: transparent;
    box-shadow: none;
}

body.profile-spb_zpi .queue-action-filter-control {
    align-items: center;
    background: #f8f9fc;
    border: 1px solid #d9e1ed;
    border-radius: 7px;
    box-sizing: border-box;
    color: #52647e;
    display: flex;
    gap: 7px;
    height: 44px;
    line-height: 1.15;
    min-height: 44px;
    padding: 0 10px;
    white-space: nowrap;
}

body.profile-spb_zpi .queue-action-filter-control > span {
    color: inherit;
    font-size: .68rem;
    font-weight: 850;
    letter-spacing: .01em;
    padding: 0;
    text-transform: uppercase;
}

body.profile-spb_zpi .queue-action-filter:has(input:checked) .queue-action-filter-control {
    background: #fff3f4;
    border-color: #efb7bf;
    color: #aa263c;
}

body.profile-spb_zpi .queue-action-filter-control input[type="checkbox"] {
    appearance: none !important;
    background: #fff;
    border: 1.5px solid #9aabc1;
    border-radius: 5px;
    box-shadow: none;
    box-sizing: border-box;
    flex: 0 0 18px;
    height: 18px !important;
    margin: 0;
    max-height: 18px;
    max-width: 18px;
    min-height: 18px;
    min-width: 18px;
    padding: 0 !important;
    width: 18px !important;
}

body.profile-spb_zpi .queue-action-filter-control input[type="checkbox"]:checked {
    background: #5067e9;
    border-color: #5067e9;
    box-shadow: inset 0 0 0 4px #fff;
}

body.profile-spb_zpi .queue-filter-result {
    align-self: center;
    background: #f2f5fa;
    border-radius: 999px;
    color: #61738e;
    padding: 7px 10px;
}

body.profile-spb_zpi .queue-filter-actions :is(button, a),
body.profile-spb_zpi :is(.primary-button, .secondary-button, .danger-secondary, .compact-button, .primary-link) {
    box-shadow: none;
    box-sizing: border-box;
    font-family: inherit;
    line-height: 1.15;
}

body.profile-spb_zpi .lead-stage-panel .quick-actions {
    align-items: stretch;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

body.profile-spb_zpi .lead-stage-panel .quick-actions > :last-child {
    grid-column: auto;
}

body.profile-spb_zpi .lead-stage-panel :is(.lead-stage-control, .lead-stage-control > button, .lead-stage-control > summary) {
    min-height: 46px;
}

body.profile-spb_zpi :is(#organization-panel, #invoice-panel) {
    align-content: start;
    display: grid;
    gap: 11px;
}

body.profile-spb_zpi :is(#organization-panel, #invoice-panel) > :is(.panel-headline, .operations-summary, .production-main-comment, .invoice-requisites-review, .task-create) {
    margin: 0;
}

body.profile-spb_zpi :is(#organization-panel, #invoice-panel) .panel-headline {
    min-height: 42px;
}

body.profile-spb_zpi .unified-history-panel {
    margin-bottom: 0;
}

@media (max-width: 1180px) {
    body.profile-spb_zpi .queue-filter-form {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    body.profile-spb_zpi .queue-filter-form > .queue-filter-search {
        grid-column: span 2;
    }
}

@media (max-width: 700px) {
    body.profile-spb_zpi .queue-filter-panel {
        grid-template-columns: minmax(0, 1fr);
        padding: 9px;
    }

    body.profile-spb_zpi .queue-filter-toolbar {
        align-items: stretch;
        display: grid;
        grid-template-columns: minmax(0, 1fr);
    }

    body.profile-spb_zpi .queue-filter-toolbar :is(.production-view-switcher, .queue-scope-tabs) {
        box-sizing: border-box;
        max-width: 100%;
        overflow-x: auto;
        width: 100%;
    }

    body.profile-spb_zpi .queue-filter-toolbar :is(.production-view-switcher a, .queue-scope-tab) {
        flex: 1 0 auto;
    }

    body.profile-spb_zpi .queue-filter-result {
        justify-self: start;
    }
}

@media (max-width: 440px) {
    body.profile-spb_zpi .queue-filter-form {
        grid-template-columns: minmax(0, 1fr);
    }

    body.profile-spb_zpi .queue-filter-form > .queue-filter-search,
    body.profile-spb_zpi .queue-filter-actions {
        grid-column: 1;
    }

    body.profile-spb_zpi .lead-stage-panel .quick-actions {
        grid-template-columns: minmax(0, 1fr);
    }
}
