/*
   CRM lead and customer cards (Leads.razor, Customers.razor), sized like the Navigator cards
   (cp-design.css .nav-card-open): 13px text, 22px icons, 29px rows and light dividers.
   Every rule is scoped under .crm-card so the rest of the app keeps its look.
*/
.crm-card {
    font-size: 13px;
    line-height: 1.2;
    color: #171717;
}

/* Name row, as .nav-person. */
.crm-card .crm-name {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0 0 5px;
    font-size: 18px;
    font-weight: 600;
    line-height: 1.2;
    color: #171717;
}

/* One info row with its icon, as .nav-card-open .info-row. Never bold. */
.crm-card .crm-row {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    min-height: 29px;
    margin: 0;
    font-size: 13px;
    font-weight: 400;
    line-height: 1.2;
    color: #171717;
    overflow-wrap: anywhere;
}

.crm-card .crm-row > span {
    min-width: 0;
}

/* The phone number is black like the rest of the card, not a blue link. */
.crm-card a.crm-row,
.crm-card a.crm-row:hover {
    color: #171717;
    text-decoration: none;
}

/* Every card icon has the same size. */
.crm-card .crm-icon,
.crm-card .crm-row > img:first-child,
.crm-card .crm-row > svg:first-child,
.crm-card .crm-name > img:first-child {
    width: 22px;
    height: 22px;
    margin: 0;
    flex-shrink: 0;
}

/* A job's title (its address): bold, but the same size as the other rows. */
.crm-card .crm-job-title {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.2;
    color: #171717;
}

.crm-card .crm-muted {
    color: #79808e;
}

/* Note row: keeps the note's line breaks. */
.crm-card .crm-note {
    align-items: flex-start;
    padding: 4px 0;
}

/* The first line of the note is centred on the 22px icon (2px + half of the 18px line = 11px),
   and longer notes continue underneath it (#1165). */
.crm-card .crm-note > span {
    white-space: pre-line;
    line-height: 18px;
    padding-top: 2px;
}

.crm-card .crm-note > img:first-child {
    margin-top: 0;
}

/* Dividers as light as the Navigator's (.arrival-delivery). */
.crm-card hr {
    border: 0;
    border-top: 1px solid #eee;
    opacity: 1;
    margin: 8px 0;
}

/* "Main job" / "Extra jobs" / "Single job": keep their colour, at the card's text size. */
.crm-card .crm-job-header {
    font-size: 13px;
    line-height: 1.2;
}

/* "Main job: <address>" / "Extra job: <address>" on one line; a long address wraps under it
   instead of taking a second row. A space between the label and the address. */
.crm-card .crm-job-header-line {
    margin: 0;
    font-size: 13px;
    line-height: 1.2;
    color: #171717;
    overflow-wrap: anywhere;
}

.crm-card .crm-job-header-line > .crm-job-header {
    margin-right: 5px;
}

/* Name row: a small status label in the top-left corner, then the name beside its icon. A long
   name wraps next to the icon (never under it) and stops before the ⋯ button in the top-right. */
.crm-card .crm-name-row {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    min-width: 0;
    width: 100%;
    padding-right: 30px;
}

.crm-card .crm-status-label {
    display: inline-block;
    padding: 2px 7px;
    border-radius: 9999px;
    font-size: 10px;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
}

.crm-card .crm-name-row > .crm-name {
    align-items: flex-start;
    flex-wrap: nowrap;
    gap: 10px;
    min-width: 0;
    max-width: 100%;
    margin: 0 0 5px;
    font-size: 16px;
}

.crm-card .crm-name [data-kanban-lead-name] {
    flex: 1 1 auto;
    min-width: 0;
    padding-top: 2px;
    overflow-wrap: anywhere;
}

