:root {
    --crm-bg: #f6f7f9;
    --crm-panel: #ffffff;
    --crm-panel-soft: #f3f4f6;
    --crm-panel-hover: #f9fafb;
    --crm-text: #1d1d1f;
    --crm-muted: #6b7280;
    --crm-line: #e5e7eb;
    --crm-line-strong: #d1d5db;
    --crm-accent: #0070f3;
    --crm-accent-strong: #0060df;
    --crm-accent-light: #f0f7ff;
    --crm-accent-ring: rgba(0, 112, 243, 0.2);
    --crm-warn: #b45309;
    --crm-danger: #b91c1c;
    --crm-radius: 8px;
    --crm-shadow: none;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--crm-bg);
    color: var(--crm-text);
}

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

.crm-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.crm-shell {
    min-height: 100vh;
}

.crm-header {
    position: sticky;
    top: 0;
    z-index: 1100;
    display: grid;
    grid-template-columns: 1fr minmax(280px, 360px) 1fr;
    gap: 16px;
    align-items: center;
    min-height: 58px;
    padding: 10px 20px;
    border-bottom: 1px solid var(--crm-line);
    background: #fff;
}

.crm-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.crm-brand-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    color: var(--crm-text);
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    letter-spacing: 0;
}

.crm-brand-link img {
    width: auto;
    height: 20px;
    display: block;
}

.crm-tool-switch {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 3px;
    border: 1px solid var(--crm-line);
    border-radius: 8px;
    background: var(--crm-panel-soft);
}

.crm-tool-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 32px;
    padding: 0 10px;
    border-radius: 6px;
    color: var(--crm-muted);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
}

.crm-tool-link svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.crm-tool-link.is-active {
    background: var(--crm-panel);
    color: var(--crm-accent);
    box-shadow: none;
}

.crm-search {
    position: relative;
    justify-self: center;
    width: 100%;
    max-width: 360px;
    min-width: 0;
}

.crm-search-mobile-idle,
.crm-search-cancel {
    display: none;
}

.crm-search-field {
    display: contents;
}

.crm-search-control {
    display: flex;
    align-items: center;
    min-width: 0;
    height: 38px;
    min-height: 38px;
    max-height: 38px;
    border: 1px solid var(--crm-line);
    border-radius: 8px;
    background: var(--crm-panel-soft);
    overflow: hidden;
}

.crm-search:focus-within .crm-search-control {
    border-color: var(--crm-accent);
    background: var(--crm-panel);
    box-shadow: 0 0 0 3px var(--crm-accent-ring);
}

.crm-search input {
    width: 100%;
    min-width: 0;
    height: 100%;
    padding: 0 14px;
    border: 0;
    outline: 0;
    color: var(--crm-text);
    background: transparent;
}

.crm-search-submit,
.crm-note-form button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    border: 0;
    background: var(--crm-accent);
    color: #fff;
    font-weight: 800;
    cursor: pointer;
}

.crm-search-submit {
    width: 44px;
    min-width: 44px;
    padding: 0;
    border-left: 1px solid var(--crm-line);
    border-radius: 0 7px 7px 0;
}

.crm-search-submit svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.crm-search-submit:hover,
.crm-note-form button:hover {
    background: var(--crm-accent-strong);
}

.crm-search-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    z-index: 1200;
    max-height: 320px;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 4px;
    border: 1px solid var(--crm-line);
    border-radius: 8px;
    background: var(--crm-panel);
    box-shadow: 0 16px 38px rgba(15, 23, 42, 0.14);
}

.crm-search-dropdown[hidden] {
    display: none;
}

.crm-search-result {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 48px;
    padding: 5px 8px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--crm-text);
    text-align: left;
    cursor: pointer;
}

.crm-search-result .crm-customer-avatar {
    width: 38px;
    height: 38px;
    font-size: 13px;
}

.crm-search-result:hover,
.crm-search-result:focus-visible {
    outline: none;
    background: var(--crm-accent-light);
}

.crm-search-result-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 14px;
    font-weight: 650;
}

.crm-search-result-copy {
    display: grid;
    gap: 3px;
    min-width: 0;
}

.crm-search-result-meta {
    min-width: 0;
    overflow: hidden;
    color: var(--crm-muted);
    font-size: 12px;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.crm-search-heading {
    padding: 7px 10px 5px;
    color: var(--crm-muted);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.crm-search-empty {
    padding: 10px 12px;
    color: var(--crm-muted);
    font-size: 13px;
    font-weight: 650;
}

.crm-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: flex-end;
}

.crm-account-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 38px;
    border: 1px solid var(--crm-line);
    border-radius: 8px;
    background: var(--crm-panel);
    color: var(--crm-text);
    cursor: pointer;
}

.crm-account-button .avatar-initials:not(:empty) + svg {
    display: none;
}

.crm-main {
    display: block;
    padding: 16px;
}

.crm-board,
.crm-detail {
    min-width: 0;
    border: 1px solid var(--crm-line);
    border-radius: var(--crm-radius);
    background: var(--crm-panel);
    box-shadow: var(--crm-shadow);
}

.crm-board {
    overflow: hidden;
}

.crm-board:has(.crm-filter-menu[open]) {
    min-height: 460px;
}

.crm-board-toolbar,
.crm-detail-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--crm-line);
    background: #fafafa;
}

.crm-board-toolbar {
    display: grid;
    grid-template-columns: minmax(104px, 0.55fr) minmax(520px, auto) minmax(128px, 0.55fr);
}

.crm-board-title {
    min-width: 104px;
}

.crm-board-title p {
    max-width: 280px;
}

.crm-board-toolbar h1,
.crm-detail-header h2 {
    margin: 0;
    color: var(--crm-text);
    font-size: 20px;
    line-height: 1.15;
    letter-spacing: 0;
}

.crm-detail-title {
    display: flex;
    flex: 1 1 auto;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.crm-detail-identity {
    display: inline-flex;
    align-items: center;
    flex: 0 1 auto;
    gap: 10px;
    min-width: 0;
    min-height: var(--ff-control-min-height);
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: left;
}

.crm-detail-identity h2 {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.crm-detail-identity-chevron {
    display: none;
    flex: 0 0 auto;
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
}

.crm-detail-avatar {
    flex: 0 0 auto;
}

.crm-detail-title-text {
    display: flex;
    flex: 1 1 auto;
    align-items: center;
    flex-wrap: nowrap;
    gap: 6px 10px;
    min-width: 0;
}

.crm-customer-actions {
    margin-left: auto;
}

.crm-task-manager button,
.crm-task-form select,
.crm-task-form input,
.crm-task-form textarea {
    min-height: var(--ff-control-min-height);
    border: 1px solid var(--crm-line-strong);
    border-radius: var(--crm-radius);
    background: var(--crm-panel);
    color: var(--crm-text);
    font: inherit;
}

.crm-customer-action-menu {
    position: relative;
}

.crm-customer-action-menu > summary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: var(--ff-control-min-height);
    padding: 0 12px;
    border: 1px solid var(--crm-line-strong);
    border-radius: var(--crm-radius);
    background: var(--crm-panel);
    color: var(--crm-accent-strong);
    font-size: 13px;
    font-weight: 800;
    list-style: none;
    cursor: pointer;
}

.crm-customer-action-menu > summary::-webkit-details-marker {
    display: none;
}

.crm-customer-action-menu > summary svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

.crm-customer-action-menu > summary:focus-visible {
    outline: 3px solid var(--crm-accent-ring);
    outline-offset: 2px;
}

.crm-customer-action-list {
    position: absolute;
    top: calc(100% + 7px);
    right: 0;
    z-index: 20;
    display: grid;
    width: 190px;
    padding: 5px;
    border: 1px solid var(--crm-line);
    border-radius: 10px;
    background: var(--crm-panel);
    box-shadow: 0 14px 34px rgba(15, 23, 42, 0.2);
}

.crm-customer-action-list button {
    display: flex;
    align-items: center;
    width: 100%;
    min-height: var(--ff-control-min-height);
    padding: 0 10px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--crm-text);
    font: inherit;
    font-size: 13px;
    font-weight: 750;
    text-align: left;
    cursor: pointer;
}

.crm-customer-action-list button:hover,
.crm-customer-action-list button:focus-visible {
    outline: 0;
    background: var(--crm-accent-light);
    color: var(--crm-accent-strong);
}

.crm-customer-action-list button:disabled {
    color: var(--crm-muted);
    cursor: not-allowed;
    opacity: 0.62;
}

.crm-customer-action-list button span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    min-height: 22px;
    margin-left: auto;
    border-radius: 999px;
    background: var(--crm-accent-light);
}

.crm-task-manager {
    flex: 0 0 auto;
    max-height: min(520px, 64vh);
    overflow: auto;
    border-bottom: 1px solid var(--crm-line);
    background: var(--crm-panel);
}

.crm-task-manager[hidden] {
    display: none;
}

.crm-task-manager > header {
    position: sticky;
    top: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--crm-line);
    background: var(--crm-panel);
}

.crm-task-manager h3,
.crm-task-manager h4,
.crm-task-manager p {
    margin: 0;
}

.crm-task-manager > header h3 {
    font-size: 17px;
}

.crm-task-manager > header span,
.crm-task-manager-row span,
.crm-task-status,
.crm-task-manager-empty {
    color: var(--crm-muted);
    font-size: 12px;
}

.crm-task-manager-close {
    width: var(--ff-control-min-height);
    padding: 0;
    font-size: 24px;
    cursor: pointer;
}

.crm-task-manager-body {
    display: grid;
    grid-template-columns: minmax(240px, 0.8fr) minmax(320px, 1.2fr);
    gap: 16px;
    padding: 16px;
}

.crm-task-manager-list {
    display: grid;
    align-content: start;
    gap: 8px;
}

.crm-task-manager-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px;
    border: 1px solid var(--crm-line);
    border-radius: var(--crm-radius);
    background: var(--crm-panel-soft);
}

.crm-task-manager-row > div {
    display: grid;
    gap: 3px;
    min-width: 0;
}

.crm-task-manager-row strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.crm-task-manager-row button,
.crm-task-form-actions button {
    padding: 0 12px;
    color: var(--crm-accent-strong);
    font-weight: 800;
    cursor: pointer;
}

.crm-task-form {
    display: grid;
    align-content: start;
    gap: 10px;
}

.crm-task-form-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.crm-task-form label {
    display: grid;
    gap: 4px;
    color: var(--crm-muted);
    font-size: 12px;
    font-weight: 700;
}

.crm-task-form select,
.crm-task-form input,
.crm-task-form textarea {
    width: 100%;
    padding: 8px 10px;
    font-size: 14px;
}

.crm-task-form .crm-task-notes {
    grid-column: 1 / -1;
}

.crm-task-form textarea {
    min-height: 78px;
    resize: vertical;
}

.crm-task-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.crm-task-form-actions [type="submit"] {
    border-color: var(--crm-accent);
    background: var(--crm-accent);
    color: #fff;
}

.crm-task-status {
    min-height: 18px;
}

.crm-detail-contact {
    display: flex;
    flex: 1 1 auto;
    align-items: center;
    flex-wrap: nowrap;
    gap: 14px;
    min-width: 0;
}

.crm-contact-control {
    display: inline-flex;
    min-width: 0;
    min-height: var(--ff-control-min-height);
}

.crm-contact-control[data-crm-contact-control="phone"] {
    flex: 0 1 auto;
}

.crm-contact-control[data-crm-contact-control="email"] {
    flex: 1 1 auto;
    max-width: 340px;
}

.crm-copy-contact {
    display: inline-flex;
    align-items: center;
    min-width: 0;
    min-height: var(--ff-control-min-height);
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: var(--crm-muted);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    overflow: hidden;
}

.crm-copy-contact [data-crm-contact-label] {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.crm-contact-select {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 var(--ff-control-min-height);
    width: var(--ff-control-min-height);
    min-height: var(--ff-control-min-height);
    border: 0;
    border-radius: 0;
    background: transparent;
    color: var(--crm-muted);
}

.crm-contact-select select {
    position: absolute;
    inset: 0;
    z-index: 1;
    width: 100%;
    height: 100%;
    margin: 0;
    opacity: 0;
    cursor: pointer;
}

.crm-contact-select svg {
    width: 15px;
    height: 15px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
}

.crm-contact-select:hover,
.crm-contact-select:focus-within {
    color: var(--crm-accent);
}

.crm-contact-select:focus-within {
    outline: 2px solid var(--crm-accent);
    outline-offset: -7px;
}

.crm-copy-contact:hover {
    color: var(--crm-accent);
}

.crm-board-toolbar p,
.crm-generated,
.crm-card-meta,
.crm-muted {
    color: var(--crm-muted);
}

.crm-board-toolbar p {
    margin: 5px 0 0;
    font-size: 13px;
}

.crm-generated {
    min-width: 0;
    text-align: right;
    font-size: 12px;
    line-height: 1.2;
}

.crm-toolbar-actions {
    display: grid;
    align-items: start;
    justify-content: flex-end;
    justify-self: end;
    gap: 4px;
    min-width: 0;
}

.crm-date-filter,
.crm-custom-dates label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--crm-muted);
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}

.crm-date-filter[hidden] {
    display: none;
}

.crm-date-filter select,
.crm-custom-dates input {
    height: 34px;
    border: 1px solid var(--crm-line);
    border-radius: 8px;
    background: #fff;
    color: var(--crm-text);
    font-size: 13px;
    font-weight: 650;
}

.crm-date-filter select {
    min-width: 126px;
    padding: 0 28px 0 9px;
}

.crm-custom-dates {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--crm-line);
    background: #fff;
}

.crm-custom-dates[hidden] {
    display: none;
}

.crm-custom-dates input {
    width: 150px;
    padding: 0 8px;
}

.crm-stage-tabs {
    display: flex;
    gap: 2px;
    justify-content: center;
    justify-self: center;
    min-width: 260px;
    width: 100%;
    max-width: 880px;
    overflow-x: auto;
    padding: 0 2px 2px;
    scrollbar-width: thin;
}

.crm-stage-tabs:empty {
    display: none;
}

.crm-funnel-step {
    --funnel-fill: #ffffff;
    --funnel-border: var(--crm-line);
    --funnel-text: var(--crm-text);
    --funnel-count: #111827;
    --funnel-notch: 16px;
    position: relative;
    isolation: isolate;
    display: grid;
    grid-template-columns: minmax(76px, 1fr) auto;
    align-items: center;
    gap: 10px;
    min-width: 116px;
    min-height: 40px;
    padding: 6px 21px 6px 18px;
    border: 0;
    background: transparent;
    color: var(--funnel-text);
    text-align: left;
    white-space: nowrap;
    cursor: pointer;
    filter: drop-shadow(0 1px 0 rgba(17, 24, 39, 0.04));
    transition: color 0.14s ease, transform 0.14s ease, filter 0.14s ease;
}

.crm-funnel-step::before,
.crm-funnel-step::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    clip-path: polygon(
        0 0,
        calc(100% - var(--funnel-notch)) 0,
        100% 50%,
        calc(100% - var(--funnel-notch)) 100%,
        0 100%,
        var(--funnel-notch) 50%
    );
}

.crm-funnel-step::before {
    z-index: -2;
    background: var(--funnel-border);
}

.crm-funnel-step::after {
    z-index: -1;
    inset: 1px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.95) 0%, rgba(249, 250, 251, 0.72) 100%),
        var(--funnel-fill);
    clip-path: polygon(
        0 0,
        calc(100% - var(--funnel-notch)) 0,
        100% 50%,
        calc(100% - var(--funnel-notch)) 100%,
        0 100%,
        var(--funnel-notch) 50%
    );
}

.crm-funnel-step:first-child {
    padding-left: 16px;
}

.crm-funnel-step:first-child::before,
.crm-funnel-step:first-child::after {
    clip-path: polygon(
        0 0,
        calc(100% - var(--funnel-notch)) 0,
        100% 50%,
        calc(100% - var(--funnel-notch)) 100%,
        0 100%
    );
}

.crm-funnel-step:last-child {
    padding-right: 16px;
}

.crm-funnel-step:last-child::before,
.crm-funnel-step:last-child::after {
    clip-path: polygon(
        0 0,
        100% 0,
        100% 100%,
        0 100%,
        var(--funnel-notch) 50%
    );
}

.crm-funnel-step:hover {
    --funnel-fill: var(--crm-panel-hover);
    --funnel-border: var(--crm-line-strong);
    transform: translateY(-1px);
    filter: drop-shadow(0 5px 12px rgba(15, 23, 42, 0.08));
}

