.crm-employee-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 16px;
    align-items: start;
    width: 100%;
}

.crm-employee-left,
.crm-employee-right {
    min-width: 0;
    width: 100%;
}
.crm-contract-panel {
    border: 1px solid rgba(120, 120, 120, 0.35);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.02);
    padding: 8px 12px;
}
.crm-contract-panel > summary {
    cursor: pointer;
    font-weight: 600;
    margin: 4px 0;
}
.crm-contract-body {
    padding: 8px 0 4px;
}
.crm-contract-preview-row {
    margin: 6px 0;
}
.crm-upload-preview {
    display: grid;
    gap: 6px;
    margin-top: 8px;
}
.crm-upload-preview-item {
    padding: 6px 10px;
    border: 1px dashed rgba(120, 120, 120, 0.45);
    border-radius: 8px;
    font-size: 12px;
}
.crm-address-suggest-list {
    display: grid;
    gap: 4px;
    margin-top: 6px;
}
.crm-address-suggest-item {
    border: 1px solid rgba(120, 120, 120, 0.35);
    background: rgba(255, 255, 255, 0.02);
    color: inherit;
    border-radius: 8px;
    text-align: left;
    padding: 6px 10px;
    cursor: pointer;
}
@media (max-width: 1200px) {
    .crm-employee-layout {
        grid-template-columns: 1fr;
    }
}
/**
 * FITCRM ? ???-??????. ??: ?????? ????, ???????????? ?????????, ????????????.
 * ??? ????? ?????? ? CSS-??????.
 */

:root {
    --crm-bg: #1a1d21;
    --crm-surface: #24282e;
    --crm-border: #3a3f47;
    --crm-text: #e6e8eb;
    --crm-text-muted: #9ca3ad;
    --crm-accent: #4a9eff;
    --crm-accent-hover: #6bb0ff;
    --crm-success: #34c759;
    --crm-error: #ff453a;
    --crm-radius: 6px;
    --crm-font: system-ui, -apple-system, sans-serif;
    /* для табеля и таблиц */
    --bg-surface: var(--crm-surface);
    --border-color: var(--crm-border);
    --text-main: var(--crm-text);
    --text-muted: var(--crm-text-muted);
}

.crm-skip-link {
    position: absolute;
    top: -100px;
    left: 12px;
    padding: 10px 14px;
    background: var(--crm-accent);
    color: #fff;
    text-decoration: none;
    font-size: 14px;
    border-radius: var(--crm-radius);
    z-index: 1000;
    transition: top 0.2s;
}

.crm-skip-link:focus {
    top: 12px;
    outline: 2px solid #fff;
    outline-offset: 2px;
}

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

/* ??????? ????????? ?????? ??? ????????? ? ?????????? */
.crm-btn:focus-visible,
.crm-nav-link:focus-visible,
.crm-action-link:focus-visible,
.crm-filter-link:focus-visible,
.crm-breadcrumb-link:focus-visible,
.crm-footer-link:focus-visible,
.crm-search-link:focus-visible,
.crm-widget-salary-debt-link:focus-visible,
.crm-director-stat-card:focus-visible,
.crm-logo:focus-visible,
.crm-org-section-summary:focus-visible {
    outline: 2px solid var(--crm-accent);
    outline-offset: 2px;
}

.crm-input:focus-visible,
.crm-select:focus-visible,
.crm-search-input:focus-visible {
    outline: none;
    border-color: var(--crm-accent);
    box-shadow: 0 0 0 2px rgba(74, 158, 255, 0.3);
}

.crm-body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--crm-bg);
    color: var(--crm-text);
    font-family: var(--crm-font);
    font-size: 14px;
    line-height: 1.5;
}

.crm-wrapper {
    flex: 1 0 auto;
}

.crm-footer {
    flex-shrink: 0;
    border-top: 1px solid var(--crm-border);
    background: var(--crm-surface);
    margin-top: 32px;
}

.crm-footer-inner {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    box-sizing: border-box;
    font-size: 12px;
    color: var(--crm-text-muted);
}

.crm-footer-brand {
    font-weight: 600;
    color: var(--crm-text);
}

.crm-footer-link {
    color: var(--crm-accent);
    text-decoration: none;
}

.crm-footer-link:hover {
    text-decoration: underline;
}

/* ???????? ????? */
.crm-login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 24px;
}

.crm-login-card {
    width: 100%;
    max-width: 360px;
    background: var(--crm-surface);
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius);
    padding: 32px;
}

.crm-login-title {
    margin: 0 0 8px;
    font-size: 22px;
    font-weight: 600;
}

.crm-login-subtitle {
    margin: 0 0 24px;
    color: var(--crm-text-muted);
    font-size: 13px;
}

.crm-login-hint {
    margin: -12px 0 18px;
    font-size: 12px;
    line-height: 1.45;
}

.crm-messages {
    list-style: none;
    margin: 0 0 16px;
    padding: 0;
}

.crm-message {
    padding: 8px 12px;
    border-radius: var(--crm-radius);
    font-size: 13px;
}

.crm-message-error {
    background: rgba(255, 69, 58, 0.15);
    color: var(--crm-error);
}

.crm-message-success {
    background: rgba(52, 199, 89, 0.15);
    color: var(--crm-success);
}

.crm-login-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.crm-label {
    display: block;
    margin-bottom: 4px;
    font-size: 12px;
    color: var(--crm-text-muted);
}

.crm-input {
    width: 100%;
    box-sizing: border-box;
    padding: 10px 12px;
    background: var(--crm-bg);
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius);
    color: var(--crm-text);
    font-size: 14px;
}

.crm-input:focus {
    outline: none;
    border-color: var(--crm-accent);
}

.crm-input-qty {
    max-width: 120px;
}

.crm-select {
    min-width: 200px;
    box-sizing: border-box;
    padding: 10px 12px;
    background: var(--crm-bg);
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius);
    color: var(--crm-text);
    font-size: 14px;
}

.crm-select:focus {
    outline: none;
    border-color: var(--crm-accent);
}

/* ????? ?????? ???????? ?? ???? ????????? */
.crm-filters-row {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 12px 20px;
    margin-bottom: 24px;
}

.crm-filter-field {
    display: flex;
    align-items: center;
    gap: 8px;
}

.crm-filter-field .crm-label {
    margin-bottom: 0;
    white-space: nowrap;
}

.crm-remainder-select-form {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 12px 20px;
    margin-bottom: 24px;
}

.crm-remainder-select-form .crm-filter-field .crm-label {
    margin-bottom: 0;
}

.crm-remainder-select-form .crm-select {
    min-width: 180px;
}

.crm-remainder-form .crm-table {
    margin-bottom: 16px;
}

/* ????????? ????? ???????? ? ???????? */
.crm-remainder-form-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}
.crm-remainder-form-header .crm-lead {
    margin: 0;
}
.crm-remainder-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* ??????? ???????? ? ??????? */
.crm-remainder-table .crm-col-days {
    min-width: 80px;
    width: 90px;
    text-align: right;
}

.crm-remainder-table .crm-col-qty {
    min-width: 140px;
    width: 160px;
}
.crm-remainder-table .crm-cell-num {
    text-align: right;
    font-variant-numeric: tabular-nums;
    color: var(--text-muted);
    white-space: nowrap;
}
.crm-remainder-table .crm-cell-critical {
    color: var(--color-danger, #ef4444);
    font-weight: 600;
    white-space: nowrap;
}
.crm-remainder-table .crm-cell-mono {
    font-family: var(--font-mono, monospace);
    font-size: 0.82rem;
    color: var(--text-muted);
}

/* ?????? ? ??? ?????????? ????????? */
.crm-rem-row-filled td:last-child input {
    background: rgba(34, 197, 94, 0.08);
    border-color: rgba(34, 197, 94, 0.4);
}

/* ?????? ??????? */
.crm-icon-warn {
    color: var(--color-danger, #ef4444);
    margin-left: 4px;
    font-size: 0.8rem;
}
.crm-icon-info {
    color: var(--color-primary, #6366f1);
    margin-right: 4px;
}

.crm-delivery-receive-form .crm-table {
    margin-bottom: 16px;
}

.crm-input-comment {
    min-width: 200px;
}

.crm-order-edit-form .crm-table {
    margin-bottom: 16px;
}

.crm-order-edit-add {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 12px 20px;
    margin-bottom: 20px;
}

.crm-order-edit-add .crm-label {
    margin-bottom: 4px;
}

.crm-checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    cursor: pointer;
}

.crm-checkbox {
    width: auto;
}

/* ????? ?????? ???? */
.crm-form {
    max-width: 760px;
}

.crm-form-group {
    margin-bottom: 16px;
}

.crm-form-group .crm-label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--crm-text);
}

.crm-form-group-inline {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.crm-label-inline {
    margin-bottom: 0;
    font-size: 14px;
    cursor: pointer;
}

.crm-form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 20px;
}

.crm-form-row .crm-form-group {
    flex: 1 1 180px;
    min-width: 0;
}

.crm-form-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
    flex-wrap: wrap;
}

.crm-dadata-fill-hint {
    margin: 8px 0 0;
    font-size: 13px;
    color: var(--crm-text-muted);
}

.crm-required {
    color: var(--crm-error);
    margin-left: 2px;
}

/* Fieldset ??? ??????????? ????? ????? */
.crm-fieldset {
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius);
    padding: 16px 20px 8px;
    margin-bottom: 20px;
}

.crm-fieldset-legend {
    padding: 0 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--crm-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* ?????????????? dl */
.crm-dl-two-col {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 4px 16px;
    align-items: baseline;
}

.crm-dl-two-col dt {
    font-size: 13px;
    color: var(--crm-text-muted);
    padding: 6px 0;
}

.crm-dl-two-col dd {
    margin: 0;
    padding: 6px 0;
    font-size: 14px;
    border-bottom: 1px solid var(--crm-border);
}

.crm-dl-two-col dt {
    border-bottom: 1px solid var(--crm-border);
}

/* Badges / ????????? ????? */
.crm-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.6;
}

.crm-badge-ok {
    background: rgba(52, 199, 89, 0.15);
    color: var(--crm-success);
}

.crm-badge-warn {
    background: rgba(255, 159, 10, 0.15);
    color: var(--crm-warning, #ff9f0a);
}

.crm-badge-neutral {
    background: rgba(255, 255, 255, 0.08);
    color: var(--crm-text-muted);
}

.crm-badge-muted {
    background: rgba(255, 255, 255, 0.05);
    color: var(--crm-text-muted);
    font-style: italic;
}

.crm-badge-tiny {
    font-size: 0.62rem;
    padding: 1px 6px;
    font-style: normal;
    font-weight: 600;
    vertical-align: middle;
    line-height: 1.4;
}

.crm-cell-date {
    white-space: nowrap;
    color: var(--crm-text-muted);
    font-size: 0.82rem;
}

.crm-cell-muted {
    color: var(--crm-text-muted);
    font-variant-numeric: tabular-nums;
}

/* ??????????????? ????????? */
.crm-message-warn {
    background: rgba(255, 159, 10, 0.15);
    color: var(--crm-warning, #ff9f0a);
}

.crm-message-info {
    background: rgba(74, 158, 255, 0.12);
    color: var(--crm-text, #e8eaed);
    border: 1px solid rgba(74, 158, 255, 0.28);
}

.crm-autosave-status {
    margin-left: 12px;
    font-size: 13px;
    color: var(--crm-text-muted);
}

.crm-autosave-status-error {
    color: var(--crm-danger, #e55353);
}

.crm-btn {
    padding: 10px 16px;
    border: none;
    border-radius: var(--crm-radius);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
}

.crm-btn-primary {
    background: var(--crm-accent);
    color: #fff;
}

.crm-btn-primary:hover {
    background: var(--crm-accent-hover);
}

.crm-btn-ghost {
    background: transparent;
    color: var(--crm-text-muted);
}

.crm-btn-ghost:hover {
    color: var(--crm-text);
}

.crm-btn-accent {
    background: #2ecc71;
    color: #fff;
}

.crm-btn-accent:hover {
    background: #27ae60;
}

/* ????? layout: ??????? ???? ????? (?? ????????? ???????), ??????? ?????? */
.crm-app-layout {
    display: flex;
    min-height: 100vh;
    flex-direction: row;
}

.crm-sidebar {
    width: 240px;
    flex-shrink: 0;
    background: var(--crm-surface);
    border-right: 1px solid var(--crm-border);
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 90;
    overflow-y: auto;
    transition: transform 0.2s ease, width 0.2s ease;
}

.crm-sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 85;
    background: rgba(0, 0, 0, 0.45);
    border: none;
    padding: 0;
    margin: 0;
    cursor: pointer;
}

.crm-sidebar-backdrop[hidden] {
    display: none !important;
}

body.crm-sidebar-closed .crm-sidebar {
    width: 56px;
    overflow: hidden;
}

.crm-app-content {
    flex: 1 1 auto;
    min-width: 0;
    margin-left: 240px;
    display: flex;
    flex-direction: column;
    transition: margin-left 0.2s ease;
}

body.crm-sidebar-closed .crm-app-content {
    margin-left: 56px;
}

.crm-app-content-full {
    margin-left: 0 !important;
}

.crm-sidebar-nav {
    padding: 72px 0 20px;
}

.crm-sidebar-group {
    margin-bottom: 12px;
}

.crm-sidebar-group:first-child {
    margin-top: 0;
}

.crm-sidebar-group-title {
    display: block;
    padding: 4px 16px 3px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    line-height: 1.25;
    color: var(--crm-text-muted);
}

.crm-sidebar-group-summary {
    list-style: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.crm-sidebar-group-summary::-webkit-details-marker {
    display: none;
}

.crm-sidebar-group-summary::marker {
    display: none;
}

.crm-sidebar-group-chevron {
    font-size: 0.8rem;
    opacity: 0.75;
    transition: transform 0.16s ease;
}

.crm-sidebar-group-collapsible[open] .crm-sidebar-group-chevron {
    transform: rotate(180deg);
}

.crm-sidebar-group-collapsible .crm-sidebar-group-body {
    padding-bottom: 2px;
}

.crm-sidebar-link {
    display: flex;
    align-items: center;
    padding: 6px 16px;
    color: var(--crm-text-muted);
    text-decoration: none;
    font-size: 14px;
    line-height: 1.35;
    transition: color 0.15s, background 0.15s;
}

.crm-sidebar-link:hover {
    color: var(--crm-text);
    background: rgba(255, 255, 255, 0.05);
}

.crm-sidebar-link-active {
    color: var(--crm-accent);
    background: rgba(74, 158, 255, 0.12);
    font-weight: 500;
}

a.crm-sidebar-link-nested {
    padding-left: 28px;
    font-size: 13px;
}

.crm-sidebar-icon {
    margin-right: 8px;
    font-size: 1.05rem;
    opacity: 0.9;
    flex-shrink: 0;
}

/* Mini-sidebar: ?????? ?????? ????? */
body.crm-sidebar-closed .crm-sidebar-group-title {
    display: none;
}

body.crm-sidebar-closed .crm-sidebar-group-summary {
    display: none;
}

body.crm-sidebar-closed .crm-sidebar-link-label {
    display: none;
}

body.crm-sidebar-closed .crm-sidebar-link {
    padding: 8px 0;
    justify-content: center;
}

body.crm-sidebar-closed .crm-sidebar-icon {
    margin-right: 0;
    font-size: 1.15rem;
}

body.crm-sidebar-closed .crm-sidebar-group {
    margin-bottom: 6px;
}

.crm-sidebar-apps-group {
    padding-top: 10px;
    border-top: 1px solid var(--crm-border);
}

.crm-sidebar-app-link .crm-sidebar-icon {
    font-size: 1.1rem;
}

.crm-sidebar-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: none;
    background: transparent;
    color: var(--crm-text);
    border-radius: var(--crm-radius);
    cursor: pointer;
}

.crm-sidebar-toggle:hover {
    background: rgba(255, 255, 255, 0.08);
}

.crm-sidebar-toggle-icon-closed {
    display: none;
}

body.crm-sidebar-closed .crm-sidebar-toggle-icon-open {
    display: none;
}

body.crm-sidebar-closed .crm-sidebar-toggle-icon-closed {
    display: inline-block;
}

/* ????? ? ????????? */
.crm-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--crm-surface);
    border-bottom: 1px solid var(--crm-border);
}

.crm-header-inner {
    display: flex;
    align-items: center;
    gap: 16px;
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 12px 24px;
    box-sizing: border-box;
}

.crm-logo {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 18px;
    color: var(--crm-text);
    text-decoration: none;
}

.crm-logo-icon {
    font-size: 1.25em;
    color: var(--crm-accent);
}

.crm-search-form {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    min-width: 0;
    max-width: 320px;
}

.crm-search-label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.crm-search-input {
    flex: 1;
    min-width: 0;
    padding: 8px 12px;
    background: var(--crm-bg);
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius);
    color: var(--crm-text);
    font-size: 14px;
}

.crm-search-input:focus {
    outline: none;
    border-color: var(--crm-accent);
}

.crm-search-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: none;
    background: var(--crm-accent);
    color: #fff;
    border-radius: var(--crm-radius);
    cursor: pointer;
}

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

.crm-nav-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    margin: 0;
    border: none;
    background: transparent;
    color: var(--crm-text);
    font-size: 1.35rem;
    cursor: pointer;
    border-radius: var(--crm-radius);
}

.crm-nav-toggle:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--crm-text);
}

.crm-nav-toggle-icon-close {
    display: none;
}

.crm-nav-toggle-icon-open {
    display: inline-block;
}

body.crm-nav-open .crm-nav-toggle-icon-open {
    display: none;
}

body.crm-nav-open .crm-nav-toggle-icon-close {
    display: inline-block;
}

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

.crm-nav-icon {
    margin-right: 6px;
    font-size: 1.05em;
    opacity: 0.9;
    vertical-align: -0.15em;
}

.crm-nav-link {
    display: inline-flex;
    align-items: center;
    padding: 8px 12px;
    color: var(--crm-text-muted);
    text-decoration: none;
    border-radius: var(--crm-radius);
    font-size: 13px;
}

.crm-nav-link:hover {
    color: var(--crm-text);
    background: rgba(255, 255, 255, 0.05);
}

/* ===== Дропдаун в верхней навигации (Настройки и др.) ===== */
.crm-nav-dropdown-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.crm-nav-dropdown-trigger {
    display: inline-flex;
    align-items: center;
    padding: 8px 12px;
    color: var(--crm-text-muted);
    background: none;
    border: none;
    border-radius: var(--crm-radius);
    font-size: 13px;
    cursor: pointer;
    gap: 6px;
    font-family: inherit;
    line-height: inherit;
}

.crm-nav-dropdown-trigger:hover,
.crm-nav-dropdown-trigger[aria-expanded="true"] {
    color: var(--crm-text);
    background: rgba(255, 255, 255, 0.05);
}

.crm-nav-dropdown-trigger-icon {
    margin-right: 6px;
    font-size: 1.05em;
    opacity: 0.9;
    vertical-align: -0.15em;
}

.crm-nav-dropdown-chevron {
    font-size: 0.75em;
    opacity: 0.7;
    transition: transform 0.18s;
}

.crm-nav-dropdown-trigger[aria-expanded="true"] .crm-nav-dropdown-chevron {
    transform: rotate(180deg);
}

.crm-nav-dropdown-menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    min-width: 200px;
    background: var(--crm-surface);
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    z-index: 300;
    padding: 4px 0;
}

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

.crm-nav-dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 16px;
    color: var(--crm-text-muted);
    text-decoration: none;
    font-size: 13px;
    white-space: nowrap;
    transition: background 0.12s, color 0.12s;
}

.crm-nav-dropdown-item:hover {
    color: var(--crm-text);
    background: rgba(255, 255, 255, 0.06);
}

.crm-nav-dropdown-item.crm-nav-link-active {
    color: var(--crm-text);
    background: rgba(255, 255, 255, 0.08);
}

.crm-nav-dropdown-item-icon {
    font-size: 1em;
    opacity: 0.85;
    flex-shrink: 0;
}

.crm-nav-dropdown-divider {
    height: 1px;
    background: var(--crm-border);
    margin: 4px 0;
}

.crm-header-user {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 12px;
}

.crm-header-user-icon {
    margin-right: 4px;
    font-size: 0.9em;
    opacity: 0.85;
    vertical-align: -0.05em;
}

.crm-btn-icon {
    margin-right: 6px;
    font-size: 1em;
    vertical-align: -0.1em;
}

.crm-user-phone {
    font-weight: 500;
}

.crm-user-name {
    font-weight: 500;
}

.crm-user-role {
    font-size: 12px;
    color: var(--crm-text-muted);
}

.crm-role-switch-wrap {
    position: relative;
}

.crm-role-switch-trigger {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: min(14rem, 42vw);
    padding: 6px 10px;
    margin: 0;
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius);
    background: rgba(255, 255, 255, 0.04);
    color: var(--crm-text-muted);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    line-height: 1.25;
}

.crm-role-switch-trigger:hover,
.crm-role-switch-trigger[aria-expanded="true"] {
    border-color: var(--crm-accent, #4a9eff);
    color: var(--crm-text);
}

.crm-role-switch-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.crm-role-switch-chevron {
    flex-shrink: 0;
    font-size: 0.7rem;
    opacity: 0.85;
}

.crm-role-switch-trigger[aria-expanded="true"] .crm-role-switch-chevron {
    transform: rotate(180deg);
}

.crm-role-switch-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    min-width: 15rem;
    max-width: min(18rem, 92vw);
    max-height: min(70vh, 22rem);
    overflow-y: auto;
    margin: 0;
    padding: 6px 0;
    list-style: none;
    background: var(--crm-surface);
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
    z-index: 120;
}

.crm-role-switch-menu[hidden] {
    display: none !important;
}

.crm-role-switch-li {
    margin: 0;
    padding: 0;
}

.crm-role-switch-form {
    margin: 0;
}

.crm-role-switch-item {
    display: block;
    width: 100%;
    padding: 8px 14px;
    border: none;
    background: transparent;
    color: var(--crm-text);
    font-size: 13px;
    text-align: left;
    cursor: pointer;
    font-family: inherit;
}

.crm-role-switch-item:hover {
    background: rgba(74, 158, 255, 0.1);
}

.crm-role-switch-item-active {
    color: var(--crm-accent, #4a9eff);
    font-weight: 600;
    background: rgba(74, 158, 255, 0.08);
}

.crm-act-as-switch-wrap {
    position: relative;
}

.crm-act-as-switch-trigger {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: min(16rem, 44vw);
    padding: 6px 10px;
    margin: 0;
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius);
    background: rgba(255, 255, 255, 0.04);
    color: var(--crm-text-muted);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    line-height: 1.25;
}

.crm-act-as-switch-trigger:hover,
.crm-act-as-switch-trigger[aria-expanded="true"] {
    border-color: var(--crm-accent-warn, #e8b84a);
    color: var(--crm-text);
}

.crm-act-as-switch-icon {
    flex-shrink: 0;
    font-size: 0.95rem;
}

.crm-act-as-switch-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.crm-act-as-switch-chevron {
    flex-shrink: 0;
    font-size: 0.7rem;
    opacity: 0.85;
}

.crm-act-as-switch-trigger[aria-expanded="true"] .crm-act-as-switch-chevron {
    transform: rotate(180deg);
}

.crm-act-as-switch-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    min-width: 18rem;
    max-width: min(22rem, 94vw);
    max-height: min(70vh, 24rem);
    overflow-y: auto;
    margin: 0;
    padding: 6px 0;
    list-style: none;
    background: var(--crm-surface);
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
    z-index: 121;
}

.crm-act-as-switch-menu[hidden] {
    display: none !important;
}

.crm-act-as-switch-li {
    margin: 0;
    padding: 0;
}

.crm-act-as-switch-form {
    margin: 0;
}

.crm-act-as-switch-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    width: 100%;
    padding: 8px 14px;
    border: none;
    background: transparent;
    color: var(--crm-text);
    font-size: 13px;
    text-align: left;
    cursor: pointer;
    font-family: inherit;
}

.crm-act-as-switch-item:hover {
    background: rgba(232, 184, 74, 0.12);
}

.crm-act-as-switch-item-name {
    font-weight: 600;
}

.crm-act-as-switch-item-roles {
    font-size: 12px;
    color: var(--crm-text-muted);
}

.crm-act-as-switch-item-phone {
    font-size: 11px;
    color: var(--crm-text-muted);
    font-variant-numeric: tabular-nums;
}

.crm-impersonation-banner {
    flex-shrink: 0;
    background: rgba(232, 184, 74, 0.14);
    border-bottom: 1px solid rgba(232, 184, 74, 0.35);
}

.crm-impersonation-banner-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px 16px;
    max-width: var(--crm-content-max, 1400px);
    margin: 0 auto;
    padding: 10px 20px;
}

.crm-impersonation-banner-text {
    font-size: 13px;
    line-height: 1.45;
    color: var(--crm-text);
}

.crm-impersonation-banner-icon {
    margin-right: 6px;
    color: var(--crm-accent-warn, #e8b84a);
}

.crm-impersonation-banner-hint {
    display: block;
    margin-top: 2px;
    font-size: 12px;
    color: var(--crm-text-muted);
    font-weight: 400;
}

.crm-impersonation-banner-form {
    margin: 0;
    flex-shrink: 0;
}

.crm-director-act-as {
    margin-bottom: 1.25rem;
    padding: 1rem 1.15rem;
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius);
    background: rgba(74, 158, 255, 0.06);
}

.crm-director-act-as-fields {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 12px 16px;
    margin-top: 10px;
}

.crm-director-act-as-fields .crm-label {
    width: 100%;
    margin-bottom: -4px;
}

.crm-director-act-as-fields .crm-select {
    flex: 1 1 16rem;
    min-width: 12rem;
    max-width: 28rem;
}

.crm-logout-form {
    margin: 0;
}

/* ====== ??????????? ? ????? ====== */
.crm-notif-wrap {
    position: relative;
}
.crm-notif-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px 8px;
    border-radius: 6px;
    color: var(--crm-text-secondary, var(--text-secondary));
    transition: background 0.15s, color 0.15s;
    position: relative;
}
.crm-notif-btn:hover {
    background: var(--crm-surface-hover, rgba(255,255,255,0.07));
    color: var(--crm-text, var(--text-primary));
}
.crm-notif-icon {
    font-size: 1.1rem;
}
.crm-notif-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background: var(--color-danger, #ef4444);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 3px;
    line-height: 1;
}
.crm-notif-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 340px;
    max-width: 95vw;
    background: var(--crm-surface, #1e2130);
    border: 1px solid var(--crm-border, rgba(255,255,255,0.1));
    border-radius: 10px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
    z-index: 2000;
    overflow: hidden;
}
.crm-notif-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px 8px;
    font-weight: 600;
    font-size: 0.85rem;
    border-bottom: 1px solid var(--crm-border, rgba(255,255,255,0.08));
    color: var(--crm-text, var(--text-primary));
}
.crm-notif-mark-all-form {
    margin: 0;
}
.crm-notif-mark-all {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.75rem;
    color: var(--color-primary, #6366f1);
    padding: 2px 0;
    text-decoration: underline;
}
.crm-notif-list {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 360px;
    overflow-y: auto;
}
.crm-notif-item {
    padding: 10px 16px;
    border-bottom: 1px solid var(--crm-border, rgba(255,255,255,0.05));
    font-size: 0.82rem;
}
.crm-notif-item:last-child {
    border-bottom: none;
}
.crm-notif-type-delivery_receive .crm-notif-item-title {
    color: var(--crm-warning, #ff9f0a);
}
.crm-notif-type-timesheet_closed .crm-notif-item-title {
    color: var(--color-danger, #ef4444);
}
.crm-notif-type-remainder_reminder .crm-notif-item-title {
    color: var(--color-primary, #6366f1);
}
.crm-notif-item-title {
    font-weight: 600;
    margin-bottom: 3px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.crm-notif-item-body {
    color: var(--crm-text-muted);
    margin-bottom: 6px;
    line-height: 1.4;
}
.crm-notif-item-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.crm-notif-date {
    color: var(--crm-text-muted);
    font-size: 0.75rem;
}
.crm-notif-read-form {
    margin: 0;
}
.crm-notif-read-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.75rem;
    color: var(--crm-success, #34c759);
    padding: 2px 0;
}

/* AI ?????????: ?????? ? ?????????? ??? ? ????? */
.crm-ai-dropdown-wrap {
    position: relative;
}

.crm-ai-trigger {
    display: inline-flex;
    align-items: center;
}

.crm-ai-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    width: 520px;
    max-width: calc(100vw - 24px);
    min-width: 300px;
    min-height: 320px;
    background: var(--crm-surface);
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    z-index: 200;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.crm-ai-dropdown[hidden] {
    display: none;
}

/* ????? ???? ? ???????? ??????? */
.crm-ai-dropdown-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-bottom: 1px solid var(--crm-border);
    flex-shrink: 0;
    background: var(--crm-bg);
}
.crm-ai-dropdown-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--crm-text);
    display: flex;
    align-items: center;
    gap: 6px;
}
.crm-ai-size-btns {
    display: flex;
    gap: 2px;
}
.crm-ai-size-btn {
    background: none;
    border: none;
    padding: 3px 5px;
    cursor: pointer;
    color: var(--crm-text-muted);
    font-size: 1rem;
    border-radius: 4px;
    line-height: 1;
    transition: color 0.15s, background 0.15s;
}
.crm-ai-size-btn:hover {
    color: var(--crm-accent);
    background: rgba(74, 158, 255, 0.12);
}
.crm-ai-size-btn.crm-ai-size-active {
    color: var(--crm-accent);
}

.crm-ai-chat-messages {
    overflow-y: auto;
    padding: 12px;
    flex: 1 1 auto;
    min-height: 160px;
    height: 340px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Drag-handle ??? ????????? ??????? (?????? ????? ????) */
.crm-ai-resize-handle {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 28px;
    height: 22px;
    cursor: sw-resize;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--crm-border);
    font-size: 1rem;
    border-radius: 0 0 0 var(--crm-radius);
    transition: color 0.15s;
    user-select: none;
}
.crm-ai-resize-handle:hover {
    color: var(--crm-accent);
}

.crm-ai-msg {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.crm-ai-msg-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
}

.crm-ai-msg-time {
    font-size: 10px;
    font-weight: 500;
    color: var(--crm-text-muted);
    white-space: nowrap;
}

.crm-ai-msg-role {
    font-size: 11px;
    font-weight: 600;
    color: var(--crm-text-muted);
    text-transform: uppercase;
}

.crm-ai-msg-user .crm-ai-msg-role {
    color: var(--crm-accent);
}

.crm-ai-msg-content {
    font-size: 13px;
    line-height: 1.45;
    color: var(--crm-text);
    white-space: pre-wrap;
    word-break: break-word;
}

.crm-ai-chat-form {
    display: flex;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid var(--crm-border);
    flex-shrink: 0;
}

.crm-ai-chat-input {
    flex: 1;
    min-width: 0;
    padding: 8px 12px;
    background: var(--crm-bg);
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius);
    color: var(--crm-text);
    font-size: 14px;
}

.crm-ai-chat-input:focus {
    outline: none;
    border-color: var(--crm-accent);
}

.crm-ai-chat-input::placeholder {
    color: var(--crm-text-muted);
}

.crm-ai-chat-send {
    flex-shrink: 0;
}

.crm-ai-dropdown-actions {
    border-top: 1px solid var(--crm-border);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
}

.crm-ai-dropdown-full-link {
    font-size: 12px;
    color: var(--crm-accent);
    text-decoration: none;
}

.crm-ai-dropdown-full-link:hover {
    color: var(--crm-text);
}

.crm-ai-clear-inline-form {
    margin: 0;
}

.crm-ai-dropdown-clear-btn {
    background: none;
    border: none;
    padding: 0;
    font-size: 12px;
    color: var(--crm-text-muted);
    cursor: pointer;
}

.crm-ai-dropdown-clear-btn:hover {
    color: var(--crm-text);
}

.crm-ai-page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.crm-ai-page-header .crm-page-title {
    margin: 0;
}

.crm-ai-clear-form {
    margin: 0;
}

.crm-ai-history-hint {
    margin-top: 4px;
    margin-bottom: 16px;
    max-width: 52rem;
}

.crm-ai-history-title {
    margin: 0;
    padding: 12px 16px 8px;
    border-bottom: 1px solid var(--crm-border);
}

.crm-ai-history-empty {
    margin: 0;
    padding: 28px 16px;
    text-align: center;
    color: var(--crm-text-muted);
    font-size: 0.95rem;
    line-height: 1.55;
}

/* Страница AI: колонка со списком диалогов + чат */
.crm-ai-layout {
    display: flex;
    gap: 0;
    align-items: stretch;
    margin-top: 16px;
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius);
    overflow: hidden;
    background: var(--crm-card-bg);
    max-width: 56rem;
}

