.crm-page-head-employees {
    display: grid;
    grid-template-columns: max-content minmax(340px, 520px) max-content;
    align-items: center;
    column-gap: 18px;
}

.crm-page-head-mobile-actions {
    display: none;
}

.crm-page-head-employees .crm-page-head-title {
    justify-self: start;
}

.crm-page-head-employees .crm-page-head-actions {
    justify-self: end;
}

.crm-employees-head-filters {
    width: min(520px, 100%);
    justify-self: center;
    grid-template-columns: minmax(180px, 1fr) 124px 152px;
}

.crm-employees-content {
    margin-bottom: 18px;
}

.crm-employees-readonly-bar {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    margin-bottom: 12px;
    padding: 5px 10px;
    border-radius: 999px;
    background: rgba(245, 158, 11, .12);
    color: #b45309;
    font-size: 13px;
    font-weight: 850;
}

.crm-employee-readonly-note {
    display: inline-flex;
    align-items: center;
    margin-left: 6px;
    padding: 2px 7px;
    border-radius: 999px;
    background: rgba(245, 158, 11, .12);
    color: #b45309;
    font-size: 12px;
    font-weight: 850;
}



.crm-employees-meta {
    color: var(--crm-muted);
    font-size: 13px;
    margin: 0 0 12px;
}

.crm-employee-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(245px, 1fr));
    gap: 14px;
}

.crm-employee-card {
    background: var(--crm-surface-soft);
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius-lg);
    padding: 15px;
    display: grid;
    grid-template-columns: 56px 1fr;
    gap: 12px;
    cursor: pointer;
    transition: transform .18s ease, border-color .18s ease, background .18s ease;
}

.crm-employee-card:hover {
    transform: translateY(-1px);
    border-color: rgba(83, 119, 255, .34);
    background: rgba(255, 255, 255, .04);
}

.crm-employees-page.is-readonly .crm-employee-card {
    cursor: default;
}

.crm-employees-page.is-readonly .crm-employee-card:hover {
    transform: none;
}

.crm-employee-avatar {
    width: 56px;
    height: 56px;
    border-radius: 18px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, rgba(83,119,255,.30), rgba(48,213,200,.18));
    color: var(--crm-text);
    font-weight: 800;
    overflow: hidden;
}

.crm-employee-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.crm-employee-info {
    min-width: 0;
}

.crm-employee-card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 3px;
}

.crm-employee-card-top .crm-employee-status {
    flex: 0 0 auto;
    margin-top: 0;
}

.crm-employee-name {
    display: block;
    min-width: 0;
    font-size: 15px;
    font-weight: 800;
    margin-bottom: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.crm-employee-login,
.crm-employee-phone,
.crm-employee-positions {
    display: block;
    color: var(--crm-muted);
    font-size: 13px;
    margin-top: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.crm-employee-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 9px;
    padding: 5px 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.crm-employee-status.work {
    color: #42cd8c;
    background: rgba(66, 205, 140, .12);
}

.crm-employee-status.no_work {
    color: #ff7271;
    background: rgba(255, 114, 113, .12);
}

.crm-modal-root.is-open {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: grid;
    place-items: center;
    align-items: center;
    padding: 18px;
    background: rgba(3, 8, 20, .72);
    backdrop-filter: blur(10px);
}

.crm-employee-modal {
    width: min(1100px, 100%);
    max-height: min(880px, calc(100vh - 34px));
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--crm-surface);
    border: 1px solid var(--crm-border);
    border-radius: 24px;
    box-shadow: 0 30px 90px rgba(0, 0, 0, .42);
}

.crm-employee-modal .crm-modal-head {
    flex: 0 0 auto;
}

.crm-employee-modal-body {
    flex: 1 1 auto;
    overflow: auto;
    padding: 20px;
}

.crm-employee-view-header,
.crm-employee-edit-header {
    align-items: center;
}

.crm-employee-view-hero {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.crm-employee-view-title {
    min-width: 0;
}

.crm-employee-view-title h2 {
    margin: 3px 0 0;
    font-size: 22px;
    line-height: 1.12;
    letter-spacing: -.02em;
}

.crm-employee-view-subline {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 7px;
    color: var(--crm-muted);
    font-size: 13px;
}

.crm-employee-view-subline .crm-employee-status {
    margin-top: 0;
}

.crm-employee-modal-avatar {
    display: grid;
    place-items: center;
    overflow: hidden;
    flex: 0 0 auto;
    background: linear-gradient(135deg, rgba(83,119,255,.30), rgba(48,213,200,.18));
    color: var(--crm-text);
    font-weight: 900;
    border: 1px solid var(--crm-border);
}

.crm-employee-modal-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.crm-employee-modal-avatar-large {
    width: 62px;
    height: 62px;
    border-radius: 20px;
    font-size: 18px;
}

.crm-employee-modal-avatar-small {
    width: 54px;
    height: 54px;
    border-radius: 18px;
    font-size: 16px;
}

.crm-employee-side-avatar {
    width: 118px;
    height: 118px;
    border-radius: 30px;
    font-size: 30px;
    margin: 0 auto;
}

.crm-employee-view-layout {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    gap: 18px;
    align-items: start;
}

.crm-employee-side-panel {
    position: sticky;
    top: 0;
    padding: 16px;
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius-lg);
    background: var(--crm-surface-soft);
    text-align: center;
}

.crm-employee-side-panel h3 {
    margin: 12px 0 0;
    font-size: 18px;
    line-height: 1.2;
}

.crm-employee-side-status {
    display: flex;
    justify-content: center;
    margin-top: 10px;
}

.crm-employee-side-actions {
    display: grid;
    gap: 8px;
    margin-top: 14px;
}

.crm-employee-view-content {
    display: grid;
    gap: 14px;
    min-width: 0;
}

.crm-employee-view-section,
.crm-employee-form-section {
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius-lg);
    background: var(--crm-surface-soft);
    padding: 16px;
}