.crm-funnel-step.is-active {
    --funnel-fill: var(--crm-accent-light);
    --funnel-border: var(--crm-accent);
    --funnel-text: var(--crm-accent-strong);
    --funnel-count: var(--crm-accent);
    filter: drop-shadow(0 6px 14px rgba(0, 112, 243, 0.14));
}

.crm-funnel-step.is-active::after {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.86) 0%, rgba(240, 247, 255, 0.96) 100%),
        var(--funnel-fill);
}

.crm-funnel-step:focus-visible {
    outline: 0;
    filter: drop-shadow(0 0 0 var(--crm-accent));
}

.crm-funnel-step:focus-visible::before {
    background: var(--crm-accent);
}

.crm-funnel-step:focus-visible::after {
    inset: 3px;
}

.crm-funnel-label {
    position: relative;
    z-index: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.01em;
}

.crm-funnel-count {
    position: relative;
    z-index: 1;
    justify-self: end;
    min-width: 24px;
    color: var(--funnel-count);
    font-size: 18px;
    font-weight: 850;
    line-height: 1;
}

.crm-list {
    min-width: 0;
}

.crm-home-toolbar .crm-filter-bar {
    flex: 1 1 220px;
    min-width: 0;
    padding: 0;
    border-bottom: 0;
    background: transparent;
}

.crm-filter-bar {
    display: flex;
    align-items: center;
    min-width: 0;
    padding: 8px;
    border-bottom: 1px solid var(--crm-line);
    background: var(--crm-panel);
}

.crm-filter-menu {
    position: relative;
    width: min(100%, 360px);
}

.crm-filter-menu > summary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: var(--ff-control-min-height);
    padding: 0 12px;
    border: 1px solid var(--crm-line-strong);
    border-radius: var(--crm-radius);
    background: var(--crm-panel);
    color: var(--crm-text);
    font-size: 13px;
    font-weight: 800;
    list-style: none;
    cursor: pointer;
}

.crm-filter-menu > summary::-webkit-details-marker {
    display: none;
}

.crm-filter-menu > summary:hover,
.crm-filter-menu > summary:focus-visible,
.crm-filter-menu[open] > summary {
    border-color: var(--crm-accent);
    outline: 0;
    background: var(--crm-accent-light);
    box-shadow: 0 0 0 3px var(--crm-accent-ring);
}

.crm-filter-menu > summary svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
}

.crm-filter-menu > summary small {
    color: var(--crm-muted);
    font-size: 11px;
    font-weight: 700;
}

.crm-filter-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    min-height: 22px;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--crm-accent);
    color: #fff;
    font-size: 11px;
    line-height: 1;
}

.crm-filter-count[hidden] {
    display: none;
}

.crm-filter-menu .crm-filter-chevron {
    width: 16px;
    height: 16px;
    transition: transform 0.14s ease;
}

.crm-filter-menu[open] .crm-filter-chevron {
    transform: rotate(180deg);
}

.crm-filter-panel {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    z-index: 80;
    width: min(360px, calc(100vw - 28px));
    padding: 12px;
    border: 1px solid var(--crm-line-strong);
    border-radius: var(--crm-radius);
    background: var(--crm-panel);
    box-shadow: 0 16px 34px rgba(15, 23, 42, 0.16);
}

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

.crm-deal-filter,
.crm-filter-custom-dates label {
    display: grid;
    min-width: 0;
    gap: 4px;
    color: var(--crm-muted);
    font-size: 11px;
    font-weight: 750;
}

.crm-deal-filter-date,
.crm-filter-custom-dates {
    grid-column: 1 / -1;
}

.crm-deal-filter > span {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
}

.crm-deal-filter > span small {
    color: var(--crm-accent-strong);
    font-size: 10px;
}

.crm-deal-filter select,
.crm-filter-custom-dates input,
.crm-filter-summary button {
    min-width: 0;
    min-height: var(--ff-control-min-height);
    border: 1px solid var(--crm-line-strong);
    border-radius: var(--crm-radius);
    background: var(--crm-panel);
    color: var(--crm-text);
    font: inherit;
}

.crm-deal-filter select,
.crm-filter-custom-dates input {
    width: 100%;
    padding: 0 10px;
    font-size: 13px;
    font-weight: 700;
}

.crm-deal-filter select:focus,
.crm-filter-custom-dates input:focus,
.crm-filter-summary button:focus-visible {
    border-color: var(--crm-accent);
    outline: 0;
    box-shadow: 0 0 0 3px var(--crm-accent-ring);
}

.crm-filter-custom-dates {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    padding: 2px 0;
}

.crm-filter-custom-dates[hidden] {
    display: none;
}

.crm-filter-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid var(--crm-line);
    color: var(--crm-muted);
    font-size: 12px;
    font-weight: 700;
}

.crm-filter-summary button {
    padding: 0 12px;
    color: var(--crm-accent-strong);
    cursor: pointer;
}

.crm-filter-summary button:disabled {
    color: var(--crm-muted);
    cursor: default;
    opacity: 0.55;
}

.crm-kanban {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    min-width: 0;
    padding: 8px;
}

.crm-kanban-column {
    min-width: 0;
    overflow: hidden;
    border: 1px solid var(--crm-line);
    border-radius: var(--crm-radius);
    background: var(--crm-panel-soft);
}

.crm-kanban-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 42px;
    padding: 0 10px;
    border-bottom: 1px solid var(--crm-line);
    background: var(--crm-panel);
}

.crm-kanban-header h2 {
    display: flex;
    align-items: center;
    gap: 7px;
    margin: 0;
    color: var(--crm-text);
    font-size: 14px;
    font-weight: 850;
}

.crm-kanban-stage-icon {
    display: inline-block;
    flex: 0 0 18px;
    width: 18px;
    height: 18px;
    background: var(--crm-accent);
    mask-position: center;
    mask-repeat: no-repeat;
    mask-size: contain;
}

.crm-kanban-stage-icon.is-engaged {
    mask-image: url('/graphics/crm/drivecentric-engaged.svg');
}

.crm-kanban-stage-icon.is-visit {
    mask-image: url('/graphics/crm/drivecentric-visit.svg');
}

.crm-kanban-stage-icon.is-proposal {
    mask-image: url('/graphics/crm/drivecentric-proposal.svg');
}

.crm-kanban-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    min-height: 24px;
    padding: 0 7px;
    border-radius: 999px;
    background: var(--crm-accent-light);
    color: var(--crm-accent-strong);
    font-size: 12px;
    font-weight: 850;
    font-variant-numeric: tabular-nums;
}

.crm-kanban-cards {
    display: grid;
    align-content: start;
    gap: 4px;
    padding: 6px;
    overflow: visible;
}

:is(.crm-kanban-card, .crm-snooze-card).crm-action-row {
    grid-template-columns: 32px minmax(0, 1fr) auto;
    min-height: 48px;
    gap: 8px;
    padding: 4px 8px;
    border: 1px solid var(--crm-line);
    border-radius: var(--crm-radius);
    background: var(--crm-panel);
}

:is(.crm-kanban-card, .crm-snooze-card, .crm-today-card).crm-action-row .crm-customer-avatar {
    width: 32px;
    height: 32px;
    font-size: 11px;
}

:is(.crm-kanban-card, .crm-snooze-card, .crm-today-card).crm-action-row .crm-action-main {
    gap: 1px;
}

:is(.crm-kanban-card, .crm-snooze-card, .crm-today-card).crm-action-row .crm-action-main strong {
    overflow: hidden;
    font-size: 13px;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
}

:is(.crm-kanban-card, .crm-snooze-card, .crm-today-card).crm-action-row .crm-action-vehicle {
    font-size: 11px;
    line-height: 1.2;
}

.crm-customer-task-icons {
    display: inline-flex;
    align-items: center;
    justify-self: end;
    gap: 4px;
}

.crm-customer-task-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: 1px solid var(--crm-accent-ring);
    border-radius: var(--crm-radius);
    background: var(--crm-accent-light);
    color: var(--crm-accent-strong);
}

.crm-customer-task-icon svg {
    width: 15px;
    height: 15px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

:is(.crm-kanban-card, .crm-snooze-card).crm-action-row:hover,
:is(.crm-kanban-card, .crm-snooze-card).crm-action-row.is-selected {
    border-color: var(--crm-line-strong);
    background: var(--crm-panel-hover);
}

:is(.crm-kanban-card, .crm-snooze-card).crm-action-row.is-selected {
    box-shadow: inset 4px 0 0 var(--crm-accent);
}

.crm-kanban-empty {
    margin: 0;
    padding: 20px 12px;
    color: var(--crm-muted);
    font-size: 13px;
    text-align: center;
}

.crm-snooze-box {
    display: grid;
    gap: 8px;
    padding: 10px;
    border-top: 1px solid var(--crm-line);
    background: var(--crm-panel-soft);
}

.crm-snooze-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.crm-snooze-header h2,
.crm-snooze-header p {
    margin: 0;
}

.crm-snooze-header h2 {
    color: var(--crm-text);
    font-size: 14px;
    font-weight: 850;
}

.crm-snooze-header p {
    margin-top: 2px;
    color: var(--crm-muted);
    font-size: 12px;
}

.crm-snooze-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    min-height: 28px;
    padding: 0 8px;
    border-radius: 999px;
    background: var(--crm-panel);
    color: var(--crm-text);
    font-size: 12px;
    font-weight: 850;
    font-variant-numeric: tabular-nums;
}

.crm-snooze-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr));
    gap: 6px;
}

.crm-snooze-card.crm-action-row {
    width: 100%;
}

.crm-snooze-empty {
    margin: 0;
    padding: 14px 10px;
    border: 1px dashed var(--crm-line-strong);
    border-radius: var(--crm-radius);
    color: var(--crm-muted);
    font-size: 13px;
    text-align: center;
}

.crm-home-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 16px;
    padding: 8px 16px;
    border-bottom: 1px solid var(--crm-line);
    background: var(--crm-panel);
}

.crm-home-views {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.crm-home-view {
    min-height: 36px;
    padding: 0 14px;
    border: 1px solid var(--crm-line-strong);
    border-radius: var(--crm-radius);
    background: var(--crm-panel);
    color: var(--crm-text);
    font: inherit;
    font-size: 13px;
    font-weight: 850;
    cursor: pointer;
}

.crm-home-view:hover,
.crm-home-view:focus-visible {
    outline: none;
    border-color: var(--crm-accent);
    box-shadow: 0 0 0 3px var(--crm-accent-ring);
}

.crm-home-view.is-active {
    border-color: var(--crm-accent);
    background: var(--crm-accent);
    color: #fff;
}

body.crm-home-pipeline .crm-today-overview {
    display: none;
}

.crm-action-focus {
    overflow: hidden;
    color: var(--crm-text);
    font-size: 13px;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.crm-action-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-top: 2px;
}

.crm-action-due,
.crm-action-task-count {
    color: var(--crm-muted);
    font-size: 12px;
    font-weight: 750;
}

.crm-today-card.crm-action-row {
    grid-template-columns: 32px minmax(0, 1fr) auto;
    align-items: center;
}

.crm-today-card .crm-customer-task-icons {
    align-self: center;
}

.crm-today-overview {
    display: grid;
    grid-template-columns: minmax(190px, 0.8fr) minmax(220px, 1fr) auto auto;
    align-items: center;
    gap: 20px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--crm-line);
    background: linear-gradient(90deg, #f8fbff, #fff);
}

.crm-progress {
    display: grid;
    gap: 7px;
    min-width: 220px;
}

.crm-home-progress {
    display: grid;
    gap: 8px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--crm-line);
    background: var(--crm-panel);
}

.crm-home-progress-value {
    justify-self: end;
    color: var(--crm-text);
    font-size: 13px;
    font-variant-numeric: tabular-nums;
    font-weight: 850;
}

.crm-progress-label {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    font-size: 12px;
}

.crm-progress-label strong {
    color: var(--crm-text);
    font-weight: 850;
}

.crm-progress-label span {
    color: var(--crm-muted);
    font-weight: 700;
}

.crm-progress-track {
    height: 9px;
    overflow: hidden;
    border-radius: 999px;
    background: #dbe4ee;
}

.crm-progress-track > span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #0070f3, #08b892);
    transition: width 0.35s ease-out;
}

.crm-progress.is-compact {
    min-width: 0;
    padding-top: 4px;
}

.crm-today-overview[hidden] {
    display: none;
}

.crm-notifications {
    padding: 10px 16px;
    border-bottom: 1px solid var(--crm-line);
    background: #fff;
}

.crm-notifications-load,
.crm-notification-card button,
.crm-task-workflows button {
    min-height: 44px;
    padding: 7px 12px;
    border: 1px solid #b9c8d8;
    border-radius: 8px;
    background: #fff;
    color: var(--crm-accent-strong);
    font: inherit;
    font-size: 12px;
    font-weight: 850;
    cursor: pointer;
}

.crm-notification-status {
    padding: 10px 0 2px;
    color: var(--crm-muted);
    font-size: 13px;
}

.crm-notification-card {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
    align-items: center;
    padding: 12px 0;
    border-top: 1px solid var(--crm-line);
}

.crm-notification-card div,
.crm-notification-card p {
    display: grid;
    gap: 3px;
    margin: 0;
}

.crm-notification-card span,
.crm-notification-card p {
    color: var(--crm-muted);
    font-size: 12px;
}

.crm-task-workflows {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
}

.crm-task-workflows[hidden] {
    display: none;
}

.crm-task-workflows.is-summary {
    margin-top: 2px;
    padding-top: 10px;
    border-top: 1px solid var(--crm-line);
}

.crm-task-workflow-label {
    color: var(--crm-muted);
    font-size: 12px;
    font-weight: 800;
}

.crm-reschedule-date input {
    min-height: 44px;
    padding: 7px 10px;
    border: 1px solid var(--crm-line-strong);
    border-radius: 8px;
    background: var(--crm-panel);
    color: var(--crm-text);
}

.crm-task-workflows button.is-primary {
    border-color: var(--crm-accent);
    background: var(--crm-accent);
    color: #fff;
}

@media (max-width: 640px) {
    .crm-notification-card {
        grid-template-columns: 1fr;
    }

    .crm-notification-card button,
    .crm-notifications-load {
        width: 100%;
    }
}

.crm-today-copy {
    display: grid;
    gap: 3px;
}

.crm-today-copy strong {
    font-size: 16px;
}

.crm-today-copy span {
    color: var(--crm-muted);
    font-size: 12px;
}

.crm-today-stats {
    display: flex;
    align-items: center;
    gap: 8px;
}

.crm-today-stats > span {
    display: inline-flex;
    align-items: baseline;
    gap: 4px;
    min-height: 30px;
    padding: 5px 9px;
    border-radius: 999px;
    background: var(--crm-panel-soft);
    color: var(--crm-muted);
    font-size: 12px;
    font-weight: 750;
}