.crm-ai-sessions {
    width: 260px;
    flex-shrink: 0;
    border-right: 1px solid var(--crm-border);
    background: rgba(0, 0, 0, 0.06);
    display: flex;
    flex-direction: column;
    min-height: 280px;
    max-height: 70vh;
}

.crm-ai-sessions-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--crm-border);
}

.crm-ai-sessions-title {
    font-weight: 600;
    font-size: 0.875rem;
}

.crm-ai-sessions-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.crm-ai-session-link {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 9px 11px;
    border-radius: var(--crm-radius);
    text-decoration: none;
    color: inherit;
    border: 1px solid transparent;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.crm-ai-session-link:hover {
    background: rgba(255, 255, 255, 0.06);
}

.crm-ai-session-link-active {
    background: rgba(30, 111, 223, 0.12);
    border-color: var(--crm-border);
}

.crm-ai-session-title {
    font-size: 0.8125rem;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.crm-ai-session-time {
    font-size: 0.7rem;
    color: var(--crm-text-muted);
}

.crm-ai-sessions-empty {
    margin: 10px 12px;
    font-size: 0.85rem;
    color: var(--crm-text-muted);
}

.crm-ai-workspace {
    flex: 1;
    min-width: 0;
}

.crm-ai-workspace .crm-ai-chat-section {
    border: none;
    border-radius: 0;
    background: transparent;
}

@media (max-width: 900px) {
    .crm-ai-layout {
        flex-direction: column;
        max-height: none;
    }

    .crm-ai-sessions {
        width: 100%;
        max-height: 38vh;
        border-right: none;
        border-bottom: 1px solid var(--crm-border);
    }
}

/* Страница AI Чат: секция переписки */
.crm-ai-page .crm-ai-chat-section {
    display: flex;
    flex-direction: column;
    gap: 0;
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius);
    overflow: hidden;
    background: var(--crm-card-bg);
}

.crm-ai-page .crm-ai-chat-messages {
    min-height: 200px;
    max-height: 55vh;
    padding: 16px;
}

.crm-ai-page .crm-ai-chat-form {
    padding: 16px;
}

.crm-ai-page .crm-ai-chat-input {
    padding: 10px 14px;
    font-size: 15px;
}

/* ===== Настройки: Синхронизация 1С ===== */
.crm-settings-section {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-top: 16px;
}

/* Карточки на странице настроек — блочный layout, полная ширина */
.crm-sync-card,
.crm-sync-log-card {
    display: block !important;
    padding: 28px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.crm-sync-log-card {
    padding: 24px;
}

/* Форма внутри карточки настроек — не ограничиваем ширину */
.crm-sync-form.crm-form {
    max-width: 100%;
}

.crm-sync-header {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 28px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--crm-border);
}

.crm-sync-icon {
    font-size: 2rem;
    color: var(--crm-accent);
    flex-shrink: 0;
    margin-top: 2px;
}

.crm-sync-title {
    font-size: 17px;
    font-weight: 600;
    color: var(--crm-text);
    margin-bottom: 4px;
}

.crm-sync-desc {
    font-size: 13px;
    color: var(--crm-text-muted);
    line-height: 1.5;
}

.crm-sync-objects {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.crm-sync-object-row {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 12px 14px;
    border-radius: var(--crm-radius);
    transition: background 0.12s;
}

.crm-sync-object-row-disabled {
    opacity: 0.6;
}

.crm-sync-object-icon {
    font-size: 1.2rem;
    color: var(--crm-text-muted);
    flex-shrink: 0;
    width: 20px;
    text-align: center;
    margin-top: 2px;
}

.crm-sync-object-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.crm-sync-object-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--crm-text);
}

.crm-sync-object-hint {
    font-size: 12px;
    color: var(--crm-text-muted);
    line-height: 1.5;
    word-break: break-word;
}

.crm-badge-muted {
    background: rgba(255, 255, 255, 0.07);
    color: var(--crm-text-muted);
    border: 1px solid var(--crm-border);
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 99px;
    white-space: nowrap;
}

.crm-sync-notice {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 14px 16px;
    background: rgba(99, 179, 237, 0.08);
    border: 1px solid rgba(99, 179, 237, 0.2);
    border-radius: var(--crm-radius);
    font-size: 13px;
    color: var(--crm-text-muted);
    line-height: 1.5;
    margin-top: 8px;
}

.crm-sync-notice-icon {
    font-size: 1rem;
    color: #63b3ed;
    flex-shrink: 0;
    margin-top: 1px;
}

/* Блок инструкции «Как подключить» */
.crm-sync-howto {
    background: rgba(99, 179, 237, 0.06);
    border: 1px solid rgba(99, 179, 237, 0.2);
    border-radius: var(--crm-radius);
    padding: 16px 20px;
    margin-bottom: 24px;
    font-size: 13px;
    line-height: 1.6;
    word-break: break-word;
    overflow-wrap: break-word;
}
.crm-sync-howto-title {
    font-weight: 600;
    color: var(--crm-text);
    margin-bottom: 10px;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.crm-sync-howto-steps {
    margin: 0;
    padding-left: 20px;
    color: var(--crm-text-muted);
}
.crm-sync-howto-steps li {
    margin-bottom: 8px;
}
.crm-sync-howto-steps li:last-child {
    margin-bottom: 0;
}
.crm-sync-howto-steps code {
    background: rgba(255,255,255,0.08);
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 12px;
    color: var(--crm-text);
}
.crm-sync-howto-steps strong {
    color: var(--crm-text);
}
.crm-sync-howto-tip {
    display: block;
    margin-top: 4px;
    color: var(--crm-text-muted);
    font-size: 12px;
}

/* Тест подключения */
.crm-sync-test-result {
    margin: 12px 0 0;
    padding: 12px 16px;
    border-radius: var(--crm-radius);
    font-size: 13px;
    line-height: 1.5;
}
.crm-sync-test-ok {
    background: rgba(72, 187, 120, 0.1);
    border: 1px solid rgba(72, 187, 120, 0.3);
    color: #68d391;
}
.crm-sync-test-error {
    background: rgba(245, 101, 101, 0.1);
    border: 1px solid rgba(245, 101, 101, 0.3);
    color: #fc8181;
}

/* Последняя проверка */
.crm-sync-last-test {
    margin-top: 16px;
    padding: 10px 14px;
    background: var(--crm-sidebar-bg);
    border-radius: var(--crm-radius);
    font-size: 12px;
    color: var(--crm-text-muted);
}

/* Журнал синхронизации */
.crm-sync-log-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--crm-border);
}
.crm-sync-log-hint {
    font-size: 12px;
    margin-left: auto;
}
.crm-sync-log-msg {
    font-size: 12px;
    font-family: monospace;
    max-width: 400px;
    word-break: break-all;
}
.crm-sync-log-empty {
    padding: 16px 0;
    font-size: 13px;
}
.crm-table-wrap {
    overflow-x: auto;
}

/* Toggle переключатель */
.crm-toggle-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 0;
}
.crm-toggle {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
    flex-shrink: 0;
}
.crm-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}
.crm-toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: var(--crm-border);
    border-radius: 22px;
    transition: background 0.2s;
}
.crm-toggle-slider::before {
    content: "";
    position: absolute;
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background: var(--white);
    border-radius: 50%;
    transition: transform 0.2s;
}
.crm-toggle input:checked + .crm-toggle-slider {
    background: var(--crm-accent);
}
.crm-toggle input:checked + .crm-toggle-slider::before {
    transform: translateX(18px);
}
.crm-toggle-label {
    font-size: 13px;
    color: var(--crm-text-muted);
}

/* Ширина поля таймаута */
.crm-form-group-narrow {
    max-width: 160px;
}

/* Превью синхронизации клубов */
.crm-sync-preview-stats {
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.crm-sync-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px 28px;
    background: var(--crm-card-bg);
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius);
    min-width: 120px;
}
.crm-sync-stat-ok { border-color: rgba(72,187,120,0.3); }
.crm-sync-stat-warn { border-color: rgba(246,173,85,0.3); }
.crm-sync-stat-num {
    font-size: 28px;
    font-weight: 700;
    color: var(--crm-text);
    line-height: 1;
}
.crm-sync-stat-label {
    font-size: 11px;
    color: var(--crm-text-muted);
    margin-top: 6px;
    text-align: center;
}
.crm-sync-preview-note {
    font-size: 13px;
    margin-bottom: 20px;
}
.crm-sync-preview-card {
    padding: 0;
    overflow: hidden;
    margin-bottom: 20px;
}
.crm-sync-preview-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--crm-border);
    font-size: 14px;
    font-weight: 600;
    color: var(--crm-text);
}
.crm-sync-check-all {
    margin-left: auto;
    font-size: 12px;
    font-weight: 400;
    color: var(--crm-text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
}
.crm-sync-fields-list {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}
.crm-sync-field-badge {
    font-size: 10px;
    padding: 2px 6px;
}
.crm-sync-preview-values {
    font-size: 12px;
    color: var(--crm-text-muted);
    line-height: 1.7;
}
.crm-sync-preview-values b {
    color: var(--crm-text);
}
.crm-sync-preview-actions {
    margin: 20px 0;
}
.crm-sync-nomatch-card {
    background: transparent;
    border: 1px dashed var(--crm-border);
}
.crm-sync-nomatch-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 0 20px 16px;
}
.crm-sync-new-hint {
    padding: 8px 20px 12px;
    font-size: 13px;
    color: var(--crm-text-muted);
    margin: 0;
}
.crm-sync-new-name {
    font-weight: 600;
    color: var(--crm-text);
}
.crm-text-warn {
    color: #e67e22;
}

/* Цвета текста */
.crm-text-ok { color: #68d391; }
.crm-text-danger { color: #fc8181; }

/* ===== Счета и Акты ===== */
.crm-page-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    gap: 12px;
    flex-wrap: wrap;
}

.crm-page-header-row .crm-page-title {
    margin-bottom: 0;
}

.crm-filter-bar {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 20px;
    padding: 14px 16px;
    background: var(--crm-surface);
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius);
}

.crm-filter-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.crm-select-sm {
    min-width: 120px;
}

.crm-th-num,
.crm-td-num {
    text-align: right;
    white-space: nowrap;
}

.crm-td-center {
    text-align: center;
    white-space: nowrap;
}

.crm-td-strong {
    font-weight: 600;
}

.crm-td-warn {
    color: #f6c90e;
}

.crm-td-danger {
    color: #fc5c65;
}

.crm-td-hint {
    margin-left: 4px;
    opacity: 0.6;
    cursor: default;
}

.crm-td-actions {
    display: flex;
    gap: 4px;
    white-space: nowrap;
}

.crm-inline-form {
    display: inline;
}

.crm-btn-xs {
    padding: 3px 8px;
    font-size: 12px;
}

.crm-invoice-row.crm-invoice-status-paid td {
    opacity: 0.65;
}

.crm-invoice-row.crm-invoice-status-overdue .crm-td-num {
    color: #fc5c65;
}

.crm-td-onec {
    min-width: 118px;
    white-space: nowrap;
}

.crm-onec-doc {
    display: flex;
    flex-direction: column;
    gap: 2px;
    line-height: 1.35;
}

.crm-onec-doc-num {
    font-weight: 600;
    font-size: 13px;
    color: var(--crm-text, #e8eaed);
}

.crm-onec-doc-date {
    font-size: 12px;
    color: var(--crm-text-muted, #9aa0a6);
}

.crm-badge-ok {
    background: rgba(72, 199, 142, 0.15);
    color: #48c78e;
    border: 1px solid rgba(72, 199, 142, 0.3);
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 99px;
    white-space: nowrap;
}

.crm-badge-warn {
    background: rgba(246, 201, 14, 0.12);
    color: #f6c90e;
    border: 1px solid rgba(246, 201, 14, 0.25);
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 99px;
    white-space: nowrap;
}

.crm-badge-info {
    background: rgba(99, 179, 237, 0.12);
    color: #63b3ed;
    border: 1px solid rgba(99, 179, 237, 0.25);
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 99px;
    white-space: nowrap;
}

.crm-badge-danger {
    background: rgba(252, 92, 101, 0.12);
    color: #fc5c65;
    border: 1px solid rgba(252, 92, 101, 0.25);
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 99px;
    white-space: nowrap;
}

.crm-invoices-1c-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px 16px;
    margin-bottom: 16px;
    padding: 12px 16px;
    border-radius: 8px;
    background: rgba(72, 152, 220, 0.08);
    border: 1px solid rgba(72, 152, 220, 0.22);
}

.crm-invoices-1c-bar-text {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    font-size: 14px;
    line-height: 1.45;
    max-width: 720px;
}

.crm-invoices-1c-bar-sync {
    font-size: 12px;
}

.crm-invoice-missing-item-static {
    cursor: default;
}

.crm-invoice-missing-item-static:hover {
    background: transparent;
}

.crm-invoices-missing {
    margin-top: 28px;
    padding: 16px 20px;
    background: rgba(246, 201, 14, 0.05);
    border: 1px solid rgba(246, 201, 14, 0.2);
    border-radius: var(--crm-radius);
}

.crm-invoices-missing-title {
    font-size: 13px;
    font-weight: 600;
    color: #f6c90e;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.crm-invoices-missing-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.crm-invoice-missing-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: var(--crm-surface);
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius);
    text-decoration: none;
    transition: background 0.12s;
}

.crm-invoice-missing-item:hover {
    background: rgba(255, 255, 255, 0.04);
}

.crm-invoice-missing-name {
    flex: 1;
    font-size: 13px;
    color: var(--crm-text);
    font-weight: 500;
}

.crm-invoice-missing-rate {
    font-size: 13px;
    color: var(--crm-text-muted);
}

.crm-invoice-edit-meta {
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius);
    margin-bottom: 20px;
    font-size: 13px;
    color: var(--crm-text-muted);
}

.crm-invoice-total-display {
    padding: 8px 12px;
    background: rgba(72, 199, 142, 0.08);
    border: 1px solid rgba(72, 199, 142, 0.2);
    border-radius: var(--crm-radius);
    font-size: 16px;
    font-weight: 600;
    color: #48c78e;
    min-height: 40px;
    display: flex;
    align-items: center;
}

.crm-invoice-total-display.crm-invoice-total-warn {
    background: rgba(252, 92, 101, 0.08);
    border-color: rgba(252, 92, 101, 0.2);
    color: #fc5c65;
}

/* ========== Основной контент ========== */
.crm-main {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 24px;
    box-sizing: border-box;
}

.crm-dashboard-content {
    background: var(--crm-surface);
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius);
    padding: 24px;
}

.crm-page-title {
    margin: 0 0 12px;
    font-size: 18px;
    font-weight: 600;
}

/* ????????? ???????? ? ?????? (??????? + ??????) ? ???? ?????? */
.crm-page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px 20px;
    margin-bottom: 12px;
}

.crm-page-header .crm-page-title {
    margin: 0;
}

.crm-page-toolbar {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 12px 16px;
}

.crm-page-toolbar .crm-print-actions {
    margin: 0;
}

.crm-page-header-orgs .crm-print-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}

.crm-page-header-orgs .crm-orgs-sync-dadata-form {
    display: inline-flex;
    align-items: center;
    margin: 0;
}

.crm-page-toolbar-form {
    margin-bottom: 0;
}

.crm-page-header .crm-filter-bar {
    margin-bottom: 0;
}

.crm-page-header-clubs {
    flex-wrap: nowrap;
    align-items: center;
    gap: 12px 24px;
}

.crm-page-header-clubs .crm-page-title {
    flex: 1 1 auto;
    min-width: 0;
    margin: 0;
}

.crm-page-header-clubs-actions {
    display: flex;
    flex: 0 0 auto;
    flex-wrap: nowrap;
    align-items: center;
    gap: 16px 20px;
    margin-left: auto;
}

.crm-clubs-filter-form {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 12px 16px;
    margin: 0;
}

.crm-clubs-filter-form .crm-clubs-filter-field {
    display: grid;
    grid-template-columns: auto 10.75rem;
    align-items: center;
    gap: 6px 8px;
}

.crm-clubs-filter-form .crm-label {
    margin-bottom: 0;
    font-size: 12px;
    color: var(--crm-text-muted);
    white-space: nowrap;
}

.crm-clubs-filter-form .crm-select.crm-clubs-filter-select {
    width: 10.75rem;
    min-width: 10.75rem;
    max-width: 10.75rem;
    box-sizing: border-box;
}

.crm-clubs-filter-reset-slot {
    flex: 0 0 5.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 2rem;
}

.crm-clubs-filter-reset {
    flex-shrink: 0;
    white-space: nowrap;
}

.crm-page-header-clubs .crm-page-toolbar {
    flex: 0 0 auto;
    flex-shrink: 0;
}

.crm-lead {
    margin: 0 0 24px;
    color: var(--crm-text-muted);
}

.crm-link {
    color: var(--crm-accent);
}

.crm-link:hover {
    text-decoration: underline;
}

.crm-table-link {
    color: var(--crm-text);
    font-weight: 600;
    text-decoration: none;
}

.crm-table-link:hover {
    color: var(--crm-accent);
    text-decoration: underline;
}

.crm-breadcrumb {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px 8px;
    margin: 0 0 16px;
    font-size: 13px;
    color: var(--crm-text-muted);
}

.crm-breadcrumb-link {
    color: var(--crm-accent);
    text-decoration: none;
}

.crm-breadcrumb-link:hover {
    text-decoration: underline;
}

.crm-breadcrumb-icon {
    margin-right: 4px;
    vertical-align: -0.1em;
}

.crm-breadcrumb-sep {
    color: var(--crm-border);
}

.crm-breadcrumb-current {
    color: var(--crm-text);
}

.crm-dl {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 6px 24px;
    margin: 0 0 24px;
    font-size: 14px;
}

.crm-dl dt {
    color: var(--crm-text-muted);
    font-weight: 500;
}

.crm-dl dd {
    margin: 0;
}

.crm-card-section {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--crm-border);
}

.crm-card-section-title {
    margin: 0 0 12px;
    font-size: 15px;
    font-weight: 600;
}

/* Карточка организации: сворачиваемые блоки реквизитов */
.crm-org-sections-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-top: 24px;
}

.crm-org-sections-grid .crm-org-section-details,
.crm-club-top-summary-grid .crm-org-section-details,
.crm-club-subgrid .crm-org-section-details {
    margin-top: 0;
    padding: 14px 16px 16px;
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius);
    background: var(--crm-surface);
    align-self: start;
    min-width: 0;
}

.crm-club-api-details {
    margin-top: 16px;
    padding: 14px 16px 16px;
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius);
    background: var(--crm-surface);
    min-width: 0;
}

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

.crm-org-sections-grid .crm-org-section-panel,
.crm-club-top-summary-grid .crm-org-section-panel,
.crm-club-subgrid .crm-org-section-panel,
.crm-club-api-details .crm-org-section-panel {
    overflow-x: auto;
}

/* Карточка клиента (клуб): компактная шапка и сетки блоков */
.crm-club-top-summary-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-top: 12px;
    align-items: start;
}

.crm-club-top-summary-grid > .crm-club-info-block:only-child {
    grid-column: 1 / -1;
}

@media (max-width: 900px) {
    .crm-club-top-summary-grid {
        grid-template-columns: 1fr;
    }
}

.crm-club-info-block--compact {
    margin: 0;
    padding: 10px 14px 12px;
}

.crm-club-subgrid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    padding: 12px 16px 16px;
}

@media (max-width: 900px) {
    .crm-club-subgrid {
        grid-template-columns: 1fr;
    }
}

.crm-club-subgrid--stack {
    grid-template-columns: 1fr;
}

.crm-club-subgrid--supply {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (max-width: 1000px) {
    .crm-club-subgrid--supply {
        grid-template-columns: 1fr;
    }
}

.crm-club-subgrid--supply > .crm-org-section-details:only-child {
    grid-column: 1 / -1;
}

.crm-club-span-2 {
    grid-column: 1 / -1;
}

.crm-club-details-actions {
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

.crm-requisites-grid--in-details {
    padding: 0;
}

.crm-org-api-intro {
    margin: 0 0 14px;
    font-size: 13px;
    color: var(--crm-text-muted);
    line-height: 1.45;
}

.crm-org-api-dl dd {
    margin-bottom: 10px;
}

.crm-org-api-dl dd:last-child {
    margin-bottom: 0;
}

.crm-code-inline {
    font-family: "Consolas", "Monaco", monospace;
    font-size: 0.88em;
    padding: 1px 6px;
    border-radius: 4px;
    background: var(--crm-surface);
    border: 1px solid var(--crm-border);
}

.crm-org-section-details > summary {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    list-style: none;
    cursor: pointer;
    user-select: none;
}

.crm-org-section-details > summary::-webkit-details-marker {
    display: none;
}

.crm-org-section-details > summary .crm-card-section-title {
    margin: 0;
}

.crm-org-section-details[open] > summary {
    margin-bottom: 12px;
}

.crm-org-section-details .crm-org-section-chevron {
    font-size: 0.9em;
    opacity: 0.75;
    transition: transform 0.15s ease;
    flex-shrink: 0;
}

.crm-org-section-details[open] .crm-org-section-chevron {
    transform: rotate(90deg);
}

.crm-org-bank-dadata-form {
    margin-top: 20px;
    padding-top: 18px;
    border-top: 1px solid var(--crm-border);
}

.crm-org-bank-dadata-legend {
    margin: 0 0 10px;
    font-size: 13px;
    font-weight: 600;
    color: var(--crm-text-muted);
}

.crm-org-bank-dadata-form .crm-form-row-inline {
    align-items: flex-end;
    flex-wrap: wrap;
}

.crm-org-bank-dadata-form .crm-input-bik {
    max-width: 140px;
}

/* ??????? ??????????: ?????, ???????? */
.crm-material-form .crm-form-group {
    margin-bottom: 16px;
}
.crm-material-form .crm-label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: var(--crm-text);
}
.crm-material-form .crm-required {
    color: var(--crm-error);
}
.crm-material-form .crm-form-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}
.crm-material-form .crm-form-hint {
    margin: 8px 0 0;
    font-size: 13px;
    color: var(--crm-text-muted);
}
.crm-material-thumb {
    max-width: 80px;
    max-height: 60px;
    vertical-align: middle;
    margin-right: 8px;
}
.crm-material-image {
    max-width: 200px;
    max-height: 150px;
    border-radius: var(--crm-radius);
    border: 1px solid var(--crm-border);
}
.crm-inline-form {
    display: inline;
}
.crm-inline-form button:not(.crm-action-link):not([class*="crm-action-link"]) {
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    cursor: pointer;
    color: inherit;
}
.crm-inline-label {
    font-weight: normal;
    cursor: pointer;
    margin-left: 8px;
}

/* ??????? ????????: ???????? ????????? ???? ???????? (?? ?.17) */
.crm-delivery-planned-edit {
    margin-bottom: 24px;
    padding: 16px;
    background: var(--crm-surface);
    border-radius: var(--crm-radius);
    border: 1px solid var(--crm-border);
}
.crm-delivery-planned-edit .crm-subtitle {
    margin: 0 0 12px 0;
    font-size: 1rem;
    font-weight: 600;
}
.crm-delivery-planned-edit .crm-form.crm-inline-form {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 12px;
    margin-bottom: 8px;
}
.crm-delivery-planned-edit .crm-form-group-inline {
    margin-bottom: 0;
}
.crm-delivery-planned-edit .crm-form-group-inline .crm-input {
    min-width: 200px;
}
.crm-delivery-planned-edit .crm-form-actions-inline {
    margin-bottom: 0;
}
.crm-delivery-planned-edit .crm-text-small {
    font-size: 0.875rem;
}

/* ?????? ?? ?????: ????? ?????????????? */
.crm-timesheet-edit-form .crm-form-group {
    margin-bottom: 16px;
}
.crm-timesheet-edit-form .crm-timesheet-rate {
    margin-bottom: 20px;
}
.crm-timesheet-edit-form .crm-timesheet-rate .crm-input {
    max-width: 160px;
}
.crm-timesheet-table {
    margin-top: 16px;
}
.crm-timesheet-table .crm-input-inline {
    width: 100%;
    min-width: 120px;
}

/* История табелей: фильтры в одну строку (на узком экране — перенос) */
.crm-timesheet-history-form.crm-form {
    max-width: none;
    width: auto;
    flex: 1 1 auto;
    min-width: 0;
}

.crm-page-header .crm-timesheet-history-form {
    justify-content: flex-end;
}

.crm-timesheet-history-form {
    display: flex;
    flex-flow: row nowrap;
    align-items: flex-end;
    gap: 10px 16px;
    margin-bottom: 0;
}

.crm-timesheet-history-form .crm-form-group {
    margin-bottom: 0;
    display: flex;
    flex-flow: row nowrap;
    align-items: center;
    gap: 8px;
    flex: 0 1 auto;
    min-width: 0;
}

.crm-timesheet-history-form .crm-form-group .crm-label {
    display: inline-block;
    margin-bottom: 0;
    white-space: nowrap;
    flex-shrink: 0;
}

.crm-timesheet-history-form .crm-form-group .crm-select {
    min-width: 7.5rem;
    max-width: 14rem;
    flex: 1 1 auto;
}

.crm-timesheet-history-form .crm-form-group:nth-child(2) .crm-select {
    max-width: 18rem;
}

.crm-timesheet-history-form .crm-form-actions {
    margin-bottom: 0;
    flex-shrink: 0;
}
.crm-timesheet-history-export {
    margin-bottom: 16px;
}
.crm-timesheet-history-export .crm-subtitle {
    margin: 0 0 8px 0;
    font-size: 1rem;
    font-weight: 600;
}
.crm-timesheet-history-export .crm-export-link {
    width: auto;
    height: auto;
    padding: 2px 8px;
    margin-right: 8px;
}

.crm-ts-history-manager-hint {
    margin: 6px 0 0;
    font-size: 0.82rem;
    color: var(--crm-muted);
}

.crm-ts-history-manager-group .crm-select:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.crm-timesheet-finance-hint {
    margin: 0 0 12px;
    max-width: 52rem;
}

.crm-ts-finance-sub {
    display: block;
    font-size: 0.78rem;
    margin-top: 2px;
}

.crm-ts-history-totals {
    margin: 0 0 16px;
    font-size: 0.95rem;
}

.crm-ts-history-list {
    display: grid;
    gap: 12px;
}

.crm-ts-history-details {
    border: 1px solid var(--crm-border);
    border-radius: 12px;
    background: var(--crm-bg-card);
    padding: 0 14px;
}

.crm-ts-history-details > summary.crm-ts-history-summary {
    padding: 12px 0;
    gap: 10px;
}

.crm-ts-history-summary-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.crm-ts-history-summary-meta {
    font-size: 0.82rem;
    color: var(--crm-muted);
    font-weight: 400;
}

.crm-ts-history-summary-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    margin-left: auto;
}

.crm-ts-history-panel {
    padding: 0 0 14px;
    border-top: 1px solid var(--crm-border);
}

.crm-ts-history-panel-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin: 12px 0;
}

.crm-ts-history-panel-actions .crm-inline-form {
    margin: 0;
}

