/*
 * Hand over work. Cards, markers and initials in the brand tokens;
 * works left to right and right to left; nothing is marked important.
 */

.crm-handover {
    display: grid;
    gap: 16px;
    max-width: 920px;
}

.crm-handover-intro,
.crm-handover-muted {
    color: var(--crm-text-muted, #526673);
    font-size: 13px;
    margin: 0;
}

.crm-handover-card {
    display: grid;
    gap: 14px;
    padding: 18px 20px;
    border: 1px solid var(--crm-border, #e3e8eb);
    border-radius: 12px;
    background: var(--crm-surface, #fff);
}

.crm-handover-card h3 {
    margin: 0;
    color: var(--crm-text, #101d26);
    font-size: 15px;
    font-weight: 600;
}

.crm-handover-fields {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
}

.crm-handover-field {
    display: grid;
    gap: 6px;
}

.crm-handover-field > span {
    color: var(--crm-text, #101d26);
    font-size: 13px;
    font-weight: 600;
}

.crm-handover select,
.crm-handover input[type="text"] {
    width: 100%;
    min-height: 38px;
    padding: 7px 10px;
    border: 1px solid var(--crm-border, #e3e8eb);
    border-radius: 8px;
    background: var(--crm-surface, #fff);
    color: var(--crm-text, #101d26);
    font: inherit;
    font-size: 14px;
}

.crm-handover-kinds {
    display: flex;
    gap: 6px;
}

.crm-handover-kind {
    display: inline-flex;
    flex: 1;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 0 12px;
    border: 1px solid var(--crm-border, #e3e8eb);
    border-radius: 8px;
    color: var(--crm-text-muted, #526673);
    font-size: 14px;
    cursor: pointer;
}

.crm-handover-kind input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.crm-handover-kind.is-on {
    border-color: var(--crm-primary-dark, #0b6b4f);
    color: var(--crm-primary-dark, #0b6b4f);
    font-weight: 600;
}

.crm-handover-kind:focus-within {
    outline: 2px solid var(--crm-primary-dark, #0b6b4f);
    outline-offset: 2px;
}

.crm-handover-head {
    display: flex;
    align-items: center;
    gap: 12px;
}

.crm-handover-initials {
    display: inline-flex;
    flex: none;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--crm-primary-faint, #eaf5f0);
    color: var(--crm-primary-dark, #0b6b4f);
    font-size: 14px;
    font-weight: 600;
}

.crm-handover-rows {
    display: grid;
    border-top: 1px solid var(--crm-border, #e3e8eb);
}

.crm-handover-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 48px minmax(180px, 260px);
    gap: 12px;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--crm-border, #e3e8eb);
}

.crm-handover-card > .crm-handover-row {
    grid-template-columns: minmax(0, 1fr) auto;
}

.crm-handover-row.is-empty {
    opacity: .7;
}

.crm-handover-what {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.crm-handover-what strong {
    color: var(--crm-text, #101d26);
    font-size: 14px;
    font-weight: 600;
}

.crm-handover-count {
    color: var(--crm-text, #101d26);
    font-size: 16px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    text-align: center;
}

.crm-handover-line {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    color: var(--crm-text, #101d26);
    font-size: 14px;
}

.crm-handover-marker {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-inline-end: 4px;
    background: var(--crm-neutral, #8a99a3);
}

.crm-handover-marker.is-done { background: var(--crm-success, #2e7d32); }
.crm-handover-marker.is-waiting { background: var(--crm-warning, #b26a00); }
.crm-handover-marker.is-off { background: var(--crm-danger, #c62828); }

.crm-handover-warning {
    margin: 0;
    color: var(--crm-warning, #b26a00);
    font-size: 13px;
}

.crm-handover-error {
    margin: 0;
    color: var(--crm-danger, #c62828);
    font-size: 13px;
    font-style: normal;
}

.crm-handover-actions {
    display: flex;
    justify-content: flex-end;
}

.crm-handover-button {
    min-height: 38px;
    padding: 0 16px;
    border: 1px solid var(--crm-primary-dark, #0b6b4f);
    border-radius: 8px;
    background: var(--crm-primary-dark, #0b6b4f);
    color: #fff;
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.crm-handover-button.is-danger {
    border-color: var(--crm-danger, #c62828);
    background: var(--crm-danger, #c62828);
}

.crm-handover-button.is-quiet {
    background: transparent;
    color: var(--crm-primary-dark, #0b6b4f);
}

.crm-handover-button[disabled] {
    opacity: .6;
    cursor: wait;
}

@media (max-width: 640px) {
    .crm-handover-row {
        grid-template-columns: minmax(0, 1fr) 40px;
    }

    .crm-handover-row .crm-handover-to {
        grid-column: 1 / -1;
    }
}

/* Leave page: one line per leave record */
.crm-handover-leave {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 8px;
    padding: 8px 10px;
    border: 1px solid var(--crm-border, #e3e8eb);
    border-radius: 8px;
}

a.crm-handover-button {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
}