.crm-employee-view-section h3,
.crm-employee-form-section h3 {
    margin: 0 0 12px;
    font-size: 16px;
    line-height: 1.2;
}

.crm-employee-form-section-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 14px;
}

.crm-employee-form-section-head h3 {
    margin: 0;
}

.crm-employee-form-section-head p {
    margin: 2px 0 0;
    color: var(--crm-muted);
    font-size: 13px;
}

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

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

.crm-employee-form-grid .wide {
    grid-column: 1 / -1;
}

.crm-employee-view-item {
    min-width: 0;
    padding: 12px;
    border: 1px solid var(--crm-border);
    border-radius: 14px;
    background: #fff;
}

.crm-employee-view-item.wide {
    grid-column: 1 / -1;
}

.crm-employee-view-item span {
    display: block;
    color: var(--crm-muted);
    font-size: 12px;
    font-weight: 850;
    margin-bottom: 5px;
}

.crm-employee-view-item strong,
.crm-employee-view-block-content {
    display: block;
    color: var(--crm-text);
    font-size: 14px;
    line-height: 1.32;
    word-break: break-word;
}

.crm-employee-view-item a {
    color: var(--crm-primary);
    text-decoration: none;
}

.crm-employee-view-item a:hover {
    text-decoration: underline;
}

.crm-employee-chip {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    margin: 2px 5px 2px 0;
    padding: 5px 9px;
    border-radius: 999px;
    background: rgba(37, 99, 235, .10);
    color: var(--crm-primary);
    font-size: 12px;
    font-weight: 850;
}

.crm-muted-inline {
    color: var(--crm-muted);
    font-weight: 700;
}

.crm-employee-files-section .crm-employee-view-grid {
    grid-template-columns: 1fr;
}

.crm-employee-file-list {
    grid-column: 1 / -1;
    display: grid;
    gap: 10px;
}

.crm-employee-file-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border: 1px solid var(--crm-border);
    border-radius: 14px;
    background: #fff;
    text-decoration: none;
    transition: border-color .15s ease, transform .15s ease;
}

.crm-employee-file-link:hover {
    transform: translateY(-1px);
    border-color: rgba(37, 99, 235, .28);
}

.crm-employee-file-icon {
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    background: rgba(37, 99, 235, .10);
    color: var(--crm-primary);
    font-size: 11px;
    font-weight: 950;
}

.crm-employee-file-link strong {
    display: block;
    font-size: 13px;
    color: var(--crm-text);
}

.crm-employee-file-link small {
    display: block;
    margin-top: 2px;
    color: var(--crm-muted);
    font-size: 12px;
}

.crm-employee-file-empty {
    grid-column: 1 / -1;
}

.crm-employee-edit-sections {
    display: grid;
    gap: 14px;
}