.crm-ts-history-card {
    border: 1px solid var(--crm-border);
    border-radius: 12px;
    background: var(--crm-bg-card);
    padding: 14px;
}

.crm-ts-history-card-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
    margin-bottom: 10px;
}

.crm-ts-history-club {
    margin: 0 0 4px;
    font-size: 1rem;
}

.crm-ts-history-managers {
    margin: 0;
    color: var(--crm-muted);
}

.crm-ts-history-status-wrap {
    text-align: right;
}

.crm-ts-history-status-meta {
    margin: 4px 0 0;
    font-size: .82rem;
    color: var(--crm-muted);
}

.crm-ts-history-weeks-title {
    margin: 0 0 8px;
    font-weight: 600;
}

.crm-ts-history-weeks-list {
    margin: 0;
    padding-left: 18px;
    display: grid;
    gap: 6px;
}

.crm-ts-history-week-item {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: baseline;
}

.crm-ts-history-week-meta {
    font-size: .82rem;
    color: var(--crm-muted);
}

.crm-form-row-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    margin-top: 8px;
}
.crm-form-row-inline .crm-input {
    min-width: 180px;
}
.crm-timesheet-add-freelancer {
    margin-top: 24px;
}
.crm-timesheet-form-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}
.crm-timesheet-row-freelancer td:first-child {
    background: var(--crm-surface);
}

/* ???????????? ?????? ????????? ? ????? ?????? */
.crm-freelancer-rows {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}
.crm-freelancer-row {
    display: flex;
    align-items: center;
    gap: 10px;
}
.crm-freelancer-row-num {
    min-width: 20px;
    font-size: 0.85rem;
    color: var(--crm-muted);
    text-align: right;
    user-select: none;
}
.crm-freelancer-name-input {
    flex: 0 0 240px;
    min-width: 0;
}
.crm-freelancer-fin-row .crm-freelancer-salary-input,
.crm-freelancer-fin-row .crm-freelancer-salary-fixed {
    flex: 0 0 110px;
    min-width: 0;
    box-sizing: border-box;
}
.crm-freelancer-fin-row .crm-freelancer-salary-fixed {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    padding: 0 10px;
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius, 6px);
    background: var(--crm-sidebar-bg, rgba(0, 0, 0, 0.04));
    font-variant-numeric: tabular-nums;
}
.crm-freelancer-fin-row .crm-freelancer-days-input,
.crm-freelancer-fin-row .crm-freelancer-shifts-input {
    flex: 0 0 76px;
    min-width: 0;
}
.crm-ts-freelancer-salary-readonly {
    display: inline-block;
    min-height: 34px;
    padding: 6px 8px;
    font-variant-numeric: tabular-nums;
    color: var(--crm-text-muted);
}
.crm-freelancer-comment-input {
    flex: 1 1 auto;
    min-width: 0;
}
.crm-freelancer-remove-hidden {
    visibility: hidden;
    pointer-events: none;
}
.crm-freelancer-add-btn {
    margin-top: 4px;
}
@media (max-width: 600px) {
    .crm-freelancer-row {
        flex-wrap: wrap;
    }
    .crm-freelancer-name-input {
        flex: 1 1 100%;
    }
    .crm-freelancer-comment-input {
        flex: 1 1 100%;
    }
}

/* ???????? ?????: ???????? ? ?????? */
.crm-table-compact th,
.crm-table-compact td {
    padding: 8px 12px;
}
.crm-club-salary-form .crm-input-numeric,
.crm-club-advance-form .crm-input-numeric {
    max-width: 140px;
}
.crm-club-form-actions {
    margin-top: 12px;
}
.crm-club-advance-form .crm-form-row-inline {
    margin-bottom: 16px;
}
.crm-club-advance-form .crm-label {
    margin-right: 4px;
}

.crm-period-close-form {
    margin-top: 12px;
}

.crm-period-patch-form .crm-input-numeric {
    max-width: 140px;
}

.crm-textarea {
    resize: vertical;
    min-height: 60px;
}

.crm-club-normatives-form .crm-input-numeric {
    max-width: 120px;
}

.crm-club-normatives-form .crm-input-days {
    max-width: 72px;
}

.crm-normative-new-row td {
    background: var(--crm-surface);
}

/* ===== ???????? ???????: ????? ? ??????? ???? ===== */
.crm-club-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.crm-club-header-main {
    flex: 1 1 240px;
    min-width: 0;
}

.crm-club-header-topline {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 6px 28px;
    row-gap: 8px;
    margin-bottom: 10px;
}

.crm-club-header-topline .crm-club-name {
    margin: 0;
    flex: 0 1 auto;
    min-width: 0;
}

.crm-club-header-org-inline {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 8px 12px;
    font-size: 0.88rem;
    line-height: 1.35;
}

.crm-club-header-org-label {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--crm-text-muted);
    white-space: nowrap;
}

.crm-club-header-org-name {
    font-weight: 600;
}

.crm-club-header-dropdowns {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.crm-club-popover-details {
    position: relative;
    display: inline-block;
    vertical-align: top;
}

.crm-club-popover-summary {
    list-style: none;
}

.crm-club-popover-summary::-webkit-details-marker {
    display: none;
}

.crm-club-popover-summary::marker {
    content: none;
}

.crm-club-popover-panel {
    position: absolute;
    left: 0;
    top: calc(100% + 6px);
    z-index: 200;
    min-width: min(100vw - 32px, 280px);
    max-width: min(94vw, 520px);
    max-height: min(72vh, 480px);
    overflow-y: auto;
    overflow-x: hidden;
    margin: 0;
    padding: 0;
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius);
    background: var(--crm-surface);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}

.crm-club-popover-panel--address {
    padding: 12px 14px;
    min-width: min(100vw - 32px, 240px);
    max-width: min(94vw, 420px);
}

.crm-club-popover-address-text {
    margin: 0;
    font-size: 0.88rem;
    line-height: 1.45;
}

/* Широкая выпадашка: таблица клиентов, форма выписки (карточка организации) */
.crm-club-popover-panel--wide {
    min-width: min(100vw - 32px, 320px);
    max-width: min(94vw, 720px);
    max-height: min(78vh, 560px);
}

.crm-org-popover-panel--pad {
    padding: 12px 14px 14px;
}

.crm-org-popover-panel--pad > .crm-dl-two-col:first-child {
    margin-top: 0;
}

.crm-org-detail-header {
    margin-bottom: 16px;
}

/* Карточка организации: выписка (Точка/ВТБ) — заметный блок под крошками */
.crm-org-import-callout {
    margin: 0 0 20px;
    padding: 16px 18px;
    background: var(--crm-surface);
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius);
    border-left: 4px solid var(--crm-accent);
}

.crm-org-import-callout--vtb {
    border-left-color: var(--crm-text-muted);
}

.crm-org-import-callout-inner {
    max-width: 960px;
}

.crm-org-import-callout-title {
    margin: 0 0 8px;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--crm-text);
}

.crm-org-import-callout-lead {
    margin: 0 0 14px;
    font-size: 0.9rem;
    line-height: 1.45;
    color: var(--crm-text-muted);
}

.crm-org-import-callout-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 12px;
}

.crm-org-import-callout-warn {
    font-size: 0.875rem;
    color: var(--crm-text-muted);
}

.crm-org-import-callout-msg {
    margin: 0;
    flex: 1 1 220px;
}

.crm-org-import-callout-file-form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    padding: 8px 12px;
    border-radius: var(--crm-radius);
    border: 1px dashed var(--crm-border);
}

.crm-org-import-file-label {
    margin: 0;
    font-size: 0.8rem;
    font-weight: 500;
}

.crm-org-tochka-intro {
    margin-top: 0;
}

/* Форма организации: блок входа в Точка ID */
.crm-org-bank-tochka-panel {
    margin: 12px 0 16px;
    padding: 14px 16px;
    background: var(--crm-surface);
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius);
    border-left: 3px solid var(--crm-accent);
}

.crm-org-bank-tochka-panel-title {
    margin: 0 0 8px;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--crm-text-muted);
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.crm-org-bank-tochka-lead {
    margin: 0 0 10px;
}

.crm-org-bank-tochka-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 14px;
    margin-bottom: 10px;
}

.crm-org-bank-tochka-verify-btn {
    display: inline-flex;
    margin: 0;
}

.crm-org-bank-tochka-steps {
    margin: 0;
    padding-left: 1.25rem;
    font-size: 0.875rem;
    line-height: 1.55;
    color: var(--crm-text-muted);
}

.crm-org-bank-tochka-steps li {
    margin-bottom: 4px;
}

.crm-org-bank-tochka-env-panel {
    margin: 4px 0 14px;
    padding: 12px 14px;
    background: var(--crm-surface);
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius);
}

/* Блок «Банк и выписки»: переключение Точка / ВТБ — flex на .crm-form-row не должен отменять скрытие */
#crm-org-bank-integration .crm-bank-sync-hide,
#crm-org-bank-integration [data-bank-sync-field][hidden],
#crm-org-bank-integration [data-bank-sync-hint][hidden] {
    display: none !important;
}

.crm-org-bank-tochka-env-list {
    margin: 8px 0 10px;
    padding-left: 1.25rem;
    font-size: 0.875rem;
    line-height: 1.55;
    color: var(--crm-text-muted);
}

.crm-org-bank-tochka-env-list li {
    margin-bottom: 4px;
}

.crm-org-bank-dadata-form--popover {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--crm-border);
}

.crm-finance-stmt-row--popover {
    flex-wrap: wrap;
}

.crm-org-clients-table-wrap {
    overflow-x: auto;
    margin: 0 -2px;
}

.crm-requisites-grid--popover {
    padding: 12px 14px 14px;
    gap: 14px;
    grid-template-columns: 1fr;
}

.crm-club-header .crm-club-header-actions {
    flex: 0 0 auto;
    align-self: flex-start;
}

.crm-club-name {
    margin-bottom: 0;
}
.crm-club-info-block {
    margin: 12px 0 20px;
    padding: 14px 18px;
    background: var(--crm-surface);
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius);
}
.crm-club-info-block .crm-dl-two-col {
    margin: 0;
}

/* ===== ????????? ?????: ?????? ? ???????????? ===== */
.crm-system-block {
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius);
    margin-bottom: 20px;
    overflow: hidden;
}
.crm-system-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 18px;
    font-weight: 600;
    font-size: 0.85rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    border-bottom: 1px solid var(--crm-border);
}
.crm-requisites-grid {
    padding: 16px 20px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.crm-requisites-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.crm-requisites-section-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--crm-text-muted);
    padding-bottom: 6px;
    border-bottom: 1px solid var(--crm-border);
}

.crm-monospace {
    font-family: "Consolas", "Monaco", monospace;
    font-size: 12px;
    letter-spacing: 0.03em;
}

.crm-system-finance-payouts > .crm-system-header {
    background: rgba(234, 179, 8, 0.12);
    color: #ca8a04;
}
.crm-club-finance-base-dl {
    margin-top: 4px;
}
.crm-system-timesheet > .crm-system-header {
    background: rgba(74, 158, 255, 0.1);
    color: var(--crm-accent);
}

.crm-club-ts-export-current {
    padding-bottom: 14px;
    margin-bottom: 14px;
    border-bottom: 1px solid var(--crm-border);
}

.crm-club-ts-export-current-label {
    display: block;
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--crm-text-muted);
    margin-bottom: 4px;
}

.crm-club-ts-export-current-period {
    margin: 0 0 10px;
    font-size: 0.95rem;
}

.crm-club-ts-export-current-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 16px;
    margin: 0 0 8px;
}

.crm-club-ts-export-hint {
    margin: 0;
    font-size: 0.72rem;
    line-height: 1.45;
}

.crm-club-ts-history-title {
    display: block;
    margin-bottom: 8px;
    font-size: 0.82rem;
}

.crm-club-ts-history-wrap {
    margin-bottom: 8px;
}

.crm-club-ts-history-table .crm-club-ts-history-actions {
    white-space: nowrap;
}

.crm-club-ts-history-table .crm-club-ts-history-actions .crm-action-link {
    margin-right: 8px;
}

.crm-club-ts-history-full {
    margin: 10px 0 0;
    font-size: 0.8rem;
}

/* Финансы: канбан-карточки клиентов */
.crm-finance-kanban-lead {
    max-width: 52rem;
}

/* Канбан: шапка — слева заголовок и текст, справа фильтры */
.crm-fk-header-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px 28px;
    margin-bottom: 14px;
}

.crm-fk-header-left {
    flex: 1 1 16rem;
    min-width: 0;
}

.crm-fk-header-title-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    margin-bottom: 6px;
}

.crm-fk-header-title-row .crm-fk-page-title {
    margin-bottom: 0;
}

.crm-fk-header-lead {
    margin: 0;
    max-width: 36rem;
    font-size: 0.8rem;
    line-height: 1.4;
    color: var(--crm-text-muted, #94a3b8);
}

.crm-fk-header-right {
    flex: 0 1 auto;
    min-width: min(100%, 17.5rem);
    max-width: 100%;
}

.crm-finance-kanban-filter-row--compact {
    gap: 10px 12px;
    align-items: flex-end;
}

.crm-finance-kanban-filter-form--compact .crm-label {
    font-size: 0.7rem;
    margin-bottom: 3px;
    letter-spacing: 0.02em;
}

.crm-finance-kanban-filter-form--compact .crm-finance-kanban-filter-row .crm-form-group {
    min-width: 0;
    margin-bottom: 0;
}

.crm-fk-filter-group-period {
    flex: 0 1 7.5rem;
}

.crm-fk-filter-group-org {
    flex: 1 1 9rem;
    min-width: 7rem;
}

.crm-fk-filter-select {
    font-size: 0.8rem;
    padding-top: 5px;
    padding-bottom: 5px;
}

.crm-fk-filter-hint {
    margin: 8px 0 0;
    font-size: 0.68rem;
    line-height: 1.35;
    max-width: 22rem;
    margin-left: auto;
    text-align: right;
}

@media (max-width: 720px) {
    .crm-fk-filter-hint {
        margin-left: 0;
        text-align: left;
        max-width: none;
    }
}
.crm-finance-kanban-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 14px;
    margin-top: 18px;
}
.crm-finance-kanban-card {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 14px 16px;
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius);
    background: var(--crm-surface, rgba(255, 255, 255, 0.03));
    text-decoration: none;
    color: inherit;
    transition: border-color 0.15s ease, background 0.15s ease;
}
.crm-finance-kanban-card:hover {
    border-color: var(--crm-accent, #4a9eff);
    background: rgba(74, 158, 255, 0.06);
}
.crm-finance-kanban-card-title {
    font-weight: 600;
    font-size: 0.95rem;
    line-height: 1.35;
}
.crm-finance-kanban-card-meta {
    font-size: 0.8rem;
    color: var(--crm-text-muted);
}
.crm-finance-kanban-card-badge {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--crm-text-muted);
    margin-top: 4px;
}
.crm-finance-kanban-filter-form {
    margin: 18px 0 8px;
    padding: 14px 16px;
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius);
    background: rgba(0, 0, 0, 0.15);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.crm-finance-kanban-filter-form.crm-finance-kanban-filter-form--compact {
    margin: 0;
    padding: 10px 12px;
    box-shadow: none;
    background: rgba(0, 0, 0, 0.12);
}
.crm-finance-kanban-filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: flex-end;
}
.crm-finance-kanban-filter-row .crm-form-group {
    margin-bottom: 0;
    min-width: 160px;
}
.crm-finance-kanban-filter-submit .crm-label-placeholder {
    visibility: hidden;
}
.crm-finance-kanban-period-caption {
    margin: 12px 0 8px;
    font-size: 0.9rem;
}

/* Вкладка «Счёт» финансового канбана — узкая таблица */
.crm-table-wrap--fin-invoice {
    overflow-x: auto;
    max-width: 100%;
}

.crm-fin-invoice-table {
    width: 100%;
    max-width: 1180px;
    table-layout: fixed;
    font-size: 0.8125rem;
}

.crm-fin-invoice-table th,
.crm-fin-invoice-table td {
    padding: 6px 8px;
    vertical-align: middle;
}

.crm-fin-invoice-table thead th {
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.crm-fin-invoice-table .crm-fin-col-client {
    width: 18%;
    min-width: 120px;
    white-space: normal;
    word-break: break-word;
}

.crm-fin-invoice-table .crm-fin-col-sum {
    width: 9%;
    font-size: 0.78rem;
}

.crm-fin-invoice-table .crm-fin-col-flag {
    width: 5%;
}

.crm-fin-invoice-table .crm-fin-col-status {
    width: 8%;
}

.crm-fin-invoice-table .crm-fin-col-stage {
    width: 8%;
}

.crm-fin-invoice-table .crm-fin-col-actions {
    width: 11%;
    min-width: 108px;
}

.crm-fin-invoice-table .crm-badge {
    font-size: 0.7rem;
    padding: 2px 6px;
}

.crm-fin-invoice-table .crm-action-link {
    font-size: 0.78rem;
}

/* Вкладка «Счёт / оплата / Р/С» — новая сетка (4 колонки) */
.crm-fin-invoice-table--v2 {
    max-width: 1080px;
}

.crm-fin-invoice-table--v2 .crm-fin-col-client {
    width: 24%;
    min-width: 130px;
}

.crm-fin-invoice-table--v2 .crm-fin-col-contract {
    width: 11%;
    min-width: 88px;
}

.crm-fin-invoice-table--v2 .crm-fin-col-penalty {
    width: 11%;
}

.crm-fin-invoice-table--v2 .crm-fin-col-invoice {
    width: 28%;
    vertical-align: top;
}

.crm-fin-invoice-table--v2 .crm-fin-col-paid {
    width: 22%;
    vertical-align: top;
}

.crm-fin-invoice-doc {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-bottom: 6px;
}

.crm-fin-invoice-doc-line {
    display: block;
    line-height: 1.35;
}

.crm-fin-invoice-doc-sum {
    font-weight: 600;
    font-size: 0.875rem;
}

.crm-fin-invoice-doc-num,
.crm-fin-invoice-doc-date {
    font-size: 0.78rem;
    color: var(--crm-text-muted, #6b7280);
}

.crm-fin-penalty-sum.crm-has-tooltip {
    cursor: help;
    border-bottom: 1px dotted var(--crm-border, #cbd5e1);
}

.crm-fin-paid-cell {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

.crm-fin-paid-amount {
    font-weight: 600;
}

.crm-fin-paid-debt {
    font-size: 0.75rem;
    color: var(--crm-warn, #b45309);
}

.crm-fin-paid-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    justify-content: flex-end;
    align-items: center;
}

.crm-fin-paid-popover {
    position: relative;
}

.crm-fin-paid-popover-panel {
    min-width: 220px;
    right: 0;
    left: auto;
}

.crm-fin-paid-popover-title {
    margin: 0 0 10px;
    font-size: 0.85rem;
    font-weight: 600;
}

.crm-fin-paid-add-btn {
    min-width: 2rem;
    padding-left: 8px;
    padding-right: 8px;
}

.crm-fin-invoice-sync-form {
    margin-top: 4px;
}

.crm-fk-page-title {
    margin-bottom: 0;
}

.crm-fk-settings-link {
    flex-shrink: 0;
}

.crm-fk-settings-section {
    margin-top: 28px;
    padding-top: 8px;
    border-top: 1px solid var(--crm-border);
}

.crm-fk-settings-subtitle {
    margin: 20px 0 12px;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--crm-text-muted);
}

.crm-fk-settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 14px 18px;
    margin-top: 12px;
}

.crm-fk-settings-field .crm-label {
    font-size: 0.82rem;
}

.crm-fk-autotask-table-wrap {
    margin: 12px 0 20px;
}

.crm-fk-autotask-table {
    font-size: 0.85rem;
}

.crm-fk-autotask-add-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 14px 18px;
    margin-top: 8px;
}

.crm-fk-autotask-field--wide {
    grid-column: 1 / -1;
}

.crm-fk-current-badge {
    font-size: 0.8rem;
    color: #ca8a04;
    font-weight: 600;
}

.crm-fk-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 18px;
    list-style: none;
    padding: 0;
    margin: 12px 0 4px;
    font-size: 0.78rem;
    color: var(--crm-text-muted);
}

.crm-fk-legend-day {
    display: inline-block;
    min-width: 1.4rem;
    font-weight: 700;
    color: var(--crm-text-muted);
}

.crm-fk-legend-day--accent {
    color: #60a5fa;
}

.crm-fk-legend-day--gold {
    color: #eab308;
}

.crm-fk-legend-day--coral {
    color: #fb7185;
}

.crm-fk-legend-day--mint {
    color: #34d399;
}

.crm-fk-legend-day--violet {
    color: #a78bfa;
}

.crm-fk-legend-day--slate {
    color: #94a3b8;
}

.crm-fk-timeline-wrap {
    position: relative;
    margin-top: 12px;
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius);
    overflow: hidden;
}

.crm-fk-timeline-scroll {
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
}

.crm-fk-day-columns {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    min-height: 220px;
    position: relative;
    z-index: 2;
    padding: 4px 0 20px;
}

.crm-fk-day-col {
    flex: 0 0 152px;
    min-width: 152px;
    border-right: 1px solid var(--crm-border);
    position: relative;
    z-index: 1;
}

.crm-fk-day-col:last-child {
    border-right: none;
}

.crm-fk-day-head {
    text-align: center;
    font-weight: 600;
    font-size: 0.72rem;
    padding: 8px 4px;
    border-bottom: 1px solid var(--crm-border);
    color: var(--crm-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.crm-fk-day-head--mark {
    font-weight: 700;
}

.crm-fk-day-head--mark.crm-fk-day-head--accent {
    color: #bfdbfe;
    background: rgba(59, 130, 246, 0.2);
    border-bottom-color: rgba(59, 130, 246, 0.45);
}

.crm-fk-day-head--mark.crm-fk-day-head--gold {
    color: #fde047;
    background: rgba(234, 179, 8, 0.18);
    border-bottom-color: rgba(234, 179, 8, 0.4);
}

.crm-fk-day-head--mark.crm-fk-day-head--coral {
    color: #fecdd3;
    background: rgba(244, 63, 94, 0.2);
    border-bottom-color: rgba(244, 63, 94, 0.4);
}

.crm-fk-day-head--mark.crm-fk-day-head--mint {
    color: #a7f3d0;
    background: rgba(16, 185, 129, 0.18);
    border-bottom-color: rgba(16, 185, 129, 0.4);
}

.crm-fk-day-head--mark.crm-fk-day-head--violet {
    color: #ddd6fe;
    background: rgba(139, 92, 246, 0.2);
    border-bottom-color: rgba(139, 92, 246, 0.4);
}

.crm-fk-day-head--mark.crm-fk-day-head--slate {
    color: #cbd5e1;
    background: rgba(100, 116, 139, 0.25);
    border-bottom-color: rgba(100, 116, 139, 0.45);
}

.crm-fk-day-cards {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 8px 6px;
    min-height: 48px;
}

.crm-fk-card {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 6px 8px 8px;
    border-radius: 6px;
    border: 1px solid var(--crm-border);
    background: rgba(255, 255, 255, 0.035);
    text-decoration: none;
    color: inherit;
    font-size: 0.68rem;
    line-height: 1.3;
}

.crm-fk-card:hover {
    border-color: var(--crm-accent, #4a9eff);
    background: rgba(74, 158, 255, 0.07);
}

.crm-fk-card-title {
    font-weight: 600;
    font-size: 0.76rem;
}

.crm-fk-card-org {
    color: var(--crm-text-muted);
    font-size: 0.68rem;
}

.crm-fk-card-debt {
    font-weight: 500;
    font-size: 0.68rem;
}

.crm-fk-card-line {
    font-size: 0.62rem;
    line-height: 1.28;
}

.crm-fk-ok {
    color: #16a34a;
}

.crm-fk-bad {
    color: #dc2626;
}

.crm-fk-card-done {
    opacity: 0.88;
    border-color: rgba(22, 163, 74, 0.35);
}

.crm-fk-card-overdue {
    box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.35);
    background: rgba(220, 38, 38, 0.07);
}

.crm-fk-past-shade {
    display: none;
}

.crm-fk-has-current-month .crm-fk-past-shade {
    display: block;
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: calc(var(--fk-now-pct, 0) * 100%);
    background: rgba(0, 0, 0, 0.32);
    pointer-events: none;
    z-index: 0;
}

.crm-fk-now-line {
    display: none;
}

.crm-fk-has-current-month .crm-fk-now-line {
    display: block;
    position: absolute;
    left: calc(var(--fk-now-pct, 0.45) * 100%);
    top: 0;
    bottom: 0;
    width: 3px;
    margin-left: -1px;
    background: #dc2626;
    z-index: 4;
    pointer-events: none;
}

.crm-fk-period-info {
    margin: 10px 0 6px;
}

.crm-fk-board {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.04) 0%, rgba(0, 0, 0, 0.08) 100%);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.22);
}

.crm-fk-card {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.crm-club-period-strip {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    padding: 10px 12px;
    margin-bottom: 12px;
    border-radius: var(--crm-radius);
    border: 1px solid var(--crm-border);
    background: rgba(0, 0, 0, 0.12);
    font-size: 0.88rem;
}

.crm-fin-chart-system-header {
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 10px 20px;
}

.crm-fin-chart-system-header-title {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1 1 auto;
    min-width: min(100%, 12rem);
}

.crm-fin-chart-system-header-period {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 10px;
    font-size: 0.8rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    text-transform: none;
}

.crm-fin-chart-system-header-period-label {
    color: var(--crm-text-muted);
    font-weight: 600;
    white-space: nowrap;
}

.crm-fin-chart-period-links {
    line-height: 1.5;
}

.crm-club-period-strip-label {
    color: var(--crm-text-muted);
    font-weight: 600;
}

.crm-system-finance-chart .crm-fin-chart-inner {
    padding: 0 4px 6px;
}

.crm-fin-chart-hint-details {
    margin: 0 0 8px;
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius);
    background: rgba(0, 0, 0, 0.1);
}

.crm-fin-chart-hint-summary {
    padding: 6px 10px;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--crm-text-muted);
    cursor: pointer;
    list-style: none;
}

.crm-fin-chart-hint-summary::-webkit-details-marker {
    display: none;
}

.crm-fin-chart-hint-details .crm-fin-chart-hint {
    margin: 0;
    padding: 0 10px 8px;
    font-size: 0.72rem;
    line-height: 1.45;
}

.crm-fin-chart-main {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 10px 14px;
    margin-bottom: 8px;
}

.crm-fin-chart-sidebar {
    flex: 0 0 auto;
    width: min(200px, 100%);
    max-width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius);
    background: rgba(0, 0, 0, 0.18);
    box-sizing: border-box;
}

.crm-fin-chart-stats {
    margin: 0;
    padding: 0;
}

.crm-fin-chart-stat-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 4px 8px;
    align-items: baseline;
    padding: 3px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    font-size: 0.72rem;
    line-height: 1.25;
}

.crm-fin-chart-stat-row:last-of-type {
    border-bottom: none;
    padding-bottom: 2px;
}

.crm-fin-chart-stat-row dt {
    margin: 0;
    font-weight: 500;
    color: var(--crm-text-muted);
}

.crm-fin-chart-stat-row dd {
    margin: 0;
    text-align: right;
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    font-size: 0.78rem;
    white-space: nowrap;
}

.crm-fin-chart-profit-compact {
    margin: 6px 0 0;
    padding-top: 6px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.76rem;
    line-height: 1.35;
    color: var(--crm-text-muted);
}

.crm-fin-chart-profit-compact strong {
    font-size: 0.88rem;
}

.crm-fin-chart-plot {
    flex: 1 1 260px;
    min-width: 0;
}

.crm-fin-chart-plot-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 6px 12px;
    margin-bottom: 6px;
}

.crm-fin-chart-scale {
    margin: 0;
    font-size: 0.68rem;
    color: var(--crm-text-muted);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.crm-fin-chart-scale-label {
    font-weight: 600;
    margin-right: 4px;
}

.crm-fin-chart-scale-val {
    font-weight: 600;
    color: var(--crm-text, #e8eaed);
}

.crm-fin-chart-plot .crm-fin-chart-svg-wrap {
    margin-top: 0;
    margin-bottom: 0;
}

.crm-fin-chart-svg-wrap {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    margin: 0;
    padding: 4px 6px;
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius);
    background: rgba(0, 0, 0, 0.2);
}

.crm-fin-chart-svg {
    display: block;
    width: 100%;
    height: auto;
    max-height: 112px;
    vertical-align: top;
}

.crm-fin-chart-axis {
    stroke: var(--crm-border);
    stroke-width: 1;
}

.crm-fin-chart-line {
    fill: none;
    stroke-width: 1.65;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.crm-fin-chart-line--forecast {
    stroke: rgba(147, 197, 253, 0.95);
    stroke-dasharray: 6 4;
}

.crm-fin-chart-line--actual {
    stroke: #22c55e;
}

.crm-fin-chart-line--expense {
    stroke: #f97316;
}

.crm-fin-chart-line--net {
    stroke: #a78bfa;
    stroke-width: 1.85;
}

.crm-fin-chart-legend {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 4px 10px;
    font-size: 0.68rem;
    color: var(--crm-text-muted);
}

.crm-fin-chart-plot .crm-fin-chart-legend {
    margin-bottom: 0;
}

.crm-fin-chart-legend li {
    display: flex;
    align-items: center;
    gap: 5px;
}

.crm-fin-chart-swatch {
    display: inline-block;
    width: 12px;
    height: 3px;
    border-radius: 2px;
    flex-shrink: 0;
}

.crm-fin-chart-swatch--forecast {
    background: repeating-linear-gradient(
        90deg,
        rgba(147, 197, 253, 0.95) 0 4px,
        transparent 4px 8px
    );
    min-width: 18px;
    height: 3px;
}

.crm-fin-chart-swatch--actual {
    background: #22c55e;
}

.crm-fin-chart-swatch--expense {
    background: #f97316;
}

.crm-fin-chart-swatch--net {
    background: #a78bfa;
}

.crm-fin-chart-profit-pos {
    color: #4ade80;
}

.crm-fin-chart-profit-neg {
    color: #f87171;
}

.crm-fin-chart-cat-block {
    margin-top: 8px;
}

.crm-fin-chart-cat-title {
    display: block;
    margin-bottom: 8px;
}

@media (max-width: 560px) {
    .crm-fin-chart-main {
        flex-direction: column;
    }

    .crm-fin-chart-sidebar {
        width: 100%;
    }
}

.crm-timesheet-rate-readonly {
    margin-bottom: 16px;
    padding: 12px 14px;
    border-radius: var(--crm-radius);
    border: 1px solid var(--crm-border);
    background: rgba(0, 0, 0, 0.12);
}

.crm-timesheet-penalty-inline {
    gap: 10px;
    align-items: flex-end;
    margin-top: 0;
}

.crm-timesheet-penalty-inline .crm-form-group {
    margin-bottom: 0;
}

.crm-timesheet-penalty-inline .crm-form-group .crm-label {
    margin-bottom: 4px;
    font-size: 12px;
}

.crm-timesheet-penalty-inline #ts-penalty-amount {
    width: 130px;
}

.crm-timesheet-penalty-inline #ts-penalty-reason {
    min-width: 300px;
}