.crm-today-stats .is-urgent { background: #fef2f2; color: #b91c1c; }
.crm-today-stats .is-ready { background: #eff6ff; color: #1d4ed8; }
.crm-today-stats .is-blocked { background: #fff7ed; color: #9a3412; }

.crm-start-next {
    min-height: 38px;
    padding: 0 16px;
    border: 0;
    border-radius: 8px;
    background: var(--crm-accent);
    color: #fff;
    font-size: 13px;
    font-weight: 850;
    cursor: pointer;
}

.crm-start-next:hover,
.crm-start-next:focus-visible {
    outline: none;
    background: var(--crm-accent-strong);
    box-shadow: 0 0 0 4px var(--crm-accent-ring);
}

.crm-start-next:disabled {
    cursor: default;
    opacity: 0.45;
}

.crm-action-queue {
    display: grid;
}

.crm-action-row {
    position: relative;
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr);
    align-items: center;
    gap: 12px;
    width: 100%;
    min-height: 74px;
    padding: 12px 16px;
    border: 0;
    border-bottom: 1px solid var(--crm-line);
    background: #fff;
    color: var(--crm-text);
    text-align: left;
    cursor: pointer;
}

.crm-action-row:hover,
.crm-action-row.is-selected {
    background: var(--crm-panel-hover);
}

.crm-action-row:focus-visible {
    z-index: 1;
    outline: 3px solid var(--crm-accent-ring);
    outline-offset: -3px;
}

.crm-action-main {
    display: grid;
    gap: 3px;
    min-width: 0;
}

.crm-action-main strong {
    font-size: 16px;
}

.crm-priority-badge {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    padding: 2px 8px;
    border-radius: 999px;
    background: #eff6ff;
    color: #1d4ed8;
    font-size: 11px;
    font-weight: 800;
}

.crm-priority-badge.is-urgent { background: #fef2f2; color: #b91c1c; }
.crm-priority-badge.is-blocked { background: #fff7ed; color: #9a3412; }

.crm-action-vehicle {
    overflow: hidden;
    color: var(--crm-muted);
    font-size: 13px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.crm-action-vehicle {
    color: #4b5563;
    font-weight: 700;
}

.crm-next-item {
    min-height: 30px;
    margin-left: auto;
    padding: 0 9px;
    border: 1px solid var(--crm-line-strong);
    border-radius: 8px;
    background: #fff;
    color: var(--crm-muted);
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
}

.crm-manager-review-open {
    min-height: 44px;
    padding: 0 9px;
    border: 1px solid var(--crm-line-strong);
    border-radius: 8px;
    background: var(--crm-panel);
    color: var(--crm-accent-strong);
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
}

.crm-next-item svg {
    display: none;
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.crm-manager-review {
    border: 1px solid var(--crm-line);
    border-radius: 10px;
    background: var(--crm-panel);
}

.crm-manager-review[hidden] {
    display: none;
}

.crm-manager-review > summary {
    display: flex;
    align-items: center;
    min-height: 44px;
    padding: 10px 14px;
    color: var(--crm-text);
    font-size: 13px;
    font-weight: 850;
    cursor: pointer;
}

.crm-manager-review > summary::marker {
    color: var(--crm-accent);
}

.crm-manager-review-body {
    display: grid;
    gap: 12px;
    padding: 0 14px 14px;
    border-top: 1px solid var(--crm-line);
}

.crm-manager-review-body > p {
    margin: 12px 0 0;
    color: var(--crm-muted);
    font-size: 13px;
    line-height: 1.4;
}

.crm-manager-field {
    display: grid;
    gap: 6px;
    color: var(--crm-text);
    font-size: 12px;
    font-weight: 800;
}

.crm-manager-field small {
    color: var(--crm-muted);
    font-weight: 650;
}

.crm-manager-field select,
.crm-manager-field textarea {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid var(--crm-line-strong);
    border-radius: 8px;
    background: var(--crm-panel);
    color: var(--crm-text);
    font: inherit;
    font-weight: 600;
}

.crm-manager-field textarea {
    min-height: 72px;
    resize: vertical;
}

.crm-manager-reasons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
}

.crm-manager-reasons legend {
    width: 100%;
    margin-bottom: 6px;
    padding: 0;
    color: var(--crm-text);
    font-size: 12px;
    font-weight: 800;
}

.crm-manager-reasons button,
.crm-manager-actions button {
    min-height: 44px;
    padding: 8px 12px;
    border: 1px solid var(--crm-line-strong);
    border-radius: 8px;
    background: var(--crm-panel);
    color: var(--crm-text);
    font: inherit;
    font-size: 12px;
    font-weight: 850;
    cursor: pointer;
}

.crm-manager-reasons button[aria-pressed="true"] {
    border-color: var(--crm-accent);
    background: var(--crm-accent-light);
    color: var(--crm-accent-strong);
}

.crm-manager-note-preview {
    padding: 10px 12px;
    border-radius: 8px;
    background: var(--crm-accent-light);
    color: var(--crm-text);
    font-size: 13px;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.crm-manager-note-preview::first-letter {
    color: var(--crm-accent-strong);
}

.crm-manager-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.crm-manager-actions button {
    border-color: var(--crm-accent);
    background: var(--crm-accent);
    color: #fff;
}

.crm-manager-actions button:disabled {
    border-color: var(--crm-line-strong);
    background: var(--crm-panel-soft);
    color: var(--crm-muted);
    cursor: default;
}

.crm-manager-actions span {
    color: var(--crm-muted);
    font-size: 12px;
    font-weight: 700;
}

.crm-next-item:hover,
.crm-next-item:focus-visible {
    outline: none;
    border-color: var(--crm-accent);
    color: var(--crm-accent);
    box-shadow: 0 0 0 3px var(--crm-accent-ring);
}

.crm-table {
    min-width: 860px;
}

.crm-table-header,
.crm-table-row {
    display: grid;
    grid-template-columns: minmax(260px, 1.25fr) minmax(260px, 1.2fr) minmax(190px, 0.8fr) minmax(170px, 0.75fr);
    align-items: center;
    column-gap: 18px;
}

.crm-table-header {
    position: sticky;
    top: 0;
    z-index: 2;
    min-height: 42px;
    padding: 0 16px;
    border-bottom: 1px solid var(--crm-line);
    background: #fff;
    color: var(--crm-muted);
    font-size: 12px;
    font-weight: 700;
}

.crm-table-row {
    width: 100%;
    min-height: 64px;
    padding: 10px 16px;
    border: 0;
    border-bottom: 1px solid var(--crm-line);
    background: #fff;
    color: var(--crm-text);
    text-align: left;
    cursor: pointer;
}

.crm-table-row:hover,
.crm-table-row.is-selected {
    background: var(--crm-panel-hover);
}

.crm-table-row.is-selected {
    box-shadow: inset 4px 0 0 var(--crm-accent);
}

.crm-table-cell {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 14px;
}

.crm-table-customer {
    display: flex;
    align-items: center;
    gap: 12px;
}

.crm-table-info {
    color: var(--crm-text);
    font-weight: 500;
}

.crm-table-count {
    text-align: right;
}

.crm-card {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 16px;
    border: 0;
    border-bottom: 1px solid var(--crm-line);
    background: #fff;
    color: var(--crm-text);
    text-align: left;
    cursor: pointer;
}

.crm-customer-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 999px;
    background: var(--crm-avatar-bg, var(--crm-accent));
    color: #fff;
    font-size: 13px;
    font-weight: 800;
    line-height: 1;
    letter-spacing: 0;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.22);
}

.crm-card-main {
    min-width: 0;
}

.crm-card:hover,
.crm-card.is-selected {
    background: var(--crm-panel-hover);
}

.crm-card.is-selected {
    box-shadow: inset 4px 0 0 var(--crm-accent);
}

.crm-card-title {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    font-weight: 650;
}

.crm-card-title span:first-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.crm-card-task-side {
    display: grid;
    justify-items: end;
    gap: 6px;
}

.crm-task-count {
    display: inline-flex;
    gap: 3px;
    align-items: center;
    color: var(--crm-muted);
    font-size: 12px;
    font-weight: 850;
    white-space: nowrap;
}

.crm-workplan-legend {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--crm-muted);
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}

.crm-badge,
.crm-stage-pill {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    padding: 0 8px;
    border-radius: 999px;
    background: var(--crm-panel-soft);
    color: var(--crm-muted);
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}

.crm-stage-pill {
    background: #dff3ef;
    color: var(--crm-accent-strong);
}

.crm-card-meta {
    margin-top: 6px;
    font-size: 13px;
    line-height: 1.35;
}

.crm-card-next {
    align-self: start;
    max-width: 130px;
    color: var(--crm-warn);
    font-size: 12px;
    font-weight: 850;
    text-align: right;
}

.crm-detail-empty {
    padding: 32px;
    color: var(--crm-muted);
}

.crm-modal[hidden] {
    display: none;
}

.crm-modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: grid;
    place-items: center;
    padding: 20px;
}

.crm-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(17, 24, 39, 0.42);
    opacity: 0;
    transition: opacity 0.16s ease-out;
}

.crm-modal-card {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    width: min(1440px, calc(100vw - 28px));
    height: min(820px, calc(100vh - 28px));
    overflow: hidden;
    border: 1px solid var(--crm-line);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 22px 70px rgba(15, 23, 42, 0.22);
    opacity: 0;
    transform: translateY(18px) scale(0.98) rotateX(2deg);
    transform-origin: 50% 40%;
    transition: opacity 0.16s ease-out, transform 0.16s ease-out;
}

.crm-modal-bar {
    display: contents;
}

.crm-modal-bar > strong,
.crm-modal-bar > span,
.crm-modal-close-back {
    display: none;
}

.crm-modal.is-open .crm-modal-backdrop {
    opacity: 1;
}

.crm-modal.is-open .crm-modal-card {
    opacity: 1;
    transform: translateY(0) scale(1) rotateX(0);
}

.crm-modal-open {
    overflow: hidden;
}

.crm-modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 3;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--ff-control-min-height);
    height: var(--ff-control-min-height);
    margin: 0;
    border: 1px solid var(--crm-line-strong);
    border-radius: 8px;
    background: #fff;
    color: var(--crm-accent-strong);
    cursor: pointer;
}

.crm-modal-close:hover {
    border-color: var(--crm-line-strong);
    color: var(--crm-text);
}

.crm-modal-close svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
}

.crm-modal .crm-detail {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 0;
    height: 100%;
    overflow: hidden;
    border: 0;
    border-radius: 0;
    box-shadow: none;
}

.crm-modal .crm-detail-header {
    flex: 0 0 auto;
    padding-right: 70px;
}

.crm-detail-empty h2 {
    margin: 0 0 8px;
    color: var(--crm-text);
}

.crm-detail-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    padding: 18px;
}

.crm-detail-main {
    min-width: 0;
}

.crm-activity-rail {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    padding: 12px;
    border-bottom: 1px solid var(--crm-line);
    background: var(--crm-panel-hover);
}

.crm-activity-toolbar {
    display: grid;
    flex: 0 0 auto;
    margin-bottom: 8px;
}

.crm-activity-filter {
    display: grid;
    color: var(--crm-muted);
    font-size: 12px;
    font-weight: 800;
}

.crm-activity-filter select {
    width: 100%;
    min-height: var(--ff-control-min-height);
    padding: 0 34px 0 10px;
    border: 1px solid var(--crm-line-strong);
    border-radius: 8px;
    background: var(--crm-panel);
    color: var(--crm-text);
    cursor: pointer;
}

.crm-activity-filter select:focus-visible {
    outline: 2px solid var(--crm-accent);
    outline-offset: 2px;
}

.crm-activity-rail > .crm-activity-list {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
}

.crm-activity-filter-empty {
    padding: 20px 8px;
    text-align: center;
}

.crm-vehicle-rail {
    display: grid;
    align-content: start;
    gap: 14px;
    min-width: 0;
    padding: 18px;
    border-top: 1px solid var(--crm-line);
    background: var(--crm-panel-hover);
}

.crm-vehicle-add {
    position: relative;
    z-index: 4;
    display: grid;
    gap: 7px;
    padding-bottom: 2px;
}

.crm-vehicle-add > label {
    color: var(--crm-text);
    font-size: 13px;
    font-weight: 850;
}

.crm-vehicle-search-control {
    position: relative;
}

.crm-vehicle-search-control > svg {
    position: absolute;
    top: 50%;
    left: 12px;
    width: 18px;
    height: 18px;
    fill: none;
    stroke: var(--crm-muted);
    stroke-width: 2;
    transform: translateY(-50%);
    pointer-events: none;
}

.crm-vehicle-search-control input {
    width: 100%;
    min-height: 44px;
    padding: 0 12px 0 38px;
    border: 1px solid var(--crm-line-strong);
    border-radius: 10px;
    background: var(--crm-panel);
    color: var(--crm-text);
    font: inherit;
}

.crm-vehicle-search-control input:focus {
    border-color: var(--crm-accent);
    outline: 2px solid color-mix(in srgb, var(--crm-accent) 24%, transparent);
    outline-offset: 1px;
}

.crm-vehicle-search-results {
    position: absolute;
    top: calc(100% - 1px);
    right: 0;
    left: 0;
    z-index: 8;
    max-height: min(410px, 52vh);
    overflow: auto;
    border: 1px solid var(--crm-line-strong);
    border-radius: 11px;
    background: var(--crm-panel);
    box-shadow: 0 16px 32px rgba(15, 23, 42, 0.2);
}

.crm-vehicle-search-result {
    display: grid;
    grid-template-columns: 58px minmax(0, 1fr) 24px;
    gap: 10px;
    align-items: center;
    width: 100%;
    min-height: 64px;
    padding: 8px;
    border: 0;
    border-bottom: 1px solid var(--crm-line);
    background: transparent;
    color: var(--crm-text);
    text-align: left;
    cursor: pointer;
}

.crm-vehicle-search-result:last-child {
    border-bottom: 0;
}

.crm-vehicle-search-result:hover,
.crm-vehicle-search-result:focus-visible {
    background: var(--crm-panel-hover);
    outline: none;
}

.crm-vehicle-search-photo {
    display: grid;
    place-items: center;
    width: 58px;
    height: 44px;
    overflow: hidden;
    border-radius: 7px;
    background: var(--crm-panel-hover);
}

.crm-vehicle-search-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.crm-vehicle-search-copy {
    display: grid;
    gap: 3px;
    min-width: 0;
}

.crm-vehicle-search-copy strong,
.crm-vehicle-search-copy span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.crm-vehicle-search-copy strong {
    font-size: 12px;
}

.crm-vehicle-search-copy span {
    color: var(--crm-muted);
    font-size: 11px;
}

.crm-vehicle-search-add {
    color: var(--crm-accent);
    font-size: 24px;
    font-weight: 500;
    text-align: center;
}

.crm-vehicle-search-empty {
    padding: 16px 12px;
    color: var(--crm-muted);
    font-size: 12px;
    text-align: center;
}

.crm-vehicle-action-status {
    min-height: 16px;
    color: var(--crm-muted);
    font-size: 11px;
    font-weight: 750;
}

.crm-vehicle-action-status.is-success {
    color: #16803c;
}

.crm-vehicle-action-status.is-error {
    color: #b42318;
}

.crm-contact-manager {
    display: grid;
    gap: 10px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--crm-line);
    background: var(--crm-panel-hover);
}

.crm-contact-manager[hidden] {
    display: none;
}

.crm-contact-edit-group > header,
.crm-contact-edit-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.crm-contact-manager-status,
.crm-contact-edit-group p {
    color: var(--crm-muted);
    font-size: 11px;
}

.crm-contact-manager button {
    min-height: var(--ff-control-min-height);
    padding: 0 12px;
    border: 1px solid var(--crm-line-strong);
    border-radius: 8px;
    background: var(--crm-panel);
    color: var(--crm-text);
    font: inherit;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
}

.crm-contact-manager button.is-danger {
    color: var(--crm-danger);
}

.crm-contact-manager [data-crm-contact-manager-body] {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.crm-contact-edit-group {
    display: grid;
    align-content: start;
    gap: 8px;
    min-width: 0;
    padding: 10px;
    border: 1px solid var(--crm-line);
    border-radius: 9px;
    background: var(--crm-panel);
}

.crm-contact-edit-group h3 {
    margin: 0;
    font-size: 13px;
}

.crm-contact-edit-group [data-crm-contact-rows] {
    display: grid;
    gap: 8px;
}

.crm-contact-edit-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(100px, 0.35fr) auto;
    align-items: end;
    gap: 7px;
}

.crm-contact-edit-row label {
    display: grid;
    gap: 3px;
    color: var(--crm-muted);
    font-size: 10px;
    font-weight: 800;
}

.crm-contact-edit-row input,
.crm-contact-edit-row select {
    width: 100%;
    min-width: 0;
    min-height: var(--ff-control-min-height);
    padding: 0 9px;
    border: 1px solid var(--crm-line-strong);
    border-radius: 8px;
    background: var(--crm-panel);
    color: var(--crm-text);
    font: inherit;
    font-size: 12px;
}

.crm-contact-edit-actions {
    justify-content: start;
}

@media (max-width: 720px) {
    .crm-contact-manager [data-crm-contact-manager-body] {
        grid-template-columns: 1fr;
    }

    .crm-contact-edit-row {
        grid-template-columns: minmax(0, 1fr) minmax(90px, 0.4fr);
    }

    .crm-contact-edit-actions {
        grid-column: 1 / -1;
    }
}

@media (min-width: 721px) and (max-width: 899px) {
    .crm-detail-main {
        height: min(600px, calc(100dvh - 340px));
        min-height: 520px;
    }
}

.crm-document-manager {
    display: grid;
    gap: 10px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--crm-line);
    background: var(--crm-panel-hover);
}

.crm-document-manager[hidden] {
    display: none;
}

.crm-document-manager > header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.crm-document-manager > header > div,
.crm-document-row > span {
    display: grid;
    gap: 2px;
}

.crm-document-manager > header span,
.crm-document-status,
.crm-document-row small,
.crm-document-list > p {
    color: var(--crm-muted);
    font-size: 11px;
}

.crm-document-manager button {
    min-height: var(--ff-control-min-height);
    padding: 0 13px;
    border: 1px solid var(--crm-line-strong);
    border-radius: 8px;
    background: var(--crm-panel);
    color: var(--crm-text);
    font: inherit;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
}

.crm-document-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr));
    gap: 7px;
}