.crm-check-field {
    gap: 8px;
}

.crm-check-list {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 10px;
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius-md);
    background: var(--crm-surface-soft);
}

.crm-check-list-payments {
    gap: 10px;
}

.crm-check-pill {
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    min-height: 42px;
    padding: 8px 12px;
    border-radius: 999px;
    border: 1px solid var(--crm-border);
    color: var(--crm-text);
    font-size: 13px;
    line-height: 1.2;
    cursor: pointer;
    user-select: none;
    background: rgba(255, 255, 255, .42);
}

.crm-check-pill input[type="checkbox"] {
    width: 16px !important;
    min-width: 16px !important;
    max-width: 16px !important;
    height: 16px !important;
    min-height: 16px !important;
    max-height: 16px !important;
    padding: 0 !important;
    margin: 0;
    flex: 0 0 16px;
    border-radius: 4px;
    box-shadow: none !important;
}

.crm-check-pill input[type="checkbox"]:focus {
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .14) !important;
}

.crm-check-label {
    color: var(--crm-text);
    font-size: 13px;
    font-weight: 700;
    line-height: 1.2;
}

.crm-file-field {
    gap: 8px;
}

.crm-current-file {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 74px;
    padding: 10px;
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius-md);
    background: var(--crm-surface-soft);
}

.crm-current-photo img {
    width: 58px;
    height: 58px;
    flex: 0 0 58px;
    object-fit: cover;
    border-radius: 16px;
    border: 1px solid var(--crm-border);
    background: #fff;
}

.crm-current-file-icon {
    width: 58px;
    height: 58px;
    flex: 0 0 58px;
    display: grid;
    place-items: center;
    border-radius: 16px;
    border: 1px solid var(--crm-border);
    background: rgba(37, 99, 235, .08);
    color: var(--crm-primary);
    font-size: 11px;
    font-weight: 900;
}