.crm-timesheet-penalty-inline .crm-form-actions {
    margin: 0;
}

.crm-timesheet-penalty-total {
    margin: 0 0 6px auto;
    white-space: nowrap;
}

.crm-club-finance-track-list {
    list-style: none;
    padding: 0;
    margin: 0 0 8px;
}

.crm-form-check-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.crm-label-inline {
    margin: 0;
    font-weight: 400;
    cursor: pointer;
}

.crm-ts-status-panel {
    margin-bottom: 18px;
    padding: 12px 16px;
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius);
    background: rgba(74, 158, 255, 0.06);
}
.crm-ts-status-panel-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.crm-ts-status-line {
    margin: 0;
    font-size: 0.9rem;
}
.crm-ts-status-label {
    color: var(--crm-text-muted);
    margin-right: 8px;
}
.crm-ts-status-verify-hint {
    margin: 8px 0 0;
}

.crm-btn-verify-ts {
    border-color: var(--crm-accent);
}

/* details + .crm-card: у .crm-card flex-row — summary и таблица не должны стоять в две колонки */
.crm-ts-workspace-details.crm-card {
    display: block;
    padding: 0;
    overflow: hidden;
}

.crm-ts-workspace-details {
    margin-top: 20px;
}

.crm-ts-workspace-details > summary {
    list-style: none;
}

.crm-ts-workspace-summary {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    list-style: none;
    padding: 12px 14px;
    width: 100%;
    box-sizing: border-box;
}

.crm-ts-workspace-summary::-webkit-details-marker {
    display: none;
}

.crm-ts-workspace-details[open] .crm-ts-workspace-chevron {
    transform: rotate(90deg);
}

.crm-ts-workspace-chevron {
    transition: transform 0.15s ease;
    color: var(--crm-text-muted);
}

.crm-ts-workspace-summary-title {
    font-weight: 600;
}

.crm-ts-workspace-panel {
    padding: 0 14px 14px;
    width: 100%;
    box-sizing: border-box;
}

.crm-ts-workspace-panel .crm-table-wrap {
    width: 100%;
}

.crm-ts-workspace-table {
    width: 100%;
}

.crm-ts-workspace-filter {
    margin-bottom: 12px;
}

.crm-ts-workspace-date {
    display: block;
    font-size: 11px;
    margin-top: 2px;
}

.crm-ts-workspace-week-pill {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    border: 1px solid var(--crm-border);
    background: var(--crm-surface);
    color: var(--crm-text);
}

.crm-ts-workspace-week-pill--saved {
    border-color: rgba(46, 160, 67, 0.45);
    background: rgba(46, 160, 67, 0.12);
}

.crm-badge-ts-ok {
    background: rgba(46, 160, 67, 0.15);
    color: #3fb950;
}

.crm-badge-ts-warn {
    background: rgba(210, 153, 34, 0.15);
    color: #d29922;
}

.crm-badge-ts-muted {
    background: var(--crm-bg);
    color: var(--crm-text-muted);
}

.crm-ts-status-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}
.crm-club-ts-status-line {
    margin-top: 8px;
}
.crm-system-supply > .crm-system-header {
    background: rgba(22, 163, 74, 0.1);
    color: #16a34a;
}
.crm-card-section-inner {
    padding: 16px 18px;
    border-bottom: 1px solid var(--crm-border);
}
.crm-card-section-inner:last-child {
    border-bottom: none;
}
.crm-section-row-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}
.crm-section-row-header .crm-card-section-title {
    margin-bottom: 0;
}
.crm-period-links {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    font-size: 0.82rem;
}
.crm-message-compact {
    margin: 8px 0;
    padding: 6px 12px;
    font-size: 0.85rem;
}
.crm-text-muted-sm {
    font-size: 0.85rem;
    margin: 4px 0 0;
}

.crm-row-overdue td {
    background: rgba(255, 69, 58, 0.08);
}

.crm-order-send-section {
    margin-top: 24px;
}

.crm-order-send-form .crm-form-row-inline {
    align-items: flex-end;
}

.crm-lead-small {
    margin: 0 0 12px;
    font-size: 13px;
}

.crm-fot-dl {
    margin-bottom: 12px;
}

.crm-fot-over {
    color: var(--crm-error);
    font-weight: 600;
}

.crm-api-links {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.crm-api-links a {
    display: inline-block;
}

/* ??????????? ??????? (?????? ?) */
.crm-help {
    display: inline-flex;
    align-items: center;
    margin-left: 4px;
    color: var(--crm-text-muted);
    cursor: help;
    font-size: 0.95rem;
}

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

/* ????????-??? ??? */
.crm-fot-progress {
    height: 8px;
    background: var(--crm-bg);
    border-radius: 999px;
    overflow: hidden;
    margin: 12px 0;
    border: 1px solid var(--crm-border);
}

.crm-fot-progress-bar {
    height: 100%;
    border-radius: 999px;
    background: var(--crm-success);
    transition: width 0.2s ease;
}

.crm-fot-progress-bar.crm-fot-progress-over {
    background: var(--crm-error);
}

.crm-fot-pct-0 { width: 0%; }
.crm-fot-pct-10 { width: 10%; }
.crm-fot-pct-20 { width: 20%; }
.crm-fot-pct-30 { width: 30%; }
.crm-fot-pct-40 { width: 40%; }
.crm-fot-pct-50 { width: 50%; }
.crm-fot-pct-60 { width: 60%; }
.crm-fot-pct-70 { width: 70%; }
.crm-fot-pct-80 { width: 80%; }
.crm-fot-pct-90 { width: 90%; }
.crm-fot-pct-100 { width: 100%; }

/* ????????? ????? ???????? ? ?????? ?????? */
.crm-remainder-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 8px;
    vertical-align: middle;
}

.crm-remainder-dot-ok {
    background: var(--crm-success);
}

.crm-remainder-dot-missing {
    background: var(--crm-error);
}

/* ?????????? ????????? ? ?????? ???????? */
.crm-table tbody tr.crm-row-inactive {
    opacity: 0.65;
}

.crm-table tbody tr.crm-row-inactive td {
    color: var(--crm-text-muted);
}

.crm-icon-inactive {
    margin-left: 6px;
    font-size: 0.9rem;
    color: var(--crm-text-muted);
}

/* ?????? ??????????? ? ????? */
.crm-copy-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    padding: 0;
    margin-left: 4px;
    border: none;
    background: transparent;
    color: var(--crm-text-muted);
    border-radius: var(--crm-radius);
    cursor: pointer;
}

.crm-copy-btn:hover {
    color: var(--crm-accent);
    background: rgba(74, 158, 255, 0.12);
}

.crm-dashboard-widget {
    margin-bottom: 24px;
    padding: 16px 20px;
    background: var(--crm-bg);
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius);
}

.crm-widget-salary-debt-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 8px;
    font-size: 15px;
    font-weight: 600;
}

.crm-widget-salary-debt-icon {
    color: var(--crm-accent);
}

.crm-widget-salary-debt-value {
    margin: 0 0 8px;
    font-size: 22px;
    font-weight: 700;
    color: var(--crm-text);
}

.crm-widget-salary-debt-link {
    font-size: 13px;
    color: var(--crm-accent);
}

.crm-widget-salary-debt-link:hover {
    text-decoration: underline;
}

.crm-director-stats {
    margin-bottom: 24px;
}

.crm-director-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 16px;
}

.crm-director-stat-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px 16px;
    background: var(--crm-bg);
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius);
    text-decoration: none;
    color: var(--crm-text);
    transition: border-color 0.2s, background 0.2s;
}

.crm-director-stat-card:hover {
    border-color: var(--crm-accent);
    background: rgba(74, 158, 255, 0.08);
}

.crm-director-stat-value {
    display: block;
    font-size: 28px;
    font-weight: 700;
    line-height: 1.2;
    color: var(--crm-text);
}

.crm-director-stat-label {
    display: block;
    margin-top: 4px;
    font-size: 13px;
    color: var(--crm-text-muted);
}

.crm-dashboard-section-title {
    margin: 0 0 12px 0;
    font-size: 15px;
    font-weight: 600;
    color: var(--crm-text);
}

.crm-dashboard-section-title-compact {
    font-size: 0.88rem;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.crm-dashboard-intro {
    font-size: 0.85rem;
    margin-bottom: 14px;
    color: var(--crm-text-muted);
}

.crm-lead-compact {
    font-size: 0.82rem;
    line-height: 1.4;
    margin: 8px 0 12px;
    color: var(--crm-text-muted);
}

.crm-role-cabinet {
    margin-bottom: 18px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--crm-border);
}

.crm-role-cabinet-inline {
    padding: 10px 14px;
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius);
    background: rgba(0, 0, 0, 0.12);
}

.crm-role-inline-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--crm-accent, #4a9eff);
    text-decoration: none;
}

.crm-role-inline-link:hover {
    text-decoration: underline;
}

.crm-role-ops-strip {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 10px;
    margin-bottom: 12px;
}

.crm-role-ops-strip-director {
    margin-bottom: 10px;
}

.crm-manager-cabinet-orgs {
    margin-top: 4px;
}

.crm-role-ops-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    min-height: 40px;
    box-sizing: border-box;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
    text-decoration: none;
    color: var(--crm-text-muted);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--crm-border);
    transition: border-color 0.15s, background 0.15s;
}

.crm-role-ops-chip:hover {
    border-color: var(--crm-accent, #4a9eff);
    color: var(--crm-text);
}

.crm-role-ops-chip-accent {
    border-color: rgba(74, 158, 255, 0.45);
    color: var(--crm-accent, #4a9eff);
}

.crm-role-ops-chip-warn {
    border-color: rgba(234, 179, 8, 0.5);
    color: #eab308;
}

.crm-role-ops-chip-danger {
    border-color: rgba(220, 38, 38, 0.45);
    color: #f87171;
}

/* Подпись без ссылки (нет доступа к карточке организации) */
.crm-role-ops-chip.crm-role-ops-chip-text {
    cursor: default;
    opacity: 0.88;
}

.crm-role-ops-chip.crm-role-ops-chip-text:hover {
    border-color: var(--crm-border);
    color: var(--crm-text-muted);
}

.crm-role-ops-meta {
    font-size: 0.72rem;
    color: var(--crm-text-muted);
    margin-left: 4px;
}

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

.crm-director-stats-grid-compact .crm-director-stat-card {
    padding: 12px 14px;
}

.crm-director-stats-grid-compact .crm-director-stat-value {
    font-size: 1.35rem;
}

.crm-director-stats-grid-compact .crm-director-stat-label {
    font-size: 0.72rem;
}

.crm-quicklinks-grid-dense {
    grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
    gap: 8px;
}

.crm-quicklinks-grid-dense .crm-quicklink-card {
    padding: 12px 8px;
    font-size: 0.78rem;
    gap: 6px;
}

.crm-quicklinks-grid-dense .crm-quicklink-icon {
    font-size: 1.15rem;
}

.crm-ts-draft-banner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px 14px;
    padding: 10px 14px;
    margin-bottom: 12px;
    border-radius: var(--crm-radius);
    border: 1px solid rgba(234, 179, 8, 0.4);
    background: rgba(234, 179, 8, 0.1);
}

.crm-ts-draft-banner[hidden] {
    display: none !important;
}

.crm-ts-draft-banner-text {
    margin: 0;
    font-size: 0.82rem;
    line-height: 1.35;
    flex: 1 1 12rem;
}

.crm-ts-autosave-hint {
    margin: 0 0 10px;
    font-size: 0.72rem;
    line-height: 1.35;
    color: var(--crm-text-muted);
}

.crm-page-header-compact .crm-page-title {
    font-size: 1rem;
}

.crm-filter-bar-compact {
    gap: 6px 10px;
}

.crm-filter-bar-compact .crm-filter-link {
    padding: 5px 9px;
    font-size: 0.78rem;
}

.crm-dashboard-quicklinks {
    margin-bottom: 24px;
}

.crm-quicklinks-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
}

.crm-quicklink-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px 12px;
    background: var(--crm-bg);
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius);
    text-decoration: none;
    color: var(--crm-text);
    font-size: 14px;
    font-weight: 500;
    transition: border-color 0.2s, background 0.2s;
}

.crm-quicklink-card:hover {
    border-color: var(--crm-accent);
    background: rgba(74, 158, 255, 0.08);
}

.crm-quicklink-card.crm-quicklink-active {
    border-color: var(--crm-accent);
    background: rgba(74, 158, 255, 0.12);
    color: var(--crm-accent);
}

.crm-quicklink-icon {
    font-size: 24px;
    color: var(--crm-text-muted);
}

.crm-quicklink-card.crm-quicklink-active .crm-quicklink-icon {
    color: var(--crm-accent);
}

.crm-dashboard-customize {
    margin-top: 16px;
    margin-bottom: 0;
}

.crm-widget-customize-actions {
    margin-bottom: 10px;
}

.crm-search-results {
    margin-top: 20px;
}

.crm-search-section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 16px 0 8px;
    font-size: 15px;
    font-weight: 600;
}

.crm-search-section-title:first-child {
    margin-top: 0;
}

.crm-search-section-icon {
    color: var(--crm-accent);
}

.crm-search-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.crm-search-list li {
    padding: 6px 0;
    border-bottom: 1px solid var(--crm-border);
}

.crm-search-list li:last-child {
    border-bottom: none;
}

.crm-search-link {
    color: var(--crm-accent);
}

.crm-search-link:hover {
    text-decoration: underline;
}

.crm-search-material {
    color: var(--crm-text);
}

.crm-search-edit {
    margin-left: 8px;
    font-size: 13px;
}

.crm-card-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.crm-card {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 16px;
    background: var(--crm-bg);
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius);
    font-size: 13px;
}

.crm-card-icon {
    flex-shrink: 0;
    font-size: 1.15rem;
    color: var(--crm-accent);
    margin-top: 1px;
}

.crm-btn-small {
    padding: 4px 10px;
    font-size: 12px;
}

.crm-notifications {
    margin-top: 28px;
    padding-top: 20px;
    border-top: 1px solid var(--crm-border);
}

.crm-notifications-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 12px;
    font-size: 16px;
    font-weight: 600;
}

.crm-notifications-title-icon {
    font-size: 1.1rem;
    color: var(--crm-accent);
}

.crm-notifications-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.crm-notification-item {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: var(--crm-bg);
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius);
    margin-bottom: 8px;
    font-size: 13px;
}

.crm-notification-unread {
    border-left: 3px solid var(--crm-accent);
}

.crm-notification-item-title {
    flex: 1 1 100%;
}

.crm-notification-date {
    color: var(--crm-text-muted);
    font-size: 12px;
}

.crm-notification-form {
    margin: 0;
    margin-left: auto;
}

.crm-notifications-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 12px;
}

.crm-notifications-head .crm-notifications-title {
    margin: 0;
}

.crm-notifications-mark-all {
    margin: 0;
}

.crm-dashboard-tasks {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--crm-border);
}

.crm-dashboard-tasks-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 10px;
}

.crm-dashboard-tasks-list {
    list-style: none;
    margin: 0 0 10px;
    padding: 0;
}

.crm-dashboard-task-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    margin-bottom: 4px;
    background: var(--crm-bg);
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius);
    font-size: 13px;
}

.crm-dashboard-task-done {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius);
    background: var(--crm-surface);
    color: var(--crm-text-muted);
    cursor: pointer;
}

.crm-dashboard-task-done:hover {
    color: var(--crm-accent);
    border-color: var(--crm-accent);
}

.crm-dashboard-task-body {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.crm-dashboard-task-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.crm-dashboard-task-meta {
    font-size: 11px;
    color: var(--crm-text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.crm-dashboard-task-link {
    flex-shrink: 0;
    font-size: 12px;
    font-weight: 500;
    color: var(--crm-accent);
    text-decoration: none;
    white-space: nowrap;
}

.crm-dashboard-task-link:hover {
    text-decoration: underline;
}

.crm-dashboard-task-due {
    flex-shrink: 0;
    font-size: 11px;
    color: var(--crm-text-muted);
}

.crm-dashboard-task-empty {
    padding: 8px 0;
    font-size: 13px;
    color: var(--crm-text-muted);
    list-style: none;
}

.crm-dashboard-task-add {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.crm-dashboard-task-add-input {
    flex: 1 1 140px;
    min-width: 0;
    padding: 6px 10px;
    font-size: 13px;
}

.crm-dashboard-task-add-date {
    flex: 0 0 auto;
    width: 8.5rem;
    padding: 6px 8px;
    font-size: 13px;
}

.crm-nav-link-active {
    color: var(--crm-accent);
}

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

.crm-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 16px;
    background: var(--crm-surface);
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius);
    overflow: hidden;
}

.crm-table th,
.crm-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--crm-border);
}

.crm-table th {
    background: var(--crm-bg);
    font-weight: 600;
    font-size: 12px;
    color: var(--crm-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.crm-table tbody tr:last-child td {
    border-bottom: none;
}

.crm-table tbody tr:nth-child(even) {
    background: rgba(0, 0, 0, 0.15);
}

.crm-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.06);
}

.crm-table tbody tr:nth-child(even):hover {
    background: rgba(255, 255, 255, 0.08);
}

/* ?????????? ???????? (?? 3.6: ?????????? ? ???????, ? ?????? ? ??????, ????????? ? ???????) */
.crm-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 500;
}

.crm-status-badge::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

.crm-status-draft {
    color: var(--crm-text-muted);
    background: rgba(156, 163, 173, 0.2);
}

.crm-status-draft::before {
    background: var(--crm-text-muted);
}

.crm-status-sent {
    color: #eab308;
    background: rgba(234, 179, 8, 0.15);
}

.crm-status-sent::before {
    background: #eab308;
}

.crm-status-in_delivery {
    color: #f59e0b;
    background: rgba(245, 158, 11, 0.15);
}

.crm-status-in_delivery::before {
    background: #f59e0b;
}

.crm-status-current {
    color: var(--crm-accent);
    background: rgba(74, 158, 255, 0.15);
}

.crm-status-current::before {
    background: var(--crm-accent);
}

.crm-sessions-actions {
    margin-top: 16px;
}

.crm-compare-form {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 12px 20px;
    margin-bottom: 20px;
}

.crm-compare-form {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 12px 20px;
    margin-bottom: 24px;
}

.crm-compare-form .crm-filter-field .crm-label {
    margin-bottom: 0;
    white-space: nowrap;
}

.crm-compare-form .crm-label {
    display: inline;
    margin-bottom: 0;
}

.crm-help-sections {
    margin-top: 24px;
}

.crm-help-section-title {
    margin: 16px 0 8px;
    font-size: 15px;
    font-weight: 600;
}

.crm-help-section-title:first-child {
    margin-top: 0;
}

.crm-help-list {
    margin: 0 0 12px;
    padding-left: 20px;
}

.crm-help-list li {
    margin-bottom: 8px;
}

.crm-help-api {
    margin-top: 24px;
}

.crm-print-actions {
    margin-bottom: 12px;
}

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

.crm-list-hint {
    margin-top: 12px;
}

@media print {
    .crm-header,
    .crm-footer,
    .crm-breadcrumb,
    .crm-lead,
    .crm-print-actions,
    .crm-filter-bar,
    .crm-cell-actions,
    .crm-nav-toggle,
        .crm-no-print,
    form.crm-no-print {
        display: none !important;
    }
    .crm-body {
        background: #fff;
    }
    .crm-main {
        max-width: none;
    }
    .crm-table {
        border: 1px solid #333;
    }
    .crm-table th,
    .crm-table td {
        color: #000;
        border-color: #333;
    }
}

.crm-status-closed {
    color: var(--crm-success);
    background: rgba(52, 199, 89, 0.15);
}

.crm-status-closed::before {
    background: var(--crm-success);
}

.crm-status-partial {
    color: #f59e0b;
    background: rgba(245, 158, 11, 0.15);
}

.crm-status-partial::before {
    background: #f59e0b;
}

.crm-status-received {
    color: var(--crm-success);
    background: rgba(52, 199, 89, 0.15);
}

.crm-status-received::before {
    background: var(--crm-success);
}

.crm-status-critical {
    color: var(--crm-error);
}
.crm-status-critical::before {
    background: var(--crm-error);
}

/* ??????: ?????? ???? ??? (?? ?.1.3.2) */
.crm-order-row-below-nso td {
    background: rgba(239, 68, 68, 0.08);
}
.crm-cell-critical {
    white-space: nowrap;
}

/* Мой профиль: блок учётной записи (все роли) */
.crm-my-profile-account {
    margin-bottom: 28px;
}
.crm-my-profile-account .crm-subtitle {
    margin: 0 0 12px 0;
    font-size: 1rem;
    font-weight: 600;
}
.crm-my-profile-account-dl {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 8px 20px;
    margin: 0;
    max-width: 480px;
}
.crm-my-profile-account-dl dt {
    margin: 0;
    color: var(--crm-text-muted);
    font-weight: 500;
}
.crm-my-profile-account-dl dd {
    margin: 0;
}
.crm-my-profile-account-actions {
    list-style: none;
    padding: 0;
    margin: 16px 0 0 0;
    display: flex;
    flex-wrap: wrap;
    gap: 10px 14px;
    align-items: center;
}
.crm-my-profile-account-actions li {
    margin: 0;
}
.crm-my-profile-account-hint {
    margin-top: 12px;
    max-width: 560px;
}

/* ??? ??????? (?? ?.25): ???? ??????????????? ? ??????? ????????? */
.crm-my-profile-zones,
.crm-my-profile-misses {
    margin-bottom: 28px;
}
.crm-my-profile-zones .crm-subtitle,
.crm-my-profile-misses .crm-subtitle {
    margin: 0 0 12px 0;
    font-size: 1rem;
    font-weight: 600;
}
.crm-my-profile-club-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.crm-my-profile-club {
    margin-bottom: 16px;
    padding: 12px 0;
    border-bottom: 1px solid var(--crm-border);
}
.crm-my-profile-club:last-child {
    border-bottom: none;
}
.crm-my-profile-employees {
    list-style: none;
    padding-left: 20px;
    margin: 8px 0 0 0;
    font-size: 0.9375rem;
}
.crm-my-profile-employees li {
    margin-bottom: 4px;
}

/* ?????? ???????? ? ????? ???????? (?????? ? ?.?.) */
.crm-export-links {
    margin-left: 12px;
}
.crm-export-links .crm-action-link {
    width: auto;
    min-width: auto;
    height: auto;
    padding: 4px 10px;
}

/* ????????????: ?????? ??????????????/???????????? ? ? ????? ????? ? ?????????? ?????????? */
.crm-user-toggle-active-form {
    display: inline;
    margin-left: 8px;
}
.crm-user-toggle-active-form .crm-action-link-toggle {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 4px 12px;
    font-size: 13px;
    font-weight: 500;
    color: var(--crm-text);
    background: rgba(230, 232, 235, 0.12);
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius);
    cursor: pointer;
    transition: color 0.2s, background 0.2s, border-color 0.2s;
}
.crm-user-toggle-active-form .crm-action-link-toggle:hover {
    color: var(--crm-accent);
    background: rgba(74, 158, 255, 0.15);
    border-color: rgba(74, 158, 255, 0.4);
}
.crm-user-toggle-active-form .crm-action-link-toggle i {
    margin-right: 5px;
}

.crm-user-edit-dd-section {
    margin-top: 1.25rem;
}

.crm-user-create-role-panel--hidden {
    display: none;
}

.crm-dd-picks-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 8px 12px;
    margin-top: 0.5rem;
}

.crm-dd-pick-label {
    align-items: flex-start;
}

/* ??????? ???????? ? ??????? ? ?????? ???????? ?????? ????? ?? ?????? ???? */
.crm-cell-actions {
    white-space: nowrap;
    min-width: 140px;
}

.crm-cell-actions .crm-action-link,
.crm-cell-actions .crm-action-link-primary,
.crm-cell-actions .crm-action-link-success,
.crm-cell-actions .crm-action-link-toggle,
.crm-cell-actions button.crm-action-link {
    margin: 0 3px;
    vertical-align: middle;
}

.crm-cell-actions form.crm-inline-form {
    display: inline;
}

.crm-action-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
    padding: 0 6px;
    margin: 0 2px;
    color: var(--crm-accent);
    background: rgba(74, 158, 255, 0.15);
    border: 1px solid rgba(74, 158, 255, 0.35);
    border-radius: var(--crm-radius);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: color 0.2s, background 0.2s, border-color 0.2s;
}

.crm-action-link:hover {
    color: #fff;
    background: var(--crm-accent);
    border-color: var(--crm-accent);
}

.crm-action-link i {
    font-size: 1.1rem;
}

.crm-action-link-primary {
    width: auto;
    min-width: auto;
    padding: 4px 12px;
    color: var(--crm-accent);
    background: rgba(74, 158, 255, 0.2);
    border-color: rgba(74, 158, 255, 0.4);
}

.crm-action-link-primary:hover {
    color: #fff;
    background: var(--crm-accent);
    border-color: var(--crm-accent);
}

.crm-action-link-primary i {
    margin-right: 5px;
}

/* ??????? ???????? (? ????? ? ?.?.) ? ??????? ??????, ?????????????? ??????? ?????? */
.crm-action-link-danger {
    color: var(--crm-error);
    background: rgba(255, 69, 58, 0.2);
    border-color: rgba(255, 69, 58, 0.5);
}
.crm-action-link-danger:hover {
    color: #fff;
    background: var(--crm-error);
    border-color: var(--crm-error);
}

.crm-action-link-success {
    color: var(--crm-success);
    background: rgba(52, 199, 89, 0.18);
    border-color: rgba(52, 199, 89, 0.45);
}

.crm-action-link-success:hover {
    color: #fff;
    background: var(--crm-success);
    border-color: var(--crm-success);
}

/* ??????-?????? ? ???????? (button-????????, ?????? .crm-action-link) */
.crm-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
    padding: 0 6px;
    margin: 0 2px;
    background: rgba(74, 158, 255, 0.15);
    color: var(--crm-accent);
    border: 1px solid rgba(74, 158, 255, 0.35);
    border-radius: var(--crm-radius);
    font-size: 1.05rem;
    cursor: pointer;
    transition: color 0.2s, background 0.2s, border-color 0.2s;
    vertical-align: middle;
}
.crm-action-btn:hover {
    color: #fff;
    background: var(--crm-accent);
    border-color: var(--crm-accent);
}
.crm-action-btn-warn {
    color: #d97706;
    background: rgba(217, 119, 6, 0.15);
    border-color: rgba(217, 119, 6, 0.4);
}
.crm-action-btn-warn:hover {
    color: #fff;
    background: #d97706;
    border-color: #d97706;
}
.crm-action-btn-success {
    color: #16a34a;
    background: rgba(22, 163, 74, 0.15);
    border-color: rgba(22, 163, 74, 0.4);
}
.crm-action-btn-success:hover {
    color: #fff;
    background: #16a34a;
    border-color: #16a34a;
}
.crm-action-btn-danger {
    color: var(--crm-error);
    background: rgba(255, 69, 58, 0.15);
    border-color: rgba(255, 69, 58, 0.4);
}
.crm-action-btn-danger:hover {
    color: #fff;
    background: var(--crm-error);
    border-color: var(--crm-error);
}

/* ?????? ?????? ? ??????? (??? ??????????) */
.crm-link-strong {
    color: var(--crm-text);
    font-weight: 600;
    text-decoration: none;
}
.crm-link-strong:hover {
    color: var(--crm-accent);
    text-decoration: underline;
}

/* ???????? crm-btn ??? ???????/???????????????/???????? ???????? */
.crm-btn-warn {
    color: #d97706;
    border-color: rgba(217, 119, 6, 0.5);
    background: rgba(217, 119, 6, 0.1);
}
.crm-btn-warn:hover {
    color: #fff;
    background: #d97706;
    border-color: #d97706;
}
.crm-btn-success {
    color: #16a34a;
    border-color: rgba(22, 163, 74, 0.5);
    background: rgba(22, 163, 74, 0.1);
}
.crm-btn-success:hover {
    color: #fff;
    background: #16a34a;
    border-color: #16a34a;
}
.crm-btn-danger {
    color: var(--crm-error);
    border-color: rgba(255, 69, 58, 0.5);
    background: rgba(255, 69, 58, 0.1);
}
.crm-btn-danger:hover {
    color: #fff;
    background: var(--crm-error);
    border-color: var(--crm-error);
}

/* ?????? ?????? ???????? ??? ??????? ?????? */
.crm-card-section-first {
    border-top: none;
    padding-top: 0;
}

/* ?????? ?? ??????? (??????, ???????, ?????? ??????????, ?????? ????????) ? ? ???? ?????? */
.crm-filter-bar {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 8px 16px;
    margin-bottom: 20px;
}