/* Lead/customer actions (⋯): a rounded panel with an icon before each action. */
.crm-card .crm-actions-menu {
    position: absolute;
    top: 26px;
    right: 0;
    z-index: 30;
    width: 232px;
    padding: 6px;
    background: #fff;
    border: 1px solid #ececec;
    border-radius: 14px;
    box-shadow: 0 12px 32px rgba(17, 24, 39, 0.14), 0 2px 6px rgba(17, 24, 39, 0.06);
}

.crm-card .crm-actions-menu__item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-height: 40px;
    padding: 8px 10px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: #222;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.2;
    text-align: left;
    cursor: pointer;
}

.crm-card .crm-actions-menu__item:hover,
.crm-card .crm-actions-menu__item:focus-visible {
    background: #f4f4f5;
    outline: none;
}

.crm-card .crm-actions-menu__item > svg,
.crm-card .crm-actions-menu__item > img {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.crm-card .crm-actions-menu__item--danger {
    color: #d72849;
}

.crm-card .crm-actions-menu__item--danger:hover,
.crm-card .crm-actions-menu__item--danger:focus-visible {
    background: #fdecef;
}

.crm-card .crm-actions-menu__divider {
    height: 1px;
    margin: 4px 6px;
    background: #f0f0f0;
}

/* "… order preview" buttons: sharp SVG icon and chevron, text centred on them. */
.crm-card .crm-preview-toggle {
    background: transparent;
    border: 0;
}

.crm-card .crm-preview-toggle img {
    display: block;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.crm-card .crm-preview-toggle > div > span {
    line-height: 20px;
}

.crm-card .crm-preview-toggle > span {
    display: flex;
    align-items: center;
}

/* An order's title in the order preview cards (customer and lead cards): one line. */
.crm-card .crm-order-line__title {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.25;
    color: #171717;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* "+ Add pictures": a plain text button without a border, so it's clear it adds pictures. */
.crm-card .crm-add-pictures {
    height: 30px;
    padding: 0 4px;
    border: 0;
    background: transparent;
    color: #374151;
    font-size: 13px;
    font-weight: 500;
}

.crm-card .crm-add-pictures:hover {
    color: #111827;
    text-decoration: underline;
}

.crm-card .crm-add-pictures svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

/* "No notes available": one short line, centred beside its icon instead of sitting above it. */
.crm-card .crm-note.crm-note--empty {
    align-items: center;
}

.crm-card .crm-note.crm-note--empty > img:first-child {
    margin-top: 0;
}

.crm-card .crm-note.crm-note--empty > span {
    padding-top: 0;
}

/* Success message on the CRM board (CrmToast.razor): a small floating card at the top that
   closes by itself, instead of a full-width green bar pushing the board down (#1165). */
.alert.crm-toast {
    position: fixed;
    top: 16px;
    left: 50%;
    z-index: 1060;
    display: flex;
    align-items: center;
    gap: 10px;
    width: max-content;
    max-width: min(420px, calc(100vw - 32px));
    margin: 0;
    padding: 10px 10px 10px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    background: #fff;
    color: #171717;
    font-size: 14px;
    line-height: 1.35;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.14), 0 2px 6px rgba(0, 0, 0, 0.08);
    transform: translateX(-50%);
    animation: crm-toast-in 0.25s ease-out;
}

.crm-toast-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    flex-shrink: 0;
    border-radius: 9999px;
    background: #22c55e;
    color: #fff;
}

.crm-toast-icon svg {
    width: 16px;
    height: 16px;
}

.crm-toast-text {
    min-width: 0;
    overflow-wrap: anywhere;
}

.crm-toast-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    border: 0;
    border-radius: 9999px;
    background: transparent;
    color: #6b7280;
}

.crm-toast-close:hover {
    background: #f3f4f6;
    color: #171717;
}

.crm-toast-close svg {
    width: 16px;
    height: 16px;
}

@keyframes crm-toast-in {
    from {
        opacity: 0;
        transform: translate(-50%, -8px);
    }

    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

@media (prefers-reduced-motion: reduce) {
    .alert.crm-toast {
        animation: none;
    }
}