.crm-current-file-meta {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.crm-current-file-meta strong {
    color: var(--crm-text);
    font-size: 13px;
    font-weight: 850;
}

.crm-current-file-meta small {
    color: var(--crm-muted);
    font-size: 12px;
    line-height: 1.25;
}

.crm-current-file-meta a {
    color: var(--crm-primary);
    font-size: 12px;
    font-weight: 800;
    text-decoration: none;
}

.crm-current-file-meta a:hover {
    text-decoration: underline;
}

.crm-file-field input[type="file"] {
    width: 100%;
    min-height: auto;
    padding: 8px 10px;
    cursor: pointer;
}

.crm-file-hint {
    color: var(--crm-muted);
    font-size: 12px;
    line-height: 1.25;
}

.crm-employee-form-note {
    color: var(--crm-muted);
    font-size: 13px;
    margin-top: 12px;
}



.crm-employee-modal .crm-btn {
    white-space: nowrap;
}

@media (max-width: 1100px) {
    .crm-employee-view-layout {
        grid-template-columns: 220px minmax(0, 1fr);
    }

    .crm-employee-side-avatar {
        width: 96px;
        height: 96px;
        border-radius: 26px;
        font-size: 26px;
    }
}

@media (max-width: 920px) {
    .crm-employee-form-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 820px) {
    .crm-employee-view-layout {
        grid-template-columns: 1fr;
    }

    .crm-employee-side-panel {
        position: static;
        display: grid;
        grid-template-columns: 86px minmax(0, 1fr);
        gap: 12px;
        text-align: left;
        align-items: center;
    }

    .crm-employee-side-avatar {
        width: 86px;
        height: 86px;
        border-radius: 24px;
        margin: 0;
        grid-row: span 3;
    }

    .crm-employee-side-panel h3 {
        margin: 0;
    }

    .crm-employee-side-status {
        justify-content: flex-start;
        margin-top: 0;
    }

    .crm-employee-side-actions {
        display: flex;
        flex-wrap: wrap;
        margin-top: 0;
    }

    .crm-employee-form-section-head {
        display: block;
    }
}

@media (max-width: 640px) {
    .crm-modal-root.is-open {
        padding: 0;
        place-items: stretch;
    }

    .crm-employee-modal {
        width: 100%;
        height: 100dvh;
        max-height: 100dvh;
        border-radius: 0;
        border-left: 0;
        border-right: 0;
    }



    .crm-employee-modal-body {
        padding: 14px;
    }

    .crm-employee-view-hero {
        gap: 10px;
    }

    .crm-employee-modal-avatar-large,
    .crm-employee-modal-avatar-small {
        width: 48px;
        height: 48px;
        border-radius: 16px;
        font-size: 15px;
    }

    .crm-employee-view-title h2 {
        font-size: 18px;
    }

    .crm-employee-view-subline {
        font-size: 12px;
        gap: 6px;
    }

    .crm-employee-view-grid,
    .crm-employee-form-grid {
        grid-template-columns: 1fr;
    }

    .crm-employee-view-section,
    .crm-employee-form-section {
        padding: 13px;
        border-radius: 16px;
    }

    .crm-employee-side-panel {
        grid-template-columns: 72px minmax(0, 1fr);
        padding: 12px;
    }

    .crm-employee-side-avatar {
        width: 72px;
        height: 72px;
        border-radius: 20px;
        font-size: 22px;
    }



    .crm-employee-modal .crm-btn {
        width: 100%;
        min-height: 44px;
    }

    .crm-employee-card {
        grid-template-columns: 48px 1fr;
        padding: 13px;
    }

    .crm-employee-avatar {
        width: 48px;
        height: 48px;
        border-radius: 16px;
    }

    .crm-employee-card-top {
        display: block;
    }

    .crm-employee-card-top .crm-employee-status {
        margin-top: 7px;
    }
}

@media (max-width: 420px) {
    .crm-employee-side-actions {
        display: grid;
        grid-template-columns: 1fr;
    }

    .crm-employee-footer-right {
        grid-template-columns: 1fr;
    }
}

/* Fix 2026-07-03: edit form is a direct child of the modal, so it must also be flex. */
.crm-employee-view-modal,
.crm-employee-edit-modal {
    height: min(880px, calc(100vh - 34px));
}

.crm-employee-edit-modal > form,
.crm-employee-edit-modal form[data-employee-form] {
    display: flex;
    flex-direction: column;
    min-height: 0;
    height: 100%;
    max-height: inherit;
}

.crm-employee-edit-modal .crm-modal-head {
    flex: 0 0 auto;
}

.crm-employee-edit-modal .crm-employee-modal-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

.crm-employee-view-modal .crm-employee-modal-body {
    min-height: 0;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

.crm-employee-edit-modal .crm-current-photo img,
.crm-employee-view-modal .crm-employee-modal-avatar img,
.crm-employee-view-modal .crm-employee-side-avatar img {
    display: block;
}

@media (max-width: 640px) {
    .crm-employee-view-modal,
    .crm-employee-edit-modal {
        height: 100dvh;
        max-height: 100dvh;
    }

    .crm-employee-edit-modal > form,
    .crm-employee-edit-modal form[data-employee-form] {
        height: 100%;
        max-height: 100%;
    }
}




@media (max-width: 1180px) {
    .crm-page-head-employees {
        grid-template-columns: max-content minmax(300px, 1fr) max-content;
        column-gap: 14px;
    }

    .crm-employees-head-filters {
        width: 100%;
        max-width: 520px;
    }
}

@media (max-width: 900px) {
    .crm-page-head-employees {
        grid-template-columns: minmax(0, 1fr) auto;
        row-gap: 10px;
        column-gap: 12px;
        align-items: center;
    }

    .crm-page-head-employees .crm-page-head-title {
        grid-column: 1;
        grid-row: 1;
        min-width: 0;
    }

    .crm-page-head-employees .crm-page-head-title h1 {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .crm-page-head-mobile-actions {
        grid-column: 2;
        grid-row: 1;
        display: flex;
        align-items: center;
        justify-content: flex-end;
        gap: 8px;
    }

    .crm-page-head-employees .crm-page-head-actions {
        display: none;
    }

    .crm-employees-head-filters {
        grid-column: 1 / -1;
        grid-row: 2;
        width: 100%;
        max-width: none;
        justify-self: stretch;
        grid-template-columns: 1fr;
    }

    .crm-employees-head-filters .crm-page-head-select {
        display: none;
    }

    .crm-employees-head-filters .crm-page-head-input {
        min-height: 40px;
    }

    .crm-employees-filter-sheet .crm-field {
        margin-bottom: 14px;
    }

    .crm-employees-mobile-filter-fields {
        display: grid;
        gap: 14px;
    }
}