.crm-filter-label {
    color: var(--crm-text-muted);
    font-size: 13px;
}

.crm-filter-link {
    color: var(--crm-text);
    text-decoration: none;
    font-size: 13px;
    padding: 4px 10px;
    border-radius: var(--crm-radius);
}

.crm-filter-link:hover {
    color: var(--crm-accent);
    background: rgba(74, 158, 255, 0.1);
}

.crm-filter-link-active {
    color: var(--crm-accent);
    font-weight: 600;
    background: rgba(74, 158, 255, 0.15);
}

/* ?????? ?? ???????? ????? */
.crm-login-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.crm-login-title-icon {
    font-size: 1.5rem;
    color: var(--crm-accent);
}

/* ????????? ??????: ??????? ???? ? ???? ???????, ??????? ?? ??? ?????? */
@media (max-width: 768px) {
    .crm-app-content {
        margin-left: 0 !important;
    }

    .crm-sidebar {
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.3);
    }

    body.crm-sidebar-closed .crm-sidebar {
        transform: translateX(-100%);
        width: 0;
        overflow: hidden;
    }

    body.crm-sidebar-closed .crm-app-content {
        margin-left: 0;
    }

    body.crm-sidebar-closed .crm-sidebar-group-title {
        display: block;
    }

    body.crm-sidebar-closed .crm-sidebar-link-label {
        display: inline;
    }

    body.crm-sidebar-closed .crm-sidebar-link {
        padding: 6px 16px;
        justify-content: flex-start;
    }

    body.crm-sidebar-closed .crm-sidebar-icon {
        margin-right: 8px;
        font-size: 1.05rem;
    }

    body.crm-sidebar-closed .crm-sidebar-group {
        margin-bottom: 12px;
    }

    .crm-header-inner {
        flex-wrap: wrap;
        align-items: center;
        padding: 8px 10px;
        gap: 8px;
        row-gap: 6px;
    }

    .crm-sidebar-toggle {
        order: 0;
        width: 36px;
        height: 36px;
        flex-shrink: 0;
    }

    .crm-logo {
        order: 1;
        font-size: 15px;
        gap: 6px;
        flex-shrink: 0;
    }

    .crm-logo-icon {
        font-size: 1.1em;
    }

    /* Верхнее меню: одна компактная строка со скроллом, подписи скрыты — только иконки */
    .crm-nav-top {
        order: 2;
        flex: 1 1 100%;
        min-width: 0;
        max-width: 100%;
        display: flex;
        flex-wrap: nowrap;
        align-items: center;
        gap: 4px;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
        padding-bottom: 2px;
    }

    .crm-nav-top::-webkit-scrollbar {
        height: 4px;
    }

    .crm-nav-top::-webkit-scrollbar-thumb {
        background: var(--crm-border);
        border-radius: 4px;
    }

    .crm-nav-top .crm-nav-link,
    .crm-nav-top .crm-nav-dropdown-trigger {
        flex-shrink: 0;
        padding: 6px 8px;
        font-size: 0;
        line-height: 0;
        gap: 0;
        white-space: nowrap;
    }

    .crm-nav-top .crm-nav-link .crm-nav-icon,
    .crm-nav-top .crm-nav-dropdown-trigger-icon {
        margin-right: 0;
        font-size: 1.05rem;
        line-height: 1;
        opacity: 1;
        vertical-align: middle;
    }

    .crm-nav-top .crm-nav-dropdown-trigger {
        gap: 2px;
    }

    .crm-nav-top .crm-nav-dropdown-chevron {
        font-size: 0.65rem;
        line-height: 1;
        margin-left: 1px;
    }

    .crm-nav-top .crm-nav-dropdown-wrap {
        flex-shrink: 0;
    }

    .crm-header-user {
        order: 3;
        margin-left: auto;
        flex-shrink: 0;
        gap: 6px;
        flex-wrap: nowrap;
        align-items: center;
        max-width: 100%;
    }

    /* Кнопки «Мой профиль», «Выход», AI — только иконка */
    .crm-header-user .crm-btn-ghost {
        padding: 6px 8px;
        font-size: 0;
        line-height: 0;
    }

    .crm-header-user .crm-btn-ghost .crm-btn-icon {
        margin-right: 0;
        font-size: 1.1rem;
        line-height: 1;
    }

    .crm-header-user .crm-ai-trigger {
        padding: 6px 8px;
        font-size: 0;
        line-height: 0;
    }

    .crm-header-user .crm-ai-trigger .crm-btn-icon {
        margin-right: 0;
        font-size: 1.1rem;
        line-height: 1;
    }

    .crm-header-user .crm-user-name {
        max-width: 7rem;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: 12px;
    }

    .crm-header-user .crm-role-switch-trigger {
        max-width: min(9rem, 36vw);
        padding: 5px 8px;
        font-size: 11px;
    }

    .crm-main {
        padding: 16px;
    }

    .crm-dashboard-content {
        padding: 16px;
    }

    .crm-page-title {
        font-size: 16px;
    }

    .crm-dashboard-content {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

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

    .crm-filter-bar {
        gap: 8px;
        flex-wrap: wrap;
    }

    .crm-filters-row,
    .crm-remainder-select-form,
    .crm-timesheet-history-form,
    .crm-compare-form,
    .crm-clubs-filter-form {
        flex-wrap: wrap;
    }

    .crm-page-header-clubs {
        flex-wrap: wrap;
        gap: 12px 16px;
    }

    .crm-page-header-clubs .crm-page-title {
        flex: 1 1 100%;
    }

    .crm-page-header-clubs-actions {
        width: 100%;
        margin-left: 0;
        flex-wrap: wrap;
        justify-content: flex-start;
        gap: 12px 16px;
    }

    .crm-clubs-filter-form {
        flex-wrap: wrap;
        row-gap: 10px;
    }

    .crm-clubs-filter-form .crm-select.crm-clubs-filter-select {
        width: 100%;
        min-width: 0;
        max-width: none;
    }

    .crm-clubs-filter-form .crm-clubs-filter-field {
        grid-template-columns: auto minmax(9rem, 1fr);
        flex: 1 1 12rem;
        min-width: 10rem;
    }

    .crm-clubs-filter-reset-slot {
        flex: 0 0 auto;
        min-width: 5.25rem;
    }

    .crm-page-toolbar {
        flex-wrap: wrap;
    }

    .crm-filter-link {
        padding: 6px 10px;
    }

    .crm-user-role {
        display: none;
    }

    .crm-login-page {
        padding: 16px;
    }

    .crm-login-card {
        padding: 24px;
    }

    /* Табель (редактирование): на узком экране не делаем .crm-dashboard-content горизонтальным scrollport —
       иначе position:sticky у блока шапки таблицы снова привязывается к карточке и «улетает». */
    .crm-page-timesheet .crm-dashboard-content {
        overflow-x: visible;
        overflow-y: visible;
    }
}

@media (max-width: 480px) {
    .crm-header-inner {
        padding: 6px 8px;
        gap: 6px;
    }

    .crm-logo {
        font-size: 14px;
    }

    .crm-sidebar-toggle {
        width: 34px;
        height: 34px;
    }

    .crm-nav-top .crm-nav-link,
    .crm-nav-top .crm-nav-dropdown-trigger {
        padding: 5px 6px;
    }

    .crm-nav-top .crm-nav-link .crm-nav-icon,
    .crm-nav-top .crm-nav-dropdown-trigger-icon {
        font-size: 1rem;
    }

    .crm-header-user {
        gap: 4px;
    }

    .crm-header-user .crm-user-name {
        display: none;
    }

    .crm-header-user .crm-role-switch-trigger {
        max-width: min(7.5rem, 32vw);
        padding: 4px 6px;
    }

    .crm-header-user .crm-btn-ghost,
    .crm-header-user .crm-ai-trigger {
        padding: 5px 6px;
    }

    .crm-main {
        padding: 12px;
    }

    .crm-dashboard-content {
        padding: 12px;
    }

    .crm-footer-inner {
        padding: 10px 16px;
    }

    .crm-table th,
    .crm-table td {
        padding: 10px 12px;
        font-size: 13px;
    }
}

/* === ????? ?????? (????????? ???????????) === */

/* ????????-???? ? ???????? ??????? */
.crm-manager-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 6px;
}

.crm-manager-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(10, 132, 255, 0.1);
    border: 1px solid rgba(10, 132, 255, 0.25);
    color: var(--crm-text);
    border-radius: 20px;
    padding: 4px 12px;
    font-size: 13px;
}

.crm-manager-tag-phone {
    color: var(--crm-text-muted);
    font-size: 12px;
}

/* ???? ?????????? */
.crm-employee-info-section {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.crm-employee-photo-block {
    flex-shrink: 0;
}

.crm-employee-photo {
    width: 120px;
    height: 120px;
    object-fit: cover;
    border-radius: 8px;
    border: 2px solid var(--crm-border);
    display: block;
}

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

.crm-employee-photo-preview {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.crm-employee-photo-thumb {
    width: 72px;
    height: 72px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid var(--crm-border);
}

.crm-employee-photo-clear {
    font-size: 13px;
    color: var(--crm-text-muted);
}

/* ???????? ???? */
.crm-input-file {
    display: block;
    padding: 6px 0;
    font-size: 14px;
    color: var(--crm-text);
}

/* ??????? ????? */
.crm-badge-danger {
    background: rgba(255, 59, 48, 0.15);
    color: #ff3b30;
}

/* ??????? */
.crm-mt-small {
    margin-top: 16px;
}

.crm-text-muted-sm {
    color: var(--crm-text-muted);
    font-size: 13px;
}

.crm-code-small {
    font-family: 'Courier New', Courier, monospace;
    font-size: 12px;
    background: rgba(255,255,255,0.05);
    padding: 2px 6px;
    border-radius: 4px;
    word-break: break-all;
}

.crm-card-section-title-sm {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--crm-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ????????? */
.crm-help-text {
    font-size: 12px;
    color: var(--crm-text-muted);
    margin-top: 4px;
}

/* ????? ??? ??????? */
.crm-table-zebra tbody tr:nth-child(even) {
    background: rgba(255,255,255,0.03);
}

/* ?????? ???????? ? ???????? ??????? */
.crm-period-links {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

/* Fieldset ????? */
.crm-fieldset {
    border: 1px solid var(--crm-border);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
}

.crm-fieldset-legend {
    font-size: 13px;
    font-weight: 600;
    color: var(--crm-text-muted);
    padding: 0 8px;
}

@media (max-width: 768px) {
    .crm-employee-info-section {
        flex-direction: column;
    }
    .crm-employee-photo {
        width: 80px;
        height: 80px;
    }
}

/* ============================================================
   Табель (редактирование): горизонтальный скролл + закрепление шапки
   ============================================================ */
/* Широкая таблица в .crm-timesheet-scroll-wrap; предков не делаем scrollport — иначе position:sticky
   привязывается к карточке, а не к окну (типично MacBook / планшет / @media overflow-x на карточке). */
.crm-page-timesheet .crm-main,
.crm-page-timesheet .crm-wrapper,
.crm-page-timesheet .crm-dashboard-content,
.crm-page-timesheet .crm-timesheet-edit-form,
.crm-page-timesheet .crm-ts-fin-split {
    overflow-x: visible;
    overflow-y: visible;
}
.crm-page-timesheet .crm-dashboard-content {
    overflow-x: visible !important;
    overflow-y: visible !important;
}
.crm-timesheet-scroll-wrap {
    overflow-x: auto;
    /* только горизонтальный скролл; overflow-y:hidden ломает position:sticky у thead при прокрутке страницы */
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
    margin: 16px 0;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    position: relative;
    cursor: grab;
}
.crm-timesheet-scroll-wrap.dragging {
    cursor: grabbing;
    user-select: none;
}
.crm-timesheet-scroll-wrap .crm-ts-scroll-tooltip {
    position: absolute;
    bottom: 5px;
    right: 5px;
    z-index: 20;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    line-height: 1.25;
    color: rgba(255, 255, 255, 0.95);
    background: rgba(0, 0, 0, 0.72);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.35s ease;
}
.crm-timesheet-scroll-wrap.crm-ts-scroll-hint-visible .crm-ts-scroll-tooltip {
    opacity: 1;
}
.crm-timesheet-scroll-wrap .crm-ts-scroll-hint {
    white-space: nowrap;
}
.crm-timesheet-scroll-wrap::-webkit-scrollbar {
    height: 8px;
}
.crm-timesheet-scroll-wrap::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.06);
    border-radius: 4px;
}
.crm-timesheet-scroll-wrap::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.28);
    border-radius: 4px;
}
.crm-timesheet-scroll-wrap::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.4);
}
.crm-timesheet-fin-table {
    /* Без класса .crm-table: у .crm-table overflow:hidden ломает position:sticky у thead */
    overflow: visible;
    margin-top: 0;
    border-radius: 0;
    background: transparent;
    border: none;
    min-width: 1600px;
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 12px;
}
/* Split: шапка в .crm-ts-fin-head-sticky (position:sticky к окну) — НЕ внутри overflow-x тела; два .crm-ts-fin-hsync
   синхронизируются по scrollLeft в timesheet-scroll.js. Иначе overflow-x:auto у scroll-wrap делает thead
   липким к внутреннему контейнеру → зазор сверху и наезд на строки. */
.crm-timesheet-edit-form {
    /* Фактическое значение выставляет timesheet-scroll.js по высоте .crm-header */
    --crm-ts-sticky-top: 60px;
}
@media (max-width: 1440px) {
    .crm-timesheet-edit-form {
        --crm-ts-sticky-top: 72px;
    }
}
@media (max-width: 768px) {
    .crm-timesheet-edit-form {
        --crm-ts-sticky-top: 96px;
    }
}
.crm-ts-fin-split {
    margin: 16px 0;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}
.crm-ts-fin-split .crm-timesheet-scroll-wrap {
    margin: 0;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}
.crm-ts-fin-head-sticky {
    position: -webkit-sticky;
    position: sticky;
    top: calc(var(--crm-ts-sticky-top, 60px) + env(safe-area-inset-top, 0px));
    z-index: 99;
    width: 100%;
    box-sizing: border-box;
    background: var(--bg-surface);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid var(--border-color);
    /* Safari: липкость не должна обрезаться внутренним overflow-x горизонтальной полосы */
    isolation: isolate;
}
.crm-ts-fin-hsync-head.crm-timesheet-scroll-wrap {
    border-radius: 6px 6px 0 0;
    border: 1px solid var(--border-color);
    border-bottom: none;
    scrollbar-width: none;
}
.crm-ts-fin-hsync-head.crm-timesheet-scroll-wrap::-webkit-scrollbar {
    height: 0;
}
.crm-ts-fin-hsync-body.crm-timesheet-scroll-wrap {
    border-radius: 0 0 6px 6px;
    border: 1px solid var(--border-color);
    border-top: none;
}
/* Две таблицы: одинаковая сетка через table-layout:fixed + colgroup (ширины выставляет timesheet-scroll.js) */
.crm-ts-fin-split .crm-timesheet-fin-table-head,
.crm-ts-fin-split .crm-timesheet-fin-table-body {
    table-layout: fixed;
    width: auto;
    min-width: 0;
}
/* thead только в верхней таблице — не sticky (липнет оболочка) */
.crm-timesheet-fin-table thead {
    position: static;
    top: auto;
    z-index: auto;
    box-shadow: none;
}
@media print {
    .crm-ts-fin-head-sticky {
        position: static;
        top: auto;
        box-shadow: none;
    }
    .crm-timesheet-fin-table thead {
        position: static;
    }
}
.crm-timesheet-fin-table th,
.crm-timesheet-fin-table td {
    padding: 5px 6px;
    border: 1px solid var(--border-color);
    white-space: nowrap;
    vertical-align: middle;
    text-align: right;
}
.crm-timesheet-fin-table th {
    background: var(--bg-surface);
    background-clip: padding-box;
    font-weight: 600;
    text-align: center;
    font-size: 11px;
    line-height: 1.3;
    text-transform: none;
    letter-spacing: normal;
    color: var(--crm-text);
}

/* Табель: просмотр (view=1) */
.crm-ts-view-card {
    border: 1px solid rgba(96, 165, 250, 0.25);
    background: linear-gradient(180deg, rgba(30, 41, 59, 0.92) 0%, rgba(17, 24, 39, 0.96) 100%);
}

.crm-ts-view-table {
    margin-top: 0;
    border-color: rgba(148, 163, 184, 0.28);
    table-layout: fixed;
}

.crm-ts-view-table thead th {
    background: rgba(30, 41, 59, 0.96);
    color: #dbeafe;
    border-bottom: 1px solid rgba(96, 165, 250, 0.25);
    font-size: 11px;
}

.crm-ts-view-table tbody tr:nth-child(even) {
    background: rgba(51, 65, 85, 0.35);
}

.crm-ts-view-table tbody tr:hover {
    background: rgba(59, 130, 246, 0.14);
}

.crm-ts-view-table tbody tr:nth-child(even):hover {
    background: rgba(59, 130, 246, 0.2);
}

.crm-ts-view-table td,
.crm-ts-view-table th {
    white-space: nowrap;
}

.crm-ts-view-col-person {
    min-width: 260px;
    white-space: normal !important;
    line-height: 1.35;
}

.crm-ts-view-col-num {
    text-align: center;
    min-width: 76px;
    color: #e2e8f0;
    font-weight: 600;
}

.crm-ts-view-col-money {
    text-align: right;
    min-width: 102px;
    font-variant-numeric: tabular-nums;
}

.crm-ts-view-col-payout {
    background: rgba(34, 197, 94, 0.12);
    color: #86efac;
    font-weight: 700;
}

.crm-ts-view-col-remain {
    background: rgba(59, 130, 246, 0.12);
    color: #93c5fd;
    font-weight: 700;
}

.crm-ts-view-table tfoot th {
    background: rgba(15, 23, 42, 0.92);
    color: #f8fafc;
    border-top: 2px solid rgba(96, 165, 250, 0.3);
}
/* Отдельная таблица шапки: под узкие колонки подписи могут переноситься — без налезания «К ВЫДАЧЕ» / «ОСТАТОК» */
.crm-timesheet-fin-table-head th {
    white-space: normal;
    overflow-wrap: break-word;
    hyphens: manual;
}
.crm-ts-col-name,
.crm-timesheet-fin-table td.crm-ts-name {
    text-align: left;
    min-width: 160px;
    max-width: 200px;
    white-space: normal;
}
.crm-ts-emp-inline {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 100%;
    white-space: nowrap;
}
.crm-ts-emp-deactivate-btn {
    min-width: 20px;
    height: 20px;
    padding: 0;
    margin: 0;
    font-size: 0.8rem;
    border-radius: 6px;
    flex: 0 0 auto;
}
.crm-ts-emp-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.crm-ts-role-badge,
.crm-ts-freelancer-badge {
    margin-left: 6px;
    font-size: 10px;
    vertical-align: middle;
}
.crm-ts-col-num,
.crm-timesheet-fin-table td.crm-ts-num {
    width: 32px;
    text-align: center;
    color: var(--text-muted);
}
.crm-ts-col-days,
.crm-ts-col-shifts,
.crm-timesheet-fin-table td.crm-ts-int {
    width: 48px;
    text-align: center;
}
.crm-ts-int-input {
    width: 44px !important;
    text-align: center;
    padding: 2px 4px !important;
}
.crm-ts-money-input {
    width: 72px !important;
    text-align: right;
    padding: 2px 4px !important;
}
.crm-ts-name-input {
    width: 130px !important;
    padding: 2px 6px !important;
}
/* заголовок группы колонок (Удержания и подзаголовки) — в стиле CRM */
.crm-ts-group-header {
    background: var(--crm-surface) !important;
    color: var(--crm-text) !important;
    border-color: var(--crm-border) !important;
}
.crm-ts-deductions {
    background: var(--crm-surface) !important;
    color: var(--crm-text) !important;
}
.crm-ts-sub {
    background: var(--crm-surface) !important;
    color: var(--crm-text-muted) !important;
    font-size: 10px;
}
.crm-ts-deduction {
    background: rgba(36, 40, 46, 0.5) !important;
}
/* К выдаче / Остаток — акценты в тёмной теме */
.crm-ts-topay {
    background: rgba(52, 199, 89, 0.12) !important;
    font-weight: 700;
    color: var(--crm-success);
}
.crm-ts-remainder {
    background: rgba(74, 158, 255, 0.12) !important;
    font-weight: 700;
    color: var(--crm-accent);
}
.crm-ts-highlight {
    background: rgba(52, 199, 89, 0.08) !important;
}
/* штраф */
.crm-ts-fine {
    background: rgba(255, 69, 58, 0.1) !important;
}
/* ???????? ?????? */
.crm-ts-totals td {
    background: var(--bg-surface) !important;
    font-weight: 700;
    border-top: 2px solid var(--border-color);
}
.crm-ts-totals-label {
    text-align: left !important;
    font-weight: 700;
    color: var(--text-main);
    padding-left: 10px !important;
}
.crm-ts-total-val {
    color: var(--text-main);
}
/* ?????? ????? */
.crm-ts-freelancer-label {
    font-style: italic;
    color: var(--text-muted);
}
/* колонка подписи (получил/расписался) */
.crm-ts-col-sign,
.crm-ts-sign {
    min-width: 100px;
    background: var(--crm-surface);
}
/* ?????? ??????? */
.crm-timesheet-row-freelancer td {
    background: rgba(99, 102, 241, 0.04);
}
/* ????? ???????? ? ??????? ???????? */
.crm-page-header-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}
.crm-page-header-row .crm-page-title {
    margin-bottom: 0;
    flex: 1;
}
/* ???? ?????????? ??????? ? ?????????? ?????? */
.crm-freelancer-fin-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px solid var(--border-color);
}
.crm-freelancer-fin-row:last-child {
    border-bottom: none;
}

/* ??? HR: ??????? ? ??????? ??????????????????????????????????????????? */
.crm-hr-dashboard {
    margin-bottom: 28px;
}

.crm-section-icon {
    margin-right: 8px;
    color: var(--crm-accent);
}

.crm-stat-card-green {
    border-left: 4px solid #2dbe6c !important;
}
.crm-stat-card-green:hover {
    background: rgba(45,190,108,0.08) !important;
}

.crm-stat-card-gray {
    border-left: 4px solid #8c9cb0 !important;
}
.crm-stat-card-gray:hover {
    background: rgba(140,156,176,0.08) !important;
}

.crm-stat-card-blue {
    border-left: 4px solid var(--crm-accent) !important;
}

.crm-hr-quick-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 16px;
}

/* ?????????? ?? ???????? ???????? */
.crm-hr-stats {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.crm-hr-stat-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 14px 24px;
    border-radius: var(--crm-radius);
    border: 1px solid var(--crm-border);
    background: var(--crm-bg);
    min-width: 110px;
}

.crm-hr-stat-card.crm-hr-stat-active {
    border-left: 4px solid #2dbe6c;
}
.crm-hr-stat-card.crm-hr-stat-inactive {
    border-left: 4px solid #8c9cb0;
}
.crm-hr-stat-card.crm-hr-stat-total {
    border-left: 4px solid var(--crm-accent);
}

.crm-hr-stat-num {
    font-size: 28px;
    font-weight: 700;
    line-height: 1.1;
    color: var(--crm-text);
}

.crm-hr-stat-label {
    font-size: 12px;
    color: var(--crm-text-muted);
    margin-top: 4px;
    text-align: center;
}

/* строка поиска + фильтры (Профили и др.) */
.crm-search-filter-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: stretch;
    margin-bottom: 16px;
    padding: 10px 14px;
    background: var(--crm-surface);
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius);
}

.crm-search-filter-row .crm-search-group {
    position: relative;
    flex: 1 1 260px;
    min-width: 0;
}

.crm-search-filter-row .crm-search-group .crm-search-input {
    padding-left: 36px;
    padding-right: 32px;
    width: 100%;
    height: 36px;
    box-sizing: border-box;
    border-color: var(--crm-border);
    background: var(--crm-bg);
}

.crm-search-filter-row .crm-search-group .crm-search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--crm-text-muted);
    pointer-events: none;
    font-size: 1rem;
}

.crm-search-filter-row .crm-search-group .crm-search-clear {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--crm-text-muted);
    text-decoration: none;
    font-size: 14px;
}

.crm-search-filter-row .crm-search-group .crm-search-clear:hover {
    color: var(--crm-error);
}

.crm-search-filter-row .crm-filter-select {
    flex: 0 1 200px;
    min-width: 160px;
    height: 36px;
    box-sizing: border-box;
    padding: 0 32px 0 12px;
    border-color: var(--crm-border);
    background: var(--crm-bg);
    color: var(--crm-text);
    font-size: 14px;
}

.crm-search-filter-row .crm-btn {
    flex-shrink: 0;
    height: 36px;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 14px;
}

.crm-profiles-bulk-add {
    margin-top: 14px;
}

.crm-profiles-bulk-add-summary {
    list-style: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px 12px;
    margin: -4px -6px 0;
    padding: 8px 10px;
    border: 1px solid var(--crm-border);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.14);
}

.crm-profiles-bulk-add-summary::-webkit-details-marker {
    display: none;
}

.crm-profiles-bulk-add-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--crm-text);
}

.crm-profiles-bulk-add-hint {
    margin-left: auto;
    font-size: 12px;
    color: var(--crm-text-muted);
}

.crm-profiles-bulk-add-chevron {
    font-size: 13px;
    color: var(--crm-text-muted);
    transition: transform 0.18s ease;
}

.crm-profiles-bulk-add[open] .crm-profiles-bulk-add-chevron {
    transform: rotate(180deg);
}

.crm-profiles-bulk-add-panel {
    margin-top: 10px;
    padding-top: 8px;
}

.crm-bulk-employee-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.crm-bulk-employee-top {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.crm-bulk-employee-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 220px;
    flex: 1 1 280px;
}

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

.crm-bulk-employee-textarea {
    min-height: 86px;
    resize: vertical;
}

.crm-bulk-employee-table td {
    vertical-align: middle;
}

.crm-bulk-employee-table .crm-input {
    width: 100%;
}

.crm-bulk-employee-official {
    min-width: 120px;
    text-align: center;
}

.crm-bulk-employee-checkbox {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--crm-text);
}

.crm-search-group {
    position: relative;
    flex: 1 1 220px;
}

.crm-search-group .crm-search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--crm-text-muted);
    pointer-events: none;
}

.crm-search-group .crm-search-input {
    padding-left: 32px;
    width: 100%;
}

.crm-search-clear {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--crm-text-muted);
    text-decoration: none;
    font-size: 14px;
}

.crm-search-clear:hover {
    color: var(--crm-error);
}

.crm-filter-select {
    flex: 0 1 220px;
    min-width: 140px;
}

/* ??????? ??????????? */
.crm-table-meta {
    font-size: 13px;
    color: var(--crm-text-muted);
    margin-bottom: 8px;
}

/* ?????? ????????? */
.crm-empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--crm-text-muted);
}

.crm-empty-icon {
    font-size: 48px;
    display: block;
    margin-bottom: 12px;
    opacity: 0.4;
}

.crm-empty-state p {
    margin-bottom: 12px;
    font-size: 15px;
}

/* Финансы: кабинет организаций (сетка + метрики) */
.crm-finance-cabinet {
    margin-top: 8px;
    margin-bottom: 24px;
    padding: 16px 18px 20px;
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius);
    background: var(--crm-surface, rgba(255, 255, 255, 0.03));
}

.crm-finance-cabinet-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px 20px;
    margin-bottom: 10px;
}

.crm-finance-cabinet-head .crm-card-section-title {
    margin-bottom: 0;
}

.crm-finance-cabinet-metrics {
    display: flex;
    flex-wrap: wrap;
    gap: 14px 22px;
    font-size: 0.875rem;
    color: var(--crm-text-muted);
}

.crm-finance-cabinet-metric-val {
    display: inline-block;
    margin-right: 4px;
    font-weight: 700;
    font-size: 1rem;
    color: var(--crm-text);
}

.crm-finance-cabinet-metric-label {
    font-weight: 400;
}

.crm-finance-cabinet-hint {
    margin-top: 0;
    margin-bottom: 14px;
}

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

.crm-finance-org-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 14px 16px;
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius);
    background: rgba(0, 0, 0, 0.12);
    text-decoration: none;
    color: inherit;
    transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