.crm-document-row {
    display: grid;
    grid-template-columns: 22px minmax(0, 1fr);
    align-items: center;
    gap: 9px;
    min-height: 52px;
    padding: 8px 10px;
    border: 1px solid var(--crm-line);
    border-radius: 8px;
    background: var(--crm-panel);
    cursor: pointer;
}

.crm-document-row input {
    width: 20px;
    height: 20px;
    accent-color: var(--crm-accent);
}

.crm-document-print {
    justify-self: start;
    border-color: var(--crm-accent) !important;
    background: var(--crm-accent) !important;
    color: #fff !important;
}

.crm-document-manager button:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.crm-appointment-manager {
    display: grid;
    gap: 10px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--crm-line);
    background: var(--crm-panel-hover);
}

.crm-appointment-manager[hidden] { display: none; }
.crm-appointment-manager > header,
.crm-appointment-row,
.crm-appointment-manager form > div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.crm-appointment-manager > header > div,
.crm-appointment-row > span { display: grid; gap: 2px; }
.crm-appointment-manager > header span,
.crm-appointment-row small,
.crm-appointment-status,
.crm-appointment-manager [data-crm-appointment-existing] > p { color: var(--crm-muted); font-size: 11px; }
.crm-appointment-manager button {
    min-height: var(--ff-control-min-height);
    padding: 0 12px;
    border: 1px solid var(--crm-line-strong);
    border-radius: 8px;
    background: var(--crm-panel);
    color: var(--crm-text);
    font: inherit;
    font-size: 12px;
    font-weight: 800;
}
.crm-appointment-manager form {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
}
.crm-appointment-manager form label { display: grid; gap: 3px; color: var(--crm-muted); font-size: 10px; font-weight: 800; }
.crm-appointment-manager form input,
.crm-appointment-manager form select,
.crm-appointment-manager form textarea {
    width: 100%; min-width: 0; min-height: var(--ff-control-min-height); padding: 8px 9px;
    border: 1px solid var(--crm-line-strong); border-radius: 8px; background: var(--crm-panel); color: var(--crm-text); font: inherit;
}
.crm-appointment-notes { grid-column: span 3; }
.crm-appointment-tentative { align-content: center; grid-template-columns: 20px auto; }
.crm-appointment-manager form > div { grid-column: 1 / -1; justify-content: start; }
.crm-appointment-row { min-height: 48px; padding: 6px 8px; border: 1px solid var(--crm-line); border-radius: 8px; background: var(--crm-panel); }

@media (max-width: 720px) {
    .crm-appointment-manager form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .crm-appointment-notes { grid-column: 1 / -1; }
}

.crm-trade-add {
    display: grid;
    gap: 9px;
    padding: 12px;
    border: 0;
    border-top: 1px solid var(--crm-line);
    background: var(--crm-panel);
}

.crm-trade-disclosure {
    overflow: hidden;
    border: 1px solid var(--crm-line);
    border-radius: 10px;
    background: var(--crm-panel);
}

.crm-trade-disclosure > summary {
    display: flex;
    align-items: center;
    gap: 9px;
    min-height: var(--ff-control-min-height);
    padding: 0 12px;
    color: var(--crm-text);
    font-size: 13px;
    font-weight: 800;
    list-style: none;
    cursor: pointer;
}

.crm-trade-disclosure > summary::-webkit-details-marker {
    display: none;
}

.crm-trade-disclosure > summary svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: var(--crm-accent);
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.crm-trade-disclosure > summary:hover,
.crm-trade-disclosure > summary:focus-visible {
    outline: 0;
    background: var(--crm-accent-light);
    color: var(--crm-accent-strong);
}

.crm-trade-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.crm-trade-heading > div {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.crm-trade-heading strong {
    color: var(--crm-text);
    font-size: 13px;
    font-weight: 850;
}

.crm-trade-heading span {
    color: var(--crm-muted);
    font-size: 11px;
    line-height: 1.3;
}

.crm-trade-heading button,
.crm-trade-scanner button,
.crm-trade-save {
    min-height: var(--ff-control-min-height);
    padding: 0 12px;
    border: 1px solid var(--crm-line-strong);
    border-radius: 8px;
    background: var(--crm-panel-hover);
    color: var(--crm-text);
    font: inherit;
    font-size: 12px;
    font-weight: 850;
    cursor: pointer;
}

.crm-trade-add label {
    display: grid;
    gap: 4px;
    color: var(--crm-muted);
    font-size: 11px;
    font-weight: 800;
}

.crm-trade-add input {
    width: 100%;
    min-width: 0;
    min-height: var(--ff-control-min-height);
    padding: 0 10px;
    border: 1px solid var(--crm-line-strong);
    border-radius: 8px;
    background: var(--crm-panel);
    color: var(--crm-text);
    font: inherit;
    font-size: 13px;
}

.crm-trade-add input:focus {
    border-color: var(--crm-accent);
    outline: 2px solid color-mix(in srgb, var(--crm-accent) 24%, transparent);
    outline-offset: 1px;
}

.crm-trade-add input[readonly] {
    background: var(--crm-panel-hover);
}

.crm-trade-decoded {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
}

.crm-trade-decoded[hidden],
.crm-trade-scanner[hidden] {
    display: none;
}

.crm-trade-scanner {
    display: grid;
    gap: 7px;
}

.crm-trade-scanner video {
    width: 100%;
    max-height: 220px;
    border-radius: 8px;
    background: #050505;
    object-fit: cover;
}

.crm-trade-save {
    border-color: var(--crm-accent);
    background: var(--crm-accent);
    color: #fff;
}

.crm-trade-heading button:disabled,
.crm-trade-save:disabled,
.crm-trade-add input:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.crm-deal-vehicle {
    position: relative;
    min-width: 0;
}

.crm-deal-vehicle ff-inventory-card {
    display: block;
}

.crm-vehicle-remove {
    position: absolute;
    top: 9px;
    right: 9px;
    z-index: 3;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-height: 32px;
    padding: 0 9px;
    border: 1px solid rgba(255, 255, 255, 0.82);
    border-radius: 999px;
    background: rgba(27, 31, 38, 0.82);
    color: #fff;
    font-size: 11px;
    font-weight: 850;
    backdrop-filter: blur(8px);
    cursor: pointer;
}

.crm-vehicle-remove > span:first-child {
    font-size: 18px;
    font-weight: 500;
    line-height: 1;
}

.crm-vehicle-remove:hover,
.crm-vehicle-remove:focus-visible {
    border-color: #fecaca;
    background: #b42318;
    outline: none;
}

.crm-vehicle-remove:disabled {
    opacity: 0.62;
    cursor: wait;
}

.crm-vehicle-empty {
    display: grid;
    justify-items: center;
    gap: 8px;
    padding: 28px 16px;
    border: 1px dashed var(--crm-line-strong);
    border-radius: 12px;
    color: var(--crm-muted);
    text-align: center;
}

.crm-vehicle-empty strong {
    color: var(--crm-text);
}

.crm-vehicle-empty > span:last-child {
    max-width: 260px;
    font-size: 12px;
    line-height: 1.45;
}

@media (min-width: 900px) {
    .crm-detail-body {
        display: grid;
        grid-template-columns: minmax(240px, 300px) minmax(300px, 1fr) minmax(260px, 320px);
        overflow: hidden;
        padding: 0;
    }

    .crm-detail-main,
    .crm-activity-rail,
    .crm-vehicle-rail {
        min-height: 0;
        overscroll-behavior: contain;
    }

    .crm-detail-main {
        overflow: auto;
        padding: 18px;
    }

    .crm-activity-rail {
        border-right: 1px solid var(--crm-line);
        border-bottom: 0;
    }

    .crm-vehicle-rail {
        overflow: auto;
        border-top: 0;
        border-left: 1px solid var(--crm-line);
    }
}

@media (max-width: 899px) {
    .crm-detail-body {
        display: grid;
        grid-template-areas:
            "main"
            "activity"
            "vehicle";
        align-content: start;
        gap: 16px;
    }

    .crm-detail-main {
        grid-area: main;
    }

    .crm-activity-rail {
        grid-area: activity;
        max-height: min(620px, 68vh);
        margin: 0 -18px;
        border-top: 1px solid var(--crm-line);
    }

    .crm-vehicle-rail {
        grid-area: vehicle;
        margin: 0 -18px -18px;
    }
}

.crm-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.crm-action-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 0 12px;
    border: 1px solid var(--crm-line);
    border-radius: 8px;
    color: var(--crm-text);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
}

.crm-action-link:hover {
    border-color: var(--crm-line-strong);
    background: var(--crm-panel-hover);
    color: var(--crm-accent);
}

.crm-section {
    padding: 16px 0;
    border-bottom: 1px solid var(--crm-line);
}

.crm-section:last-child {
    border-bottom: 0;
}

.crm-section h3 {
    margin: 0 0 10px;
    font-size: 12px;
    letter-spacing: 0;
    text-transform: uppercase;
    color: var(--crm-muted);
}