a.crm-finance-org-card:hover {
    border-color: var(--crm-accent, #4a9eff);
    background: rgba(74, 158, 255, 0.08);
}

.crm-finance-org-card--active {
    border-color: var(--crm-accent, #4a9eff);
    box-shadow: 0 0 0 1px var(--crm-accent, #4a9eff);
    background: rgba(74, 158, 255, 0.1);
}

.crm-finance-org-card--all .crm-finance-org-card-title {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 1rem;
}

.crm-finance-org-card-icon {
    font-size: 1.1rem;
    opacity: 0.85;
}

.crm-finance-org-card-sub {
    font-size: 0.8125rem;
    color: var(--crm-text-muted);
    line-height: 1.4;
}

.crm-finance-org-card-total {
    font-size: 0.875rem;
    color: var(--crm-text);
    line-height: 1.35;
}

.crm-finance-org-card-total strong {
    font-weight: 700;
}

.crm-finance-cabinet-metric--balance .crm-finance-cabinet-metric-label {
    display: inline;
}

.crm-finance-org-card-badge {
    align-self: flex-start;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 3px 8px;
    border-radius: 6px;
    background: rgba(74, 158, 255, 0.2);
    color: var(--crm-accent, #4a9eff);
}

.crm-finance-org-card-badge--on {
    margin-top: 2px;
}

.crm-finance-org-card-top {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 12px;
}

.crm-finance-org-card-title-link {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--crm-text);
    text-decoration: none;
}

.crm-finance-org-card-title-link:hover {
    color: var(--crm-accent, #4a9eff);
    text-decoration: underline;
}

.crm-finance-org-card-tag {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 3px 8px;
    border-radius: 6px;
    white-space: nowrap;
}

.crm-finance-org-card-tag--ok {
    background: rgba(46, 160, 67, 0.18);
    color: #6ecf8a;
}

.crm-finance-org-card-tag--off {
    background: rgba(255, 255, 255, 0.06);
    color: var(--crm-text-muted);
}

.crm-finance-org-card-tag--stale {
    background: rgba(220, 53, 69, 0.18);
    color: #ff8e99;
}

.crm-finance-org-card-dl {
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.8125rem;
}

.crm-finance-org-card-dl-row {
    display: grid;
    grid-template-columns: minmax(0, 42%) 1fr;
    gap: 8px 12px;
    align-items: baseline;
}

.crm-finance-org-card-dl-row dt {
    margin: 0;
    font-weight: 500;
    color: var(--crm-text-muted);
}

.crm-finance-org-card-dl-row dd {
    margin: 0;
    text-align: right;
    word-break: break-word;
}

.crm-finance-org-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 4px;
    padding-top: 10px;
    border-top: 1px solid var(--crm-border);
}

@media (max-width: 520px) {
    .crm-finance-cabinet-grid {
        grid-template-columns: 1fr;
    }

    .crm-finance-org-card-dl-row {
        grid-template-columns: 1fr;
    }

    .crm-finance-org-card-dl-row dd {
        text-align: left;
    }
}

/* Финансы: выписки и аналитика */
.crm-finance-workspace-section {
    margin-top: 20px;
    margin-bottom: 8px;
    padding-top: 0;
    padding-bottom: 4px;
}

.crm-finance-org-select-row {
    margin-bottom: 16px;
}

.crm-finance-org-select-field {
    max-width: 420px;
}

.crm-finance-org-hint {
    margin-top: 8px;
    max-width: 720px;
}

.crm-finance-workspace-panel {
    margin-top: 8px;
    padding: 20px;
    border-radius: 12px;
    border: 1px solid var(--crm-border);
    background: rgba(255, 255, 255, 0.03);
}

.crm-finance-workspace-panel-head {
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--crm-border);
}

.crm-finance-workspace-title {
    margin: 0 0 8px;
    font-size: 18px;
    font-weight: 600;
}

.crm-finance-workspace-meta {
    margin: 0 0 8px;
    font-size: 14px;
    color: var(--crm-text-muted);
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}

.crm-finance-workspace-balance {
    color: var(--crm-text);
    font-weight: 600;
}

.crm-finance-workspace-links {
    margin: 0;
    font-size: 14px;
}

.crm-finance-workspace-placeholder {
    margin: 12px 0 0;
    padding: 16px;
    border-radius: 10px;
    border: 1px dashed var(--crm-border);
}

.crm-finance-imports-details {
    margin-top: 20px;
}

.crm-finance-orgs-collapsible .crm-finance-orgs-details {
    margin-top: 0;
    padding: 14px 16px 16px;
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius);
    background: var(--crm-surface);
}

.crm-tochka-callback-url .crm-code-block {
    display: block;
    padding: 12px 14px;
    margin: 8px 0 0;
    font-size: 13px;
    word-break: break-all;
    border-radius: 8px;
    border: 1px solid var(--crm-border);
    background: rgba(0, 0, 0, 0.2);
}

.crm-tochka-token-ta {
    font-family: ui-monospace, monospace;
    font-size: 12px;
    width: 100%;
    max-width: 100%;
    min-height: 4rem;
}

.crm-tochka-oauth-pre {
    margin-top: 12px;
    padding: 12px;
    font-size: 12px;
    overflow-x: auto;
    border-radius: 8px;
    border: 1px solid var(--crm-border);
    background: rgba(0, 0, 0, 0.2);
    white-space: pre-wrap;
    word-break: break-word;
}

.crm-finance-section {
    margin-top: 28px;
    padding-top: 20px;
    border-top: 1px solid var(--crm-border);
}

.crm-finance-section:first-of-type {
    border-top: none;
    padding-top: 0;
    margin-top: 16px;
}

.crm-finance-refresh-form {
    margin: 12px 0 16px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}

.crm-finance-balance-wrap {
    margin-top: 8px;
}

.crm-finance-balance-chart {
    margin: 16px 0 20px;
    padding: 14px 16px;
    border-radius: var(--crm-radius);
    border: 1px solid var(--crm-border);
    background: rgba(0, 0, 0, 0.14);
}

.crm-finance-balance-chart-title {
    margin: 0 0 6px;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--crm-text);
}

.crm-finance-balance-chart-hint {
    margin-top: 0;
    margin-bottom: 12px;
}

.crm-finance-balance-chart-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px 12px;
}

.crm-finance-balance-chart-item {
    display: grid;
    grid-template-columns: minmax(5rem, 11rem) 1fr minmax(6.5rem, auto);
    gap: 8px 12px;
    align-items: center;
}

@media (max-width: 640px) {
    .crm-finance-balance-chart-item {
        grid-template-columns: 1fr;
        gap: 6px;
    }

    .crm-finance-balance-chart-value {
        justify-self: start;
    }
}

.crm-finance-balance-chart-name {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--crm-accent, #4a9eff);
    text-decoration: none;
    line-height: 1.3;
    word-break: break-word;
}

.crm-finance-balance-chart-name:hover {
    text-decoration: underline;
}

.crm-finance-balance-chart-bar-wrap {
    min-width: 0;
    height: 14px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--crm-border);
    overflow: hidden;
}

.crm-finance-balance-chart-svg {
    display: block;
    width: 100%;
    height: 14px;
    vertical-align: top;
}

.crm-finance-balance-chart-rect {
    fill: rgba(74, 158, 255, 0.85);
}

.crm-finance-balance-chart-rect--neg {
    fill: rgba(248, 113, 113, 0.9);
}

.crm-finance-balance-chart-value {
    font-size: 0.8rem;
    font-weight: 600;
    text-align: right;
    white-space: nowrap;
    color: var(--crm-text);
}

.crm-finance-balance-amount {
    font-weight: 600;
}

.crm-finance-cell-muted {
    font-size: 12px;
    word-break: break-all;
}

/* Якорь после «Показать»: не уезжает под липкую шапку CRM */
#crm-finance-analytics {
    scroll-margin-top: 5.5rem;
}

.crm-finance-filter-form {
    margin: 12px 0;
}

.crm-finance-filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: flex-end;
}

.crm-finance-filter-submit .crm-label-spacer {
    visibility: hidden;
}

.crm-finance-period-caption {
    font-size: 14px;
    color: var(--crm-text-muted);
    margin-bottom: 16px;
}

.crm-finance-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.crm-finance-stat {
    padding: 16px;
    border-radius: 10px;
    border: 1px solid var(--crm-border);
    background: rgba(255, 255, 255, 0.02);
}

.crm-finance-stat-income {
    border-color: rgba(52, 199, 89, 0.35);
}

.crm-finance-stat-income .crm-finance-stat-line {
    color: #34c759;
}

.crm-finance-stat-expense {
    border-color: rgba(255, 69, 58, 0.35);
}

.crm-finance-stat-expense .crm-finance-stat-line {
    color: #ff453a;
}

.crm-finance-stat-line {
    margin: 0 0 8px;
    font-size: 15px;
}

.crm-finance-stat-sub {
    margin: 0 0 12px;
    font-size: 13px;
    color: var(--crm-text-muted);
}

.crm-finance-details {
    margin-top: 8px;
}

.crm-finance-details-summary {
    cursor: pointer;
    font-size: 14px;
    color: var(--crm-text-muted);
    padding: 6px 0;
}

.crm-finance-cat-groups {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 12px;
}

.crm-finance-cat-group {
    border-radius: 8px;
    border: 1px solid var(--crm-border);
    background: rgba(255, 255, 255, 0.02);
    overflow: hidden;
}

.crm-finance-cat-group--in {
    border-color: rgba(52, 199, 89, 0.25);
}

.crm-finance-cat-group--out {
    border-color: rgba(255, 69, 58, 0.25);
}

.crm-finance-cat-group-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px 16px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--crm-border);
}

.crm-finance-cat-group-title {
    font-weight: 600;
    font-size: 14px;
    color: var(--crm-text);
}

.crm-finance-cat-group-meta {
    font-size: 13px;
    color: var(--crm-text-muted);
    white-space: nowrap;
}

.crm-finance-cat-group-meta strong {
    color: var(--crm-text);
}

.crm-finance-cat-sub-wrap {
    padding: 0 8px 8px;
}

.crm-finance-cat-sub-wrap .crm-finance-cat-table {
    margin-top: 4px;
}

.crm-finance-tx-pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 16px;
    margin-bottom: 12px;
}

.crm-finance-tx-pagination--bottom {
    margin-top: 16px;
    margin-bottom: 0;
}

.crm-finance-tx-pageinfo {
    font-size: 13px;
    color: var(--crm-text-muted);
}

.crm-finance-cat-table th,
.crm-finance-cat-table td {
    font-size: 13px;
}

.crm-finance-tx-wrap {
    overflow-x: auto;
}

.crm-finance-tx-purpose {
    max-width: 280px;
    white-space: normal;
    word-break: break-word;
    font-size: 13px;
    line-height: 1.35;
}

.crm-finance-tx-credit {
    color: #34c759;
}

.crm-finance-tx-debit {
    color: #ff453a;
}

.crm-finance-line-form {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 180px;
}

.crm-input-compact,
.crm-select-compact {
    padding: 6px 8px;
    font-size: 13px;
}

.crm-btn-tiny {
    padding: 4px 10px;
    font-size: 12px;
    align-self: flex-start;
}

.crm-finance-tx-category {
    display: block;
    font-size: 13px;
}

.crm-finance-stmt-lead {
    font-size: 15px;
    margin: 0 0 8px;
    color: var(--crm-text);
}

.crm-finance-stmt-form {
    margin-top: 12px;
}

.crm-finance-stmt-row {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: flex-end;
}

.crm-finance-stmt-account {
    flex: 1 1 200px;
    min-width: 180px;
}

.crm-finance-stmt-submit .crm-label-spacer {
    visibility: hidden;
}

@media (max-width: 768px) {
    .crm-finance-stmt-row .crm-form-group {
        flex: 1 1 100%;
    }
}

.crm-finance-stmt-block {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--crm-border, rgba(255, 255, 255, 0.08));
}

.crm-finance-stmt-block:last-of-type {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.crm-finance-stmt-subtitle {
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 8px;
    color: var(--crm-text);
}

/* Табель: подсказка об ограничении сводных сумм */
.crm-timesheet-scope-hint {
    font-size: 13px;
    margin: 0 0 16px;
    max-width: 720px;
}

/* Настройки: доступ к меню по ролям */
.crm-menu-access-intro {
    font-size: 13px;
    color: var(--crm-text-muted);
    max-width: 900px;
    margin: 0 0 20px;
    line-height: 1.5;
}
.crm-menu-access-role-card {
    margin-bottom: 24px;
    padding: 20px 22px;
}
.crm-menu-access-role-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 10px 14px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--crm-border);
}
.crm-menu-access-role-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}
.crm-menu-access-role-code {
    font-size: 12px;
    color: var(--crm-text-muted);
}
.crm-menu-access-badge {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(99, 179, 237, 0.15);
    color: var(--crm-text);
}
.crm-menu-access-badge-muted {
    background: var(--crm-sidebar-bg);
    color: var(--crm-text-muted);
}
.crm-menu-access-check-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 10px 16px;
}
.crm-menu-access-check {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 13px;
    cursor: pointer;
    line-height: 1.35;
}
.crm-menu-access-check input {
    margin-top: 3px;
    flex-shrink: 0;
}
.crm-menu-access-check-label {
    color: var(--crm-text);
}
.crm-menu-access-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 18px;
}
.crm-menu-access-reset-form {
    margin-top: 12px;
}
.crm-menu-access-form .crm-fieldset {
    margin-top: 0;
}

.crm-club-list-meta {
    margin-top: 4px;
    display: grid;
    gap: 2px;
}

.crm-club-list-meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 12px;
    line-height: 1.3;
}

.crm-club-list-meta-label {
    color: var(--crm-text-muted);
    white-space: nowrap;
}

.crm-club-list-meta-value {
    color: var(--crm-text);
    min-width: 0;
}

.crm-club-employees-col {
    white-space: nowrap;
}

.crm-club-employees-cell {
    vertical-align: top;
    white-space: nowrap;
}

.crm-club-employees-total {
    display: block;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.crm-club-employees-breakdown {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 10px;
    margin-top: 4px;
    font-size: 12px;
    line-height: 1.3;
}

.crm-club-employees-part {
    font-variant-numeric: tabular-nums;
}

.crm-club-employees-official {
    color: var(--crm-success, #3dd68c);
}

.crm-club-employees-unofficial {
    color: var(--crm-text-muted);
}

/* Карточка организации: сводка, оповещения, гистограммы (ширина столбиков — классы .crm-org-histo-w*) */
.crm-org-histo-w0 { width: 0%; }
.crm-org-histo-w5 { width: 5%; }
.crm-org-histo-w10 { width: 10%; }
.crm-org-histo-w15 { width: 15%; }
.crm-org-histo-w20 { width: 20%; }
.crm-org-histo-w25 { width: 25%; }
.crm-org-histo-w30 { width: 30%; }
.crm-org-histo-w35 { width: 35%; }
.crm-org-histo-w40 { width: 40%; }
.crm-org-histo-w45 { width: 45%; }
.crm-org-histo-w50 { width: 50%; }
.crm-org-histo-w55 { width: 55%; }
.crm-org-histo-w60 { width: 60%; }
.crm-org-histo-w65 { width: 65%; }
.crm-org-histo-w70 { width: 70%; }
.crm-org-histo-w75 { width: 75%; }
.crm-org-histo-w80 { width: 80%; }
.crm-org-histo-w85 { width: 85%; }
.crm-org-histo-w90 { width: 90%; }
.crm-org-histo-w95 { width: 95%; }
.crm-org-histo-w100 { width: 100%; }

.crm-org-alert-strip {
    margin: 0 0 20px;
    padding: 12px 14px;
    background: var(--crm-surface);
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius);
}
.crm-org-alert-strip-inner {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 12px;
    align-items: stretch;
}
.crm-org-alert-chip {
    border-radius: 10px;
    font-size: 13px;
    line-height: 1.35;
    border: 1px solid transparent;
    min-width: 0;
}
.crm-org-alert-chip-link,
.crm-org-alert-chip-static {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 8px 12px;
    text-decoration: none;
    color: inherit;
    border-radius: inherit;
}
.crm-org-alert-chip-link:hover {
    text-decoration: none;
    filter: brightness(1.03);
}
.crm-org-alert-chip--danger {
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.35);
    color: #b91c1c;
}
.crm-org-alert-chip--warn {
    background: rgba(234, 179, 8, 0.14);
    border-color: rgba(202, 138, 4, 0.35);
    color: #a16207;
}
.crm-org-alert-chip--ok {
    background: rgba(34, 197, 94, 0.1);
    border-color: rgba(22, 163, 74, 0.3);
    color: #166534;
}
.crm-org-alert-icon {
    flex-shrink: 0;
    margin-top: 2px;
    font-size: 1rem;
}

.crm-org-cabinet-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px 20px;
    margin-bottom: 24px;
}
.crm-org-cabinet-block {
    margin-bottom: 0;
}
.crm-org-cabinet-block--actions,
.crm-org-cabinet-block--links {
    grid-column: 1 / -1;
}
.crm-org-cabinet-block-body {
    padding: 14px 18px 16px;
}
.crm-org-metric-table {
    width: 100%;
}
.crm-org-metric-table th,
.crm-org-metric-table td {
    vertical-align: top;
}
.crm-org-metric-detail {
    font-size: 12px;
    max-width: 420px;
}
.crm-org-forecast-line {
    margin: 14px 0 0;
    font-size: 13px;
    line-height: 1.45;
    color: var(--crm-text);
}
.crm-org-forecast-icon {
    margin-right: 6px;
    color: var(--crm-text-muted);
}
.crm-org-meta-line {
    margin: 10px 0 0;
    font-size: 12px;
}

.crm-org-histo-title {
    margin: 0 0 10px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--crm-text-muted);
}
.crm-org-histo-title--second {
    margin-top: 18px;
}
.crm-org-histo {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.crm-org-histo-row {
    display: grid;
    grid-template-columns: minmax(72px, 88px) minmax(0, 1fr) minmax(88px, auto);
    gap: 10px 12px;
    align-items: center;
    font-size: 13px;
}
.crm-org-histo-row--dual {
    grid-template-columns: minmax(72px, 88px) minmax(0, 1fr);
    align-items: start;
}
.crm-org-histo-label {
    color: var(--crm-text-muted);
    font-size: 12px;
    word-break: break-word;
}
.crm-org-histo-label .crm-link {
    font-weight: 500;
}
.crm-org-histo-track {
    height: 10px;
    border-radius: 6px;
    background: var(--crm-sidebar-bg);
    overflow: hidden;
    min-width: 0;
}
.crm-org-histo-fill {
    display: block;
    height: 100%;
    border-radius: 6px;
    min-width: 0;
    transition: width 0.2s ease;
}
.crm-org-histo-fill--invoice {
    background: linear-gradient(90deg, #6366f1, #818cf8);
}
.crm-org-histo-fill--in {
    background: linear-gradient(90deg, #059669, #34d399);
}
.crm-org-histo-fill--out {
    background: linear-gradient(90deg, #dc2626, #f87171);
}
.crm-org-histo-fill--debt {
    background: linear-gradient(90deg, #d97706, #fbbf24);
}
.crm-org-histo-val {
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    font-size: 12px;
}
.crm-org-histo-val--small {
    font-size: 11px;
    color: var(--crm-text-muted);
}

.crm-org-histo-dual-tracks {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}
.crm-org-histo-track-wrap {
    display: grid;
    grid-template-columns: 52px minmax(0, 1fr) minmax(64px, auto);
    gap: 8px 10px;
    align-items: center;
}
.crm-org-histo-legend {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--crm-text-muted);
}
.crm-org-histo-legend--in {
    color: #059669;
}
.crm-org-histo-legend--out {
    color: #b91c1c;
}

.crm-org-progress-wrap {
    margin-top: 14px;
}
.crm-org-progress-label {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--crm-text-muted);
    margin-bottom: 6px;
}
.crm-org-progress-track {
    height: 8px;
    border-radius: 999px;
    background: var(--crm-sidebar-bg);
    overflow: hidden;
}
.crm-org-progress-fill {
    display: block;
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, #0ea5e9, #6366f1);
    min-width: 0;
}

.crm-org-actions-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 12px;
    align-items: center;
}
.crm-org-quicklinks {
    margin: 0;
    padding-left: 1.1rem;
    font-size: 14px;
    line-height: 1.65;
}
.crm-org-quicklinks li {
    margin: 0;
}

@media (max-width: 960px) {
    .crm-org-cabinet-grid {
        grid-template-columns: 1fr;
    }
    .crm-org-histo-row {
        grid-template-columns: minmax(64px, 76px) minmax(0, 1fr);
        grid-template-rows: auto auto;
    }
    .crm-org-histo-val {
        grid-column: 1 / -1;
        text-align: left;
    }
    .crm-org-histo-track-wrap {
        grid-template-columns: 48px minmax(0, 1fr) minmax(56px, auto);
    }
}

/* Финансы: вкладочный рабочий центр */
.crm-fin-tabs {
    margin-top: 16px;
}
.crm-fin-tabs-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}
.crm-fin-tab-btn {
    border: 1px solid var(--crm-border);
    background: var(--crm-surface);
    color: var(--crm-text);
    border-radius: 10px;
    padding: 8px 12px;
    font-size: 13px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.crm-fin-tab-btn.is-active {
    border-color: var(--crm-accent);
    background: rgba(99, 179, 237, 0.16);
}
.crm-fin-tab-btn i {
    opacity: 0.9;
}
.crm-fin-tabs-body {
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius);
    background: var(--crm-surface);
    padding: 14px 16px;
    position: relative;
}
.crm-fin-tabs-body.is-loading {
    opacity: 0.55;
    pointer-events: none;
}
.crm-fin-tab-panel .crm-card-section-title {
    margin-top: 0;
}

.crm-fin-sync-1c-form {
    margin: 0 0 10px;
}

.crm-fin-sync-1c-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 16px;
}

.crm-fin-sync-1c-check {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.82rem;
    color: var(--crm-text-muted);
    cursor: pointer;
}

.crm-fin-sync-1c-check input {
    margin: 0;
}

.crm-fin-kpi-strip {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 8px 10px;
    margin: 10px 0 12px;
}
.crm-fin-kpi-item {
    border: 1px solid var(--crm-border);
    border-radius: 10px;
    background: var(--crm-sidebar-bg);
    padding: 8px 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.crm-fin-kpi-item span {
    font-size: 11px;
    color: var(--crm-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.crm-fin-kpi-item strong {
    font-size: 14px;
    font-variant-numeric: tabular-nums;
}
.crm-fin-kpi-item--paid-split .crm-fin-kpi-sub {
    font-size: 11px;
    color: var(--crm-text-muted);
    text-transform: none;
    letter-spacing: 0;
    line-height: 1.35;
}
.crm-fin-paid-split {
    display: block;
    font-size: 11px;
    margin-top: 2px;
    line-height: 1.3;
}
.crm-fin-tab-panel .crm-table-wrap {
    border: 1px solid var(--crm-border);
    border-radius: 10px;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    background: var(--crm-surface);
}
.crm-fin-tab-panel .crm-table-compact thead th {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--crm-text-muted);
    background: rgba(255, 255, 255, 0.02);
}
.crm-fin-tab-panel .crm-table-compact tbody tr:hover {
    background: rgba(99, 179, 237, 0.08);
}
.crm-fin-tab-panel .crm-cell-actions {
    white-space: normal;
    min-width: 180px;
}
.crm-fin-tab-panel .crm-action-link,
.crm-fin-tab-panel .crm-inline-form {
    margin-right: 8px;
}
.crm-fin-tab-panel .crm-inline-form:last-child {
    margin-right: 0;
}
.crm-fin-org-group {
    margin-top: 14px;
}
.crm-fin-org-title {
    margin: 0 0 4px;
    font-size: 15px;
}
.crm-fin-org-summary {
    margin: 0 0 8px;
    color: var(--crm-text-muted);
    font-size: 13px;
}
.crm-fin-mark-form {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-right: 8px;
    margin-bottom: 6px;
}
.crm-fin-mark-amount {
    width: 92px;
    min-width: 0;
    height: 30px;
    font-size: 12px;
}
.crm-fin-org-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin: 0 0 10px;
}
.crm-fin-bulk-form {
    margin: 0;
}
.crm-fin-payout-cell-form {
    margin: 0;
}
.crm-fin-payout-cell-widget {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    max-width: 100%;
}
.crm-fin-payout-cell-widget.is-saved .crm-fin-payout-cell-form {
    display: none;
}
.crm-fin-payout-cell-widget:not(.is-saved) .crm-fin-payout-saved {
    display: none;
}
.crm-fin-payout-saved {
    display: inline-flex;
    align-items: center;
    gap: 3px;
}
.crm-fin-payout-badge {
    display: inline-block;
    padding: 2px 7px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.25;
    background: #e8f5e9;
    color: #1b5e20;
    border: 1px solid #81c784;
    white-space: nowrap;
}
.crm-fin-payout-cell-inner {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    justify-content: flex-end;
}
.crm-btn-icon-only {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    min-width: 28px;
    padding: 0;
    margin: 0;
}
.crm-btn-icon-only .bi {
    margin: 0;
    font-size: 14px;
    line-height: 1;
}
.crm-fin-payout-amount.crm-fin-mark-amount {
    width: 72px;
    min-width: 72px;
    height: 28px;
    font-size: 11px;
    padding: 2px 6px;
}
.crm-fin-salary-advance-table .crm-fin-payout-cell {
    padding-top: 4px;
    padding-bottom: 4px;
}
.crm-fin-due-fot-cell {
    vertical-align: middle;
    white-space: normal !important;
}
.crm-fin-due-fot-stack {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 3px;
    min-width: 6.5rem;
}
.crm-fin-due-line,
.crm-fin-fot-line {
    display: block;
    width: 100%;
    text-align: right;
    white-space: nowrap;
    line-height: 1.25;
}
.crm-fin-due-main {
    font-size: inherit;
}
.crm-fin-fot-line {
    font-size: 10px;
    font-weight: 500;
    color: var(--crm-text-muted);
    letter-spacing: 0.01em;
}
.crm-fin-fot-label {
    margin-right: 4px;
    opacity: 0.9;
}
.crm-fin-fot-value {
    font-variant-numeric: tabular-nums;
}
.crm-table-wrap--fin-salary-advance {
    overflow-x: auto;
}
.crm-fin-salary-advance-table th,
.crm-fin-salary-advance-table td {
    white-space: nowrap;
}
.crm-fin-penalty-form {
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--crm-border);
}
.crm-fin-multiselect {
    min-height: 120px;
}
/* Табель /timesheet/: компактная шапка */
.crm-timesheet-dashboard .crm-page-header {
    margin-bottom: 6px;
}
.crm-timesheet-page-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 8px 12px;
}
.crm-timesheet-open-form.crm-remainder-select-form {
    margin-bottom: 0;
    gap: 8px 12px;
    flex-wrap: wrap;
    align-items: flex-end;
}
.crm-timesheet-open-form .crm-filter-field .crm-label {
    font-size: 0.78rem;
}
.crm-timesheet-print-actions {
    margin: 0;
}
.crm-timesheet-dashboard .crm-page-title {
    margin-bottom: 4px;
}
.crm-timesheet-dashboard .crm-lead-compact {
    margin-top: 0;
    margin-bottom: 6px;
    font-size: 0.82rem;
    line-height: 1.35;
}
.crm-timesheet-dashboard .crm-table th,
.crm-timesheet-dashboard .crm-table td {
    padding: 6px 8px;
    font-size: 0.82rem;
}

/* Парсер вставки табеля из Excel */
.crm-ts-paste-details.crm-card {
    display: block;
    padding: 0;
    margin: 6px 0 10px;
    overflow: hidden;
}
.crm-ts-paste-details > summary {
    list-style: none;
}
.crm-ts-paste-details > summary::-webkit-details-marker {
    display: none;
}
.crm-ts-paste-summary {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    cursor: pointer;
    user-select: none;
}
.crm-ts-paste-summary:hover {
    background: rgba(255, 255, 255, 0.04);
}
.crm-ts-paste-chevron {
    flex-shrink: 0;
    font-size: 0.85rem;
    opacity: 0.75;
    transition: transform 0.15s ease;
}
.crm-ts-paste-details[open] .crm-ts-paste-chevron {
    transform: rotate(90deg);
}
.crm-ts-paste-summary-text {
    display: flex;
    flex-direction: column;
    gap: 1px;
    align-items: flex-start;
    min-width: 0;
}
.crm-ts-paste-summary-title {
    font-size: 0.9rem;
    font-weight: 600;
}
.crm-ts-paste-summary-hint {
    font-size: 0.7rem;
    line-height: 1.25;
}
.crm-ts-paste-panel {
    padding: 10px 12px 12px;
    border-top: 1px solid var(--crm-border);
}
.crm-ts-paste-textarea {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.78rem;
    line-height: 1.35;
    min-height: 120px;
    resize: vertical;
}
.crm-ts-paste-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 8px 0 10px;
}
.crm-ts-paste-map-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 8px 12px;
    margin-bottom: 10px;
}
.crm-ts-paste-map-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.crm-ts-paste-map-label {
    font-size: 0.75rem;
    margin: 0;
}
.crm-ts-paste-map-select[multiple] {
    min-height: 72px;
}
.crm-ts-paste-status {
    font-size: 0.82rem;
    margin: 6px 0;
    min-height: 1.2em;
}
.crm-ts-paste-status--ok {
    color: #6ecf8a;
}
.crm-ts-paste-status--warn {
    color: #e8c468;
}
.crm-ts-paste-status--error {
    color: #ff8e99;
}
.crm-ts-paste-preview-wrap {
    margin-top: 10px;
}
.crm-ts-paste-preview-row--miss td {
    opacity: 0.85;
    background: rgba(220, 53, 69, 0.08);
}
.crm-ts-paste-filters {
    margin-bottom: 8px;
}
.crm-ts-paste-header-flag {
    align-self: flex-end;
}

/* Массовые штрафы: сворачиваемый блок + одна строка полей */
.crm-ts-penalty-bulk-details.crm-card {
    display: block;
    padding: 0;
}

.crm-ts-penalty-bulk-details {
    margin: 6px 0 10px;
    padding: 0;
    overflow: hidden;
}
.crm-ts-penalty-bulk-details > summary {
    list-style: none;
}
.crm-ts-penalty-bulk-details > summary::-webkit-details-marker {
    display: none;
}
.crm-ts-penalty-bulk-summary {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    cursor: pointer;
    user-select: none;
}
.crm-ts-penalty-bulk-summary:hover {
    background: rgba(255, 255, 255, 0.04);
}
.crm-ts-penalty-bulk-chevron {
    flex-shrink: 0;
    font-size: 0.85rem;
    opacity: 0.75;
    transition: transform 0.15s ease;
}
.crm-ts-penalty-bulk-details[open] .crm-ts-penalty-bulk-chevron {
    transform: rotate(90deg);
}
.crm-ts-penalty-bulk-summary-text {
    display: flex;
    flex-direction: column;
    gap: 1px;
    align-items: flex-start;
    min-width: 0;
}
.crm-ts-penalty-bulk-summary-title {
    font-size: 0.9rem;
    font-weight: 600;
}
.crm-ts-penalty-bulk-summary-hint {
    font-size: 0.7rem;
    line-height: 1.25;
}
.crm-ts-penalty-bulk-panel {
    padding: 8px 12px 10px;
    border-top: 1px solid var(--crm-border);
}
.crm-ts-penalty-bulk-form {
    margin: 0;
}
.crm-ts-penalty-bulk-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 8px 10px;
}
.crm-ts-penalty-field {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.crm-ts-penalty-field .crm-label {
    margin: 0;
    font-size: 0.72rem;
    white-space: nowrap;
}
.crm-ts-penalty-field--period {
    flex: 0 0 118px;
    width: 118px;
}
.crm-ts-penalty-field--amount {
    flex: 0 0 88px;
    width: 88px;
}
.crm-ts-penalty-field--reason {
    flex: 1 1 140px;
    min-width: 100px;
}
.crm-ts-penalty-field--clubs {
    flex: 1 1 160px;
    min-width: 120px;
}
.crm-ts-penalty-field--submit {
    flex: 0 0 auto;
    align-items: stretch;
}
.crm-ts-penalty-submit-spacer {
    display: block;
    height: 0.72rem;
    line-height: 1;
}
select.crm-ts-penalty-clubs.crm-fin-multiselect {
    min-height: 0;
    max-height: 68px;
    padding: 4px 6px;
    font-size: 0.75rem;
    line-height: 1.25;
}
.crm-ts-penalty-bulk-note {
    margin: 4px 0 0;
    font-size: 0.68rem;
    line-height: 1.3;
}
.crm-ts-week-nav-card {
    margin-bottom: 14px;
}
.crm-ts-week-nav-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}
a.crm-ts-week-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 0.82rem;
    text-decoration: none;
    border: 1px solid var(--crm-border, rgba(255, 255, 255, 0.12));
    color: var(--crm-text);
    background: rgba(255, 255, 255, 0.04);
}
a.crm-ts-week-pill:hover {
    border-color: var(--crm-accent, #6ea8fe);
    color: var(--crm-text);
}
a.crm-ts-week-pill-active {
    border-color: var(--crm-accent, #6ea8fe);
    background: rgba(110, 168, 254, 0.12);
}
a.crm-ts-week-pill-done:not(.crm-ts-week-pill-active) {
    opacity: 0.85;
}
a.crm-ts-week-pill-verified:not(.crm-ts-week-pill-active) {
    border-color: rgba(104, 211, 145, 0.55);
    background: rgba(104, 211, 145, 0.12);
}
a.crm-ts-week-pill-month {
    font-weight: 600;
    margin-left: 2px;
}
a.crm-ts-week-pill-month:not(.crm-ts-week-pill-active) {
    border-style: dashed;
}
.crm-ts-week-verified-mark {
    color: #68d391;
}
.crm-ts-workspace-week-pill--verified {
    border-color: rgba(104, 211, 145, 0.55);
    background: rgba(104, 211, 145, 0.12);
    color: #68d391;
}
.crm-ts-week-done-mark {
    font-size: 0.75rem;
}
.crm-ts-week-month-hint {
    display: block;
    margin-top: 4px;
    font-size: 0.68rem;
    color: var(--crm-text-muted, rgba(255, 255, 255, 0.55));
}

.crm-ts-col-shift-calendar-head {
    min-width: 200px;
    text-align: center;
    vertical-align: middle;
}
.crm-ts-shift-calendar-cell {
    vertical-align: top;
    padding: 8px 8px;
    min-width: 260px;
    max-width: 400px;
}
.crm-ts-week-shift-picker {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.crm-ts-shift-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    justify-content: space-between;
}
.crm-ts-shift-toolbar .crm-ts-shift-mode-row {
    flex: 0 0 auto;
}
.crm-ts-week-legend {
    margin: 0;
    flex: 1 1 160px;
    min-width: 0;
    font-size: 0.61rem;
    line-height: 1.35;
    color: var(--crm-text-muted, rgba(255, 255, 255, 0.5));
}
.crm-ts-shift-mode-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}
.crm-ts-mode-btn-active.crm-ts-mode-btn-day {
    border-color: rgba(110, 168, 254, 0.82);
    background: rgba(110, 168, 254, 0.22);
    color: var(--crm-text);
}
.crm-ts-mode-btn-active.crm-ts-mode-btn-night {
    border-color: rgba(186, 104, 200, 0.82);
    background: rgba(186, 104, 200, 0.24);
    color: var(--crm-text);
}
.crm-ts-mode-btn-active:not(.crm-ts-mode-btn-day):not(.crm-ts-mode-btn-night) {
    border-color: var(--crm-accent, #6ea8fe);
    background: rgba(110, 168, 254, 0.15);
    color: var(--crm-text);
}
.crm-ts-week-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: flex-start;
}
.crm-ts-week-strip-readonly .crm-ts-cal-cell {
    cursor: default;
}
.crm-ts-cal-cell {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    padding: 3px 2px;
    border-radius: 8px;
    border: 1px solid var(--crm-border, rgba(255, 255, 255, 0.12));
    background: rgba(255, 255, 255, 0.03);
    font-size: 0.72rem;
    line-height: 1.15;
    cursor: pointer;
    color: var(--crm-text);
    position: relative;
    overflow: hidden;
    isolation: isolate;
}
.crm-ts-cal-cell:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}
.crm-ts-cal-out {
    opacity: 0.4;
}
.crm-ts-cal-dow {
    font-size: 0.65rem;
    color: var(--crm-text-muted, rgba(255, 255, 255, 0.55));
    position: relative;
    z-index: 2;
}
.crm-ts-cal-dom {
    font-weight: 600;
    position: relative;
    z-index: 2;
}
.crm-ts-cal-empty:not(:disabled):hover {
    border-color: var(--crm-accent, #6ea8fe);
}
.crm-ts-cal-day {
    background: rgba(110, 168, 254, 0.25);
    border-color: rgba(110, 168, 254, 0.55);
}
/* Ночная смена с D: утро следующего дня (верхняя половина ячейки) */
.crm-ts-cal-ne::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    height: 50%;
    background: linear-gradient(
        180deg,
        rgba(176, 100, 210, 0.5) 0%,
        rgba(157, 90, 200, 0.2) 100%
    );
    border-radius: 7px 7px 0 0;
    z-index: 1;
    pointer-events: none;
}
/* Ночная смена с D: вечер этого дня (нижняя половина ячейки) */
.crm-ts-cal-ns::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 50%;
    background: linear-gradient(
        180deg,
        rgba(186, 104, 200, 0.18) 0%,
        rgba(186, 104, 200, 0.48) 100%
    );
    border-radius: 0 0 7px 7px;
    z-index: 1;
    pointer-events: none;
}
.crm-ts-cal-cell.crm-ts-cal-ns,
.crm-ts-cal-cell.crm-ts-cal-ne {
    border-color: rgba(186, 104, 200, 0.45);
}
.crm-ts-cal-muted {
    opacity: 0.55;
}
.crm-ts-legacy-hint-wrap {
    padding: 6px 8px;
    border-radius: 6px;
    border: 1px solid rgba(240, 173, 78, 0.35);
    background: rgba(240, 173, 78, 0.08);
}
.crm-ts-legacy-hint {
    margin: 0;
    font-size: 0.66rem;
    line-height: 1.35;
    color: var(--crm-warn, #f0ad4e);
}
.crm-ts-shift-summary {
    margin: 0;
    font-size: 0.72rem;
    color: var(--crm-text-muted, rgba(255, 255, 255, 0.55));
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding-top: 2px;
}
.crm-ts-shift-summary-row .crm-ts-shift-summary-caption {
    margin: 0 0 4px;
}
.crm-ts-shift-summary-caption {
    margin: 0;
    font-size: 0.64rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: rgba(230, 235, 250, 0.68);
}
.crm-ts-week-stats-preserve-note {
    margin: 0;
    order: 3;
    font-size: 0.61rem;
    line-height: 1.38;
    color: rgba(240, 200, 120, 0.85);
    padding: 4px 7px;
    border-radius: 5px;
    border: 1px dashed rgba(240, 200, 120, 0.32);
    background: rgba(240, 200, 120, 0.05);
}
.crm-ts-week-stats-preserve-note[hidden] {
    display: none !important;
}
.crm-ts-shift-summary-row {
    order: 1;
}
.crm-ts-shift-summary-cards {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 5px;
    align-items: stretch;
}
.crm-ts-stat-hint-mini {
    display: block;
    margin: 4px 0 0;
    font-size: 0.52rem;
    font-weight: 400;
    line-height: 1.25;
    opacity: 0.72;
    color: inherit;
}
.crm-ts-stat-day .crm-ts-stat-hint-mini {
    color: rgba(170, 200, 255, 0.75);
}
.crm-ts-stat-night .crm-ts-stat-hint-mini {
    color: rgba(220, 175, 245, 0.75);
}
.crm-ts-stat-cal .crm-ts-stat-hint-mini {
    color: rgba(200, 210, 225, 0.65);
}
.crm-ts-summary-sep,
.crm-ts-summary-sep-inner {
    color: rgba(255, 255, 255, 0.28);
    user-select: none;
}
.crm-ts-stat {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    padding: 6px 7px;
    border-radius: 6px;
    border: 1px solid transparent;
    box-sizing: border-box;
    min-height: 0;
}
.crm-ts-stat-day {
    background: rgba(110, 168, 254, 0.12);
    border-color: rgba(110, 168, 254, 0.35);
}
.crm-ts-stat-night {
    background: rgba(186, 104, 200, 0.12);
    border-color: rgba(186, 104, 200, 0.38);
}
.crm-ts-stat-cal {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.12);
}
.crm-ts-stat-label {
    font-size: 0.6rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    opacity: 0.88;
}
.crm-ts-stat-day .crm-ts-stat-label {
    color: rgba(130, 185, 255, 0.95);
}
.crm-ts-stat-night .crm-ts-stat-label {
    color: rgba(220, 175, 245, 0.95);
}
.crm-ts-stat-cal .crm-ts-stat-label {
    color: rgba(200, 210, 230, 0.88);
}
.crm-ts-stat-num {
    margin-top: 2px;
    font-size: 0.94rem;
    font-weight: 700;
    line-height: 1.15;
    color: var(--crm-text);
    font-variant-numeric: tabular-nums;
}
.crm-ts-shift-summary-month-wrap {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px;
    padding-top: 6px;
    margin-top: 1px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 0.67rem;
    order: 2;
}
.crm-ts-shift-summary-month-inline {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 10px;
    width: 100%;
}
.crm-ts-shift-summary-month-heading {
    font-weight: 600;
    font-size: 0.62rem;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    opacity: 0.75;
    color: rgba(235, 240, 255, 0.66);
    margin-right: 4px;
}
.crm-ts-shift-summary-month-hint-meta {
    width: auto;
    flex: 1 1 auto;
    font-size: 0.56rem;
    opacity: 0.58;
    color: rgba(200, 210, 235, 0.7);
}
.crm-ts-shift-summary-month-label {
    color: rgba(255, 255, 255, 0.45);
    margin-right: 2px;
}
.crm-ts-stat-month-shift {
    color: rgba(130, 185, 255, 0.92);
    font-weight: 500;
}
.crm-ts-stat-month-shift strong {
    color: rgba(160, 205, 255, 1);
    font-weight: 700;
}
.crm-ts-stat-month-day {
    color: rgba(200, 175, 235, 0.9);
    font-weight: 500;
}
.crm-ts-stat-month-day strong {
    color: rgba(225, 195, 250, 1);
    font-weight: 700;
}
.crm-ts-shift-summary .crm-ts-week-month-hint {
    display: inline;
    margin-top: 0;
}

/* ── Месячный календарь день/ночь ─────────────────────────────────── */
.crm-ts-month-shift-picker,
.crm-ts-month-shift-readonly {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.crm-ts-month-grid {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.crm-ts-month-dow-row {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    margin-bottom: 2px;
}

.crm-ts-month-dow {
    text-align: center;
    font-size: 0.6rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: rgba(200, 210, 230, 0.65);
    padding: 2px 0;
}

.crm-ts-month-week-row {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.crm-ts-month-cell {
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
}

.crm-ts-month-grid-readonly .crm-ts-month-cell {
    cursor: default;
}

.crm-ts-month-calendar-cell {
    min-width: 280px;
    vertical-align: top;
    padding: 6px 8px;
}

.crm-settings-guide-card {
    margin-bottom: 14px;
}
.crm-settings-guide-list {
    margin: 0;
    padding-left: 18px;
}
.crm-settings-guide-list li {
    margin: 0 0 8px;
    color: var(--crm-text);
}
@media (max-width: 540px) {
    .crm-ts-shift-summary-cards {
        grid-template-columns: 1fr;
    }
    .crm-ts-shift-summary-month-wrap .crm-ts-stat-month-shift,
    .crm-ts-shift-summary-month-wrap .crm-ts-stat-month-day {
        flex: 1 1 auto;
    }
}

@media (max-width: 900px) {
    .crm-fin-tabs-body {
        padding: 10px 10px;
    }
    .crm-fin-tab-panel .crm-table-compact th,
    .crm-fin-tab-panel .crm-table-compact td {
        padding: 6px 8px;
        font-size: 12px;
    }
    .crm-fin-mark-form {
        display: flex;
        width: 100%;
        margin-right: 0;
    }
    .crm-fin-mark-amount {
        width: 78px;
    }
    .crm-fin-kpi-strip {
        grid-template-columns: 1fr 1fr;
    }
    .crm-fin-tab-btn {
        width: 100%;
        justify-content: flex-start;
    }
    .crm-fin-tab-panel .crm-cell-actions {
        min-width: 140px;
    }
    .crm-ts-penalty-field--period,
    .crm-ts-penalty-field--amount,
    .crm-ts-penalty-field--reason,
    .crm-ts-penalty-field--clubs,
    .crm-ts-penalty-field--submit {
        flex: 1 1 100%;
        width: 100%;
    }
    select.crm-ts-penalty-clubs.crm-fin-multiselect {
        max-height: 100px;
    }
}

/* Персональный ассистент — полная ширина контента, компактная сетка */
.crm-main--assistant {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 8px clamp(6px, 1.5vw, 14px) 16px;
    box-sizing: border-box;
}

.crm-assistant-shell {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

.crm-assistant-header {
    margin-bottom: 10px;
}

.crm-assistant-title {
    margin-bottom: 4px;
    font-size: 1.1rem;
}

.crm-assistant-lead {
    margin: 0;
    font-size: 0.8rem;
    line-height: 1.4;
    color: var(--crm-text-muted);
    max-width: 72ch;
}

/* Сетка: календарь+доска слева | чат (высокий) | форма+push */
.crm-assistant-cal-column {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.crm-assistant-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    align-items: start;
    width: 100%;
    min-width: 0;
}

@media (min-width: 900px) and (max-width: 1199px) {
    .crm-assistant-layout {
        grid-template-columns: minmax(220px, min(360px, 42vw)) minmax(0, 1fr);
        grid-template-rows: auto auto;
        gap: 10px 12px;
    }
    .crm-assistant-cal-column {
        grid-column: 1;
        grid-row: 1 / -1;
        align-self: start;
    }
    .crm-assistant-mid {
        grid-column: 2;
        grid-row: 1;
    }
    .crm-assistant-sidebar {
        grid-column: 2;
        grid-row: 2;
    }
}

@media (min-width: 1200px) {
    .crm-assistant-layout {
        grid-template-columns: minmax(280px, min(400px, 28vw)) minmax(0, 1fr) minmax(220px, 300px);
        gap: 12px 14px;
        align-items: start;
    }
}

.crm-assistant-pane--chat,
.crm-assistant-cal-panel,
.crm-assistant-kanban-panel,
.crm-assistant-create,
.crm-assistant-push-panel {
    background: var(--crm-surface, #1a1d24);
    border: 1px solid var(--crm-border, rgba(255, 255, 255, 0.08));
    border-radius: var(--crm-radius, 8px);
    padding: 10px 12px;
    min-width: 0;
}

.crm-assistant-mid {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
    min-height: 0;
}

.crm-assistant-pane--chat {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    height: min(68vh, calc(100dvh - 11.5rem));
    max-height: min(68vh, calc(100dvh - 11.5rem));
    min-height: 18rem;
    overflow: hidden;
    box-sizing: border-box;
    padding-bottom: 10px;
}

@media (min-width: 900px) {
    .crm-assistant-pane--chat {
        height: min(76vh, calc(100dvh - 9.5rem));
        max-height: min(76vh, calc(100dvh - 9.5rem));
    }
}

.crm-assistant-chat-head {
    flex-shrink: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 12px;
    margin-bottom: 6px;
}

.crm-assistant-chat-head .crm-assistant-section-title {
    margin-bottom: 0;
}

.crm-assistant-chat-layout {
    display: flex;
    flex: 1 1 auto;
    min-height: 0;
    gap: 0;
    overflow: hidden;
    border-top: 1px solid var(--crm-border, rgba(255, 255, 255, 0.08));
    margin-top: 6px;
    padding-top: 8px;
}

.crm-assistant-chat-main {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    min-height: 0;
    gap: 8px;
}

.crm-assistant-chat-sessions {
    width: min(240px, 34%);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    min-height: 0;
    border-left: 1px solid var(--crm-border, rgba(255, 255, 255, 0.08));
    margin: -8px -12px -10px 0;
    padding: 0 0 0 8px;
    background: rgba(0, 0, 0, 0.12);
}

.crm-assistant-chat-sessions-head {
    flex-shrink: 0;
    padding: 4px 8px 8px 4px;
    border-bottom: 1px solid var(--crm-border, rgba(255, 255, 255, 0.08));
}

.crm-assistant-chat-sessions-title {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--crm-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.crm-assistant-chat-sessions-list {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 6px 4px 6px 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.crm-assistant-chat-session-btn {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    width: 100%;
    padding: 8px 10px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    color: inherit;
    text-align: left;
    cursor: pointer;
    font: inherit;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.crm-assistant-chat-session-btn:hover {
    background: rgba(255, 255, 255, 0.06);
}

.crm-assistant-chat-session-btn--active {
    background: rgba(30, 111, 223, 0.14);
    border-color: var(--crm-border, rgba(255, 255, 255, 0.12));
}

.crm-assistant-chat-session-title {
    font-size: 0.8125rem;
    font-weight: 500;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

.crm-assistant-chat-session-meta {
    font-size: 0.68rem;
    color: var(--crm-text-muted);
    line-height: 1.3;
}

.crm-assistant-chat-session-badge {
    font-size: 0.62rem;
    font-weight: 600;
    color: var(--color-primary, #1e6fdf);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.crm-assistant-chat-sessions-empty {
    margin: 8px 4px;
    font-size: 0.8rem;
    line-height: 1.4;
    color: var(--crm-text-muted);
}

.crm-assistant-chat-form--readonly .crm-assistant-chat-input,
.crm-assistant-chat-form--readonly .crm-assistant-send-btn {
    opacity: 0.55;
    pointer-events: none;
}

.crm-assistant-chat-readonly-hint {
    margin: 0;
    font-size: 0.78rem;
    line-height: 1.35;
    color: var(--crm-text-muted);
}

.crm-assistant-chat-body {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    gap: 8px;
    overflow: hidden;
}

.crm-assistant-chat-history {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    gap: 4px;
    overflow: hidden;
}

.crm-assistant-chat-history-label {
    flex-shrink: 0;
    margin: 0;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--crm-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.crm-assistant-chat-form {
    flex-shrink: 0;
}

.crm-assistant-kanban-hint {
    margin: 0 0 8px;
    font-size: 0.78rem;
    line-height: 1.35;
}

.crm-assistant-sidebar {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
}

.crm-assistant-section-title {
    font-size: 0.92rem;
    margin: 0 0 8px;
    font-weight: 600;
}

.crm-assistant-chat-log {
    flex: 1 1 0;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 0;
    padding: 8px 10px 10px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 6px;
    scroll-behavior: smooth;
}

.crm-assistant-chat-empty {
    margin: 0;
    padding: 12px 4px;
    font-size: 0.85rem;
    line-height: 1.45;
    color: var(--crm-text-muted);
}

.crm-assistant-chat-line {
    margin-bottom: 10px;
}

.crm-assistant-chat-line-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 6px 10px;
    margin-bottom: 3px;
}

.crm-assistant-chat-line-pending .crm-assistant-chat-text {
    opacity: 0.8;
    font-style: italic;
}

.crm-assistant-chat-line-error .crm-assistant-chat-text {
    color: var(--color-danger, #ef4444);
}

.crm-assistant-chat-role {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--crm-text-muted);
}

.crm-assistant-chat-time {
    font-size: 0.68rem;
    color: var(--crm-text-muted);
    opacity: 0.85;
}

.crm-assistant-chat-text {
    white-space: pre-wrap;
    line-height: 1.4;
    font-size: 0.88rem;
}

.crm-assistant-chat-form .crm-assistant-chat-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: flex-end;
}

.crm-assistant-chat-input {
    flex: 1 1 180px;
    min-width: 0;
    resize: vertical;
    min-height: 4.5rem;
    max-height: 12rem;
    padding: 10px 12px;
    border-radius: 6px;
    border: 1px solid var(--crm-border);
    background: var(--crm-bg, #12141a);
    color: var(--crm-text);
    font-size: 0.88rem;
    line-height: 1.45;
}

.crm-assistant-send-btn {
    flex-shrink: 0;
    white-space: nowrap;
}

.crm-assistant-chat-hint {
    color: var(--color-danger, #ef4444);
    font-size: 0.8rem;
    margin-top: 6px;
}

@media (max-width: 899px) {
    .crm-assistant-chat-layout {
        flex-direction: column;
    }

    .crm-assistant-chat-sessions {
        width: 100%;
        max-height: 28vh;
        border-left: none;
        border-top: 1px solid var(--crm-border, rgba(255, 255, 255, 0.08));
        margin: 0 -12px -10px;
        padding: 8px 12px 0;
        order: 2;
    }

    .crm-assistant-chat-main {
        order: 1;
    }
}

.crm-assistant-cal-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px 10px;
    margin-bottom: 6px;
}

.crm-assistant-cal-head .crm-assistant-section-title {
    margin-bottom: 0;
}

.crm-assistant-cal-nav {
    display: flex;
    align-items: center;
    gap: 6px;
}

.crm-assistant-cal-label {
    min-width: 0;
    text-align: center;
    font-weight: 600;
    font-size: 0.85rem;
}

.crm-assistant-cal-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 16px;
    margin-bottom: 8px;
    font-size: 0.72rem;
    color: var(--crm-text-muted);
}

.crm-assistant-cal-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.crm-assistant-cal-mark {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 2px;
    flex-shrink: 0;
}

.crm-assistant-cal-mark--due {
    background: #6366f1;
}

.crm-assistant-cal-mark--remind {
    background: #d4a017;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.crm-assistant-cal-weekdays {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    font-size: 0.65rem;
    color: var(--crm-text-muted);
    margin-bottom: 4px;
    text-align: center;
    gap: 3px;
}

/* Месяц: 7×6 ячеек; пропорции ~7:6 (не квадрат — иначе 1fr-строки схлопываются без явной высоты) */
.crm-assistant-cal-square {
    width: 100%;
    max-width: min(100%, 400px);
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    aspect-ratio: 7 / 6;
    min-height: 260px;
    min-width: 0;
}

@media (min-width: 1200px) {
    .crm-assistant-cal-column .crm-assistant-cal-square {
        margin: 0;
        max-width: 100%;
    }
}

.crm-assistant-cal-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    /* 6 недель × 7 дней: явная минимальная высота строки, чтобы цифры даты не исчезали */
    grid-template-rows: repeat(6, minmax(44px, 1fr));
    gap: 3px;
    flex: 1 1 auto;
    width: 100%;
    /* не min-height:0 — иначе во flex-колонке сетка может схлопнуться и обрезать цифры */
    min-height: 220px;
    align-content: stretch;
}

/* Кнопка дня: без flex-колонки — цифра всегда в потоке сверху, метки снизу absolute (Chrome/Safari) */
.crm-assistant-cal-cell {
    position: relative;
    display: block;
    box-sizing: border-box;
    min-height: 44px;
    min-width: 0;
    padding: 6px 4px 14px;
    border: 1px solid var(--crm-border);
    border-radius: 4px;
    font-size: 0.8rem;
    overflow: visible;
    background: var(--crm-bg, #12141a);
    color: #eceef3;
    -webkit-text-fill-color: #eceef3;
    cursor: pointer;
    font-family: inherit;
    text-align: center;
    transition: background 0.12s ease, border-color 0.12s ease;
    appearance: none;
    -webkit-appearance: none;
}

.crm-assistant-cal-cell:hover {
    background: rgba(99, 102, 241, 0.12);
    border-color: rgba(99, 102, 241, 0.45);
}

.crm-assistant-cal-cell:focus-visible {
    outline: 2px solid var(--color-primary, #6366f1);
    outline-offset: 1px;
}

.crm-assistant-cal-cell-muted {
    opacity: 0.42;
}

.crm-assistant-cal-cell-muted .crm-assistant-cal-day {
    color: rgba(244, 246, 252, 0.58);
    -webkit-text-fill-color: rgba(244, 246, 252, 0.58);
}

.crm-assistant-cal-day {
    display: block;
    position: relative;
    z-index: 1;
    width: 100%;
    font-weight: 700;
    font-size: 0.95rem;
    line-height: 1.2;
    color: #f4f6fc;
    -webkit-text-fill-color: #f4f6fc;
    text-align: center;
    font-variant-numeric: tabular-nums;
    pointer-events: none;
}

.crm-assistant-cal-marks {
    position: absolute;
    left: 2px;
    right: 2px;
    bottom: 3px;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    justify-content: center;
    align-items: center;
    min-height: 10px;
    pointer-events: none;
}

@media (forced-colors: active) {
    .crm-assistant-cal-day {
        color: CanvasText;
        -webkit-text-fill-color: CanvasText;
    }
}

.crm-assistant-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.crm-assistant-toolbar .crm-assistant-section-title {
    margin-bottom: 0;
}

.crm-assistant-cal-column .crm-assistant-kanban-wrap {
    max-height: min(34vh, 260px);
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
}

.crm-assistant-kanban {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

@media (min-width: 700px) {
    .crm-assistant-kanban {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

.crm-assistant-col {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 6px;
    padding: 6px;
    min-height: 80px;
    min-width: 0;
}

.crm-assistant-col-title {
    font-size: 0.72rem;
    margin: 0 0 6px;
    color: var(--crm-text-muted);
    font-weight: 600;
}

.crm-assistant-task-card {
    background: var(--crm-bg, #12141a);
    border: 1px solid var(--crm-border);
    border-radius: 5px;
    padding: 6px;
    margin-bottom: 4px;
    cursor: pointer;
}

.crm-assistant-task-title {
    font-weight: 600;
    font-size: 0.78rem;
    margin-bottom: 2px;
    line-height: 1.25;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.crm-assistant-task-meta {
    font-size: 0.68rem;
    color: var(--crm-text-muted);
}

.crm-assistant-create {
    margin-bottom: 0;
}

.crm-assistant-create-form {
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
}

.crm-assistant-create-row {
    margin-bottom: 8px;
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
}

.crm-assistant-create-row label {
    display: block;
    font-size: 0.78rem;
    margin-bottom: 3px;
    color: var(--crm-text-muted);
}

.crm-assistant-field-hint {
    margin: 6px 0 0;
    font-size: 0.72rem;
    line-height: 1.35;
    color: var(--crm-text-muted);
    max-width: 100%;
    overflow-wrap: anywhere;
}

.crm-assistant-task-meta--remind {
    margin-top: 2px;
    font-size: 0.72rem;
    color: var(--crm-text-muted);
}

.crm-assistant-task-action-link {
    display: inline-block;
    margin-top: 6px;
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--crm-accent);
    text-decoration: none;
}

.crm-assistant-task-action-link:hover {
    text-decoration: underline;
}

/* Селект в узкой колонке ассистента: глобальный .crm-select { min-width: 200px } ломает сетку */
.crm-assistant-create-form .crm-select {
    display: block;
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

.crm-assistant-create-submit {
    width: 100%;
    margin-top: 4px;
}

/* Модалка календаря (разметка в assistant_hub.html) */
.crm-assistant-cal-modal {
    position: fixed;
    inset: 0;
    z-index: 1040;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    box-sizing: border-box;
}

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

.crm-assistant-cal-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
}

.crm-assistant-cal-modal-box {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 420px;
    max-height: min(85vh, 520px);
    display: flex;
    flex-direction: column;
    background: var(--crm-bg, #12141a);
    border: 1px solid var(--crm-border);
    border-radius: 10px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
    overflow: hidden;
}

.crm-assistant-cal-modal-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--crm-border);
    flex-shrink: 0;
}

.crm-assistant-cal-modal-title {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.3;
    flex: 1;
    min-width: 0;
}

.crm-assistant-cal-modal-x {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--crm-text);
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: inherit;
}

.crm-assistant-cal-modal-x:hover {
    background: rgba(255, 255, 255, 0.12);
}

.crm-assistant-cal-modal-body {
    padding: 10px 14px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
    font-size: 0.82rem;
}

.crm-assistant-cal-modal-foot {
    flex-shrink: 0;
    padding: 10px 14px 14px;
    border-top: 1px solid var(--crm-border);
}

.crm-assistant-cal-modal-empty {
    margin: 0;
    color: var(--crm-text-muted);
    font-size: 0.8rem;
}

.crm-assistant-cal-modal-item {
    border: 1px solid var(--crm-border);
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 8px;
    background: rgba(0, 0, 0, 0.12);
}

.crm-assistant-cal-modal-item:last-child {
    margin-bottom: 0;
}

.crm-assistant-cal-modal-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 6px;
}

.crm-assistant-cal-badge {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
    line-height: 1.3;
}

.crm-assistant-cal-badge--due {
    background: rgba(99, 102, 241, 0.25);
    color: #a5b4fc;
}

.crm-assistant-cal-badge--remind {
    background: rgba(212, 160, 23, 0.22);
    color: #f5d76e;
}

.crm-assistant-cal-modal-item-title {
    font-weight: 600;
    margin: 0 0 6px;
    font-size: 0.88rem;
    line-height: 1.3;
}

.crm-assistant-cal-modal-item-body {
    margin: 0 0 10px;
    font-size: 0.8rem;
    color: var(--crm-text-muted);
    line-height: 1.4;
    white-space: pre-wrap;
}

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

.crm-assistant-cal-modal-actions .crm-btn {
    flex: 1 1 auto;
    min-width: 120px;
}

.crm-assistant-cal-modal-done-note {
    margin: 0;
    font-size: 0.76rem;
    color: var(--crm-text-muted);
}

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

.crm-assistant-push-panel {
    padding: 10px 12px;
}

.crm-assistant-push-text {
    margin: 0 0 8px;
    font-size: 0.78rem;
    color: var(--crm-text-muted);
    line-height: 1.35;
    max-width: 100%;
    overflow-wrap: anywhere;
}
.crm-notif-type-assistant_reminder .crm-notif-item-title,
.crm-notif-type-assistant_task_due .crm-notif-item-title {
    color: #e8c547;
}
.crm-notif-open-task {
    font-size: 0.75rem;
    color: var(--color-primary, #6366f1);
    text-decoration: none;
    margin-right: 8px;
}
.crm-notif-open-task:hover {
    text-decoration: underline;
}
.crm-notif-item-actions {
    flex-wrap: wrap;
}

/* Employee profile form UX refresh */
.crm-employee-layout {
    gap: 20px;
}

.crm-employee-layout.crm-employee-layout-single {
    grid-template-columns: minmax(0, 1fr);
    width: 100%;
}

.crm-employee-layout.crm-employee-layout-single .crm-employee-left {
    width: 100%;
    max-width: none;
}

.crm-employee-layout.crm-employee-layout-single .crm-form-row .crm-form-group {
    flex: 1 1 260px;
}

@media (min-width: 1600px) {
    .crm-employee-layout.crm-employee-layout-single .crm-form-row .crm-form-group {
        flex-basis: 320px;
    }
}

.crm-employee-left,
.crm-employee-right {
    display: grid;
    gap: 14px;
}

.crm-employee-left .crm-fieldset {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.015));
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 12px;
    padding: 14px 14px 12px;
    margin: 0;
}

.crm-employee-left .crm-fieldset .crm-form-row {
    gap: 12px;
    margin-bottom: 8px;
}

.crm-employee-left .crm-form-group {
    margin-bottom: 8px;
}

.crm-employee-left .crm-input,
.crm-employee-left .crm-select,
.crm-employee-left textarea.crm-input {
    min-height: 40px;
    border-radius: 10px;
}

.crm-employee-left textarea.crm-input {
    min-height: 72px;
    resize: vertical;
}

.crm-employee-left .crm-file-input {
    border: 1px dashed rgba(255, 255, 255, 0.22);
    border-radius: 10px;
    padding: 8px;
}

.crm-employee-left .crm-file-input:hover {
    border-color: var(--crm-accent);
}

.crm-contract-panel {
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: linear-gradient(180deg, rgba(74, 158, 255, 0.08), rgba(74, 158, 255, 0.03));
    padding: 10px 12px;
    position: sticky;
    top: 12px;
}

.crm-contract-panel > summary {
    font-size: 15px;
    font-weight: 700;
    padding: 4px 0;
}

.crm-contract-body {
    display: grid;
    gap: 8px;
}

.crm-contract-preview-row {
    margin: 0;
    padding: 7px 9px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.16);
    line-height: 1.35;
}

.crm-upload-preview {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-height: 160px;
    overflow: auto;
    padding-right: 2px;
}

.crm-upload-preview-item {
    background: rgba(0, 0, 0, 0.2);
    border-style: solid;
    display: grid;
    gap: 6px;
}

@media (max-width: 900px) {
    .crm-upload-preview {
        grid-template-columns: 1fr;
    }
}

.crm-upload-preview-name {
    font-size: 12px;
    line-height: 1.3;
    word-break: break-word;
}

.crm-upload-preview-thumb {
    display: block;
    max-width: 100%;
    max-height: 180px;
    object-fit: contain;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: rgba(255, 255, 255, 0.03);
}

.crm-upload-preview-pdf {
    width: 100%;
    min-height: 220px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 8px;
    background: #fff;
}

.crm-address-suggest-list {
    max-height: 180px;
    overflow: auto;
}

.crm-address-suggest-item:hover,
.crm-address-suggest-item:focus-visible {
    border-color: var(--crm-accent);
    background: rgba(74, 158, 255, 0.14);
}

.crm-employee-left .crm-form-actions {
    margin-top: 4px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.crm-doc-tabs {
    display: grid;
    gap: 10px;
}

.crm-doc-tabs-nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.crm-doc-tab {
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: rgba(255, 255, 255, 0.03);
    color: var(--crm-text);
    border-radius: 10px;
    min-height: 38px;
    padding: 8px 10px;
    cursor: pointer;
    font-weight: 600;
}

.crm-doc-tab.is-active {
    border-color: var(--crm-accent);
    background: rgba(74, 158, 255, 0.18);
}

.crm-doc-tab-panel {
    margin: 0;
}

.crm-contract-doc {
    font-size: 13px;
    line-height: 1.45;
}

.crm-contract-doc-title {
    margin: 0 0 8px;
    font-size: 16px;
}

.crm-contract-doc-line {
    margin: 0 0 8px;
}

.crm-contract-doc h5 {
    margin: 10px 0 6px;
    font-size: 13px;
    line-height: 1.3;
}

.crm-contract-doc p {
    margin: 0 0 6px;
}

@media (max-width: 1200px) {
    .crm-contract-panel {
        position: static;
    }
}

/* Employee detail compact layout */
.crm-employee-main-card {
    margin-bottom: 12px;
}

.crm-employee-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 12px;
}

.crm-employee-stat-tile {
    border: 1px solid var(--crm-border);
    border-radius: 10px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.02);
    display: grid;
    gap: 4px;
}

.crm-employee-stat-label {
    font-size: 11px;
    color: var(--crm-text-muted);
    text-transform: uppercase;
}

.crm-employee-stat-value {
    font-size: 14px;
    font-weight: 600;
}

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

.crm-employee-card {
    margin: 0;
}

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

.crm-employee-card-collapse {
    margin-top: 12px;
}

.crm-employee-card-collapse > summary {
    cursor: pointer;
    list-style: none;
}

.crm-employee-card-collapse > summary::-webkit-details-marker {
    display: none;
}

@media (max-width: 1024px) {
    .crm-employee-stats-grid,
    .crm-employee-cards-grid {
        grid-template-columns: 1fr;
    }
}

.crm-doc-workspace {
    display: grid;
    gap: 10px;
}

.crm-doc-workspace-document .crm-contract-side-form {
    padding: 14px;
}

.crm-doc-workspace-document .crm-form-actions {
    margin-bottom: 10px;
}

.crm-doc-workspace-document .crm-contract-doc {
    font-family: "Times New Roman", Georgia, serif;
    font-size: 14px;
    line-height: 1.45;
    color: #111;
}

.crm-doc-workspace-document .crm-contract-doc-title {
    margin: 0 0 12px;
    font-size: 20px;
    line-height: 1.2;
    text-align: center;
}

.crm-doc-workspace-document .crm-contract-doc h5 {
    margin: 14px 0 8px;
    font-size: 15px;
    line-height: 1.3;
    font-weight: 700;
}

.crm-doc-workspace-document .crm-contract-doc p {
    margin: 0 0 8px;
}

.crm-doc-workspace-document .crm-contract-doc ul {
    margin: 0 0 10px 18px;
    padding: 0;
}

.crm-doc-workspace-document .crm-contract-doc li {
    margin: 0 0 4px;
}

.crm-contract-sign-columns {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 18px;
    margin-top: 8px;
}

.crm-contract-sign-col {
    min-width: 0;
}

.crm-contract-city-date {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
}

.crm-contract-city-date-right {
    margin-left: auto;
    white-space: nowrap;
}

.crm-doc-workspace-document .crm-contract-panel.crm-contract-body {
    background: #fff;
    color: #111;
    border-color: #d6d8de;
    box-shadow: 0 2px 10px rgba(8, 22, 44, 0.08);
}

.crm-doc-workspace-grid {
    display: grid;
    grid-template-columns: minmax(320px, 1fr) minmax(360px, 1.4fr);
    gap: 12px;
    align-items: start;
}

.crm-contract-side-form {
    border: 1px solid var(--crm-border);
    border-radius: 10px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.02);
}

.crm-doc-field-legend {
    display: flex;
    gap: 8px;
    align-items: center;
    margin: 0 0 10px;
}

.crm-doc-badge {
    display: inline-block;
    font-size: 11px;
    line-height: 1.2;
    border-radius: 999px;
    padding: 2px 8px;
}

.crm-doc-badge-auto {
    background: rgba(52, 199, 89, 0.2);
    color: #7ef2a1;
}

.crm-doc-badge-hr {
    background: rgba(245, 158, 11, 0.2);
    color: #facc6b;
}

@media (max-width: 1200px) {
    .crm-doc-workspace-grid {
        grid-template-columns: 1fr;
    }

    .crm-contract-sign-columns {
        grid-template-columns: 1fr;
    }
}

@media print {
    .crm-doc-workspace-document .crm-doc-tabs-nav,
    .crm-doc-workspace-document .crm-contract-side-form,
    .crm-doc-workspace-document .crm-btn {
        display: none !important;
    }

    .crm-doc-workspace-document .crm-doc-tab-panel {
        display: block !important;
    }

    .crm-doc-workspace-document .crm-doc-workspace-grid {
        grid-template-columns: 1fr !important;
    }

    .crm-doc-workspace-document .crm-contract-panel.crm-contract-body {
        border: 0;
        box-shadow: none;
        padding: 0;
    }
}

/* FITCRM Premium Dark Enterprise refresh v1 — final cascade layer */
:root {
    --crm-bg: #08111d;
    --crm-bg-2: #0b1422;
    --crm-surface: #111c2b;
    --crm-surface-2: #182538;
    --crm-surface-3: #223149;
    --crm-border: #2a3b54;
    --crm-border-soft: rgba(148, 163, 184, 0.16);
    --crm-text: #f3f7fb;
    --crm-text-muted: #93a4b8;
    --crm-text-faint: #617187;
    --crm-accent: #38bdf8;
    --crm-accent-hover: #67d4ff;
    --crm-accent-strong: #22d3ee;
    --crm-success: #34d399;
    --crm-warning: #fbbf24;
    --crm-error: #fb7185;
    --crm-radius: 16px;
    --crm-radius-sm: 12px;
    --crm-radius-lg: 24px;
    --crm-shadow-soft: 0 18px 45px rgba(0, 0, 0, 0.28);
    --crm-shadow-card: 0 14px 34px rgba(3, 10, 20, 0.32);
    --crm-focus-ring: 0 0 0 3px rgba(56, 189, 248, 0.26);
}

.crm-body {
    background:
        radial-gradient(circle at 12% 0%, rgba(56, 189, 248, 0.14), transparent 26rem),
        radial-gradient(circle at 92% 12%, rgba(34, 211, 238, 0.08), transparent 24rem),
        linear-gradient(145deg, var(--crm-bg), #050b13 72%) !important;
    color: var(--crm-text);
    letter-spacing: -0.01em;
}

.crm-header {
    position: sticky;
    top: 0;
    z-index: 80;
    background: rgba(8, 17, 29, 0.78) !important;
    border-bottom: 1px solid var(--crm-border-soft);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}

.crm-sidebar {
    background: rgba(10, 20, 34, 0.94) !important;
    border-right: 1px solid var(--crm-border-soft);
    box-shadow: var(--crm-shadow-soft);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}

.crm-login-page {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(320px, 420px);
    gap: clamp(28px, 6vw, 88px);
    align-items: center;
    justify-content: center;
    padding: clamp(24px, 5vw, 72px);
}

.crm-login-hero {
    max-width: 680px;
}

.crm-login-kicker {
    display: inline-flex;
    padding: 8px 12px;
    border: 1px solid rgba(56, 189, 248, 0.28);
    border-radius: 999px;
    background: rgba(56, 189, 248, 0.10);
    color: var(--crm-accent-hover);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.crm-login-hero-title {
    margin: 18px 0 12px;
    font-size: clamp(52px, 9vw, 108px);
    line-height: 0.92;
    letter-spacing: -0.08em;
}

.crm-login-hero-copy {
    max-width: 560px;
    color: var(--crm-text-muted);
    font-size: clamp(17px, 2vw, 22px);
    line-height: 1.45;
}

.crm-login-trust-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 180px));
    gap: 10px;
    margin-top: 28px;
}

.crm-login-trust-grid span {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border: 1px solid var(--crm-border-soft);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.045);
    color: var(--crm-text);
}

.crm-login-card,
.crm-dashboard-widget,
.crm-role-cabinet,
.crm-card-section,
.crm-card,
.crm-dashboard-quicklinks,
.crm-dashboard-tasks,
.crm-notifications,
.crm-table-wrap {
    border: 1px solid var(--crm-border-soft) !important;
    border-radius: var(--crm-radius-lg) !important;
    background: linear-gradient(180deg, rgba(17, 28, 43, 0.94), rgba(13, 23, 38, 0.94)) !important;
    box-shadow: var(--crm-shadow-card);
}

.crm-login-card {
    max-width: 420px;
    padding: 30px;
    box-shadow: var(--crm-shadow-soft);
}

.crm-page-title {
    color: var(--crm-text);
    font-size: clamp(26px, 2.3vw, 38px);
    font-weight: 850;
    letter-spacing: -0.04em;
}

.crm-nav-link,
.crm-nav-dropdown-trigger,
.crm-sidebar-link,
.crm-director-stat-card,
.crm-quicklink-card,
.crm-role-ops-chip {
    border-radius: 16px !important;
    border: 1px solid transparent;
    transition: background 180ms ease, border-color 180ms ease, color 180ms ease, transform 180ms ease;
}

.crm-sidebar-link:hover,
.crm-nav-link:hover,
.crm-nav-dropdown-trigger:hover,
.crm-director-stat-card:hover,
.crm-quicklink-card:hover,
.crm-role-ops-chip:hover {
    color: var(--crm-text);
    background: rgba(56, 189, 248, 0.09) !important;
    border-color: rgba(56, 189, 248, 0.30);
    transform: translateY(-1px);
}

.crm-sidebar-link-active,
.crm-nav-link-active,
.crm-nav-dropdown-trigger.crm-nav-link-active {
    color: var(--crm-text) !important;
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.22), rgba(34, 211, 238, 0.08)) !important;
    border-color: rgba(56, 189, 248, 0.35) !important;
}

.crm-btn {
    min-height: 40px;
    border-radius: 14px !important;
    font-weight: 800;
    transition: transform 170ms ease, box-shadow 170ms ease, background 170ms ease, border-color 170ms ease;
}

.crm-btn:hover {
    transform: translateY(-1px);
}

.crm-btn-primary,
.crm-btn-accent {
    border: 1px solid rgba(103, 212, 255, 0.48) !important;
    background: linear-gradient(135deg, var(--crm-accent), var(--crm-accent-strong)) !important;
    color: #04111d !important;
    box-shadow: 0 14px 28px rgba(56, 189, 248, 0.20);
}

.crm-btn-ghost {
    border: 1px solid var(--crm-border-soft) !important;
    background: rgba(255, 255, 255, 0.045) !important;
    color: var(--crm-text) !important;
}

.crm-input,
.crm-select,
.crm-search-input,
.crm-textarea,
input.crm-input,
select.crm-input,
textarea.crm-input {
    min-height: 42px;
    border-radius: 14px !important;
    border: 1px solid var(--crm-border) !important;
    background: rgba(24, 37, 56, 0.78) !important;
    color: var(--crm-text) !important;
}

.crm-input:focus,
.crm-select:focus,
.crm-search-input:focus,
.crm-textarea:focus {
    border-color: var(--crm-accent) !important;
    box-shadow: var(--crm-focus-ring) !important;
}

.crm-table th {
    background: rgba(13, 23, 38, 0.96) !important;
    color: var(--crm-text-muted) !important;
    font-size: 12px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.crm-table td,
.crm-table th {
    border-color: var(--crm-border-soft) !important;
}

.crm-table tbody tr:hover {
    background: rgba(56, 189, 248, 0.055) !important;
}

@media (max-width: 900px) {
    .crm-login-page {
        grid-template-columns: 1fr;
        align-items: stretch;
        padding: 20px;
    }

    .crm-login-card {
        max-width: none;
    }
}

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

    .crm-main,
    .crm-dashboard-content {
        padding-inline: 12px;
    }
}

/* --------------------------------------------------------------------------
   FITCRM UI pass v2 — density, buttons, tables (Soft UI / data-dense ops CRM)
   -------------------------------------------------------------------------- */

.crm-btn-sm {
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.25;
    min-height: 32px;
    border-radius: 12px !important;
    letter-spacing: -0.01em;
}

.crm-btn-small {
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.25;
    min-height: 32px;
    border-radius: 12px !important;
    letter-spacing: -0.01em;
}

.crm-btn-xs {
    padding: 4px 9px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.2;
    min-height: 28px;
    border-radius: 10px !important;
}

.crm-btn-secondary {
    border: 1px solid var(--crm-border-soft) !important;
    background: rgba(255, 255, 255, 0.06) !important;
    color: var(--crm-text) !important;
    box-shadow: none;
}

.crm-btn-secondary:hover {
    border-color: rgba(56, 189, 248, 0.28) !important;
    background: rgba(56, 189, 248, 0.10) !important;
    color: var(--crm-text) !important;
}

.crm-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    max-width: 100%;
    text-align: center;
    text-decoration: none;
    line-height: 1.25;
    box-sizing: border-box;
    min-height: 36px;
    font-weight: 700;
    white-space: nowrap;
}

.crm-btn-wrap {
    white-space: normal;
    text-wrap: balance;
}

.crm-btn-icon {
    flex-shrink: 0;
    font-size: 1.05em;
}

.crm-page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px 16px;
    margin-bottom: 12px;
}

.crm-page-toolbar,
.crm-print-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.crm-page-toolbar .crm-btn,
.crm-print-actions > .crm-btn,
.crm-print-actions > a.crm-btn {
    min-height: 32px;
}

.crm-table-wrap {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 16px;
    border-radius: var(--crm-radius-lg);
}

.crm-table-wrap > .crm-table {
    margin-bottom: 0;
    min-width: 640px;
}

.crm-cell-actions {
    white-space: nowrap;
}

.crm-cell-actions .crm-action-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-right: 8px;
    font-size: 13px;
}