.crm-customer-summary {
    margin: 0;
    padding: 12px 14px;
    border: 1px solid var(--crm-line);
    border-left: 4px solid var(--crm-accent);
    border-radius: 8px;
    background: var(--crm-accent-light);
    color: var(--crm-text);
    font-size: 15px;
    font-weight: 650;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.crm-detail.is-refreshed .crm-customer-summary {
    animation: crm-detail-refreshed 1.2s ease-out;
}

@keyframes crm-detail-refreshed {
    0% {
        border-color: var(--crm-accent);
        box-shadow: 0 0 0 3px var(--crm-accent-ring);
    }
    100% {
        border-color: var(--crm-line);
        box-shadow: 0 0 0 0 rgba(0, 0, 0, 0);
    }
}

@keyframes crm-status-soft-pop {
    0% {
        transform: translateY(2px);
        opacity: 0;
    }
    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

.crm-comm-panel {
    display: grid;
    gap: 10px;
}

.crm-comm-action-bar {
    overflow: hidden;
    border: 1px solid var(--crm-line);
    border-radius: 8px;
    background: var(--crm-panel-soft);
}

.crm-comm-action-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 6px;
}

.crm-comm-channel-action {
    --crm-channel-color: var(--crm-line-strong);
    --crm-channel-text: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 44px;
    min-height: var(--ff-control-min-height);
    padding: 0 10px;
    border: 1px solid var(--crm-channel-color);
    border-radius: 8px;
    background: var(--crm-channel-color);
    color: var(--crm-channel-text);
    font-size: 12px;
    font-weight: 800;
    line-height: 1;
    cursor: pointer;
    position: relative;
}

.crm-comm-action-picker {
    position: relative;
    display: inline-flex;
    align-items: stretch;
}

.crm-comm-action-picker > .crm-comm-primary-action {
    width: var(--ff-control-min-height);
    padding: 0;
    border-radius: 8px 0 0 8px;
}

.crm-comm-panel[data-mode="video"] .crm-comm-action-picker > .crm-comm-primary-action {
    width: auto;
    min-width: 116px;
    padding: 0 14px;
}

.crm-comm-primary-label {
    overflow: visible;
    text-overflow: clip;
}

.crm-comm-action-menu-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--ff-control-min-height);
    min-height: var(--ff-control-min-height);
    padding: 0;
    border: 1px solid color-mix(in srgb, var(--ff-color-activity-text, #4182d7) 82%, #000);
    border-left: 1px solid rgba(255, 255, 255, 0.38);
    border-radius: 0 8px 8px 0;
    background: var(--ff-color-activity-text, #4182d7);
    color: #fff;
    cursor: pointer;
}

.crm-comm-action-menu-toggle svg {
    width: 15px;
    height: 15px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
    transition: transform 0.14s ease;
}

.crm-comm-action-menu-toggle[aria-expanded="true"] svg {
    transform: rotate(180deg);
}

.crm-comm-action-menu-toggle:hover,
.crm-comm-action-menu-toggle:focus-visible {
    background: color-mix(in srgb, var(--ff-color-activity-text, #4182d7) 86%, #000);
    outline: none;
}

.crm-comm-action-menu-toggle:focus-visible {
    box-shadow: 0 0 0 4px var(--crm-accent-ring);
}

.crm-comm-action-menu-toggle:disabled {
    cursor: not-allowed;
    opacity: 0.42;
}

.crm-comm-action-menu {
    position: absolute;
    right: 0;
    bottom: calc(100% + 7px);
    z-index: 12;
    display: grid;
    gap: 6px;
    padding: 6px;
    border: 1px solid var(--crm-line);
    border-radius: 12px;
    background: var(--crm-panel);
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.2);
}

.crm-comm-action-menu[hidden] {
    display: none;
}

.crm-comm-action-menu.is-below {
    top: calc(100% + 7px);
    bottom: auto;
}

.crm-comm-action-menu .crm-comm-channel-action {
    width: var(--ff-control-min-height);
    padding: 0;
}

.crm-comm-channel-text {
    --crm-channel-color: var(--ff-color-activity-text, #4182d7);
}

.crm-comm-channel-email {
    --crm-channel-color: var(--ff-color-activity-email, #19b4ff);
    --crm-channel-text: #063b4f;
}

.crm-comm-channel-call {
    --crm-channel-color: var(--ff-color-activity-call, #2ecc71);
    --crm-channel-text: #073b20;
}

.crm-comm-channel-video {
    --crm-channel-color: #8b5cf6;
}

.crm-comm-channel-note {
    --crm-channel-color: var(--ff-color-activity-note, #f5cd19);
    --crm-channel-text: #493d00;
}

.crm-comm-channel-action svg,
.crm-video-upload-button svg {
    flex: 0 0 auto;
    width: 17px;
    height: 17px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.crm-comm-channel-action span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.crm-comm-channel-action:hover,
.crm-comm-channel-action:focus-visible {
    border-color: color-mix(in srgb, var(--crm-channel-color) 82%, #000);
    background: color-mix(in srgb, var(--crm-channel-color) 86%, #000);
    color: var(--crm-channel-text);
    outline: none;
}

.crm-comm-quick-action.is-ready {
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--crm-channel-color) 25%, transparent);
}

.crm-comm-channel-action:disabled {
    cursor: not-allowed;
    opacity: 0.42;
}

.crm-comm-body {
    display: grid;
    gap: 9px;
}

.crm-comm-compose {
    min-width: 0;
    overflow: visible;
}

.crm-comm-messagebar {
    position: relative;
    display: flex;
    align-items: flex-end;
    gap: 4px;
    min-width: 0;
    padding: 3px;
    border: 1px solid var(--crm-line);
    border-radius: var(--crm-radius);
    background: #fff;
}

.crm-comm-photo-button {
    display: inline-flex;
    flex: 0 0 var(--ff-control-min-height);
    align-items: center;
    justify-content: center;
    width: var(--ff-control-min-height);
    min-width: var(--ff-control-min-height);
    height: var(--ff-control-min-height);
    padding: 0;
    border: 0;
    border-radius: var(--crm-radius);
    background: transparent;
    color: var(--crm-accent);
    cursor: pointer;
}

.crm-comm-photo-button[hidden] {
    display: none;
}

.crm-comm-photo-button svg {
    width: 24px;
    height: 24px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.9;
}

.crm-comm-photo-button:hover,
.crm-comm-photo-button:focus-visible {
    outline: none;
    background: var(--crm-accent-light);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--crm-accent) 34%, transparent);
}

.crm-comm-photo-button:disabled {
    cursor: wait;
    opacity: 0.5;
}

.crm-photo-attachments {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    max-height: 112px;
    margin: 0 3px 6px;
    overflow-y: auto;
}

.crm-photo-attachments[hidden] {
    display: none;
}

.crm-photo-attachment {
    display: inline-flex;
    align-items: center;
    min-width: 0;
    min-height: var(--ff-control-min-height);
    max-width: min(100%, 320px);
    padding-left: 10px;
    border: 1px solid var(--crm-line);
    border-radius: 12px;
    background: var(--crm-panel-soft);
    color: var(--crm-text);
}

.crm-photo-attachment > span:first-child {
    display: inline-flex;
    flex: 0 0 auto;
    color: var(--crm-accent);
}

.crm-photo-attachment > span:first-child svg {
    width: 17px;
    height: 17px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
}

.crm-photo-attachment-name {
    min-width: 0;
    margin-left: 7px;
    overflow: hidden;
    font-size: 12px;
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.crm-photo-attachment small {
    flex: 0 0 auto;
    margin-left: 7px;
    color: var(--crm-muted);
    font-size: 10px;
    font-weight: 700;
}

.crm-photo-attachment button {
    display: inline-flex;
    flex: 0 0 var(--ff-control-min-height);
    align-items: center;
    justify-content: center;
    width: var(--ff-control-min-height);
    height: var(--ff-control-min-height);
    margin-left: 2px;
    padding: 0;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--crm-muted);
    font-size: 22px;
    cursor: pointer;
}

.crm-photo-attachment button:hover,
.crm-photo-attachment button:focus-visible {
    outline: none;
    background: color-mix(in srgb, var(--crm-danger) 12%, transparent);
    color: var(--crm-danger);
}

.crm-note-mention-menu {
    position: absolute;
    right: 6px;
    bottom: calc(100% + 7px);
    left: 6px;
    z-index: 20;
    max-height: min(240px, 42vh);
    overflow-y: auto;
    padding: 5px;
    border: 1px solid var(--crm-line);
    border-radius: 11px;
    background: var(--crm-panel);
    box-shadow: 0 14px 34px rgba(15, 23, 42, 0.22);
}

.crm-note-mention-menu[hidden] {
    display: none;
}

.crm-note-mention-option {
    display: grid;
    width: 100%;
    min-height: var(--ff-control-min-height);
    padding: 7px 10px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--crm-text);
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.crm-note-mention-option > span {
    font-size: 14px;
    font-weight: 750;
    line-height: 1.25;
}

.crm-note-mention-option > small {
    color: var(--crm-muted);
    font-size: 11px;
    line-height: 1.25;
}

.crm-note-mention-option:hover,
.crm-note-mention-option:focus-visible,
.crm-note-mention-option[aria-selected="true"] {
    outline: 0;
    background: var(--crm-accent-light);
    color: var(--crm-accent);
}

.crm-note-mention-status {
    padding: 10px;
    color: var(--crm-muted);
    font-size: 12px;
}

.crm-comm-messagebar:focus-within {
    border-color: var(--crm-accent);
    box-shadow: 0 0 0 3px var(--crm-accent-ring);
}

.crm-comm-panel[data-mode="note"] .crm-comm-messagebar {
    border-color: var(--ff-color-activity-note, #f5cd19);
    background: var(--crm-activity-note-card-surface, var(--ff-color-activity-note-card, #fff5d7));
}

.crm-comm-panel[data-mode="note"] .crm-comm-messagebar:focus-within {
    border-color: color-mix(in srgb, var(--ff-color-activity-note, #f5cd19) 82%, #000);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--ff-color-activity-note, #f5cd19) 28%, transparent);
}

.crm-comm-panel[data-mode="note"] .crm-comm-message {
    border-color: transparent;
    background: transparent;
}

.crm-comm-panel[data-mode="note"] .crm-comm-action-menu-toggle {
    border-color: color-mix(in srgb, var(--ff-color-activity-note, #f5cd19) 82%, #000);
    border-left-color: rgba(73, 61, 0, 0.24);
    background: var(--ff-color-activity-note, #f5cd19);
    color: #493d00;
}

.crm-comm-panel[data-mode="note"] .crm-comm-action-menu-toggle:hover,
.crm-comm-panel[data-mode="note"] .crm-comm-action-menu-toggle:focus-visible {
    background: color-mix(in srgb, var(--ff-color-activity-note, #f5cd19) 86%, #000);
}

.crm-comm-message[hidden],
.crm-comm-subject[hidden],
.crm-comm-video-url[hidden] {
    display: none;
}

.crm-comm-message,
.crm-comm-subject,
.crm-comm-video-url {
    width: 100%;
    min-width: 0;
    border: 1px solid var(--crm-line);
    border-radius: 8px;
    background: #fff;
    color: var(--crm-text);
    outline: 0;
}

.crm-comm-message {
    min-height: 86px;
    max-height: 220px;
    padding: 10px 11px;
    line-height: 1.4;
    resize: vertical;
}

.crm-comm-compose .crm-comm-message,
.crm-comm-compose .crm-comm-subject,
.crm-comm-compose .crm-comm-video-url {
    border: 0;
    border-radius: 0;
    background: transparent;
}

.crm-comm-subject,
.crm-comm-video-url {
    height: 38px;
    padding: 0 11px;
}

.crm-comm-panel[data-mode="email"] .crm-comm-subject {
    min-height: var(--ff-control-min-height);
    margin-bottom: 6px;
    border: 1px solid var(--crm-line);
    border-radius: var(--crm-radius);
    background: var(--crm-panel);
}

.crm-comm-panel[data-mode="email"] .crm-comm-subject:focus {
    border-color: var(--crm-accent);
    box-shadow: 0 0 0 3px var(--crm-accent-ring);
}

.crm-comm-message:focus,
.crm-comm-subject:focus,
.crm-comm-video-url:focus {
    border-color: var(--crm-accent);
    box-shadow: 0 0 0 3px var(--crm-accent-ring);
}

.crm-comm-compose .crm-comm-message:focus,
.crm-comm-compose .crm-comm-subject:focus,
.crm-comm-compose .crm-comm-video-url:focus {
    border-color: transparent;
    box-shadow: none;
}

.crm-video-upload {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    padding: 8px;
    border: 1px solid var(--crm-line);
    border-radius: 10px;
    background: var(--crm-panel-soft);
}

.crm-comm-compose .crm-video-upload {
    border: 0;
    border-radius: 0;
}

.crm-video-upload[hidden] {
    display: none;
}

.crm-video-channel {
    display: flex;
    align-items: center;
    gap: 7px;
    min-width: 0;
    color: var(--crm-muted);
    font-size: 11px;
    font-weight: 800;
    white-space: nowrap;
}

.crm-video-channel select {
    min-height: var(--ff-control-min-height);
    width: auto;
    min-width: 86px;
    padding: 0 34px 0 11px;
    border: 1px solid var(--crm-line);
    border-radius: 8px;
    background: var(--crm-panel);
    color: var(--crm-text);
    font: inherit;
}

.crm-video-channel select:focus {
    border-color: var(--crm-accent);
    outline: none;
    box-shadow: 0 0 0 3px var(--crm-accent-ring);
}

.crm-video-channel.is-single select {
    min-width: 0;
    padding-right: 11px;
    appearance: none;
    pointer-events: none;
}

.crm-video-attachment {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.crm-video-attachment-icon {
    display: inline-flex;
    flex: 0 0 36px;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: color-mix(in srgb, #8b5cf6 18%, var(--crm-panel));
    color: #8b5cf6;
}

.crm-video-attachment-icon svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
}

.crm-video-upload-button {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    min-height: var(--ff-control-min-height);
    padding: 0 10px;
    border: 1px solid var(--crm-line-strong);
    border-radius: 8px;
    background: var(--crm-panel);
    color: var(--crm-text);
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
}

.crm-video-upload-button:hover,
.crm-video-upload-button:focus-visible {
    outline: none;
    border-color: var(--crm-accent);
    background: var(--crm-accent-light);
    color: var(--crm-accent-strong);
    box-shadow: 0 0 0 4px var(--crm-accent-ring);
}

.crm-video-upload-button:disabled {
    cursor: wait;
    opacity: 0.65;
}

.crm-video-file-name {
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    color: var(--crm-muted);
    font-size: 12px;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.crm-video-file-name.is-ready {
    color: var(--crm-text);
}

.crm-comm-status {
    min-width: 0;
    color: var(--crm-muted);
    font-size: 12px;
    font-weight: 750;
    line-height: 1.3;
    overflow-wrap: anywhere;
}

.crm-comm-status:not(:empty) {
    border: 1px solid transparent;
    border-radius: 8px;
}

.crm-comm-status.is-error {
    border-color: color-mix(in srgb, #ef4444 42%, var(--crm-line));
    background: color-mix(in srgb, #ef4444 9%, var(--crm-panel));
    color: color-mix(in srgb, #ef4444 82%, var(--crm-text));
}

.crm-comm-status.is-sending {
    border-color: color-mix(in srgb, #8b5cf6 36%, var(--crm-line));
    background: color-mix(in srgb, #8b5cf6 9%, var(--crm-panel));
    color: var(--crm-text);
}

.crm-comm-status:empty {
    display: none;
}

.crm-comm-status a {
    color: var(--crm-accent);
    font-weight: 850;
    text-decoration: none;
}

.crm-comm-status a:hover {
    text-decoration: underline;
}

.crm-call-workflow {
    display: grid;
    gap: 10px;
    margin: 0 3px 9px;
    padding: 11px 12px;
    border: 1px solid color-mix(in srgb, var(--ff-color-activity-call, #2ecc71) 48%, var(--crm-line));
    border-radius: 10px;
    background: color-mix(in srgb, var(--ff-color-activity-call, #2ecc71) 9%, var(--crm-panel));
}

.crm-call-workflow[hidden] {
    display: none;
}

.crm-call-workflow.is-ended {
    border-color: color-mix(in srgb, var(--crm-accent) 42%, var(--crm-line));
    background: var(--crm-accent-light);
}

.crm-call-workflow-head,
.crm-call-disposition-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.crm-call-workflow-head > div {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.crm-call-workflow-head strong {
    font-size: 13px;
}

.crm-call-workflow-head span,
.crm-call-disposition-actions small,
.crm-call-outcome-description {
    color: var(--crm-muted);
    font-size: 11px;
}

.crm-call-end,
.crm-call-disposition-actions button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: var(--ff-control-min-height);
    padding: 0 14px;
    border: 0;
    border-radius: 8px;
    color: #fff;
    font-size: 12px;
    font-weight: 850;
    cursor: pointer;
}

.crm-call-end {
    background: var(--crm-danger);
}

.crm-call-end svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
}

.crm-call-disposition-actions button {
    background: var(--crm-accent);
}

.crm-call-end:hover,
.crm-call-end:focus-visible,
.crm-call-disposition-actions button:hover,
.crm-call-disposition-actions button:focus-visible {
    outline: none;
    filter: brightness(0.9);
    box-shadow: 0 0 0 4px var(--crm-accent-ring);
}

.crm-call-end:disabled,
.crm-call-disposition-actions button:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.crm-call-disposition {
    display: grid;
    gap: 8px;
}

.crm-call-disposition[hidden] {
    display: none;
}

.crm-call-disposition label {
    display: grid;
    gap: 5px;
    color: var(--crm-text);
    font-size: 12px;
    font-weight: 800;
}

.crm-call-disposition select,
.crm-call-disposition textarea {
    width: 100%;
    min-height: var(--ff-control-min-height);
    border: 1px solid var(--crm-line-strong);
    border-radius: 8px;
    background: var(--crm-panel);
    color: var(--crm-text);
    outline: none;
}

.crm-call-disposition select {
    padding: 0 10px;
}

.crm-call-disposition textarea {
    max-height: 120px;
    padding: 9px 10px;
    line-height: 1.35;
    resize: vertical;
}

.crm-call-disposition select:focus,
.crm-call-disposition textarea:focus {
    border-color: var(--crm-accent);
    box-shadow: 0 0 0 3px var(--crm-accent-ring);
}

@media (max-width: 520px) {
    .crm-call-disposition-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .crm-call-disposition-actions button {
        width: 100%;
    }
}

.crm-text-opt-in {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    margin: 0 3px 8px;
    padding: 10px 12px;
    border: 1px solid color-mix(in srgb, var(--crm-accent) 42%, var(--crm-line));
    border-radius: 10px;
    background: color-mix(in srgb, var(--crm-accent) 9%, var(--crm-panel));
    color: var(--crm-text);
}

.crm-text-opt-in[hidden] {
    display: none;
}

.crm-text-opt-in-copy {
    display: grid;
    min-width: 0;
    gap: 3px;
}

.crm-text-opt-in-copy strong {
    font-size: 12px;
    font-weight: 850;
}

.crm-text-opt-in-copy span {
    font-size: 11px;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.crm-text-opt-in-copy small {
    color: var(--crm-muted);
    font-size: 10px;
    font-weight: 700;
}

.crm-text-opt-in-copy small:empty {
    display: none;
}

.crm-text-opt-in-send {
    min-height: var(--ff-control-min-height);
    padding: 0 14px;
    border: 1px solid var(--crm-accent);
    border-radius: 8px;
    background: var(--crm-accent);
    color: #fff;
    font-size: 12px;
    font-weight: 850;
    white-space: nowrap;
    cursor: pointer;
}

.crm-text-opt-in-send:hover,
.crm-text-opt-in-send:focus-visible {
    border-color: var(--crm-accent-strong);
    background: var(--crm-accent-strong);
    outline: none;
    box-shadow: 0 0 0 4px var(--crm-accent-ring);
}

.crm-text-opt-in-send:disabled {
    cursor: not-allowed;
    opacity: 0.48;
}

/* Customer conversation: one chronological thread with a composer anchored below it. */
.crm-detail-main {
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
    padding: 0;
}

.crm-conversation {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.crm-task-bubble-wrap {
    display: flex;
    flex: 0 0 auto;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 4px 8% 0;
}

.crm-task-bubble {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 64px;
    min-height: var(--ff-control-min-height);
    padding: 9px 13px;
    border: 1px solid var(--crm-line);
    border-radius: 17px;
    background: var(--crm-panel-soft);
    color: var(--crm-text);
    text-align: center;
    cursor: pointer;
}

.crm-task-bubble:hover,
.crm-task-bubble:focus-visible {
    border-color: var(--crm-accent);
    background: var(--crm-panel-hover);
    outline: none;
    box-shadow: 0 0 0 3px var(--crm-accent-ring);
}

.crm-task-bubble.is-empty {
    min-width: 152px;
    border-style: dashed;
}

.crm-task-bubble strong {
    color: inherit;
    font-size: 12px;
    line-height: 1.3;
}

.crm-conversation-list {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 9px;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 0 18px 16px;
    scrollbar-gutter: stable;
}

.crm-thread-item {
    --crm-thread-accent: var(--crm-line-strong);
    --crm-thread-accent-text: #fff;
    display: flex;
    width: 100%;
}

.crm-thread-kind-text {
    --crm-thread-accent: var(--ff-color-activity-text, #4182d7);
}

.crm-thread-kind-email {
    --crm-thread-accent: var(--ff-color-activity-email, #19b4ff);
    --crm-thread-accent-text: #063b4f;
}

.crm-thread-kind-call {
    --crm-thread-accent: var(--ff-color-activity-call, #2ecc71);
    --crm-thread-accent-text: #073b20;
}

.crm-thread-kind-video {
    --crm-thread-accent: #8b5cf6;
}

.crm-thread-item.is-inbound {
    justify-content: flex-start;
    padding-right: 12%;
}

.crm-thread-item.is-outbound {
    justify-content: flex-end;
    padding-left: 12%;
}

.crm-thread-item.is-system {
    justify-content: center;
    padding: 0 8%;
}

.crm-thread-bubble {
    position: relative;
    min-width: 96px;
    max-width: 82%;
    padding: 9px 12px 7px;
    border: 1px solid color-mix(in srgb, var(--crm-thread-accent) 44%, var(--crm-line));
    border-radius: 17px 17px 17px 5px;
    background: color-mix(in srgb, var(--crm-thread-accent) 12%, var(--crm-panel));
    color: var(--crm-text);
    box-shadow: 0 1px 1px rgba(15, 23, 42, 0.04);
}

.crm-thread-item.is-outbound .crm-thread-bubble {
    border-color: var(--crm-thread-accent);
    border-radius: 17px 17px 5px 17px;
    background: var(--crm-thread-accent);
    color: var(--crm-thread-accent-text);
}

.crm-thread-bubble .crm-activity-text {
    color: inherit;
    font-size: 14px;
    line-height: 1.4;
}

.crm-thread-bubble .crm-activity-email-body {
    max-height: 210px;
    overflow: auto;
}

.crm-activity-attachments {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    min-width: 0;
    margin-top: 7px;
}

.crm-activity-text:empty + .crm-activity-attachments {
    margin-top: 0;
}

.crm-activity-attachment {
    min-width: 0;
    overflow: hidden;
    border-radius: 10px;
}

.crm-activity-attachment:only-child,
.crm-activity-attachment.is-video,
.crm-activity-attachment.is-file {
    grid-column: 1 / -1;
}

.crm-activity-attachment.is-image {
    display: block;
    background: rgba(15, 23, 42, 0.08);
}

.crm-activity-attachment.is-image img {
    display: block;
    width: 100%;
    max-height: 320px;
    object-fit: contain;
}

.crm-activity-attachment.is-video {
    display: grid;
    gap: 4px;
}

.crm-activity-attachment.is-video video {
    display: block;
    width: 100%;
    max-height: 360px;
    border-radius: 10px;
    background: #000;
}

.crm-activity-attachment.is-video a {
    width: fit-content;
    color: inherit;
    font-size: 11px;
    font-weight: 750;
}

.crm-activity-attachment.is-pdf {
    display: grid;
    grid-column: 1 / -1;
    gap: 0;
    border: 1px solid color-mix(in srgb, currentColor 22%, transparent);
    background: color-mix(in srgb, var(--crm-panel) 78%, transparent);
}

.crm-activity-attachment.is-pdf iframe {
    display: block;
    width: 100%;
    height: clamp(250px, 42vw, 360px);
    border: 0;
    background: #fff;
}

.crm-activity-attachment.is-pdf > a {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding: 7px 10px;
    color: inherit;
    font-size: 12px;
    text-decoration: none;
}

.crm-thread-item.is-outbound .crm-activity-attachment.is-pdf {
    background: rgba(255, 255, 255, 0.14);
}

.crm-activity-attachment.is-pdf svg {
    flex: 0 0 auto;
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.crm-activity-attachment.is-pdf span {
    display: grid;
    min-width: 0;
    gap: 1px;
}

.crm-activity-attachment.is-pdf strong {
    overflow-wrap: anywhere;
}

.crm-activity-attachment.is-pdf small {
    font-size: 10px;
    font-weight: 700;
    opacity: 0.78;
}

.crm-activity-attachment.is-file {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding: 8px 10px;
    border: 1px solid color-mix(in srgb, currentColor 22%, transparent);
    background: color-mix(in srgb, var(--crm-panel) 78%, transparent);
    color: inherit;
    font-size: 12px;
    font-weight: 750;
    text-decoration: none;
}

.crm-thread-item.is-outbound .crm-activity-attachment.is-file {
    background: rgba(255, 255, 255, 0.14);
}

.crm-activity-attachment.is-file svg {
    flex: 0 0 auto;
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.crm-activity-attachment.is-file span {
    min-width: 0;
    overflow-wrap: anywhere;
}

.crm-thread-meta {
    margin-top: 5px;
    color: var(--crm-muted);
    font-size: 10px;
    font-weight: 750;
    line-height: 1.25;
}

.crm-thread-item.is-outbound .crm-thread-meta {
    color: rgba(255, 255, 255, 0.78);
    text-align: right;
}

.crm-conversation-empty {
    display: grid;
    flex: 1 1 auto;
    place-items: center;
    min-height: 120px;
    text-align: center;
}

.crm-comm-panel[data-mode="video"] .crm-comm-action-menu-toggle {
    border-color: color-mix(in srgb, #8b5cf6 82%, #000);
    border-left-color: rgba(255, 255, 255, 0.32);
    background: #8b5cf6;
}

.crm-comm-panel[data-mode="video"] .crm-comm-action-menu-toggle:hover,
.crm-comm-panel[data-mode="video"] .crm-comm-action-menu-toggle:focus-visible {
    background: color-mix(in srgb, #8b5cf6 86%, #000);
}

.crm-comm-panel {
    position: sticky;
    bottom: 0;
    z-index: 5;
    display: block;
    flex: 0 0 auto;
    gap: 0;
    padding: 10px 14px 12px;
    border-top: 1px solid var(--crm-line);
    background: color-mix(in srgb, var(--crm-panel) 94%, transparent);
    box-shadow: 0 -8px 20px rgba(15, 23, 42, 0.07);
    backdrop-filter: blur(12px);
}

.crm-comm-body {
    gap: 0;
}

.crm-comm-message {
    flex: 1 1 auto;
    height: 44px;
    min-height: 44px;
    max-height: 150px;
    padding: 11px 6px 11px 12px;
    overflow-y: hidden;
    line-height: 22px;
    resize: none;
}

.crm-comm-messagebar > .crm-comm-action-row {
    flex: 0 0 auto;
    flex-wrap: nowrap;
}

.crm-comm-compose > .crm-comm-status:not(:empty) {
    padding: 0 10px 8px;
}

.crm-kv {
    display: grid;
    grid-template-columns: minmax(120px, 0.35fr) 1fr;
    gap: 8px 14px;
    font-size: 14px;
}

.crm-kv dt {
    color: var(--crm-muted);
}

.crm-kv dd {
    margin: 0;
    min-width: 0;
    overflow-wrap: anywhere;
    font-weight: 600;
}

.crm-activity-list {
    display: grid;
    align-content: start;
    gap: 7px;
}

.crm-activity-item {
    --crm-activity-accent: var(--ff-color-activity-timeline, #969696);
    --crm-activity-border: color-mix(in srgb, var(--crm-activity-accent) 42%, var(--crm-line));
    --crm-activity-surface: color-mix(in srgb, var(--crm-activity-accent) 13%, var(--crm-panel));
    --crm-activity-label-text: #fff;
    display: grid;
    gap: 5px;
    padding: 8px 10px;
    border: 1px solid var(--crm-activity-border);
    border-radius: 8px;
    background: var(--crm-activity-surface);
}

.crm-activity-item[hidden] {
    display: none;
}

.crm-activity-call-stack {
    display: grid;
    gap: 5px;
    min-width: 0;
}

.crm-activity-call-stack[hidden] {
    display: none;
}

.crm-activity-call-stack-items {
    display: grid;
    min-width: 0;
    isolation: isolate;
}

.crm-activity-call-stack:not(.is-expanded) .crm-activity-call-stack-items {
    padding-bottom: 16px;
}

.crm-activity-call-stack:not(.is-expanded) .crm-activity-item {
    grid-area: 1 / 1;
    transform-origin: center top;
}

.crm-activity-call-stack:not(.is-expanded) .crm-activity-item:nth-child(1) {
    z-index: 3;
}

.crm-activity-call-stack:not(.is-expanded) .crm-activity-item:nth-child(2) {
    z-index: 2;
    transform: translateY(8px) scale(0.975);
}

.crm-activity-call-stack:not(.is-expanded) .crm-activity-item:nth-child(3) {
    z-index: 1;
    transform: translateY(16px) scale(0.95);
}

.crm-activity-call-stack:not(.is-expanded) .crm-activity-item:nth-child(n + 4) {
    display: none;
}

.crm-activity-call-stack.is-expanded .crm-activity-call-stack-items {
    gap: 7px;
}

.crm-activity-call-stack-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: var(--ff-control-min-height);
    padding: 0 10px;
    border: 1px solid var(--crm-line-strong);
    border-radius: 8px;
    background: var(--crm-panel);
    color: var(--crm-text);
    font: inherit;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
}

.crm-activity-call-stack-toggle [data-crm-call-stack-action] {
    color: var(--crm-accent-strong);
}

.crm-activity-call-stack-toggle:hover {
    background: var(--crm-panel-hover);
}

.crm-activity-call-stack-toggle:focus-visible {
    outline: 2px solid var(--crm-accent);
    outline-offset: 2px;
}

.crm-activity-text,
.crm-activity-meta {
    min-width: 0;
    overflow-wrap: anywhere;
}

.crm-activity-head {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.crm-activity-kind {
    display: inline-flex;
    align-items: center;
    min-height: 20px;
    padding: 0 7px;
    border-radius: 999px;
    background: var(--crm-activity-accent);
    color: var(--crm-activity-label-text);
    font-size: 11px;
    font-weight: 800;
    white-space: nowrap;
}

.crm-activity-meta {
    margin-left: auto;
    color: var(--crm-muted);
    font-size: 11px;
    font-weight: 600;
    text-align: right;
}

.crm-activity-text {
    color: var(--crm-text);
    font-size: 13px;
    line-height: 1.35;
    white-space: pre-wrap;
}

.crm-call-outcome {
    color: var(--crm-text);
    font-size: 12px;
    font-weight: 800;
    line-height: 1.25;
}

.crm-activity-text:empty {
    display: none;
}

.crm-activity-email-body {
    max-height: 220px;
    padding-right: 6px;
    overflow: auto;
    scrollbar-gutter: stable;
}

.crm-activity-kind-text {
    --crm-activity-accent: var(--ff-color-activity-text, #4182d7);
}

.crm-activity-kind-email {
    --crm-activity-accent: var(--ff-color-activity-email, #19b4ff);
    --crm-activity-label-text: #063b4f;
}

.crm-activity-kind-call {
    --crm-activity-accent: var(--ff-color-activity-call, #2ecc71);
    --crm-activity-label-text: #073b20;
}

.crm-activity-kind-note {
    --crm-activity-accent: var(--ff-color-activity-note, #f5cd19);
    --crm-activity-surface: var(--crm-activity-note-card-surface, var(--ff-color-activity-note-card, #fff5d7));
    --crm-activity-label-text: #493d00;
}

.crm-activity-kind-task {
    --crm-activity-accent: var(--ff-color-activity-task, #969696);
}

.crm-activity-kind-appointment {
    --crm-activity-accent: var(--ff-color-activity-appointment, #50326e);
}

.crm-activity-kind-deal {
    --crm-activity-accent: var(--ff-color-activity-deal, #969696);
}

.crm-activity-kind-service {
    --crm-activity-accent: var(--ff-color-activity-service, #2c3e50);
}

.crm-note-form {
    display: grid;
    gap: 10px;
}

.crm-note-form textarea {
    min-height: 96px;
    padding: 10px;
    border: 1px solid var(--crm-line);
    border-radius: 8px;
    resize: vertical;
}

.crm-note-form button {
    justify-self: start;
    min-height: 38px;
    padding: 0 14px;
    border-radius: 8px;
}

.crm-notes {
    display: grid;
    gap: 10px;
    margin-top: 12px;
}

.crm-note {
    padding: 10px;
    border: 1px solid var(--crm-line);
    border-radius: 8px;
    background: #fbfcfd;
}

.crm-note-time {
    margin-bottom: 4px;
    color: var(--crm-muted);
    font-size: 12px;
    font-weight: 750;
}

.crm-error,
.crm-empty {
    padding: 18px;
    color: var(--crm-muted);
}

.crm-error {
    color: var(--crm-danger);
}

.crm-detail-loading {
    display: grid;
    gap: 10px;
}

.crm-skeleton-line {
    display: block;
    height: 12px;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--crm-panel-soft), var(--crm-line), var(--crm-panel-soft));
    background-size: 200% 100%;
    animation: crm-skeleton 1.1s ease-in-out infinite;
}

.crm-skeleton-line.is-short {
    width: 48%;
}

.crm-skeleton-line.is-medium {
    width: 72%;
}

@keyframes crm-skeleton {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

@media (max-width: 980px) {
    .crm-header {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .crm-search {
        justify-self: stretch;
        max-width: none;
    }

    .crm-brand,
    .crm-header-actions {
        justify-content: space-between;
    }

    .crm-board-toolbar {
        grid-template-columns: minmax(104px, auto) 1fr;
    }

    .crm-toolbar-actions {
        justify-self: end;
    }

    .crm-main {
        padding: 12px;
    }

    .crm-today-overview {
        grid-template-columns: 1fr auto;
    }

    .crm-today-overview > .crm-progress {
        grid-column: 1;
        grid-row: 2;
    }

    .crm-today-stats {
        grid-column: 1 / -1;
        grid-row: 3;
    }

    .crm-stage-tabs {
        grid-column: 1 / -1;
        grid-row: 2;
        justify-content: flex-start;
        justify-self: stretch;
        max-width: none;
    }
}

@media (max-width: 720px) {
    .crm-customer-actions {
        position: absolute;
        top: env(safe-area-inset-top, 0px);
        right: 8px;
        z-index: 30;
        margin-left: 0;
    }

    .crm-modal .crm-detail-header {
        padding-right: 16px;
    }

    .crm-customer-action-menu > summary {
        border-color: transparent;
        background: transparent;
        color: #fff;
    }

    .crm-customer-action-menu > summary:hover,
    .crm-customer-action-menu > summary:focus-visible {
        border-color: rgba(255, 255, 255, 0.14);
        background: rgba(255, 255, 255, 0.1);
        color: #fff;
    }

    .crm-customer-action-menu > summary {
        width: var(--ff-control-min-height);
        padding: 0;
    }

    .crm-customer-action-menu > summary > span {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        white-space: nowrap;
        clip-path: inset(50%);
    }

    .crm-task-manager-body,
    .crm-task-form-grid {
        grid-template-columns: 1fr;
    }

    .crm-task-form .crm-task-notes {
        grid-column: auto;
    }

    .crm-filter-bar {
        align-items: stretch;
    }

    .crm-filter-menu {
        width: 100%;
    }

    .crm-filter-menu > summary {
        width: 100%;
    }

    .crm-filter-menu > summary .crm-filter-chevron {
        margin-left: auto;
    }

    .crm-filter-panel {
        right: 0;
        width: auto;
    }

    .crm-list {
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        scrollbar-width: none;
    }

    .crm-list::-webkit-scrollbar {
        display: none;
    }

    .crm-kanban {
        grid-template-columns: repeat(3, minmax(82vw, 1fr));
        width: max-content;
        max-width: none;
        gap: 10px;
        padding: 10px 14px max(14px, env(safe-area-inset-bottom));
    }

    .crm-kanban-column {
        width: 82vw;
        scroll-snap-align: start;
        border-color: var(--crm-line);
        background: #111216;
    }

    .crm-kanban-header {
        min-height: 42px;
        border-bottom-color: var(--crm-line);
        background: #17191d;
    }

    .crm-kanban-card.crm-action-row {
        border-color: var(--crm-line);
        background: var(--crm-panel);
    }
}

@media (max-width: 560px) {
    .crm-header {
        padding: 10px 12px;
    }

    .crm-brand {
        align-items: stretch;
        flex-direction: column;
        gap: 10px;
    }

    .crm-tool-switch {
        width: 100%;
    }

    .crm-tool-link {
        flex: 1;
    }

    .crm-text-opt-in {
        grid-template-columns: 1fr;
    }

    .crm-text-opt-in-send {
        width: 100%;
    }

    .crm-video-upload {
        grid-template-columns: minmax(0, 1fr);
        gap: 2px;
        padding: 6px;
    }

    .crm-video-attachment {
        gap: 7px;
    }

    .crm-video-file-name {
        font-size: 11px;
    }

    .crm-video-channel {
        justify-content: space-between;
        padding: 2px 0 0 43px;
        border-top: 1px solid var(--crm-line);
    }

    .crm-video-channel select {
        min-width: 112px;
    }

    .crm-comm-panel[data-mode="video"] .crm-comm-action-picker > .crm-comm-primary-action {
        flex: 1 1 auto;
        min-width: 0;
        padding: 0 11px;
    }

    .crm-comm-panel[data-mode="video"] .crm-comm-messagebar {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
    }

    .crm-comm-panel[data-mode="video"] .crm-comm-message,
    .crm-comm-panel[data-mode="video"] .crm-comm-action-row,
    .crm-comm-panel[data-mode="video"] .crm-comm-action-picker {
        width: 100%;
    }

    .crm-comm-panel[data-mode="video"] .crm-comm-action-row {
        margin-left: 0;
    }

    .crm-card {
        grid-template-columns: 38px minmax(0, 1fr);
        align-items: start;
    }

    .crm-card-task-side {
        grid-column: 2;
        justify-items: start;
    }

    .crm-card-next {
        max-width: none;
        text-align: left;
    }

    .crm-workplan-legend {
        flex-wrap: wrap;
        white-space: normal;
    }

    .crm-toolbar-actions,
    .crm-custom-dates {
        align-items: stretch;
        flex-direction: column;
    }

    .crm-board-toolbar {
        grid-template-columns: 1fr;
    }

    .crm-toolbar-actions {
        justify-self: stretch;
    }

    .crm-generated {
        min-width: 0;
        text-align: left;
    }

    .crm-date-filter {
        justify-content: space-between;
    }

    .crm-date-filter select,
    .crm-custom-dates input {
        width: 100%;
    }

    .crm-funnel-step {
        min-width: 116px;
    }

    .crm-home-toolbar {
        padding: 8px 12px;
    }

    .crm-home-views {
        width: 100%;
    }

    .crm-home-view {
        min-height: 44px;
        flex: 1 1 0;
    }

    .crm-today-overview {
        grid-template-columns: 1fr;
    }

    .crm-today-overview > .crm-progress {
        grid-column: 1;
        grid-row: auto;
        min-width: 0;
    }

    .crm-today-stats {
        grid-column: 1;
        grid-row: auto;
        flex-wrap: wrap;
    }

    .crm-next-item {
        width: 100%;
    }

    .crm-start-next {
        width: 100%;
    }

    .crm-kv {
        grid-template-columns: 1fr;
        gap: 4px;
    }
}

@media (max-width: 720px) {
    :root {
        --crm-bg: #0f1013;
        --crm-panel: #15161a;
        --crm-panel-soft: #202126;
        --crm-panel-hover: #1a1c20;
        --crm-text: #f7f7f8;
        --crm-muted: #9a9ca3;
        --crm-line: #25272d;
        --crm-line-strong: #343842;
        --crm-accent: #08b892;
        --crm-accent-strong: #10d2a8;
        --crm-accent-light: rgba(8, 184, 146, 0.14);
        --crm-accent-ring: rgba(8, 184, 146, 0.22);
        --crm-activity-card-surface: #36383f;
        --crm-activity-note-card-surface: #5c5232;
    }

    body {
        background: var(--crm-bg);
    }

    .crm-header {
        grid-template-columns: minmax(0, 1fr) 40px;
        grid-template-areas:
            "brand actions"
            "search search";
        gap: 10px;
        padding: max(10px, env(safe-area-inset-top)) 14px 12px;
        border-bottom-color: #202228;
        background: #101115;
    }

    .crm-brand {
        grid-area: brand;
        flex-direction: row;
        align-items: center;
        justify-content: flex-start;
        gap: 9px;
        min-width: 0;
    }

    .crm-brand-link {
        flex: 0 0 auto;
    }

    .crm-brand-link img {
        height: 22px;
    }

    .crm-brand-link span,
    .crm-tool-link span {
        display: none;
    }

    .crm-tool-switch {
        width: auto;
        padding: 2px;
        border-color: #2a2d34;
        background: #1b1d22;
    }

    .crm-tool-link {
        flex: 0 0 auto;
        width: 34px;
        min-height: 32px;
        padding: 0;
        border-radius: 7px;
    }

    .crm-tool-link.is-active {
        background: #2b2e35;
        color: var(--crm-accent-strong);
    }

    .crm-search {
        grid-area: search;
    }

    .crm-search-control {
        height: 38px;
        min-height: 38px;
        max-height: 38px;
        border: 1px solid var(--crm-line);
        border-radius: 8px;
        background: #27282e;
    }

    .crm-search input {
        padding: 0 14px;
        color: #fff;
        font-size: 15px;
        font-weight: 650;
    }

    .crm-search input::placeholder {
        color: #b7b7bd;
    }

    .crm-search-submit {
        width: 44px;
        min-width: 44px;
        border-left: 1px solid var(--crm-line);
        border-radius: 0 8px 8px 0;
        background: var(--crm-accent);
        color: #fff;
    }

    .crm-search-submit:hover {
        background: var(--crm-accent-strong);
    }

    .crm-search-dropdown {
        top: calc(100% + 8px);
        max-height: min(340px, calc(100vh - 170px));
        border-color: var(--crm-line-strong);
        background: #1b1d22;
        box-shadow: 0 18px 44px rgba(0, 0, 0, 0.42);
    }

    .crm-search-result {
        grid-template-columns: 40px minmax(0, 1fr);
        min-height: 54px;
        gap: 12px;
        padding: 7px 10px;
        color: var(--crm-text);
    }

    .crm-search-result .crm-customer-avatar {
        width: 40px;
        height: 40px;
        font-size: 14px;
    }

    .crm-search-result-name {
        color: var(--crm-text);
        font-size: 16px;
        font-weight: 760;
    }

    .crm-header-actions {
        grid-area: actions;
        justify-content: flex-end;
    }

    .crm-account-button {
        width: 40px;
        height: 40px;
        border: 0;
        background: #24262c;
        color: #fff;
    }

    .crm-main {
        padding: 0;
    }

    .crm-board {
        border: 0;
        border-radius: 0;
        background: var(--crm-bg);
    }

    .crm-board-toolbar {
        align-items: center;
        flex-wrap: wrap;
        gap: 10px;
        padding: 18px 16px 0;
        border-bottom: 0;
        background: #101115;
    }

    .crm-board-title {
        min-width: 0;
    }

    .crm-board-toolbar h1 {
        color: #fff;
        font-size: 26px;
        line-height: 1.08;
        font-weight: 820;
    }

    .crm-toolbar-actions {
        width: auto;
        margin-left: auto;
        gap: 8px;
    }

    .crm-date-filter {
        gap: 0;
    }

    .crm-date-filter span,
    .crm-generated {
        display: none;
    }

    .crm-date-filter select {
        width: auto;
        min-width: 112px;
        height: 34px;
        border-color: #2d3139;
        border-radius: 999px;
        background: #202228;
        color: #fff;
        font-size: 12px;
        font-weight: 800;
    }

    .crm-custom-dates {
        align-items: stretch;
        padding: 12px 16px;
        border-color: #24262b;
        background: #111216;
    }

    .crm-custom-dates label {
        justify-content: space-between;
    }

    .crm-custom-dates input {
        border-color: #323640;
        background: #24262c;
        color: #fff;
    }

    .crm-stage-tabs {
        order: 3;
        flex: 0 0 calc(100% + 32px);
        min-width: 0;
        margin: 4px -16px 0;
        padding: 0 16px 14px;
        gap: 8px;
        border-bottom: 1px solid #25272d;
        scrollbar-width: none;
    }

    .crm-stage-tabs::-webkit-scrollbar {
        display: none;
    }

    .crm-funnel-step {
        display: grid;
        grid-template-columns: auto auto;
        grid-template-rows: 1fr;
        align-content: center;
        align-items: center;
        gap: 7px;
        min-width: 126px;
        min-height: 52px;
        padding: 9px 12px;
        filter: none;
    }

    .crm-funnel-step::before {
        display: none;
    }

    .crm-funnel-step::after,
    .crm-funnel-step:first-child::after,
    .crm-funnel-step:last-child::after {
        inset: 0;
        border: 1px solid #292c33;
        border-radius: 12px;
        background: #1f2127;
        clip-path: none;
    }

    .crm-funnel-step.is-active::after {
        border-color: rgba(8, 184, 146, 0.38);
        background: #172922;
    }

    .crm-funnel-step:hover {
        transform: none;
    }

    .crm-funnel-count {
        grid-column: 1;
        grid-row: 1;
        justify-self: start;
        min-width: 0;
        color: var(--crm-accent);
        font-size: 22px;
        font-weight: 850;
        line-height: 1;
    }

    .crm-funnel-label {
        grid-column: 2;
        grid-row: 1;
        color: #aeb0b7;
        overflow: visible;
        text-overflow: clip;
        font-size: 12px;
        font-weight: 800;
    }

    .crm-list {
        max-height: none;
        background: var(--crm-bg);
    }

    .crm-today-overview {
        border-color: #25272d;
        background: #15161a;
    }

    .crm-today-copy strong {
        color: #fff;
    }

    .crm-progress-label strong {
        color: #fff;
    }

    .crm-progress-track {
        background: #2b2e34;
    }

    .crm-today-stats .is-urgent { background: rgba(220, 38, 38, 0.16); color: #fca5a5; }
    .crm-today-stats .is-ready { background: rgba(8, 184, 146, 0.14); color: #6ee7c9; }
    .crm-today-stats .is-blocked { background: rgba(217, 119, 6, 0.16); color: #fdba74; }

    .crm-action-row {
        grid-template-columns: 40px minmax(0, 1fr);
        min-height: 70px;
        gap: 10px;
        padding: 10px 16px;
        border-bottom-color: #24262b;
        background: var(--crm-bg);
        color: #fff;
    }

    .crm-action-row:hover,
    .crm-action-row.is-selected {
        background: #17191d;
    }

    .crm-action-row .crm-customer-avatar {
        grid-column: 1;
        grid-row: 1;
        width: 40px;
        height: 40px;
    }

    .crm-action-main {
        grid-column: 2;
        grid-row: 1;
    }

    .crm-action-main strong {
        color: #fff;
    }

    .crm-action-vehicle {
        color: #9b9ea6;
    }

    .crm-priority-badge.is-ready {
        background: rgba(8, 184, 146, 0.14);
        color: #6ee7c9;
    }

    .crm-priority-badge.is-urgent {
        background: rgba(220, 38, 38, 0.16);
        color: #fca5a5;
    }

    .crm-priority-badge.is-blocked {
        background: rgba(217, 119, 6, 0.16);
        color: #fdba74;
    }

    .crm-task-workflows {
        align-items: stretch;
    }

    .crm-task-workflow-label {
        width: 100%;
    }

    .crm-reschedule-date {
        flex: 1 1 150px;
    }

    .crm-reschedule-date input {
        width: 100%;
    }

    .crm-manager-reasons {
        display: grid;
        grid-template-columns: 1fr;
    }

    .crm-manager-reasons button,
    .crm-manager-actions button {
        width: 100%;
    }

    .crm-manager-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .crm-next-item {
        border-color: #343842;
        background: #24262c;
        color: #d1d5db;
    }

    .crm-table {
        min-width: 0;
    }

    .crm-table-header {
        display: none;
    }

    .crm-table-body {
        display: block;
    }

    .crm-table-row {
        position: relative;
        display: grid;
        grid-template-columns: 44px minmax(0, 1fr) 16px;
        grid-template-rows: min-content min-content;
        column-gap: 12px;
        row-gap: 2px;
        align-content: center;
        min-height: 64px;
        padding: 9px 16px;
        border-bottom-color: #24262b;
        background: var(--crm-bg);
        color: #fff;
    }

    .crm-table-row::after {
        content: "";
        grid-column: 3;
        grid-row: 1 / 3;
        align-self: center;
        justify-self: end;
        width: 10px;
        height: 10px;
        border-top: 2px solid #555861;
        border-right: 2px solid #555861;
        transform: rotate(45deg);
    }

    .crm-table-row:hover,
    .crm-table-row.is-selected {
        background: #17191d;
    }

    .crm-table-row.is-selected {
        box-shadow: inset 3px 0 0 var(--crm-accent);
    }

    .crm-table-cell {
        white-space: nowrap;
        font-size: 14px;
    }

    .crm-table-customer {
        display: contents;
    }

    .crm-customer-avatar {
        grid-column: 1;
        grid-row: 1 / 3;
        align-self: center;
        justify-self: start;
        width: 40px;
        height: 40px;
        font-size: 15px;
        box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16);
    }

    .crm-card-title {
        grid-column: 2;
        grid-row: 1;
        align-self: end;
        color: #fff;
        font-size: 17px;
        font-weight: 800;
        line-height: 1.12;
    }

    .crm-table-cell:nth-child(2) {
        grid-column: 2;
        color: #9b9ea6;
        font-size: 14px;
        font-weight: 680;
        line-height: 1.16;
    }

    .crm-table-cell:nth-child(2) {
        grid-row: 2;
    }

    .crm-table-cell:nth-child(4),
    .crm-table-cell:nth-child(3) {
        display: none;
    }

    .crm-empty,
    .crm-error {
        padding: 24px 16px;
        background: var(--crm-bg);
    }

    .crm-modal {
        align-items: end;
        padding: 0;
    }

    .crm-modal-backdrop {
        background: rgba(0, 0, 0, 0.58);
    }

    .crm-modal-card {
        width: 100%;
        height: 100dvh;
        max-height: none;
        border: 0;
        border-radius: 18px 18px 0 0;
        background: #15171b;
        box-shadow: 0 -18px 50px rgba(0, 0, 0, 0.42);
        transform: translateY(28px);
    }

    .crm-modal-close {
        top: 12px;
        right: 12px;
        width: 38px;
        height: 38px;
        border-color: #333741;
        background: #22252b;
        color: #f4f4f5;
    }

    .crm-detail-header {
        border-color: #2b2e34;
        background: #15171b;
    }

    .crm-task-manager button,
    .crm-task-form select,
    .crm-task-form input,
    .crm-task-form textarea {
        border-color: #343842;
        background: #22252b;
        color: #f7f7f8;
    }

    .crm-customer-action-menu > summary,
    .crm-customer-action-list {
        border-color: #343842;
        background: #22252b;
        color: #f7f7f8;
    }

    .crm-customer-action-list button {
        color: #f7f7f8;
    }

    .crm-task-manager,
    .crm-task-manager > header {
        border-color: #2b2e34;
        background: #181a1f;
    }

    .crm-task-manager-row {
        border-color: #30343c;
        background: #1d2025;
    }

    .crm-detail-body {
        padding: 16px;
    }

    .crm-modal .crm-activity-rail {
        height: min(620px, 68vh);
        margin-right: -12px;
        margin-left: -12px;
        padding: 14px 12px;
        border-color: #2b2e34;
        background: #181a1f;
    }

    .crm-modal .crm-activity-rail.is-empty {
        height: auto;
    }

    .crm-modal .crm-vehicle-rail {
        margin: 0 -12px -10px;
    }

    .crm-activity-filter select {
        border-color: #343842;
        background: #22252b;
        color: #f7f7f8;
    }

    .crm-activity-filter option {
        background: #22252b;
        color: #f7f7f8;
    }

    .crm-customer-summary {
        border-color: #30343c;
        background: #1d2025;
        color: #f7f7f8;
    }

    .crm-activity-item {
        border-color: var(--crm-activity-border);
        background: var(--crm-activity-surface);
        color: #f7f7f8;
    }

    .crm-comm-action-bar {
        border-color: #30343c;
        background: #1d2025;
    }

    .crm-comm-quick-action.is-ready {
        box-shadow: 0 0 0 3px color-mix(in srgb, var(--crm-channel-color) 30%, transparent);
    }

    .crm-comm-message,
    .crm-comm-subject,
    .crm-comm-video-url {
        border-color: #30343c;
        background: #1d2025;
        color: #f7f7f8;
    }

    .crm-comm-messagebar {
        border-color: #30343c;
        background: #1d2025;
    }

    .crm-note-mention-menu {
        border-color: #30343c;
        background: #1d2025;
    }

    .crm-comm-compose .crm-comm-message,
    .crm-comm-compose .crm-comm-subject,
    .crm-comm-compose .crm-comm-video-url {
        background: transparent;
    }

    .crm-video-upload {
        border-color: #3f4652;
        background: #1d2025;
    }

    .crm-video-file-name.is-ready {
        color: #6ee7c9;
    }

    .crm-comm-message::placeholder,
    .crm-comm-subject::placeholder,
    .crm-comm-video-url::placeholder {
        color: #8c9098;
    }

    .crm-comm-action-row {
        flex-wrap: nowrap;
        gap: 4px;
        width: auto;
        margin-left: auto;
    }

    .crm-comm-channel-action {
        flex: 0 0 var(--ff-control-min-height);
        min-width: var(--ff-control-min-height);
        padding: 0;
    }

    .crm-comm-action-row .crm-comm-channel-action svg {
        display: block;
    }

    .crm-detail-main {
        height: calc(100dvh - 150px);
        min-height: 560px;
        margin: 0 -12px;
    }

    .crm-detail-main.has-empty-conversation {
        height: auto;
        min-height: 0;
    }

    .crm-conversation.is-empty {
        flex: 0 0 139px;
        min-height: 139px;
        max-height: 180px;
        overflow: visible;
    }

    .crm-conversation.is-empty .crm-conversation-list {
        flex: 0 0 auto;
        min-height: 0;
        overflow: visible;
        padding-top: 14px;
        padding-bottom: 12px;
    }

    .crm-conversation.is-empty .crm-conversation-empty {
        flex: 0 0 auto;
        min-height: 58px;
        padding: 8px 14px;
        font-size: 13px;
    }

    .crm-conversation.is-empty .crm-task-bubble-wrap {
        padding-top: 2px;
    }

    .crm-conversation-list {
        padding-right: 10px;
        padding-left: 10px;
    }

    .crm-thread-item.is-inbound {
        padding-right: 6%;
    }

    .crm-thread-item.is-outbound {
        padding-left: 6%;
    }

    .crm-thread-bubble {
        max-width: 88%;
    }

    .crm-detail-main > .crm-comm-panel {
        position: static;
        padding: 8px 8px 10px;
        background: rgba(21, 23, 27, 0.96);
    }

    .crm-comm-status {
        width: 100%;
    }

    .crm-comm-compose > .crm-comm-status:not(:empty) {
        margin: 0 0 7px;
        padding: 8px 9px;
        font-size: 11px;
        line-height: 1.35;
    }
}

/* Unified CRM button behavior. Uses shared CRM variables across viewports. */
:root {
    --crm-control-shadow: inset 0 1px 0 rgba(255,255,255,0.68), 0 1px 2px rgba(15,23,42,0.05);
    --crm-control-shadow-hover: inset 0 1px 0 rgba(255,255,255,0.80), 0 8px 20px rgba(15,23,42,0.08);
    --crm-primary-shadow: inset 0 1px 0 rgba(255,255,255,0.22), 0 1px 2px rgba(0,112,243,0.12);
    --crm-primary-shadow-hover: inset 0 1px 0 rgba(255,255,255,0.28), 0 8px 18px rgba(0,112,243,0.18);
    --crm-control-ease: cubic-bezier(0.23, 1, 0.32, 1);
}

.crm-tool-link,
.crm-modal-close,
.crm-customer-action-menu > summary,
.crm-action-link,
.crm-comm-channel-action {
    border-radius: var(--crm-radius);
    box-shadow: var(--crm-control-shadow);
    transition:
        background 0.14s var(--crm-control-ease),
        border-color 0.14s var(--crm-control-ease),
        box-shadow 0.14s var(--crm-control-ease),
        color 0.14s var(--crm-control-ease),
        transform 0.14s var(--crm-control-ease);
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.crm-search-submit,
.crm-note-form button {
    box-shadow: var(--crm-primary-shadow);
    transition:
        background 0.14s var(--crm-control-ease),
        border-color 0.14s var(--crm-control-ease),
        box-shadow 0.14s var(--crm-control-ease),
        color 0.14s var(--crm-control-ease),
        transform 0.14s var(--crm-control-ease);
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.crm-tool-link:hover,
.crm-modal-close:hover,
.crm-customer-action-menu > summary:hover,
.crm-action-link:hover,
.crm-tool-link:focus-visible,
.crm-modal-close:focus-visible,
.crm-customer-action-menu > summary:focus-visible,
.crm-action-link:focus-visible {
    border-color: var(--crm-line-strong);
    background: var(--crm-panel-hover);
    box-shadow: var(--crm-control-shadow-hover);
    color: var(--crm-accent);
    outline: none;
    transform: translateY(-1px);
}

.crm-search-submit:hover,
.crm-note-form button:hover,
.crm-search-submit:focus-visible,
.crm-note-form button:focus-visible {
    background: var(--crm-accent-strong);
    box-shadow: var(--crm-primary-shadow-hover);
    color: #fff;
    outline: none;
    transform: translateY(-1px);
}

.crm-tool-link:focus-visible,
.crm-modal-close:focus-visible,
.crm-customer-action-menu > summary:focus-visible,
.crm-action-link:focus-visible,
.crm-comm-channel-action:focus-visible,
.crm-search-submit:focus-visible,
.crm-note-form button:focus-visible {
    box-shadow: 0 0 0 4px var(--crm-accent-ring), var(--crm-control-shadow);
}

.crm-search-submit:focus-visible,
.crm-note-form button:focus-visible {
    box-shadow: 0 0 0 4px var(--crm-accent-ring), var(--crm-primary-shadow);
}

.crm-tool-link:active,
.crm-modal-close:active,
.crm-customer-action-menu > summary:active,
.crm-action-link:active,
.crm-comm-channel-action:active,
.crm-search-submit:active,
.crm-note-form button:active {
    box-shadow: var(--crm-control-shadow);
    transform: translateY(0) scale(0.98);
}

.crm-search-submit:active,
.crm-note-form button:active {
    box-shadow: var(--crm-primary-shadow);
}

.crm-comm-channel-action:disabled {
    box-shadow: none;
    transform: none;
}

.crm-contact-control > .crm-copy-contact {
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.crm-contact-control > .crm-copy-contact:hover,
.crm-contact-control > .crm-copy-contact:focus-visible,
.crm-contact-control > .crm-copy-contact:active {
    border: 0;
    background: transparent;
    box-shadow: none;
    transform: none;
}

.crm-contact-control > .crm-copy-contact:focus-visible {
    outline: 2px solid var(--crm-accent);
    outline-offset: 2px;
}

@media (hover: none), (pointer: coarse) {
    .crm-tool-link:hover,
    .crm-modal-close:hover,
    .crm-customer-action-menu > summary:hover,
    .crm-action-link:hover,
    .crm-comm-channel-action:hover,
    .crm-search-submit:hover,
    .crm-note-form button:hover {
        transform: none;
    }
}

@keyframes crm-unread-notification-glow {
    0%, 100% {
        box-shadow:
            0 0 0 1px var(--ff-color-success),
            0 0 8px color-mix(in srgb, var(--ff-color-success) 34%, transparent);
    }
    50% {
        box-shadow:
            0 0 0 2px color-mix(in srgb, var(--ff-color-success) 75%, transparent),
            0 0 16px color-mix(in srgb, var(--ff-color-success) 58%, transparent);
    }
}

.crm-kanban-card.crm-action-row.is-unread,
.crm-snooze-card.crm-action-row.is-unread,
.crm-search-result.is-unread {
    position: relative;
    z-index: 1;
    border-color: var(--ff-color-success);
    animation: crm-unread-notification-glow 2.4s ease-in-out infinite;
}

.crm-kanban-card.crm-action-row.is-unread::after,
.crm-snooze-card.crm-action-row.is-unread::after,
.crm-search-result.is-unread::after {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 8px;
    height: 8px;
    border: 2px solid var(--crm-panel);
    border-radius: 999px;
    background: var(--ff-color-success);
    content: '';
}

.crm-kanban-card.crm-action-row.is-unread:hover,
.crm-kanban-card.crm-action-row.is-unread.is-selected,
.crm-search-result.is-unread:hover {
    border-color: var(--ff-color-success);
}

@media (prefers-reduced-motion: reduce) {
    .crm-kanban-card.crm-action-row.is-unread,
    .crm-search-result.is-unread {
        animation: none;
        box-shadow:
            0 0 0 2px color-mix(in srgb, var(--ff-color-success) 75%, transparent),
            0 0 10px color-mix(in srgb, var(--ff-color-success) 42%, transparent);
    }
}

/* Customer workflow tools share one review-ready surface across breakpoints. */
.crm-customer-actions {
    min-width: 0;
}

.crm-contact-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    min-width: 0;
    padding: 9px;
    border: 1px solid var(--crm-line);
    border-radius: 8px;
    background: var(--crm-panel-soft);
}

.crm-contact-row-summary {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.crm-contact-row-summary strong {
    overflow: hidden;
    color: var(--crm-text);
    font-size: 13px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.crm-contact-row-summary span {
    color: var(--crm-muted);
    font-size: 11px;
}

.crm-contact-row-actions,
.crm-document-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 7px;
}

.crm-contact-row > .crm-contact-edit-row {
    grid-column: 1 / -1;
    width: 100%;
    padding-top: 9px;
    border-top: 1px solid var(--crm-line);
}

.crm-contact-row > .crm-contact-edit-row[hidden] {
    display: none;
}

.crm-task-form-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
}

.crm-appointment-manager form h3 {
    grid-column: 1 / -1;
    margin: 0;
    color: var(--crm-text);
    font-size: 14px;
}

.crm-appointment-row span {
    min-width: 0;
}

.crm-appointment-row em {
    overflow: hidden;
    color: var(--crm-text);
    font-size: 12px;
    font-style: normal;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.crm-document-actions {
    justify-content: space-between;
}

.crm-trade-scanner {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    background: #050505;
}

.crm-trade-scanner video {
    grid-area: 1 / 1;
    max-height: 260px;
}

.crm-trade-scan-guide {
    position: absolute;
    top: 50%;
    left: 8%;
    width: 84%;
    height: 72px;
    border: 2px solid rgba(255, 255, 255, 0.9);
    border-radius: 8px;
    box-shadow: 0 0 0 999px rgba(0, 0, 0, 0.35);
    transform: translateY(-50%);
    pointer-events: none;
}

.crm-trade-scan-guide::after {
    position: absolute;
    top: 50%;
    right: 8px;
    left: 8px;
    height: 2px;
    background: #ef4444;
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.75);
    content: '';
}

.crm-trade-scanner p {
    margin: 0;
    padding: 2px 10px;
    color: #f4f4f5;
    font-size: 11px;
    text-align: center;
}

.crm-trade-scanner button {
    margin: 0 8px 8px;
}

@media (max-width: 960px) {
    .crm-task-manager-body {
        grid-template-columns: 1fr;
    }

    .crm-task-form-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 720px) {
    .crm-detail-title-text {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
    }

    .crm-customer-actions {
        margin-left: 0;
    }

    .crm-customer-action-menu > summary {
        border-color: transparent;
        background: transparent;
        color: #fff;
    }

    .crm-customer-action-menu > summary:hover,
    .crm-customer-action-menu > summary:focus-visible {
        border-color: rgba(255, 255, 255, 0.14);
        background: rgba(255, 255, 255, 0.1);
        color: #fff;
    }

    .crm-detail.has-crm-tool-open .crm-detail-body {
        display: none;
    }

    .crm-contact-manager,
    .crm-document-manager,
    .crm-appointment-manager,
    .crm-task-manager {
        min-height: 0;
        max-height: none;
        overflow: auto;
        border-color: #2b2e34;
        background: #181a1f;
        color: #f7f7f8;
    }

    .crm-document-manager > header,
    .crm-appointment-manager > header,
    .crm-task-manager > header {
        position: sticky;
        top: 0;
        z-index: 3;
        padding: 12px;
        border-bottom: 1px solid #2b2e34;
        background: #181a1f;
    }

    .crm-contact-manager [data-crm-contact-manager-body],
    .crm-task-manager-body,
    .crm-task-form-grid,
    .crm-appointment-manager form {
        grid-template-columns: 1fr;
    }

    .crm-contact-edit-group,
    .crm-contact-row,
    .crm-document-row,
    .crm-appointment-row,
    .crm-task-manager-row {
        border-color: #30343c;
        background: #1d2025;
        color: #f7f7f8;
    }

    .crm-contact-row-summary strong,
    .crm-appointment-manager form h3,
    .crm-appointment-row em {
        color: #f7f7f8;
    }

    .crm-contact-manager button,
    .crm-document-manager button,
    .crm-appointment-manager button,
    .crm-contact-edit-row input,
    .crm-contact-edit-row select,
    .crm-appointment-manager form input,
    .crm-appointment-manager form select,
    .crm-appointment-manager form textarea {
        min-height: 44px;
        border-color: #343842;
        background: #22252b;
        color: #f7f7f8;
    }

    .crm-contact-row {
        grid-template-columns: 1fr;
    }

    .crm-contact-row-actions {
        justify-content: flex-start;
    }

    .crm-contact-edit-row {
        grid-template-columns: 1fr;
    }

    .crm-contact-edit-actions,
    .crm-task-form .crm-task-notes,
    .crm-appointment-notes {
        grid-column: auto;
    }

    .crm-document-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .crm-document-actions button {
        width: 100%;
    }

    .crm-appointment-row {
        align-items: stretch;
        flex-direction: column;
    }

    .crm-appointment-row button {
        align-self: flex-start;
    }
}

/* Compact task editor: overlay the conversation without replacing its layout. */
.crm-detail {
    position: relative;
}

.crm-task-manager {
    position: absolute;
    z-index: 40;
    bottom: 74px;
    left: 50%;
    width: min(360px, calc(100% - 24px));
    max-height: min(470px, calc(100% - 94px));
    overflow: auto;
    border: 1px solid var(--crm-line);
    border-radius: 14px;
    background: var(--crm-panel);
    box-shadow: 0 18px 50px rgba(15, 23, 42, 0.24);
    transform: translateX(-50%);
}

.crm-task-manager > header {
    position: static;
    padding: 10px 12px;
}

.crm-task-manager > header h3 {
    font-size: 15px;
}

.crm-task-manager-close {
    min-width: 44px;
    min-height: 44px;
}

.crm-task-manager-body {
    display: block;
    padding: 12px;
}

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

.crm-task-form-grid > label:first-child,
.crm-task-form .crm-task-notes {
    grid-column: 1 / -1;
}

.crm-task-form textarea {
    min-height: 64px;
    max-height: 120px;
}

.crm-task-form-actions button {
    min-height: 44px;
}

.crm-task-bubble:disabled,
.crm-task-bubble.is-read-only:not(button) {
    cursor: default;
    opacity: 0.72;
}

.crm-task-bubble:disabled:hover,
.crm-task-bubble:disabled:focus-visible,
.crm-task-bubble.is-read-only:not(button):hover {
    border-color: var(--crm-line);
    background: var(--crm-panel-soft);
    outline: none;
    box-shadow: none;
}

@media (max-width: 720px) {
    .crm-task-manager {
        bottom: 66px;
        width: min(350px, calc(100% - 20px));
        min-height: 0;
        max-height: min(450px, calc(100% - 82px));
        border-color: #343842;
        background: #181a1f;
        color: #f7f7f8;
    }

    .crm-task-manager > header {
        position: static;
        padding: 9px 10px;
        border-color: #343842;
        background: #181a1f;
    }

    .crm-task-manager-body {
        padding: 10px;
    }

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

    .crm-task-form .crm-task-notes {
        grid-column: 1 / -1;
    }

    .crm-task-form select,
    .crm-task-form input,
    .crm-task-form textarea,
    .crm-task-form-actions button,
    .crm-task-manager-close {
        min-height: 44px;
        border-color: #343842;
        background: #22252b;
        color: #f7f7f8;
    }

    .crm-task-form-actions [type="submit"] {
        border-color: var(--crm-accent);
        background: var(--crm-accent);
        color: #fff;
    }
}

/* Keep contact editing as an anchored dropdown instead of replacing the conversation. */
.crm-customer-actions {
    position: relative;
}

.crm-contact-manager {
    position: absolute;
    z-index: 45;
    top: calc(100% + 8px);
    right: 0;
    display: grid;
    width: min(430px, calc(100vw - 32px));
    max-height: min(520px, calc(100dvh - 130px));
    gap: 0;
    overflow: auto;
    padding: 0;
    border: 1px solid var(--crm-line);
    border-radius: 14px;
    background: var(--crm-panel);
    box-shadow: 0 18px 50px rgba(15, 23, 42, 0.24);
}

.crm-contact-edit-group h3 svg,
.crm-contact-icon-button svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
}

.crm-contact-manager-status {
    min-height: 0;
    padding: 8px 10px 0;
}

.crm-contact-manager-status:empty {
    display: none;
}

.crm-contact-manager [data-crm-contact-manager-body] {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
    padding: 6px;
}

.crm-contact-edit-group {
    grid-template-columns: 36px minmax(0, 1fr) 44px;
    align-items: start;
    gap: 4px;
    padding: 5px 0;
    border: 0;
    border-radius: 0;
    background: transparent;
}

.crm-contact-edit-group > header {
    display: contents;
}

.crm-contact-edit-group + .crm-contact-edit-group {
    border-top: 1px solid var(--crm-line);
}

.crm-contact-edit-group h3 {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    grid-column: 1;
    grid-row: 1;
    margin-top: 4px;
    border-radius: 999px;
    background: var(--crm-accent-light);
    color: var(--crm-accent-strong);
}

.crm-contact-edit-group > header > [data-crm-contact-add] {
    grid-column: 3;
    grid-row: 1;
}

.crm-contact-edit-group [data-crm-contact-rows] {
    grid-column: 2;
    grid-row: 1;
    gap: 4px;
}

.crm-contact-row {
    grid-template-columns: minmax(0, 1fr) auto;
    min-height: 44px;
    padding: 0 0 0 8px;
}

.crm-contact-edit-row,
.crm-contact-row > .crm-contact-edit-row {
    grid-template-columns: minmax(0, 1fr) 108px;
}

.crm-contact-edit-actions {
    grid-column: 1 / -1;
    gap: 5px;
}

.crm-contact-row > .crm-contact-edit-row {
    padding: 5px 0 0;
}

.crm-contact-manager button,
.crm-contact-edit-row input,
.crm-contact-edit-row select {
    min-height: 44px;
}

.crm-contact-manager .crm-contact-icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    min-width: 44px;
    padding: 0;
}

.crm-contact-manager .crm-contact-icon-button.is-primary {
    border-color: var(--crm-accent);
    background: var(--crm-accent);
    color: #fff;
}

.crm-contact-row-actions {
    flex-wrap: nowrap;
    gap: 4px;
}

@media (max-width: 720px) {
    .crm-customer-actions {
        position: absolute;
        top: env(safe-area-inset-top, 0px);
        right: 8px;
        margin-left: 0;
    }

    .crm-contact-manager {
        width: min(350px, calc(100vw - 24px));
        max-height: min(540px, calc(100dvh - 76px));
        border-color: #343842;
        background: #181a1f;
        color: #f7f7f8;
    }

    .crm-contact-manager [data-crm-contact-manager-body] {
        grid-template-columns: 1fr;
        padding: 6px;
    }

    .crm-contact-edit-group {
        border-color: #30343c;
        background: transparent;
    }

    .crm-contact-row {
        grid-template-columns: minmax(0, 1fr) auto;
    }

    .crm-contact-edit-row,
    .crm-contact-row > .crm-contact-edit-row {
        grid-template-columns: minmax(0, 1fr) 96px;
    }
}