.crm-lead {
    max-width: 72ch;
    line-height: 1.45;
}

.crm-page-title {
    line-height: 1.1;
    text-wrap: balance;
}

.crm-ts-history-filters-note {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0 0 12px;
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid var(--crm-border-soft);
    background: rgba(56, 189, 248, 0.08);
    color: var(--crm-text-muted);
    font-size: 12px;
    font-weight: 600;
}

.crm-ts-history-filters-note i {
    color: var(--crm-accent);
}

.crm-page-header.crm-ts-history-header {
    position: sticky;
    top: 72px;
    z-index: 20;
    padding: 12px 0 10px;
    margin-bottom: 8px;
    background: rgba(8, 17, 29, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.crm-ts-history-details {
    border: 1px solid var(--crm-border-soft);
    border-radius: 16px;
    background: rgba(17, 28, 43, 0.72);
}

.crm-ts-history-summary {
    list-style: none;
    cursor: pointer;
}

.crm-ts-history-club {
    font-size: 1.02rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.crm-ts-history-weeks-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 6px;
}

.crm-ts-history-week-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px 12px;
    align-items: center;
    padding: 8px 10px;
    border: 1px solid var(--crm-border-soft);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.03);
}

.crm-ts-history-week-item .crm-link {
    font-weight: 700;
}

.crm-ts-history-week-meta {
    text-align: right;
    white-space: nowrap;
}

.crm-ts-history-panel-actions .crm-btn {
    min-height: 32px;
}

@media (max-width: 900px) {
    .crm-timesheet-history-form {
        flex-wrap: wrap;
    }

    .crm-page-header.crm-ts-history-header {
        top: 64px;
    }

    .crm-ts-history-week-item {
        grid-template-columns: 1fr;
    }

    .crm-ts-history-week-meta {
        text-align: left;
    }
}

/* --------------------------------------------------------------------------
   FITCRM UI pass v3 — timesheet density, finance shell, club hero, compare
   -------------------------------------------------------------------------- */

.crm-page-timesheet .crm-ts-status-panel {
    margin-bottom: 12px;
    padding: 10px 14px;
    border-radius: 14px;
    border: 1px solid var(--crm-border-soft);
    background: rgba(17, 28, 43, 0.65);
}

.crm-page-timesheet .crm-ts-week-nav-card {
    position: sticky;
    top: 72px;
    z-index: 18;
    margin-bottom: 12px;
    padding: 12px 14px;
    border-radius: 16px;
    border: 1px solid var(--crm-border-soft);
    background: rgba(8, 17, 29, 0.94);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.crm-timesheet-fin-table tbody tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.025);
}

.crm-timesheet-fin-table tbody tr:hover {
    background: rgba(56, 189, 248, 0.06);
}

.crm-timesheet-fin-table td,
.crm-timesheet-fin-table th {
    padding: 6px 8px;
}

.crm-ts-mode-btn {
    min-height: 28px !important;
    padding: 3px 10px !important;
    font-size: 11px !important;
}

.crm-ts-shift-toolbar .crm-ts-week-legend {
    font-size: 0.72rem;
}

.crm-club-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px 16px;
    margin-bottom: 14px;
    padding: 14px 16px;
    border: 1px solid var(--crm-border-soft);
    border-radius: 18px;
    background: linear-gradient(135deg, rgba(16, 36, 58, 0.55), rgba(17, 28, 43, 0.85));
}

.crm-club-kpi-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 14px;
}

.crm-club-kpi-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 12px;
    border: 1px solid var(--crm-border-soft);
    background: rgba(255, 255, 255, 0.04);
    font-size: 13px;
}

.crm-club-kpi-chip strong {
    font-weight: 800;
    letter-spacing: -0.02em;
}

.crm-club-kpi-chip .crm-badge {
    margin: 0;
}

.crm-system-block {
    margin-bottom: 18px;
    border: 1px solid var(--crm-border-soft);
    border-radius: 18px;
    overflow: hidden;
    background: rgba(17, 28, 43, 0.55);
}

.crm-system-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    font-weight: 800;
    letter-spacing: -0.02em;
    border-bottom: 1px solid var(--crm-border-soft);
    background: rgba(56, 189, 248, 0.06);
}

.crm-finance-page-header .crm-page-toolbar {
    margin-left: auto;
}

.crm-table-compare tbody tr:last-child td:nth-child(4) {
    font-weight: 800;
}

.crm-table-compare .crm-compare-diff-pos {
    color: var(--crm-success, #34d399);
}

.crm-table-compare .crm-compare-diff-neg {
    color: var(--crm-error, #fb7185);
}

.crm-club-list-meta {
    font-size: 12px;
    color: var(--crm-text-muted);
    margin-top: 4px;
}

@media (max-width: 900px) {
    .crm-page-timesheet .crm-ts-week-nav-card {
        top: 64px;
    }

    .crm-club-list-meta-row {
        display: block;
    }
}

/* --------------------------------------------------------------------------
   FITCRM UI pass v4 — kanban tabs, invoices, order edit, docs, dashboard
   -------------------------------------------------------------------------- */

.crm-fin-tabs-nav--scroll {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
    margin-bottom: 10px;
    scrollbar-width: thin;
}

.crm-fin-tabs-nav--scroll .crm-fin-tab-btn {
    flex: 0 0 auto;
    white-space: nowrap;
    min-height: 36px;
    font-size: 12px;
    padding: 7px 11px;
}

.crm-fin-tabs-body {
    border-color: var(--crm-border-soft);
    border-radius: 16px;
    background: rgba(17, 28, 43, 0.72);
}

.crm-invoices-sticky-bar {
    position: sticky;
    top: 72px;
    z-index: 18;
    padding: 10px 0 8px;
    margin-bottom: 8px;
    background: rgba(8, 17, 29, 0.94);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.crm-invoices-sticky-bar .crm-filter-bar {
    margin-bottom: 0;
}

.crm-order-edit-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    margin-top: 12px;
}

.crm-autosave-status:not(:empty) {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: 0;
    padding: 5px 10px;
    border-radius: 999px;
    border: 1px solid var(--crm-border-soft);
    background: rgba(255, 255, 255, 0.05);
    font-size: 12px;
    font-weight: 600;
}

.crm-autosave-status:not(:empty)::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--crm-accent);
}

.crm-autosave-status-error:not(:empty)::before {
    background: var(--crm-error, #fb7185);
}

.crm-order-row-below-nso {
    background: rgba(251, 113, 133, 0.08) !important;
}

.crm-order-row-below-nso td {
    border-color: rgba(251, 113, 133, 0.18) !important;
}

.crm-doc-workspace .crm-doc-tabs-nav {
    position: sticky;
    top: 72px;
    z-index: 16;
    padding: 8px 0;
    background: rgba(8, 17, 29, 0.94);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.crm-dashboard-bento {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 14px;
    margin-top: 12px;
}

.crm-dashboard-bento > .crm-dashboard-widget,
.crm-dashboard-bento > .crm-dashboard-quicklinks,
.crm-dashboard-bento > .crm-dashboard-tasks,
.crm-dashboard-bento > .crm-notifications {
    margin: 0;
}

.crm-dashboard-bento .crm-dashboard-quicklinks {
    grid-column: 1 / -1;
}

.crm-role-cabinet {
    margin-bottom: 14px;
    padding: 14px 16px;
    border: 1px solid var(--crm-border-soft);
    border-radius: 18px;
    background: rgba(17, 28, 43, 0.55);
}

@media (max-width: 900px) {
    .crm-invoices-sticky-bar,
    .crm-doc-workspace .crm-doc-tabs-nav,
    .crm-remainder-sticky-bar {
        top: 64px;
    }
}

/* --------------------------------------------------------------------------
   FITCRM UI pass v5 — deliveries, remainder, orgs, docs form, fin tabs
   -------------------------------------------------------------------------- */

.crm-remainder-sticky-bar {
    position: sticky;
    top: 72px;
    z-index: 18;
    padding: 10px 0 8px;
    margin-bottom: 12px;
    background: rgba(8, 17, 29, 0.94);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.crm-remainder-sticky-bar .crm-search-filter-row {
    margin-bottom: 0;
}

.crm-remainder-empty {
    margin-top: 8px;
}

.crm-page-header-orgs .crm-page-toolbar .crm-print-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0;
}

.crm-fin-org-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 8px;
    margin-bottom: 10px;
}

.crm-fin-tab-panel .crm-card-section-title {
    margin-top: 0;
}

.crm-fk-settings-form .crm-form-actions,
.crm-fk-autotask-add-form .crm-form-actions {
    margin-top: 12px;
}

@media (min-width: 768px) {
    .crm-doc-workspace .crm-contract-side-form .crm-form-row {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px 14px;
    }

    .crm-doc-workspace .crm-contract-side-form .crm-form-row .crm-form-group {
        flex: unset;
        min-width: 0;
    }
}

@media (max-width: 767px) {
    .crm-doc-workspace-grid {
        grid-template-columns: 1fr;
    }
}

/* --------------------------------------------------------------------------
   FITCRM UI pass v6 — settings nav, org form, club sections, list buttons
   -------------------------------------------------------------------------- */

.crm-settings-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 14px;
    padding-bottom: 4px;
}

.crm-settings-nav-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    border: 1px solid var(--crm-border-soft);
    border-radius: 10px;
    background: rgba(17, 28, 43, 0.55);
    color: var(--crm-text-muted);
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}

.crm-settings-nav-link:hover {
    color: var(--crm-text);
    border-color: rgba(74, 158, 255, 0.35);
}

.crm-settings-nav-link.is-active {
    color: var(--crm-text);
    border-color: var(--crm-accent);
    background: rgba(74, 158, 255, 0.14);
}

.crm-org-form .crm-fieldset {
    margin-bottom: 18px;
}

.crm-org-form .crm-form-row {
    gap: 10px 14px;
}

@media (min-width: 768px) {
    .crm-org-form .crm-form-row {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .crm-org-form .crm-form-row .crm-form-group {
        flex: unset;
        min-width: 0;
    }
}

.crm-club-section-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 14px;
}

.crm-club-section-nav-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 11px;
    border: 1px solid var(--crm-border-soft);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--crm-text-muted);
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
}

.crm-club-section-nav-link:hover {
    color: var(--crm-text);
    border-color: rgba(74, 158, 255, 0.35);
}

.crm-org-section-details:target .crm-org-section-summary,
.crm-org-section-details:target {
    scroll-margin-top: 88px;
}

/* --------------------------------------------------------------------------
   FITCRM UI pass v7 — employee docs, timesheet save bar, user forms
   -------------------------------------------------------------------------- */

.crm-employee-docs-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin: 8px 0;
}

.crm-page-timesheet .crm-timesheet-save-bar {
    position: sticky;
    bottom: 0;
    z-index: 24;
    margin-top: 16px;
    padding: 10px 12px;
    border: 1px solid var(--crm-border-soft);
    border-radius: 14px;
    background: rgba(8, 17, 29, 0.96);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.28);
}

.crm-page-timesheet .crm-timesheet-save-bar .crm-btn {
    white-space: nowrap;
}

.crm-user-create-form .crm-form-actions,
.crm-form-page-actions {
    margin-top: 16px;
}

.crm-help-sections {
    margin-top: 8px;
}

.crm-help-api {
    margin-top: 16px;
}

/* --------------------------------------------------------------------------
   FITCRM UI pass v8 — club/employee forms, settings forms, form audit
   -------------------------------------------------------------------------- */

.crm-club-edit-form .crm-fieldset,
.crm-employee-layout-single .crm-fieldset {
    margin-bottom: 18px;
}

.crm-timesheet-settings-form {
    max-width: 420px;
}

.crm-timesheet-settings-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px 16px;
    margin-bottom: 4px;
}

.crm-timesheet-settings-row .crm-form-group {
    flex: unset;
    min-width: 0;
}

.crm-user-edit-form,
.crm-material-form {
    max-width: 640px;
}

.crm-sessions-actions {
    margin-top: 12px;
}
