/* Светлая CRM-оболочка в духе Tamara. Класс crm-ui у партнёра и у админки платформы. */

body.crm-ui {
    --crm-blue: #1677ff;
    --crm-blue-hover: #0958d9;
    --crm-blue-soft: rgba(22, 119, 255, 0.12);
    --crm-sidebar: #f0f5fa;
    --crm-canvas: #f1f5fa;
    --crm-line: #e6edf4;
    --crm-ink: rgba(0, 0, 0, 0.88);
    --crm-muted: rgba(0, 0, 0, 0.45);
    --crm-soft: #e6f4ff;
    --crm-soft-ink: #0958d9;
    --crm-soft-line: #91caff;
    --crm-hover: #f7faff;
    --crm-track: #f5f7fa;
    --crm-well: #f8fafc;
    --sidebar: #f0f5fa;
    --sidebar-hover: rgba(22, 119, 255, 0.08);
    --sidebar-active-bg: #1677ff;
    --sidebar-active-border: transparent;
    --sidebar-text: rgba(0, 0, 0, 0.78);
    --sidebar-text-hover: #1677ff;
    --sidebar-border: #e6edf4;
    --sidebar-active: #1677ff;
    --sidebar-w: 220px;
    --bg: #f1f5fa;
    --surface: #ffffff;
    --surface-muted: #f1f5fa;
    --border: #e6edf4;
    --text: rgba(0, 0, 0, 0.88);
    --text-muted: rgba(0, 0, 0, 0.45);
    --primary: #1677ff;
    --primary-hover: #0958d9;
    --accent: #1677ff;
    --brand-grad: #1677ff;
    --shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    --radius: 10px;
    background: var(--crm-canvas);
    color: var(--crm-ink);
    color-scheme: light;
}

body.crm-ui .sidebar {
    width: var(--sidebar-w);
    background: var(--crm-sidebar);
    color: var(--crm-ink);
    border-right: 1px solid var(--crm-line);
    padding: 12px 10px 12px;
    box-shadow: none;
}

body.crm-ui .sidebar-brand {
    align-items: center;
    padding: 8px 10px 14px;
    margin-bottom: 6px;
    border-bottom: 1px solid var(--crm-line);
}

body.crm-ui .brand-title,
body.crm-ui .user-name {
    color: var(--crm-ink);
}

body.crm-ui .brand-title {
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: -0.03em;
}

body.crm-ui .brand-subtitle,
body.crm-ui .user-role {
    color: var(--crm-muted);
}

body.crm-ui .nav-section-label {
    margin: 14px 10px 6px;
    color: #8b97a8;
    letter-spacing: 0.06em;
}

body.crm-ui .nav-item,
body.crm-ui .nav-group-toggle {
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 14px;
    font-weight: 500;
    color: var(--sidebar-text);
    border: 0;
    background: transparent;
    box-shadow: none;
}

body.crm-ui .nav-item:hover,
body.crm-ui .nav-group-toggle:hover {
    background: var(--sidebar-hover);
    color: var(--crm-blue);
}

body.crm-ui .nav-item.active {
    background: var(--crm-blue);
    color: #fff;
    box-shadow: none;
}

body.crm-ui .nav-item.active .nav-icon-svg {
    color: #fff;
    opacity: 1;
}

body.crm-ui .nav-icon-svg {
    width: 16px;
    height: 16px;
    color: var(--crm-blue);
    opacity: 1;
}

body.crm-ui .nav-item:not(.active) .nav-icon-svg,
body.crm-ui .nav-group-toggle .nav-icon-svg {
    color: var(--crm-blue);
}

body.crm-ui .nav-group.is-open .nav-group-toggle,
body.crm-ui .nav-group.has-active .nav-group-toggle {
    background: transparent;
    color: var(--crm-ink);
    border: 0;
}

body.crm-ui .nav-group.has-active .nav-group-toggle {
    color: var(--crm-blue);
}

body.crm-ui .nav-chevron {
    background: rgba(15, 23, 42, 0.05);
}

body.crm-ui .nav-chevron::before {
    border-color: #8b97a8;
}

body.crm-ui .nav-submenu-inner {
    border-left-color: var(--crm-line);
}

body.crm-ui .nav-subitem {
    color: var(--crm-ink);
}

body.crm-ui .nav-subitem:hover {
    background: var(--sidebar-hover);
    color: var(--crm-blue);
}

body.crm-ui .nav-subitem.active {
    background: var(--crm-blue);
    color: #fff;
    border-color: transparent;
}

body.crm-ui .sidebar-platform {
    background: var(--surface);
    border: 1px solid var(--crm-line);
    color: var(--crm-muted);
}

body.crm-ui .sidebar-footer {
    border-top: 1px solid var(--crm-line);
}

body.crm-ui .user-avatar {
    background: var(--crm-blue);
    color: #fff;
}

body.crm-ui .logout-btn {
    background: var(--surface);
    color: var(--crm-ink);
    border: 1px solid var(--crm-line);
}

body.crm-ui .logout-btn:hover {
    background: var(--crm-blue-soft);
    color: var(--crm-blue);
}

body.crm-ui .qozgal-logo--sidebar,
body.crm-ui .brand-logo {
    box-shadow: none;
    border-radius: 8px;
}

body.crm-ui .brand-logo--wide {
    background: #fff;
    box-shadow: 0 0 0 1px var(--crm-line, #e8edf3);
}

body.crm-ui .main-content {
    background: var(--crm-canvas);
    padding: 20px 24px 40px;
}

body.crm-ui .page-header h1 {
    font-size: 1.35rem;
    font-weight: 700;
}

body.crm-ui .btn-primary {
    background: var(--crm-blue);
    color: #fff;
    box-shadow: none;
    border-radius: 8px;
}

body.crm-ui .btn-primary:hover {
    background: var(--crm-blue-hover);
    filter: none;
    color: #fff;
}

body.crm-ui .btn-primary:disabled,
body.crm-ui .btn-primary[disabled],
body.crm-ui .btn-primary.is-disabled {
    background: #c5cdd6;
    color: #fff;
    opacity: 0.72;
    cursor: not-allowed;
    box-shadow: none;
    pointer-events: none;
}

body.crm-ui .btn-primary:disabled:hover,
body.crm-ui .btn-primary[disabled]:hover,
body.crm-ui .btn-primary.is-disabled:hover {
    background: #c5cdd6;
    color: #fff;
    filter: none;
}

body.crm-ui .crm-demo-limited {
    display: inline-block;
    margin-left: 4px;
    font-size: 0.82rem;
    color: var(--crm-muted);
    line-height: 1.35;
}

body.crm-ui .btn-secondary {
    background: var(--surface);
    color: var(--crm-ink);
    border: 1px solid var(--crm-line);
}

body.crm-ui .btn-secondary:hover {
    background: var(--crm-blue-soft);
    color: var(--crm-blue);
}

body.crm-ui .stat-card,
body.crm-ui .card,
body.crm-ui .partner-card,
body.crm-ui .clients-card {
    border: 1px solid var(--crm-line);
    box-shadow: none;
    border-radius: 10px;
}

body.crm-ui .stat-card::before {
    background: var(--crm-blue);
    height: 2px;
}

body.crm-ui .badge,
body.crm-ui .category-badge,
body.crm-ui .client-chip {
    background: var(--crm-soft);
    color: var(--crm-soft-ink);
}

body.crm-ui .status-badge.active {
    background: var(--crm-soft);
    color: var(--crm-soft-ink);
}

body.crm-ui .settings-subnav-item.active,
body.crm-ui .settings-subnav-item:hover,
body.crm-ui .settings-tab.active,
body.crm-ui .settings-tab:hover,
body.crm-ui .clients-filter.is-active {
    background: var(--crm-blue);
    border-color: var(--crm-blue);
    color: #fff;
}

body.crm-ui .clients-filter {
    background: var(--surface);
    border: 1px solid var(--crm-line);
    color: var(--crm-ink);
}

body.crm-ui .clients-filter:hover:not(.is-active) {
    background: var(--crm-blue-soft);
    border-color: var(--crm-soft-line);
    color: var(--crm-blue);
}

body.crm-ui .clients-search input {
    background: var(--surface);
    border-color: var(--crm-line);
}

body.crm-ui .clients-search input:focus {
    border-color: var(--crm-blue);
    box-shadow: 0 0 0 3px rgba(22, 119, 255, 0.14);
}

body.crm-ui .clients-search svg {
    color: #8b97a8;
}

body.crm-ui .client-card:hover {
    background: var(--crm-hover);
}

body.crm-ui .client-avatar--placeholder {
    background: var(--crm-blue);
    color: #fff;
}

body.crm-ui .form-group input:focus,
body.crm-ui .form-group select:focus,
body.crm-ui .form-group textarea:focus,
body.crm-ui input:focus,
body.crm-ui select:focus,
body.crm-ui textarea:focus {
    border-color: var(--crm-blue);
    box-shadow: 0 0 0 3px rgba(22, 119, 255, 0.14);
}

body.crm-ui .sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(15, 23, 42, 0.12);
}

body.crm-ui .app-topbar {
    border-bottom-color: var(--crm-line);
}

body.crm-ui .theme-toggle {
    border-color: var(--crm-line);
    background: var(--surface);
    color: var(--crm-ink);
    box-shadow: none;
}

body.crm-ui .theme-toggle:hover {
    border-color: var(--crm-blue);
    color: var(--crm-blue);
    background: var(--crm-blue-soft);
}

body.crm-ui .theme-toggle:focus-visible {
    box-shadow: 0 0 0 3px rgba(22, 119, 255, 0.18);
}

body.crm-ui .sidebar-toggle span {
    background: var(--crm-ink);
}

body.crm-ui .link-inline {
    color: var(--crm-blue);
}

body.crm-ui .notice-preset:hover {
    border-color: var(--crm-blue);
    color: var(--crm-blue);
}

body.crm-ui .auth-channel {
    background: var(--surface);
}

body.crm-ui .auth-channel.is-ready {
    background: var(--crm-soft);
    border-color: var(--crm-soft-line);
}

body.crm-ui .staff-panel-url {
    color: var(--crm-blue);
}

/* Недельная сетка расписания */
.crm-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.crm-view-switch {
    display: inline-flex;
    background: var(--surface);
    border: 1px solid var(--crm-line);
    border-radius: 8px;
    overflow: hidden;
}

.crm-view-switch button {
    border: 0;
    background: transparent;
    color: var(--crm-ink);
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    padding: 8px 14px;
    cursor: pointer;
}

.crm-view-switch button.is-active {
    background: var(--crm-blue);
    color: #fff;
}

.crm-week-range {
    font-size: 14px;
    font-weight: 600;
    color: var(--crm-ink);
}

.crm-week-range span {
    margin-left: 6px;
    color: var(--crm-blue);
    font-weight: 600;
}

.crm-schedule-toolbar {
    background: var(--surface);
    border: 1px solid var(--crm-line);
    border-radius: 10px;
    padding: 10px 12px;
}

.crm-week-nav {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.crm-week-arrow {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--crm-line);
    border-radius: 8px;
    background: var(--surface);
    color: var(--crm-ink);
    font-size: 20px;
    line-height: 1;
    text-decoration: none;
}

.crm-week-arrow:hover {
    border-color: #91caff;
    color: var(--crm-blue);
}

.crm-view-switch a {
    border: 0;
    background: transparent;
    color: var(--crm-ink);
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    padding: 8px 14px;
    text-decoration: none;
}

.crm-view-switch a.is-active {
    background: var(--crm-blue);
    color: #fff;
}

.crm-week-day {
    text-decoration: none;
    color: inherit;
}

.crm-week-day.is-selected,
.crm-week-day:hover {
    background: var(--crm-soft);
}

.crm-week-check {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 0 1px #fff;
    z-index: 1;
}

.crm-week-check::after {
    content: "";
    position: absolute;
    left: 5px;
    top: 3px;
    width: 4px;
    height: 7px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.crm-week-card {
    position: relative;
}

.crm-day-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 14px;
}

.crm-day-class {
    background: var(--surface);
    border: 1px solid var(--crm-line);
    border-radius: 10px;
    margin-bottom: 12px;
    overflow: hidden;
}

.crm-day-class.tone-mint { border-left: 4px solid #16a34a; }
.crm-day-class.tone-sun { border-left: 4px solid #f5b301; }
.crm-day-class.tone-lilac { border-left: 4px solid #9333ea; }
.crm-day-class.tone-rose { border-left: 4px solid #e11d64; }
.crm-day-class.tone-sky { border-left: 4px solid #2280ff; }
.crm-day-class.tone-peach { border-left: 4px solid #f4611a; }
.crm-day-class.tone-teal { border-left: 4px solid #0d9488; }
.crm-day-class.tone-coral { border-left: 4px solid #ef4444; }
.crm-day-class.tone-indigo { border-left: 4px solid #4f46e5; }
.crm-day-class.tone-lime { border-left: 4px solid #65a30d; }

.crm-day-class__head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    text-decoration: none;
    color: inherit;
}

.crm-day-class__head strong {
    display: block;
    font-size: 16px;
}

.crm-day-class__head span {
    display: block;
    margin-top: 4px;
    color: var(--crm-muted);
    font-size: 13px;
}

.crm-day-class__meta {
    text-align: right;
}

.crm-day-class__meta b {
    display: block;
    font-size: 18px;
    letter-spacing: -0.03em;
}

.crm-day-class__meta small {
    display: block;
    margin: 4px 0;
    color: var(--crm-muted);
}

.crm-day-roster {
    list-style: none;
    margin: 0;
    padding: 0 16px 12px;
    border-top: 1px solid var(--crm-line);
}

.crm-day-roster li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid var(--crm-line);
}

.crm-day-roster li:last-child {
    border-bottom: 0;
}

.crm-day-roster strong {
    display: block;
}

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

.crm-day-roster form {
    display: flex;
    gap: 6px;
}

.crm-day-empty {
    padding: 0 16px 14px;
}

body.crm-ui.desk-app .desk-scan--compact {
    background: var(--surface);
    border-color: var(--crm-line);
}

body.crm-ui.desk-app .desk-scan--compact .desk-scan-hint {
    display: none;
}

body.crm-ui.desk-app .desk-scan--compact .desk-scan-form input {
    border-color: var(--crm-line);
    border-radius: 8px;
    min-height: 40px;
}

.crm-week {
    background: var(--surface);
    border: 1px solid var(--crm-line);
    border-radius: 10px;
    overflow: visible;
    margin-bottom: 20px;
}

.crm-week-head,
.crm-week-body {
    display: grid;
    grid-template-columns: 56px repeat(7, minmax(0, 1fr));
}

.crm-week-head {
    border-bottom: 1px solid var(--crm-line);
    background: var(--crm-well);
}

.crm-week-day {
    padding: 10px 8px;
    text-align: center;
    border-left: 1px solid var(--crm-line);
}

.crm-week-day span {
    display: block;
    font-size: 12px;
    color: var(--crm-muted);
}

.crm-week-day b {
    display: block;
    margin-top: 2px;
    font-size: 14px;
}

.crm-week-day.is-today b {
    color: var(--crm-blue);
}

.crm-week-body {
    position: relative;
    grid-template-rows: repeat(var(--slots), 36px);
    background-image:
        linear-gradient(to right, var(--crm-line) 1px, transparent 1px),
        linear-gradient(to bottom, var(--crm-line) 1px, transparent 1px);
    background-size: calc((100% - 56px) / 7) 36px;
    background-position: 56px 0;
    min-height: calc(var(--slots) * 36px);
}

.crm-week-time {
    grid-column: 1;
    padding: 4px 8px 0 0;
    font-size: 11px;
    color: var(--crm-muted);
    text-align: right;
}

.crm-week-card {
    margin: 3px 4px;
    padding: 6px 8px 6px 10px;
    border-radius: 8px;
    text-decoration: none;
    color: rgba(0, 0, 0, 0.88);
    overflow: hidden;
    min-height: 0;
    border: 1px solid transparent;
    border-left: 4px solid transparent;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
    transition: box-shadow 0.15s ease, transform 0.15s ease;
    z-index: 1;
}

.crm-week--grid .crm-week-card {
    box-sizing: border-box;
    width: calc(100% / var(--lanes, 1) - 8px);
    margin: 3px 0 3px calc(var(--lane, 0) * (100% / var(--lanes, 1)) + 4px);
    justify-self: start;
    min-width: 0;
    z-index: calc(2 + var(--lane, 0));
}

.crm-week--grid .crm-week-card__name,
.crm-week--grid .crm-week-card__trainer,
.crm-week--grid .crm-week-card__meta {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.crm-week--grid .crm-week-card:hover,
.crm-week--grid .crm-week-card:focus-visible {
    z-index: 8;
}

.crm-week-slot {
    z-index: 0;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
    min-width: 0;
    min-height: 0;
}

.crm-week-slot:hover,
.crm-week-slot:focus-visible {
    background: rgba(22, 119, 255, 0.1);
    outline: none;
}

.slot-dialog {
    box-sizing: border-box;
    width: min(500px, calc(100vw - 24px));
    max-width: 100%;
    max-height: calc(100dvh - 24px);
    padding: 0;
    border: 0;
    border-radius: 18px;
    background: var(--surface, #fff);
    color: inherit;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.24);
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.slot-dialog[open] {
    animation: slot-dialog-in 0.24s cubic-bezier(0.2, 0.9, 0.3, 1.1);
}

.slot-dialog::backdrop {
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(2px);
}

@keyframes slot-dialog-in {
    from { opacity: 0; transform: translateY(14px) scale(0.98); }
    to { opacity: 1; transform: none; }
}

.slot-dialog *,
.slot-dialog *::before,
.slot-dialog *::after {
    box-sizing: border-box;
}

.slot-dialog__form {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 18px 20px 0;
}

.slot-dialog__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.slot-dialog__title {
    margin: 0;
    font-size: 19px;
    letter-spacing: -0.01em;
}

.slot-dialog__close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    width: 34px;
    height: 34px;
    margin-right: -6px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--crm-muted, #64748b);
    cursor: pointer;
}

.slot-dialog__close:hover {
    background: var(--crm-well, #f1f5f9);
    color: inherit;
}

.slot-dialog__close svg {
    width: 20px;
    height: 20px;
}

.slot-dialog__hint {
    margin: 0;
    color: var(--crm-muted, #64748b);
    font-size: 12.5px;
    line-height: 1.4;
}

.slot-dialog__caption {
    color: var(--crm-muted, #64748b);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.slot-dialog__link {
    flex: none;
    border: 0;
    background: none;
    padding: 2px 0;
    color: var(--crm-blue, #1677ff);
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.slot-dialog__link:hover {
    text-decoration: underline;
}

.slot-seg {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 4px;
    border-radius: 12px;
    background: var(--crm-well, #f1f5f9);
}

.slot-dialog label.slot-seg__item {
    flex: 1 1 auto;
    position: relative;
    display: block;
    margin: 0;
    cursor: pointer;
}

.slot-dialog .slot-seg__item input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    min-height: 0;
    margin: 0;
    opacity: 0;
    cursor: pointer;
}

.slot-seg__item span {
    display: block;
    padding: 8px 10px;
    border-radius: 9px;
    color: var(--crm-muted, #64748b);
    font-size: 13.5px;
    font-weight: 650;
    text-align: center;
    white-space: nowrap;
    transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.slot-seg__item input:checked + span {
    background: var(--surface, #fff);
    color: var(--crm-text, #0f172a);
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.14);
}

.slot-seg__item input:focus-visible + span {
    outline: 2px solid var(--crm-blue, #1677ff);
    outline-offset: 1px;
}

.slot-sum {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px 14px;
    border: 1px solid var(--crm-line, #e2e8f0);
    border-radius: 14px;
}

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

.slot-sum__icon {
    flex: none;
    width: 18px;
    height: 18px;
    color: var(--crm-blue, #1677ff);
}

.slot-sum__when,
.slot-sum__trainer {
    flex: 1;
    min-width: 0;
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.slot-sum__trainer {
    font-weight: 600;
}

.slot-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding-left: 28px;
}

.slot-chip {
    min-height: 30px;
    padding: 0 12px;
    border: 1px solid var(--crm-line, #e2e8f0);
    border-radius: 999px;
    background: var(--surface, #fff);
    color: inherit;
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.slot-chip:hover {
    border-color: var(--crm-blue, #1677ff);
}

.slot-chip:active {
    transform: scale(0.96);
}

.slot-chip.is-on {
    border-color: var(--crm-blue, #1677ff);
    background: var(--crm-blue, #1677ff);
    color: #fff;
}

.slot-busy {
    margin: 2px 0 0;
    padding: 8px 10px;
    border-radius: 10px;
    background: rgba(239, 68, 68, 0.1);
    color: #b91c1c;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.4;
    animation: slot-list-in 0.2s ease-out;
}

.slot-busy.is-soft {
    background: rgba(245, 158, 11, 0.12);
    color: #92400e;
}

.stagger-confirm {
    margin: 0 0 14px;
    padding: 12px 14px;
    border-radius: 12px;
    background: rgba(245, 158, 11, 0.12);
    color: #92400e;
}
.stagger-confirm p { margin: 0 0 8px; font-weight: 600; }

html[data-theme="dark"] .slot-busy {
    background: rgba(239, 68, 68, 0.18);
    color: #fca5a5;
}

html[data-theme="dark"] .slot-busy.is-soft {
    background: rgba(245, 158, 11, 0.18);
    color: #fcd34d;
}

.slot-pick {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.slot-pick.is-shake {
    animation: move-dialog-shake 0.42s ease;
}

.slot-dialog .slot-pick .slot-pick__search input[type="search"][data-pick-input] {
    width: 100%;
    min-height: 44px;
    padding-left: 38px;
    font-size: 15px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='6.5'/%3E%3Cpath d='m16 16 4 4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 12px center;
    background-size: 18px;
}

.slot-pick__list {
    display: flex;
    flex-direction: column;
    max-height: 264px;
    margin-top: 6px;
    padding: 4px;
    border: 1px solid var(--crm-line, #e2e8f0);
    border-radius: 12px;
    overflow-y: auto;
    animation: slot-list-in 0.16s ease-out;
}

@keyframes slot-list-in {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: none; }
}

.slot-pick__row {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 46px;
    padding: 6px 8px;
    border: 0;
    border-radius: 9px;
    background: none;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.slot-pick__row:hover,
.slot-pick__row.is-active {
    background: var(--crm-well, #f1f5f9);
}

.slot-pick__row.is-new {
    justify-content: flex-start;
    color: var(--crm-blue, #1677ff);
    font-weight: 650;
}

.slot-pick__avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    width: 32px;
    height: 32px;
    border-radius: 999px;
    background: rgba(22, 119, 255, 0.12);
    color: var(--crm-blue, #1677ff);
    font-size: 12px;
    font-weight: 750;
}

.slot-pick__who {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}

.slot-pick__who b {
    font-size: 14px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.slot-pick__who small {
    color: var(--crm-muted, #64748b);
    font-size: 12px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.slot-pick__empty {
    margin: 0;
    padding: 8px 10px 4px;
    color: var(--crm-muted, #64748b);
    font-size: 13px;
}

.slot-pick__chosen {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px 8px 8px;
    border: 1px solid rgba(22, 119, 255, 0.35);
    border-radius: 12px;
    background: rgba(22, 119, 255, 0.06);
}

.slot-pick__chosen.is-in {
    animation: slot-chosen-in 0.26s cubic-bezier(0.2, 0.9, 0.3, 1.25);
}

@keyframes slot-chosen-in {
    from { opacity: 0; transform: scale(0.97); }
    to { opacity: 1; transform: none; }
}

.slot-pick__error {
    margin: 0;
    color: #dc2626;
    font-size: 13px;
    font-weight: 600;
}

.slot-new {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px;
    border-radius: 12px;
    background: var(--crm-well, #f8fafc);
}

.slot-new__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.slot-pack {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(16, 185, 129, 0.1);
    color: #047857;
    font-size: 13.5px;
    font-weight: 600;
}

.slot-pack__icon {
    flex: none;
    width: 18px;
    height: 18px;
}

.slot-pack__text {
    flex: 1;
    min-width: 0;
}

.slot-hall {
    margin: -4px 0 0;
    color: var(--crm-muted, #64748b);
    font-size: 13px;
}

.slot-days {
    display: flex;
    gap: 6px;
}

.slot-dialog .slot-days label {
    flex: 1;
    position: relative;
    display: block;
    cursor: pointer;
}

.slot-dialog .slot-days input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    min-height: 0;
    margin: 0;
    opacity: 0;
    cursor: pointer;
}

.slot-days span {
    display: block;
    padding: 8px 0;
    border: 1px solid var(--crm-line, #e2e8f0);
    border-radius: 10px;
    font-size: 13px;
    font-weight: 650;
    text-align: center;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.slot-days input:checked + span {
    border-color: var(--crm-blue, #1677ff);
    background: var(--crm-blue, #1677ff);
    color: #fff;
}

.slot-repeat {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px;
    border: 1px solid var(--crm-line, #e2e8f0);
    border-radius: 14px;
    background: linear-gradient(180deg, rgba(22, 119, 255, 0.04), transparent);
}

.slot-repeat[hidden],
.slot-repeat__weekly[hidden],
.slot-seats[hidden] {
    display: none !important;
}

.slot-repeat__seg {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.slot-dialog label.slot-repeat__opt {
    position: relative;
    display: block;
    margin: 0;
    cursor: pointer;
}

.slot-dialog .slot-repeat__opt input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    min-height: 0;
    margin: 0;
    opacity: 0;
    cursor: pointer;
}

.slot-repeat__opt span {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 10px 12px;
    border: 1.5px solid var(--crm-line, #e2e8f0);
    border-radius: 12px;
    background: var(--surface, #fff);
    transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.slot-repeat__opt b {
    font-size: 14px;
    font-weight: 700;
    color: var(--crm-text, #0f172a);
}

.slot-repeat__opt small {
    font-size: 12px;
    color: var(--crm-muted, #64748b);
}

.slot-repeat__opt input:checked + span {
    border-color: var(--crm-blue, #1677ff);
    box-shadow: 0 0 0 3px rgba(22, 119, 255, 0.14);
}

.slot-repeat__opt input:checked + span b {
    color: var(--crm-blue, #1677ff);
}

.slot-repeat__opt input:focus-visible + span {
    outline: 2px solid var(--crm-blue, #1677ff);
    outline-offset: 2px;
}

.slot-repeat__weekly {
    display: flex;
    flex-direction: column;
    gap: 8px;
    animation: slot-repeat-in 0.22s ease;
}

.slot-repeat__days label.is-anchor span {
    box-shadow: inset 0 -3px 0 rgba(255, 255, 255, 0.55);
}

.purchase-freeze { margin-top: 8px; }
.purchase-freeze__form { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.purchase-freeze__days { width: 64px; }
.purchase-tariff { margin-top: 8px; }
.purchase-tariff select { max-width: 100%; }
body.crm-ui .crm-kind-pill--unlimited {
    background: #fff7e6;
    color: #d46b08;
    border-color: #ffd591;
}
body.crm-ui .is-unlimited {
    box-shadow: inset 3px 0 0 #fa8c16;
}
body.crm-ui .crm-list__row.is-unlimited {
    background: #fff7e6;
}
.slot-also { display: grid; gap: 8px; margin-top: 12px; }
.slot-also[hidden] { display: none; }
.slot-repeat__note {
    margin: 0;
    font-size: 12.5px;
    line-height: 1.45;
    color: var(--crm-muted, #64748b);
}

.slot-seats {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.slot-seats__label {
    font-size: 13.5px;
    font-weight: 650;
}

.slot-seats__stepper {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--crm-line, #e2e8f0);
    border-radius: 12px;
    overflow: hidden;
    background: var(--surface, #fff);
}

.slot-seats__btn {
    width: 38px;
    height: 38px;
    border: 0;
    background: transparent;
    color: var(--crm-blue, #1677ff);
    font-size: 20px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
}

.slot-seats__btn:hover {
    background: rgba(22, 119, 255, 0.08);
}

.slot-dialog .slot-seats__stepper input {
    width: 52px;
    min-height: 38px;
    padding: 0;
    border: 0;
    border-left: 1px solid var(--crm-line, #e2e8f0);
    border-right: 1px solid var(--crm-line, #e2e8f0);
    border-radius: 0;
    text-align: center;
    font-size: 15px;
    font-weight: 700;
    -moz-appearance: textfield;
}

.slot-seats__stepper input::-webkit-outer-spin-button,
.slot-seats__stepper input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

@keyframes slot-repeat-in {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: none; }
}

html[data-theme="dark"] .slot-repeat__opt span,
html[data-theme="dark"] .slot-seats__stepper {
    background: rgba(148, 163, 184, 0.08);
}

.slot-mini {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.slot-mini-list {
    display: flex;
    flex-direction: column;
    max-height: 220px;
    overflow-y: auto;
    margin-top: 6px;
    border: 1px solid var(--crm-border, #e2e8f0);
    border-radius: 10px;
}

.slot-dialog label.slot-mini-row {
    flex-direction: row;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-bottom: 1px solid var(--crm-border, #e2e8f0);
    cursor: pointer;
}

.slot-dialog label.slot-mini-row:last-child {
    border-bottom: 0;
}

.slot-dialog label.slot-mini-row input {
    width: auto;
    flex: none;
}

.slot-dialog__grid {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.slot-dialog label {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 0;
    font-size: 13px;
    font-weight: 600;
}

.slot-dialog input:not([type="radio"]):not([type="checkbox"]):not(.kz-phone__input),
.slot-dialog select {
    width: 100%;
    max-width: 100%;
    min-height: 40px;
    border: 1px solid var(--crm-line, #e2e8f0);
    border-radius: 10px;
    padding: 8px 10px;
    background-color: var(--surface, #fff);
    color: inherit;
    font: inherit;
    font-weight: 400;
}

.slot-dialog .slot-new .kz-phone {
    flex: none;
    width: 100%;
    min-height: 40px;
    border-radius: 10px;
    font-weight: 400;
}

.slot-dialog input:not([type="radio"]):not([type="checkbox"]):not(.kz-phone__input):focus,
.slot-dialog select:focus {
    border-color: var(--crm-blue, #1677ff);
    outline: none;
    box-shadow: 0 0 0 3px rgba(22, 119, 255, 0.15);
}

.slot-dialog fieldset {
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.slot-dialog fieldset[hidden],
.slot-dialog [hidden] {
    display: none !important;
}

.slot-dialog__trainers {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.slot-dialog .slot-trainer-chip {
    position: relative;
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    margin: 0;
    cursor: pointer;
}

.slot-dialog .slot-trainer-chip input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    min-height: 0;
    margin: 0;
    opacity: 0;
    cursor: pointer;
}

.slot-trainer-chip span {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 0 12px;
    border: 1px solid var(--crm-line, #e2e8f0);
    border-radius: 999px;
    background: var(--surface, #fff);
    font-size: 13px;
    font-weight: 600;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.slot-trainer-chip input:checked + span {
    border-color: var(--crm-blue, #1677ff);
    background: var(--crm-blue, #1677ff);
    color: #fff;
}

.slot-trainer-chip input:focus-visible + span {
    outline: 2px solid var(--crm-blue, #1677ff);
    outline-offset: 2px;
}

.slot-dialog__actions {
    position: sticky;
    bottom: 0;
    z-index: 2;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin: 2px -20px 0;
    padding: 12px 20px calc(14px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--crm-line, #e2e8f0);
    background: var(--surface, #fff);
}

.slot-dialog__actions .btn {
    min-height: 42px;
}

.slot-dialog__actions .btn.is-busy {
    opacity: 0.7;
    cursor: progress;
}

@media (max-width: 560px) {
    .slot-dialog {
        width: 100vw;
        max-width: 100vw;
        max-height: 92dvh;
        margin: auto 0 0;
        border-radius: 20px 20px 0 0;
    }

    .slot-dialog[open] {
        animation: slot-sheet-in 0.3s cubic-bezier(0.2, 0.9, 0.3, 1);
    }

    .slot-dialog__grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .slot-dialog__grid label:first-child {
        grid-column: 1 / -1;
    }

    .slot-seg__item span {
        padding: 8px 6px;
        font-size: 13px;
    }

    .slot-chips {
        padding-left: 0;
    }

    .slot-dialog__actions .btn {
        flex: 1;
    }
}

@keyframes slot-sheet-in {
    from { transform: translateY(100%); }
    to { transform: none; }
}

html[data-theme="dark"] .slot-pack {
    background: rgba(16, 185, 129, 0.16);
    color: #6ee7b7;
}

html[data-theme="dark"] .slot-seg__item input:checked + span {
    background: rgba(148, 163, 184, 0.22);
    color: #f8fafc;
}

@media (prefers-reduced-motion: reduce) {
    .slot-dialog[open],
    .slot-pick__list,
    .slot-pick__chosen.is-in,
    .slot-pick.is-shake {
        animation: none !important;
    }
}

/* --- Перенос карточек перетаскиванием --- */
.crm-week--grid[data-move-url] .crm-week-card[data-move] {
    cursor: grab;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

.crm-week-card.is-pressing {
    transform: scale(0.97);
    transition: transform 0.32s ease;
}

.crm-week-card.is-dragging {
    z-index: 40;
    cursor: grabbing;
    transition: box-shadow 0.2s ease, filter 0.2s ease !important;
    box-shadow: 0 22px 44px rgba(15, 23, 42, 0.3), 0 0 0 2px rgba(255, 255, 255, 0.95);
    filter: saturate(1.15);
    will-change: transform;
}

.crm-week-card.is-dragging .crm-week-hover,
.crm-week-card.is-pending .crm-week-hover {
    display: none !important;
}

.crm-week-card.is-pending {
    z-index: 40;
    pointer-events: none;
    transition: transform 0.28s cubic-bezier(0.2, 0.9, 0.3, 1.15), box-shadow 0.2s ease !important;
    box-shadow: 0 10px 26px rgba(15, 23, 42, 0.24), 0 0 0 2px var(--crm-blue, #1677ff);
}

.crm-week-card.is-returning {
    z-index: 30;
    transition: transform 0.38s cubic-bezier(0.25, 1.35, 0.4, 1), box-shadow 0.3s ease !important;
}

.crm-week-card.is-landing {
    z-index: 30;
    transition: transform 0.42s cubic-bezier(0.2, 0.95, 0.3, 1.18) !important;
}

.crm-week-card.is-landed {
    animation: crm-card-landed 0.9s ease-out;
}

@keyframes crm-card-landed {
    0% { box-shadow: 0 0 0 0 rgba(22, 119, 255, 0.55); }
    100% { box-shadow: 0 0 0 16px rgba(22, 119, 255, 0); }
}

.crm-week--grid.is-drag-active .crm-week-slot {
    pointer-events: none;
}

.crm-week--grid.is-drag-active .crm-week-card:not(.is-dragging) {
    opacity: 0.5;
    transition: opacity 0.2s ease;
}

body.crm-drag-lock,
body.crm-drag-lock * {
    cursor: grabbing !important;
    -webkit-user-select: none !important;
    user-select: none !important;
}

.crm-drop-ghost {
    position: absolute;
    z-index: 2;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 1px;
    padding: 5px 8px;
    border: 2px dashed var(--crm-blue, #1677ff);
    border-radius: 8px;
    background: rgba(22, 119, 255, 0.1);
    color: var(--crm-blue, #1677ff);
    font-size: 11px;
    line-height: 1.25;
    overflow: hidden;
    pointer-events: none;
    transition: top 0.12s ease-out, left 0.16s ease-out, width 0.16s ease-out, background 0.15s ease, border-color 0.15s ease;
    animation: crm-ghost-in 0.18s ease-out;
}

.crm-drop-ghost b {
    font-size: 13px;
    font-weight: 750;
    letter-spacing: -0.01em;
}

.crm-drop-ghost span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.crm-drop-ghost.is-bad {
    border-color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
    color: #b91c1c;
}

.crm-drop-ghost.is-same {
    opacity: 0.45;
}

.crm-drop-ghost.is-locked {
    border-style: solid;
    animation: crm-ghost-pulse 1.2s ease-in-out infinite;
}

.crm-drop-ghost.is-leaving {
    opacity: 0;
    transition: opacity 0.2s ease;
}

.crm-drop-chip {
    position: absolute;
    z-index: 50;
    padding: 5px 10px;
    border-radius: 999px;
    background: #0f172a;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
    pointer-events: none;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.28);
    transform: translate(-50%, -100%);
    transition: top 0.12s ease-out, left 0.16s ease-out, background 0.15s ease, opacity 0.18s ease;
    animation: crm-chip-in 0.2s cubic-bezier(0.2, 0.9, 0.3, 1.3);
}

.crm-drop-chip.is-below {
    transform: translate(-50%, 0);
}

.crm-drop-chip.is-tick {
    animation: crm-chip-tick 0.18s ease-out;
}

.crm-drop-chip.is-bad {
    background: #dc2626;
}

.crm-drop-chip.is-same {
    background: #64748b;
}

.crm-drop-chip.is-leaving {
    opacity: 0;
}

@keyframes crm-chip-in {
    from { opacity: 0; margin-top: 6px; }
    to { opacity: 1; margin-top: 0; }
}

@keyframes crm-chip-tick {
    0% { scale: 1; }
    45% { scale: 1.08; }
    100% { scale: 1; }
}

.crm-week-card__clock {
    transition: color 0.2s ease, background-color 0.2s ease;
}

.crm-week-card__clock.is-retimed {
    color: var(--crm-blue, #1677ff) !important;
}

.crm-drop-origin {
    position: absolute;
    z-index: 1;
    box-sizing: border-box;
    border: 2px dashed rgba(100, 116, 139, 0.45);
    border-radius: 8px;
    background: repeating-linear-gradient(-45deg, rgba(148, 163, 184, 0.1) 0 6px, transparent 6px 12px);
    pointer-events: none;
    animation: crm-ghost-in 0.18s ease-out;
    transition: opacity 0.2s ease;
}

.crm-drop-origin.is-leaving {
    opacity: 0;
}

@keyframes crm-ghost-in {
    from { opacity: 0; transform: scale(0.96); }
    to { opacity: 1; transform: none; }
}

@keyframes crm-ghost-pulse {
    0%, 100% { background: rgba(22, 119, 255, 0.08); }
    50% { background: rgba(22, 119, 255, 0.18); }
}

.move-dialog {
    width: min(420px, calc(100vw - 32px));
    padding: 0;
    border: 0;
    border-radius: 16px;
    background: var(--surface, #fff);
    color: inherit;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.24);
}

.move-dialog[open] {
    animation: move-dialog-in 0.22s cubic-bezier(0.2, 0.9, 0.3, 1.1);
}

.move-dialog::backdrop {
    background: rgba(15, 23, 42, 0.35);
    backdrop-filter: blur(2px);
}

@keyframes move-dialog-in {
    from { opacity: 0; transform: translateY(12px) scale(0.97); }
    to { opacity: 1; transform: none; }
}

.move-dialog__box {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 20px;
}

.move-dialog__box.is-shake {
    animation: move-dialog-shake 0.42s ease;
}

@keyframes move-dialog-shake {
    0%, 100% { transform: none; }
    20% { transform: translateX(-7px); }
    40% { transform: translateX(6px); }
    60% { transform: translateX(-4px); }
    80% { transform: translateX(2px); }
}

.move-dialog__title {
    margin: 0;
    font-size: 18px;
}

.move-dialog__name {
    margin: -6px 0 0;
    color: var(--crm-muted, #64748b);
    font-size: 14px;
    font-weight: 600;
}

.move-dialog__route {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 12px;
    border-radius: 12px;
    background: var(--crm-well, #f8fafc);
}

.move-dialog__row {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.move-dialog__row span {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--crm-muted, #64748b);
}

.move-dialog__row b {
    font-size: 15px;
    line-height: 1.35;
}

.move-dialog__row.is-was b {
    color: var(--crm-muted, #64748b);
    font-weight: 600;
    text-decoration: line-through;
    text-decoration-color: rgba(100, 116, 139, 0.5);
}

.move-dialog__row.is-now b {
    color: var(--crm-blue, #1677ff);
}

.move-dialog__arrow {
    width: 14px;
    height: 14px;
    margin-left: 2px;
    border-right: 2px solid var(--crm-muted, #94a3b8);
    border-bottom: 2px solid var(--crm-muted, #94a3b8);
    transform: rotate(45deg) scale(0.7);
}

.move-dialog__box.is-loading .move-dialog__row b {
    min-height: 18px;
    border-radius: 6px;
    color: transparent !important;
    text-decoration: none;
    background: linear-gradient(90deg, rgba(148, 163, 184, 0.18), rgba(148, 163, 184, 0.38), rgba(148, 163, 184, 0.18));
    background-size: 200% 100%;
    animation: move-dialog-shimmer 1s linear infinite;
}

@keyframes move-dialog-shimmer {
    from { background-position: 200% 0; }
    to { background-position: -200% 0; }
}

.move-dialog__note {
    margin: 0;
    color: var(--crm-muted, #64748b);
    font-size: 13px;
    line-height: 1.4;
}

.move-dialog__notify {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    cursor: pointer;
}

.move-dialog__notify input {
    width: 18px;
    height: 18px;
    margin: 0;
    accent-color: var(--crm-blue, #1677ff);
}

.move-dialog__error {
    margin: 0;
    padding: 10px 12px;
    border-radius: 10px;
    background: rgba(239, 68, 68, 0.1);
    color: #b91c1c;
    font-size: 14px;
    line-height: 1.4;
}

.move-dialog__actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.move-dialog__box.is-saving [data-move-ok] {
    opacity: 0.7;
    cursor: progress;
}

.move-toast {
    position: fixed;
    left: 50%;
    bottom: max(18px, env(safe-area-inset-bottom));
    z-index: 1200;
    display: flex;
    align-items: center;
    gap: 14px;
    box-sizing: border-box;
    width: max-content;
    max-width: min(560px, calc(100vw - 24px));
    padding: 12px 14px 14px 18px;
    border-radius: 14px;
    background: #0f172a;
    color: #fff;
    font-size: 14px;
    line-height: 1.35;
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.32);
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, 24px) scale(0.98);
    transition: opacity 0.22s ease, transform 0.3s cubic-bezier(0.2, 0.9, 0.3, 1.15);
}

.move-toast.is-on {
    opacity: 1;
    pointer-events: auto;
    transform: translate(-50%, 0);
}

.move-toast.is-error {
    background: #7f1d1d;
}

.move-toast__undo {
    flex: none;
    min-height: 34px;
    padding: 0 14px;
    border: 0;
    border-radius: 999px;
    background: #fff;
    color: #0f172a;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.move-toast__undo:hover {
    background: #e2e8f0;
}

.move-toast__timer {
    position: absolute;
    left: 0;
    bottom: 0;
    height: 3px;
    width: 100%;
    background: rgba(255, 255, 255, 0.55);
    transform-origin: left center;
}

@keyframes move-toast-timer {
    from { transform: scaleX(1); }
    to { transform: scaleX(0); }
}

html[data-theme="dark"] .crm-drop-chip:not(.is-bad):not(.is-same) {
    background: #e2e8f0;
    color: #0f172a;
}

html[data-theme="dark"] .crm-week-card__clock.is-retimed {
    color: #93c5fd !important;
}

html[data-theme="dark"] .move-dialog__route {
    background: rgba(148, 163, 184, 0.1);
}

html[data-theme="dark"] .move-toast {
    background: #e2e8f0;
    color: #0f172a;
}

html[data-theme="dark"] .move-toast__undo {
    background: #0f172a;
    color: #fff;
}

html[data-theme="dark"] .move-toast__timer {
    background: rgba(15, 23, 42, 0.45);
}

html[data-theme="dark"] .move-toast.is-error {
    background: #fecaca;
    color: #7f1d1d;
}

@media (prefers-reduced-motion: reduce) {
    .crm-week-card.is-landing,
    .crm-week-card.is-returning,
    .crm-week-card.is-pending,
    .crm-drop-ghost,
    .crm-drop-chip,
    .move-dialog[open],
    .move-toast {
        transition: none !important;
        animation: none !important;
    }
}

.crm-week-card strong,
.crm-week-card__name {
    display: block;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: -0.02em;
    color: rgba(0, 0, 0, 0.88);
}

.crm-week-card span,
.crm-week-card small {
    display: block;
    font-size: 11px;
    color: rgba(0, 0, 0, 0.5);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.crm-week-card__trainer {
    font-size: 12px;
    font-weight: 650;
    line-height: 1.25;
    color: rgba(0, 0, 0, 0.86);
    margin-top: 3px;
}

.crm-week-people {
    list-style: none;
    margin: 5px 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.crm-week-person,
.crm-week-more {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    line-height: 1.25;
    color: rgba(0, 0, 0, 0.72);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.crm-week-more {
    color: rgba(0, 0, 0, 0.42);
}

.crm-week-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex: 0 0 auto;
    background: #bfbfbf;
}

.crm-week-dot.is-ok { background: #52c41a; }
.crm-week-dot.is-miss { background: #ff4d4f; }
.crm-week-dot.is-wait { background: #bfbfbf; }

.crm-week-tick {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex: 0 0 auto;
    background: #22c55e;
    position: relative;
}

.crm-week-tick::after {
    content: "";
    position: absolute;
    left: 3px;
    top: 1px;
    width: 2px;
    height: 5px;
    border: solid #fff;
    border-width: 0 1.5px 1.5px 0;
    transform: rotate(45deg);
}

.crm-week-cross {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex: 0 0 auto;
    background: #ef4444;
    position: relative;
}

.crm-week-cross::before,
.crm-week-cross::after {
    content: "";
    position: absolute;
    left: 4px;
    top: 2px;
    width: 1.6px;
    height: 6px;
    background: #fff;
    border-radius: 1px;
}

.crm-week-cross::before { transform: rotate(45deg); }
.crm-week-cross::after { transform: rotate(-45deg); }

.crm-week-hover {
    display: none;
    list-style: none;
    margin: 6px 0 0;
    padding: 0;
    flex-direction: column;
    gap: 2px;
}

.crm-week-card.is-complete {
    box-shadow: inset 0 0 0 1px rgba(34, 197, 94, 0.18);
}

.crm-week-card.is-open {
    box-shadow: 0 0 0 2px var(--crm-blue);
    filter: none;
}

.crm-week-card.tone-mint { background: #6ee7b7; border-color: #34d399; border-left-color: #059669; }
.crm-week-card.tone-sun { background: #fde047; border-color: #facc15; border-left-color: #ca8a04; }
.crm-week-card.tone-lilac { background: #c4b5fd; border-color: #a78bfa; border-left-color: #7c3aed; }
.crm-week-card.tone-rose { background: #fda4af; border-color: #fb7185; border-left-color: #e11d48; }
.crm-week-card.tone-sky { background: #7dd3fc; border-color: #38bdf8; border-left-color: #0284c7; }
.crm-week-card.tone-peach { background: #fdba74; border-color: #fb923c; border-left-color: #ea580c; }
.crm-week-card.tone-teal { background: #5eead4; border-color: #2dd4bf; border-left-color: #0f766e; }
.crm-week-card.tone-coral { background: #fca5a5; border-color: #f87171; border-left-color: #dc2626; }
.crm-week-card.tone-indigo { background: #a5b4fc; border-color: #818cf8; border-left-color: #4338ca; }
.crm-week-card.tone-lime { background: #bef264; border-color: #a3e635; border-left-color: #4d7c0f; }

.crm-week-card:hover {
    filter: none;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.14);
}

/* Выбор цвета направления в форме */
.tone-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tone-picker__item {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 12px 7px 8px;
    border: 1.5px solid var(--crm-border, #e2e8f0);
    border-radius: 999px;
    cursor: pointer;
    font-size: 13px;
    user-select: none;
    background: #fff;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.tone-picker__item input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.tone-picker__item:has(input:checked) {
    border-color: var(--crm-blue, #2563eb);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

.tone-picker__swatch {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    flex: 0 0 auto;
    border: 1px solid rgba(0, 0, 0, 0.08);
}

.tone-picker__swatch.tone-auto {
    background: conic-gradient(#16a34a, #f59e0b, #e11d64, #2280ff, #9333ea, #16a34a);
}

.tone-picker__swatch.tone-mint { background: #16a34a; }
.tone-picker__swatch.tone-sun { background: #f5b301; }
.tone-picker__swatch.tone-lilac { background: #9333ea; }
.tone-picker__swatch.tone-rose { background: #e11d64; }
.tone-picker__swatch.tone-sky { background: #2280ff; }
.tone-picker__swatch.tone-peach { background: #f4611a; }
.tone-picker__swatch.tone-teal { background: #0d9488; }
.tone-picker__swatch.tone-coral { background: #ef4444; }
.tone-picker__swatch.tone-indigo { background: #4f46e5; }
.tone-picker__swatch.tone-lime { background: #65a30d; }

/* Справочники: статусы, источники, категории — inline-редактирование */
.dict-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 16px;
    align-items: start;
}

.dict-title {
    margin: 0 0 4px;
    font-size: 16px;
}

.dict-hint {
    margin: 0 0 12px;
    font-size: 13px;
    color: var(--crm-muted, #64748b);
}

.dict-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 0;
}

.dict-row--add {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed var(--crm-line, #e2e8f0);
}

.dict-input {
    flex: 1 1 auto;
    min-width: 0;
    padding: 7px 10px;
    font-size: 14px;
    border: 1px solid var(--crm-line, #e2e8f0);
    border-radius: 8px;
    background: var(--surface, #fff);
    color: inherit;
}

span.dict-input { border-color: transparent; }

.dict-input:focus {
    outline: none;
    border-color: var(--crm-blue, #2563eb);
}

.dict-color {
    padding: 7px 8px;
    font-size: 13px;
    border: 1px solid var(--crm-line, #e2e8f0);
    border-radius: 8px;
    background: var(--surface, #fff);
    color: inherit;
}

.dict-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    flex: 0 0 auto;
}

.dict-dot.tone-mint { background: #16a34a; }
.dict-dot.tone-sun { background: #f5b301; }
.dict-dot.tone-lilac { background: #9333ea; }
.dict-dot.tone-rose { background: #e11d64; }
.dict-dot.tone-sky { background: #2280ff; }
.dict-dot.tone-peach { background: #f4611a; }
.dict-dot.tone-teal { background: #0d9488; }
.dict-dot.tone-coral { background: #ef4444; }
.dict-dot.tone-indigo { background: #4f46e5; }
.dict-dot.tone-lime { background: #65a30d; }

.dict-del {
    width: 28px;
    height: 28px;
    flex: 0 0 auto;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--crm-muted, #94a3b8);
    font-size: 13px;
    cursor: pointer;
}

.dict-del:hover { color: #dc2626; background: rgba(220, 38, 38, 0.08); }

.dict-empty {
    margin: 8px 0;
    font-size: 13px;
    color: var(--crm-muted, #94a3b8);
}

.dict-defaults { margin-top: 10px; }

/* Метка клиента (свой статус) */
.crm-label-pill {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    color: rgba(0, 0, 0, 0.8);
}

.crm-label-pill.tone-mint { background: #6ee7b7; }
.crm-label-pill.tone-sun { background: #fde047; }
.crm-label-pill.tone-lilac { background: #c4b5fd; }
.crm-label-pill.tone-rose { background: #fda4af; }
.crm-label-pill.tone-sky { background: #7dd3fc; }
.crm-label-pill.tone-peach { background: #fdba74; }
.crm-label-pill.tone-teal { background: #5eead4; }
.crm-label-pill.tone-coral { background: #fca5a5; }
.crm-label-pill.tone-indigo { background: #a5b4fc; }
.crm-label-pill.tone-lime { background: #bef264; }

.crm-label-select,
.clients-dict-filter {
    padding: 6px 8px;
    font-size: 13px;
    border: 1px solid var(--crm-line, #e2e8f0);
    border-radius: 8px;
    background: var(--surface, #fff);
    color: inherit;
    max-width: 150px;
}

/* Направления: цвет и порядок прямо в списке */
.dir-colors {
    display: inline-flex;
    gap: 5px;
    flex-wrap: wrap;
}

.dir-color-dot {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid transparent;
    padding: 0;
    cursor: pointer;
    background-clip: padding-box;
}

.dir-color-dot.tone-mint { background-color: #16a34a; }
.dir-color-dot.tone-sun { background-color: #f5b301; }
.dir-color-dot.tone-lilac { background-color: #9333ea; }
.dir-color-dot.tone-rose { background-color: #e11d64; }
.dir-color-dot.tone-sky { background-color: #2280ff; }
.dir-color-dot.tone-peach { background-color: #f4611a; }
.dir-color-dot.tone-teal { background-color: #0d9488; }
.dir-color-dot.tone-coral { background-color: #ef4444; }
.dir-color-dot.tone-indigo { background-color: #4f46e5; }
.dir-color-dot.tone-lime { background-color: #65a30d; }

.dir-color-dot.is-current {
    border-color: var(--crm-text, #0f172a);
    box-shadow: 0 0 0 2px var(--surface, #fff) inset;
}

.dir-move {
    width: 22px;
    height: 20px;
    padding: 0;
    font-size: 10px;
    border: 1px solid var(--crm-line, #e2e8f0);
    border-radius: 6px;
    background: var(--surface, #fff);
    color: var(--crm-muted, #64748b);
    cursor: pointer;
    display: block;
    margin: 2px 0;
}

.dir-move:disabled { opacity: 0.35; cursor: default; }
.direction-move-cell { width: 30px; }
.direction-quick-add { max-width: 420px; }

/* Финансы */
.fin-month {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}

.fin-month__label { font-size: 17px; }

.fin-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.fin-stat {
    padding: 14px 16px;
    border-radius: 12px;
    border: 1px solid var(--crm-line, #e2e8f0);
    background: var(--surface, #fff);
}

.fin-stat span {
    display: block;
    font-size: 12px;
    color: var(--crm-muted, #64748b);
}

.fin-stat b {
    display: block;
    margin-top: 4px;
    font-size: 20px;
    letter-spacing: -0.03em;
}

.fin-stat--sales b { color: #16a34a; }
.fin-stat--income b { color: #0d9488; }
.fin-stat--expense b { color: #dc2626; }
.fin-stat--net b { color: var(--crm-blue, #2563eb); }

.fin-grid {
    display: grid;
    grid-template-columns: minmax(300px, 420px) 1fr;
    gap: 16px;
    align-items: start;
}

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

.fin-form__row {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
}

.fin-form__row .form-control { flex: 1 1 0; min-width: 0; }

.fin-kind {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    cursor: pointer;
}

.fin-cats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

@media (max-width: 520px) {
    .fin-cats { grid-template-columns: 1fr; }
}

.fin-pill {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}

.fin-pill--income { background: #d7f5e3; color: #15803d; }
.fin-pill--expense { background: #ffdde3; color: #be123c; }

.fin-amount.is-income { color: #16a34a; font-weight: 700; }
.fin-amount.is-expense { color: #dc2626; font-weight: 700; }

.fin-comment { color: var(--crm-muted, #64748b); font-size: 13px; }

/* Личный порядок бокового меню */
.menu-order-toggle {
    margin: 10px 12px 4px;
    padding: 6px 10px;
    font-size: 12px;
    color: var(--crm-muted, #64748b);
    background: transparent;
    border: 1px dashed var(--crm-line, #e2e8f0);
    border-radius: 8px;
    cursor: pointer;
    text-align: center;
    transition: color 0.15s ease, border-color 0.15s ease;
}

.menu-order-toggle:hover {
    color: var(--crm-blue, #2563eb);
    border-color: var(--crm-blue, #2563eb);
}

.menu-order-toggle.is-active {
    color: #fff;
    background: var(--crm-blue, #2563eb);
    border-style: solid;
    border-color: var(--crm-blue, #2563eb);
}

.sidebar-nav.is-menu-editing [data-menu-key] {
    position: relative;
    outline: 1px dashed rgba(37, 99, 235, 0.45);
    outline-offset: -1px;
    border-radius: 8px;
}

.sidebar-nav.is-menu-editing a[data-menu-key],
.sidebar-nav.is-menu-editing [data-menu-key] .nav-group-toggle {
    cursor: default;
}

.menu-move {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    display: inline-flex;
    gap: 2px;
    z-index: 3;
}

.nav-group .menu-move {
    top: 18px;
}

.menu-move__btn {
    width: 22px;
    height: 22px;
    padding: 0;
    font-size: 10px;
    line-height: 1;
    border: 1px solid var(--crm-line, #e2e8f0);
    border-radius: 6px;
    background: var(--surface, #fff);
    color: var(--crm-muted, #64748b);
    cursor: pointer;
}

.menu-move__btn:hover {
    color: var(--crm-blue, #2563eb);
    border-color: var(--crm-blue, #2563eb);
}

@media (hover: hover) and (pointer: fine) {
    .crm-week--grid .crm-week-card:hover,
    .crm-week--grid .crm-week-card:focus-within {
        z-index: 8;
        overflow: visible;
        align-self: start;
        height: auto;
        min-height: calc(100% - 6px);
        padding-bottom: 8px;
        box-shadow: 0 10px 28px rgba(15, 23, 42, 0.16);
    }

    .crm-week--grid .crm-week-card:hover .crm-week-hover,
    .crm-week--grid .crm-week-card:focus-within .crm-week-hover {
        display: flex;
    }
}

.crm-week-trial {
    display: inline-flex !important;
    align-items: center;
    margin-top: 4px;
    height: 16px;
    padding: 0 6px;
    border-radius: 999px;
    background: #fffbe6;
    border: 1px solid #ffe58f;
    color: #ad6800 !important;
    font-size: 10px;
    font-weight: 650;
    line-height: 1;
    max-width: 100%;
}

.crm-week-mark {
    display: inline-flex !important;
    align-items: center;
    margin: 4px 4px 0 0;
    height: 18px;
    padding: 0 7px;
    border-radius: 999px;
    font-size: 10.5px;
    font-weight: 700;
    line-height: 1;
    max-width: 100%;
    white-space: nowrap;
}

.crm-week-mark.is-done {
    background: #ecfdf3;
    border: 1px solid #bbf7d0;
    color: #15803d !important;
}

.crm-week-mark.is-wait {
    background: #fff7e6;
    border: 1px solid #ffd591;
    color: #ad4e00 !important;
}

.crm-mark-summary {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 18px;
    margin: 0 0 12px;
    padding: 10px 14px;
    border: 1px solid var(--crm-line, #e5e7eb);
    border-radius: 12px;
    background: #fff;
    font-size: 13px;
    color: var(--crm-muted, #6b7280);
}

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

.crm-mark-summary b {
    color: #111827;
    font-size: 15px;
    margin-left: 2px;
}

.crm-mark-summary__title {
    font-weight: 700;
    color: #111827;
}

.crm-mark-summary .is-done b {
    color: #15803d;
}

.crm-mark-summary__wait {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 32px;
    margin-left: auto;
    padding: 0 12px;
    border: 1px solid #ffd591;
    border-radius: 999px;
    background: #fff7e6;
    color: #ad4e00;
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.crm-mark-summary__wait b {
    color: #ad4e00;
}

.crm-mark-summary__wait em {
    font-style: normal;
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.crm-mark-summary__wait[aria-pressed="true"] {
    background: #ad4e00;
    border-color: #ad4e00;
    color: #fff;
}

.crm-mark-summary__wait[aria-pressed="true"] b {
    color: #fff;
}

.crm-mark-summary__wait:disabled {
    cursor: default;
    border-color: #bbf7d0;
    background: #ecfdf3;
    color: #15803d;
}

.crm-mark-summary__wait:disabled b {
    color: #15803d;
}

.is-only-unmarked .crm-week-card[data-live-card]:not(.is-unmarked) {
    opacity: 0.18;
    pointer-events: none;
}

html[data-theme="dark"] body.crm-ui .crm-mark-summary {
    background: #fff;
}

.crm-list-view[hidden],
.crm-week-view[hidden] {
    display: none !important;
}

/* Менеджер зала в той же CRM-оболочке */
body.crm-ui.desk-app {
    --desk-green: #1677ff;
    --desk-ink: rgba(0, 0, 0, 0.88);
    --desk-muted: rgba(0, 0, 0, 0.45);
    --desk-line: #e6edf4;
    --desk-card: var(--surface);
    background: var(--crm-canvas);
}

body.crm-ui.desk-app .desk-top,
body.crm-ui.desk-app .desk-nav {
    display: none;
}

body.crm-ui.desk-app .desk-main {
    padding: 0;
    max-width: none;
}

body.crm-ui.desk-app .desk-main:has(.trial-sheet) {
    width: 100%;
    max-width: none;
    min-width: 0;
}

body.crm-ui.desk-app .desk-btn {
    background: var(--crm-blue);
    color: #fff;
    border-radius: 8px;
    min-height: 40px;
}

body.crm-ui.desk-app .desk-btn.secondary,
body.crm-ui.desk-app .desk-btn.ghost {
    background: var(--surface);
    color: var(--crm-ink);
    border: 1px solid var(--crm-line);
}

body.crm-ui.desk-app .desk-card,
body.crm-ui.desk-app .desk-stat,
body.crm-ui.desk-app .desk-group {
    background: var(--surface);
    border: 1px solid var(--crm-line);
    box-shadow: none;
    border-radius: 10px;
}

body.crm-ui.desk-app .desk-pill.arrived,
body.crm-ui.desk-app .desk-pill.now,
body.crm-ui.desk-app .desk-pill.crm {
    background: var(--crm-soft);
    color: var(--crm-soft-ink);
}

body.crm-ui.desk-app .desk-shift {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
    padding: 10px 14px;
    background: var(--surface);
    border: 1px solid var(--crm-line);
    border-radius: 10px;
    font-size: 0.88rem;
}

body.crm-ui.desk-app .desk-shift-dot {
    background: #22c55e;
    box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.15);
}

body.crm-ui.desk-app .desk-shift-dot.off {
    background: #94a3b8;
    box-shadow: 0 0 0 4px rgba(148, 163, 184, 0.16);
}

body.crm-ui.desk-app .desk-clock-inline {
    font-variant-numeric: tabular-nums;
    font-weight: 700;
    color: var(--crm-muted);
}

body.crm-ui.desk-app .desk-avatar {
    background: var(--crm-blue);
}

body.crm-ui.desk-app .desk-progress > i {
    background: var(--crm-blue);
}

body.crm-ui.desk-app .desk-found {
    background: var(--crm-soft);
}

body.crm-ui.desk-app .desk-more {
    display: none;
}

/* ===== Ресепшен = визуал админки партнёра (Tamara): формы, сканер, ссылки, типографика ===== */
body.crm-ui.desk-app .desk-btn {
    font-size: 14px;
    font-weight: 600;
}

body.crm-ui.desk-app .desk-btn:hover {
    background: var(--crm-blue-hover);
}

body.crm-ui.desk-app .desk-btn.secondary:hover,
body.crm-ui.desk-app .desk-btn.ghost:hover {
    background: var(--crm-hover);
    color: var(--crm-blue);
    border-color: var(--crm-blue);
}

body.crm-ui.desk-app .desk-btn.danger {
    background: #f04438;
}

body.crm-ui.desk-app .desk-btn.kaspi {
    background: #f04438;
}

body.crm-ui.desk-app .desk-h1 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

body.crm-ui.desk-app .desk-form input,
body.crm-ui.desk-app .desk-form select,
body.crm-ui.desk-app .desk-form textarea,
body.crm-ui.desk-app .desk-search input,
body.crm-ui.desk-app .desk-search select {
    border: 1px solid var(--crm-line);
    border-radius: 8px;
    min-height: 40px;
    padding: 8px 12px;
    font-size: 14px;
    background: var(--surface);
    color: var(--crm-ink);
}

body.crm-ui.desk-app .desk-form input:focus,
body.crm-ui.desk-app .desk-form select:focus,
body.crm-ui.desk-app .desk-form textarea:focus,
body.crm-ui.desk-app .desk-search input:focus {
    outline: none;
    border-color: var(--crm-blue);
    box-shadow: 0 0 0 3px var(--crm-blue-soft);
}

body.crm-ui.desk-app .desk-form label {
    color: var(--crm-ink);
}

body.crm-ui.desk-app .desk-avatar {
    border-radius: 50%;
}

body.crm-ui.desk-app .desk-link {
    color: var(--crm-blue);
}

body.crm-ui.desk-app .desk-filter {
    background: var(--surface);
    border-color: var(--crm-line);
    color: var(--crm-muted);
    font-weight: 600;
}

body.crm-ui.desk-app .desk-filter.is-on {
    background: var(--crm-soft);
    border-color: var(--crm-soft-line);
    color: var(--crm-soft-ink);
}

body.crm-ui.desk-app .desk-scan {
    background: var(--surface);
    border-color: var(--crm-line);
}

body.crm-ui.desk-app .desk-scan-form input {
    border: 1px solid var(--crm-soft-line);
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: .04em;
}

body.crm-ui.desk-app .desk-scan-form input:focus {
    border-color: var(--crm-blue);
    box-shadow: 0 0 0 3px var(--crm-blue-soft);
}

body.crm-ui.desk-app .desk-scan-dot {
    background: #22c55e;
    box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.15);
}

body.crm-ui.desk-app .desk-scan-result.is-ok {
    background: #f6ffed;
    border-color: #d9f7be;
}

body.crm-ui.desk-app .desk-scan-opt {
    border-radius: 8px;
}

body.crm-ui.desk-app .desk-notice-live {
    border: 1px solid #ffe58f;
    background: #fffbe6;
    border-radius: 8px;
}

body.crm-ui.desk-app .desk-empty {
    background: var(--crm-well);
    border: 1px dashed var(--crm-line);
    border-radius: 10px;
    padding: 16px;
}

body.crm-ui.desk-app .desk-hero-start {
    background: var(--surface);
    border: 1px solid var(--crm-line);
    border-radius: 10px;
}

@media (min-width: 901px) {
    body.crm-ui.desk-app .desk-stats {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    body.crm-ui.desk-app .desk-actions {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (max-width: 900px) {
    .crm-week-card span:not(.crm-week-card__trainer):not(.crm-week-trial) {
        display: none;
    }

    body.crm-ui .sidebar {
        box-shadow: 12px 0 32px rgba(15, 23, 42, 0.12);
    }

    body.crm-ui .sidebar-backdrop {
        background: rgba(15, 23, 42, 0.28);
    }

    /* Не раздувать страницу: колонки сжимаются, внутренний scroll только у day-grid. */
    .crm-week {
        max-width: 100%;
        overflow-x: hidden;
    }

    .crm-week-head,
    .crm-week-body {
        min-width: 0;
        grid-template-columns: 40px repeat(7, minmax(0, 1fr));
    }

    .crm-week-body {
        background-size: calc((100% - 40px) / 7) 36px;
        background-position: 40px 0;
    }

    .crm-day-grid {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .crm-day-grid .crm-week-head,
    .crm-day-grid .crm-week-body {
        min-width: 0;
        grid-template-columns: 40px repeat(var(--cols, 1), minmax(112px, 1fr));
    }

    .crm-day-grid .crm-week-body {
        background-size: calc((100% - 40px) / var(--cols, 1)) 36px;
        background-position: 40px 0;
    }
}

/* --- Расписание: «Сегодня», день по сотрудникам --- */
.crm-week-today {
    display: inline-flex;
    align-items: center;
    height: 32px;
    padding: 0 12px;
    margin-left: 4px;
    border: 1px solid var(--crm-line);
    border-radius: 8px;
    background: var(--surface);
    color: var(--crm-muted);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
}

.crm-week-today:hover {
    border-color: #91caff;
    color: var(--crm-blue);
}

.crm-week-range {
    margin: 0;
    padding: 0 14px;
    min-width: 150px;
    text-align: center;
    font-size: 15px;
}

.crm-week-corner {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--crm-muted);
}

.crm-week-corner svg {
    width: 20px;
    height: 20px;
}

.crm-day-grid {
    max-width: 100%;
    overflow-x: auto;
}

.crm-day-grid .crm-week-head,
.crm-day-grid .crm-week-body {
    grid-template-columns: 56px repeat(var(--cols, 1), minmax(160px, 1fr));
    min-width: calc(56px + (var(--cols, 1) * 160px));
}

.crm-day-grid .crm-week-body {
    background-size: calc((100% - 56px) / var(--cols, 1)) 36px;
    background-position: 56px 0;
}

.crm-week-day--staff {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
}

.crm-week-day--staff b {
    font-size: 14px;
}

.crm-week-day--staff span {
    font-size: 13px;
}

.crm-week-card small {
    display: block;
    opacity: 0.75;
}

/* --- График посещений в стиле Tamara --- */
body.crm-ui .crm-sheet-toolbar {
    margin-bottom: 10px;
}

body.crm-ui .crm-sheet-date {
    position: relative;
    cursor: pointer;
}

body.crm-ui .crm-sheet-date input[type="date"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

body.crm-ui .crm-sheet-filters {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 14px;
    padding: 10px 12px;
    background: var(--crm-well);
    border: 1px solid var(--crm-line);
    border-radius: 10px;
}

body.crm-ui .crm-sheet-select {
    height: 36px;
    min-width: 220px;
    padding: 0 12px;
    border: 1px solid var(--crm-line);
    border-radius: 8px;
    background: var(--surface);
    color: var(--crm-ink);
    font: inherit;
    font-size: 13px;
}

body.crm-ui .crm-sheet-search {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 240px;
    height: 36px;
    padding: 0 12px;
    border: 1px solid var(--crm-line);
    border-radius: 8px;
    background: var(--surface);
    color: var(--crm-muted);
}

body.crm-ui .crm-sheet-search svg {
    width: 16px;
    height: 16px;
    flex: 0 0 auto;
}

body.crm-ui .crm-sheet-search input {
    flex: 1;
    border: 0;
    outline: 0;
    background: transparent;
    font: inherit;
    font-size: 13px;
    color: var(--crm-ink);
}

body.crm-ui .crm-sheet-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
    gap: 8px;
    margin-bottom: 12px;
}

body.crm-ui .crm-sheet-stat,
body.crm-ui .sheet-summary-item {
    background: var(--surface);
    border: 1px solid var(--crm-line);
    border-radius: 10px;
    padding: 10px 12px;
    box-shadow: none;
}

body.crm-ui .crm-sheet-stat strong,
body.crm-ui .sheet-summary-item strong {
    display: block;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--crm-ink);
}

body.crm-ui .crm-sheet-stat span,
body.crm-ui .sheet-summary-item span {
    color: var(--crm-muted);
    font-size: 12px;
}

body.crm-ui .crm-sheet-stat.is-present,
body.crm-ui .sheet-summary-item.tone-present { background: #ecfdf3; border-color: #bbf7d0; }
body.crm-ui .crm-sheet-stat.is-qr,
body.crm-ui .sheet-summary-item.tone-qr { background: #e6f4ff; border-color: #bae0ff; }
body.crm-ui .crm-sheet-stat.is-missed,
body.crm-ui .sheet-summary-item.tone-missed { background: #fff1f0; border-color: #ffccc7; }
body.crm-ui .crm-sheet-stat.is-pending,
body.crm-ui .sheet-summary-item.tone-pending { background: #fffbe6; border-color: #ffe58f; }

body.crm-ui .sheet {
    font-family: inherit;
}

body.crm-ui .sheet-app {
    border: 0;
    background: transparent;
}

body.crm-ui .sheet-menubar {
    display: none;
}

body.crm-ui .sheet-formula {
    min-height: 0;
    margin-bottom: 10px;
    padding: 8px 12px;
    border: 1px solid var(--crm-line);
    border-radius: 10px;
    background: var(--surface);
    color: var(--crm-muted);
    font-size: 13px;
}

body.crm-ui .sheet-formula b {
    display: none;
}

body.crm-ui .sheet-legend {
    gap: 8px;
    padding: 0 0 12px;
    background: transparent;
}

body.crm-ui .sheet-chip {
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 600;
}

body.crm-ui .sheet-chip.tone-present { background: #d9f7be; border-color: #b7eb8f; color: #237804; }
body.crm-ui .sheet-chip.tone-qr { background: #bae0ff; border-color: #91caff; color: #0958d9; }
body.crm-ui .sheet-chip.tone-auto { background: #e6fffb; border-color: #87e8de; color: #006d75; }
body.crm-ui .sheet-chip.tone-missed { background: #ffccc7; border-color: #ffa39e; color: #cf1322; }
body.crm-ui .sheet-chip.tone-pending { background: #fff1b8; border-color: #ffe58f; color: #ad6800; }
body.crm-ui .sheet-chip.tone-upcoming { background: #e6f4ff; border-color: #91caff; color: #1677ff; }
body.crm-ui .sheet-chip.tone-none { background: #f5f5f5; border-color: #e8e8e8; color: rgba(0, 0, 0, 0.45); }

body.crm-ui .sheet-group {
    border: 1px solid var(--crm-line);
    border-radius: 10px;
    margin-bottom: 12px;
    overflow: hidden;
    background: var(--surface);
}

body.crm-ui .sheet-group + .sheet-group {
    border-top: 1px solid var(--crm-line);
}

body.crm-ui .sheet-group-bar {
    padding: 12px 14px;
    background: var(--crm-well);
    border-bottom: 1px solid var(--crm-line);
}

body.crm-ui .sheet-group-bar strong {
    font-size: 14px;
    color: var(--crm-ink);
}

body.crm-ui .sheet-group-bar span,
body.crm-ui .sheet-group-stats {
    color: var(--crm-muted);
    font-size: 12px;
}

body.crm-ui .sheet-scroll {
    background: var(--surface);
}

body.crm-ui .sheet-table {
    font-size: 13px;
}

body.crm-ui .sheet:not(.sheet--crm) .sheet-table th,
body.crm-ui .sheet:not(.sheet--crm) .sheet-table td {
    border-color: var(--crm-line);
}

body.crm-ui .sheet:not(.sheet--crm) .sheet-table thead th {
    background: var(--crm-well);
    color: var(--crm-muted);
    min-width: 56px;
    padding: 8px 4px;
    font-weight: 600;
}

body.crm-ui .sheet:not(.sheet--crm) .sheet-table thead th em {
    display: none;
}

body.crm-ui .sheet:not(.sheet--crm) .sheet-table thead th.is-today {
    background: var(--crm-soft);
    color: var(--crm-blue);
}

body.crm-ui .sheet:not(.sheet--crm) .sheet-table thead th.is-weekend {
    background: var(--crm-well);
}

body.crm-ui .sheet:not(.sheet--crm) .sheet-corner,
body.crm-ui .sheet:not(.sheet--crm) .sheet-num {
    display: none;
}

body.crm-ui .sheet:not(.sheet--crm) .sheet-table .sheet-name {
    left: 0;
    min-width: 220px;
    max-width: 260px;
    padding: 8px 12px;
    background: var(--surface);
    box-shadow: 2px 0 0 var(--crm-line);
}

body.crm-ui .sheet:not(.sheet--crm) .sheet-table thead .sheet-name {
    background: var(--crm-well);
}

body.crm-ui .sheet:not(.sheet--crm) .sheet-table tbody tr:nth-child(even) .sheet-name,
body.crm-ui .sheet:not(.sheet--crm) .sheet-table tbody tr:nth-child(even) .sheet-num {
    background: var(--crm-hover);
}

body.crm-ui .sheet:not(.sheet--crm) .sheet-table tbody tr:hover .sheet-name,
body.crm-ui .sheet:not(.sheet--crm) .sheet-table tbody tr:hover .sheet-num {
    background: var(--crm-soft);
}

body.crm-ui .sheet:not(.sheet--crm) .sheet-name strong {
    font-size: 13px;
    color: var(--crm-ink);
}

body.crm-ui .sheet:not(.sheet--crm) .sheet-name span {
    font-size: 11px;
    color: var(--crm-muted);
}

body.crm-ui .sheet:not(.sheet--crm) .sheet-td {
    height: 36px;
    min-width: 56px;
}

body.crm-ui .sheet:not(.sheet--crm) .sheet-cell,
body.crm-ui .sheet:not(.sheet--crm) .sheet-dot {
    height: 36px;
    border-radius: 0;
    font-weight: 600;
}

body.crm-ui .sheet:not(.sheet--crm) button.sheet-cell:hover,
body.crm-ui .sheet:not(.sheet--crm) .sheet-cell.is-selected {
    outline-color: var(--crm-blue);
}

body.crm-ui .sheet:not(.sheet--crm) .sheet-cell.tone-present { color: #237804; background: #d9f7be; }
body.crm-ui .sheet:not(.sheet--crm) .sheet-cell.tone-qr { color: #0958d9; background: #bae0ff; }
body.crm-ui .sheet:not(.sheet--crm) .sheet-cell.tone-missed { color: #cf1322; background: #ffccc7; }
body.crm-ui .sheet:not(.sheet--crm) .sheet-cell.tone-pending { color: #ad6800; background: #fff1b8; }
body.crm-ui .sheet:not(.sheet--crm) .sheet-cell.tone-upcoming { color: #1677ff; background: #e6f4ff; }
body.crm-ui .sheet:not(.sheet--crm) .sheet-cell.tone-auto { color: #006d75; background: #e6fffb; }
body.crm-ui .sheet:not(.sheet--crm) .sheet-cell.tone-none,
body.crm-ui .sheet:not(.sheet--crm) .sheet-dot.tone-none { background: #fafafa; color: #d9d9d9; }

body.crm-ui .sheet-pop {
    top: 34px;
    border: 1px solid var(--crm-line);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
    padding: 8px;
}

body.crm-ui .sheet-pop-ok,
body.crm-ui .sheet-pop-no {
    border-radius: 8px;
    padding: 7px 12px;
    font-size: 13px;
}

body.crm-ui .sheet-pop-ok { background: #d9f7be; color: #237804; border-color: #b7eb8f; }
body.crm-ui .sheet-pop-no { background: #ffccc7; color: #cf1322; border-color: #ffa39e; }

body.crm-ui .sheet-tabs {
    gap: 8px;
    background: transparent;
    border: 0;
    padding: 4px 0 0;
}

body.crm-ui .sheet-tab {
    min-height: 32px;
    margin: 0;
    padding: 0 12px;
    border: 1px solid var(--crm-line);
    border-radius: 8px;
    background: var(--surface);
    color: var(--crm-ink);
}

body.crm-ui .sheet-tab:hover {
    background: var(--crm-soft);
    color: var(--crm-blue);
    border-color: var(--crm-soft-line);
}

@media (max-width: 720px) {
    body.crm-ui .crm-sheet-search {
        margin-left: 0;
        width: 100%;
        min-width: 0;
    }

    body.crm-ui .sheet-table .sheet-name {
        min-width: 148px;
        max-width: 168px;
    }
}

body.crm-ui .sidebar-studio {
    padding: 0 10px 12px;
    margin: 0 0 8px;
    border-bottom: 1px solid var(--crm-line);
}

body.crm-ui .sidebar-studio__name {
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--crm-ink);
    line-height: 1.3;
}

body.crm-ui .sidebar-studio__role {
    margin-top: 2px;
    font-size: 0.75rem;
    color: var(--crm-muted);
}

body.crm-ui .sidebar-studio__plan {
    display: inline-block;
    margin-top: 8px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--crm-blue);
    text-decoration: none;
}

body.crm-ui .branch-switch {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 10px;
}

body.crm-ui .branch-switch__label {
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--crm-muted, #64748b);
}

body.crm-ui .branch-switch__select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--crm-line);
    border-radius: 10px;
    background: var(--crm-surface, #fff);
    color: inherit;
    font: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
}

body.crm-ui .wake-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--crm-muted, #64748b);
    cursor: pointer;
    user-select: none;
}

body.crm-ui .wake-toggle input {
    width: 16px;
    height: 16px;
    margin: 0;
    accent-color: var(--crm-blue);
    cursor: pointer;
}

body.crm-ui .wake-toggle.is-on {
    color: var(--crm-blue);
}

body.crm-ui .crm-nav-divider {
    height: 1px;
    margin: 10px 8px;
    background: var(--crm-line);
}

body.crm-demo {
    --demo-bar-h: calc(48px + env(safe-area-inset-top, 0px));
    overflow-x: hidden;
}

body.crm-demo .crm-demo-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 80;
    height: var(--demo-bar-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: env(safe-area-inset-top, 0px) 16px 0;
    background: linear-gradient(90deg, #145a2a 0%, #1f7a3a 48%, #2aa24f 100%);
    color: #fff;
}

body.crm-demo .crm-demo-bar__back,
body.crm-demo .crm-demo-bar__label,
body.crm-demo .crm-demo-bar__apply {
    color: #fff;
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 600;
}

body.crm-demo .crm-demo-bar__label {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    pointer-events: none;
}

body.crm-demo .crm-demo-bar__apply {
    padding: 6px 14px;
    border-radius: 999px;
    background: var(--surface);
    color: #145a2a;
}

body.crm-demo .layout {
    min-height: calc(100vh - var(--demo-bar-h));
}

body.crm-demo .sidebar {
    top: var(--demo-bar-h);
    height: calc(100vh - var(--demo-bar-h));
}

body.crm-demo .crm-demo-note {
    margin: 0 0 14px;
    padding: 8px 12px;
    border-radius: 10px;
    background: #eaf6ee;
    color: #145a2a;
    font-size: 0.84rem;
}

body.crm-demo .crm-demo-note__short {
    display: none;
}

body.crm-demo .btn-danger {
    display: none;
}

body.crm-demo .sidebar-footer .btn-primary {
    width: 100%;
}

.crm-demo-page {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.crm-demo-highlights {
    margin: 0;
    padding: 16px 18px;
    border-radius: 14px;
    background: var(--surface);
    border: 1px solid var(--crm-line);
    list-style: none;
}

.crm-demo-highlights li {
    padding: 6px 0 6px 18px;
    position: relative;
}

.crm-demo-highlights li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 13px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #1f7a3a;
}

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

.crm-demo-card {
    display: block;
    padding: 16px;
    border-radius: 14px;
    background: var(--surface);
    border: 1px solid var(--crm-line);
    text-decoration: none;
    color: inherit;
    box-shadow: var(--shadow);
}

.crm-demo-card:hover {
    border-color: #91caff;
}

.crm-demo-card__meta {
    display: inline-block;
    margin-bottom: 8px;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--crm-blue);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.crm-demo-card strong {
    display: block;
    margin-bottom: 6px;
    font-size: 1rem;
}

.crm-demo-card p {
    margin: 0;
    color: var(--crm-muted);
    font-size: 0.88rem;
}

.crm-demo-tasks {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.crm-demo-task {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 12px 14px;
    border-radius: 12px;
    background: #f7faf8;
}

.crm-demo-task strong,
.crm-demo-task p {
    margin: 0;
}

.crm-demo-task p {
    margin-top: 4px;
    color: var(--crm-muted);
    font-size: 0.85rem;
}

.crm-demo-task__tag {
    flex-shrink: 0;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    background: var(--crm-soft);
    color: var(--crm-blue);
}

.crm-demo-task--warn .crm-demo-task__tag {
    background: #fff7e6;
    color: #ad6800;
}

.crm-demo-task--ok .crm-demo-task__tag {
    background: #eaf6ee;
    color: #145a2a;
}

.crm-demo-channel {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    background: #eaf6ee;
    color: #145a2a;
    font-size: 0.78rem;
    font-weight: 600;
}

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

.crm-demo-steps li {
    display: flex;
    gap: 14px;
    padding: 16px;
    border-radius: 14px;
    background: var(--surface);
    border: 1px solid var(--crm-line);
}

.crm-demo-steps__num {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: #1f7a3a;
    color: #fff;
    font-weight: 700;
}

.crm-demo-steps p {
    margin: 4px 0 0;
    color: var(--crm-muted);
}

.crm-demo-stores {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

@media (max-width: 900px) {
    body.crm-demo .crm-demo-bar__label {
        display: none;
    }

    body.crm-demo .crm-demo-bar {
        padding-left: max(12px, env(safe-area-inset-left));
        padding-right: max(12px, env(safe-area-inset-right));
    }

    body.crm-demo .crm-demo-bar__back,
    body.crm-demo .crm-demo-bar__apply {
        font-size: 0.8rem;
    }

    body.crm-demo .crm-demo-bar__apply {
        padding: 7px 12px;
        min-height: 34px;
    }

    body.crm-demo .app-topbar {
        position: sticky;
        top: var(--demo-bar-h);
        z-index: 20;
        margin: 0 0 12px;
        padding: 10px 0;
        background: var(--crm-canvas);
    }

    body.crm-demo .sidebar {
        width: min(300px, 86vw);
        padding-bottom: max(16px, env(safe-area-inset-bottom));
    }

    body.crm-demo .sidebar-platform {
        display: none;
    }

    body.crm-demo .sidebar-studio {
        padding-bottom: 10px;
        margin-bottom: 4px;
    }

    body.crm-demo .nav-item,
    body.crm-demo .nav-subitem {
        min-height: 42px;
    }

    body.crm-demo .main-content {
        padding: 12px 14px calc(28px + env(safe-area-inset-bottom));
    }

    /* Демо-бар фиксирован, а липкий топбар считается от контента
       .main-content и уезжает вниз на высоту бара. Отдаём это место
       отступом, чтобы топбар не накрывал первую строку страницы. */
    body.crm-demo .app-topbar {
        margin-bottom: calc(var(--demo-bar-h) + 12px);
    }

    body.crm-demo .page-header {
        margin-bottom: 8px;
    }

    body.crm-demo .page-header h1 {
        font-size: 1.2rem;
    }

    body.crm-demo .page-description {
        font-size: 0.82rem;
        line-height: 1.4;
    }

    body.crm-demo .crm-demo-note {
        margin-bottom: 10px;
        padding: 7px 10px;
    }

    body.crm-demo .crm-demo-note__full {
        display: none;
    }

    body.crm-demo .crm-demo-note__short {
        display: inline;
    }

    body.crm-demo .crm-toolbar,
    body.crm-demo .crm-schedule-toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    body.crm-demo .crm-week-nav {
        width: 100%;
        justify-content: space-between;
        gap: 6px;
    }

    body.crm-demo .crm-week-range {
        flex: 1;
        min-width: 0;
        padding: 0 6px;
        font-size: 14px;
    }

    body.crm-demo .crm-view-switch {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    body.crm-demo .crm-view-switch a {
        flex: 1 0 auto;
        text-align: center;
        white-space: nowrap;
        padding: 9px 10px;
    }

    body.crm-demo .crm-week,
    body.crm-demo .table-wrap,
    body.crm-demo .sheet-wrap,
    body.crm-demo .card-body {
        -webkit-overflow-scrolling: touch;
    }

    body.crm-demo .crm-week-head,
    body.crm-demo .crm-week-body {
        min-width: 0;
    }

    body.crm-demo .crm-demo-cards {
        grid-template-columns: 1fr;
    }

    body.crm-demo .crm-demo-task {
        flex-wrap: wrap;
    }

    body.crm-demo .crm-demo-stores .btn {
        flex: 1;
        text-align: center;
    }

    body.crm-demo .data-table {
        min-width: 520px;
    }
}

.crm-class-page {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

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

.crm-class-nav .btn {
    padding: 6px 10px;
    font-size: 13px;
}

.crm-class-note {
    margin: 0;
    padding: 8px 12px;
    border-radius: 8px;
    background: #fff7e6;
    color: #ad6800;
    font-size: 13px;
}

.crm-class-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    margin: 0;
}

.crm-class-summary .sheet-summary-item {
    padding: 6px 10px;
    border-radius: 8px;
}

.crm-class-summary .sheet-summary-item strong {
    font-size: 1rem;
    line-height: 1.2;
}

.crm-class-summary .sheet-summary-item span {
    font-size: 11px;
}

.crm-class-roster .card-body,
.crm-class-book .card-body {
    padding: 0;
}

.crm-class-table th,
.crm-class-table td {
    padding: 8px 12px;
    font-size: 13px;
    vertical-align: middle;
}

.crm-class-table th {
    font-size: 11px;
}

.crm-class-table tbody tr.is-ok {
    background: #f6ffed;
}

.crm-class-table tbody tr.is-miss {
    background: #fff1f0;
}

.crm-class-table tbody tr.is-wait {
    background: var(--surface);
}

.crm-class-name {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.crm-class-status {
    font-size: 12px;
    color: var(--crm-muted);
}

.crm-class-actions {
    white-space: nowrap;
    text-align: right;
}

.crm-class-actions .crm-class-mark,
.crm-class-mark {
    display: inline;
    margin: 0;
}

.crm-class-actions .btn-sm {
    padding: 4px 8px;
    font-size: 12px;
}

.crm-class-book__bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 10px;
    border-bottom: 1px solid var(--crm-line);
    background: #fafcfe;
}

.crm-class-book-tabs button {
    padding: 6px 12px;
    font-size: 12px;
}

.crm-class-pane {
    padding: 10px 12px;
}

.crm-class-pane[hidden] {
    display: none !important;
}

.crm-class-inline {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.crm-class-inline input[type="text"],
.crm-class-inline input[type="tel"],
.crm-class-inline select {
    margin: 0;
    min-height: 32px;
    padding: 6px 10px;
    font-size: 13px;
    border: 1px solid var(--crm-line);
    border-radius: 8px;
    background: var(--surface);
    color: var(--crm-ink);
}

.crm-class-inline input[type="text"],
.crm-class-inline input[type="tel"] {
    width: 140px;
    max-width: 100%;
}

.crm-class-inline select {
    min-width: 220px;
    flex: 1 1 220px;
}

.crm-class-inline--db {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed var(--crm-line);
}

.crm-class-inline--trial select {
    min-width: 200px;
}

.crm-class-hint {
    margin: 8px 0 0;
    font-size: 12px;
    color: var(--crm-muted);
}

.crm-class-table--attach {
    margin: 0;
}

.crm-assign-schedule {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin: 0;
}

.crm-assign-schedule select {
    margin: 0;
    max-width: 180px;
    min-height: 30px;
    padding: 4px 8px;
    font-size: 12px;
}

.crm-assign-schedule .btn-sm {
    margin: 0;
    padding: 4px 8px;
    font-size: 12px;
}

body.crm-ui .clients-filter em {
    font-style: normal;
    margin-left: 4px;
    opacity: 0.72;
}

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

    .crm-class-inline input[type="text"],
    .crm-class-inline input[type="tel"],
    .crm-class-inline select {
        width: 100%;
        min-width: 0;
        flex: 1 1 100%;
    }

    .crm-class-actions {
        white-space: normal;
    }
}


/* ===== Partner analytics (Tamara-style) ===== */
body.crm-ui .crm-analytics {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

body.crm-ui .crm-analytics__alert {
    margin: 0;
}

body.crm-ui .crm-analytics__filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 16px;
    padding: 12px 14px;
    background: var(--surface);
    border: 1px solid var(--crm-line);
    border-radius: 10px;
}

body.crm-ui .crm-analytics__periods {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 3px;
    background: var(--crm-track);
    border-radius: 999px;
}

body.crm-ui .crm-analytics__pill {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 4px 12px;
    border-radius: 999px;
    color: var(--crm-muted);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    border: 1px solid transparent;
}

body.crm-ui .crm-analytics__pill:hover {
    color: var(--crm-blue);
    background: var(--surface);
}

body.crm-ui .crm-analytics__pill.is-active {
    background: var(--crm-soft);
    color: var(--crm-soft-ink);
    border-color: var(--crm-soft-line);
}

body.crm-ui .crm-analytics__custom {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

body.crm-ui .crm-analytics__custom label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    font-size: 12px;
    color: var(--crm-muted);
}

body.crm-ui .crm-analytics__custom input[type="date"] {
    min-height: 32px;
    padding: 4px 8px;
    border: 1px solid var(--crm-line);
    border-radius: 8px;
    background: var(--surface);
    color: var(--crm-ink);
    font-size: 13px;
}

body.crm-ui .crm-analytics__range-label {
    margin-left: auto;
    font-size: 12px;
    color: var(--crm-muted);
    font-weight: 600;
}

body.crm-ui .crm-analytics__kpis {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

body.crm-ui .crm-analytics__kpi {
    position: relative;
    padding: 16px 16px 14px;
    border-radius: 12px;
    border: 1px solid var(--crm-line);
    background: var(--surface);
    overflow: hidden;
    opacity: 0;
    transform: translateY(8px);
    animation: crmAnalyticsFadeIn 0.45s ease forwards;
}

body.crm-ui .crm-analytics__kpi::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 4px;
    background: var(--crm-blue);
}

@keyframes crmAnalyticsFadeIn {
    to { opacity: 1; transform: translateY(0); }
}

body.crm-ui .crm-analytics__kpi.tone-mint { background: #f6ffed; border-color: #d9f7be; }
body.crm-ui .crm-analytics__kpi.tone-mint::before { background: #52c41a; }
body.crm-ui .crm-analytics__kpi.tone-lilac { background: #f9f0ff; border-color: #efdbff; }
body.crm-ui .crm-analytics__kpi.tone-lilac::before { background: #722ed1; }
body.crm-ui .crm-analytics__kpi.tone-sky { background: #e6f4ff; border-color: #bae0ff; }
body.crm-ui .crm-analytics__kpi.tone-sky::before { background: #1677ff; }
body.crm-ui .crm-analytics__kpi.tone-rose { background: #fff1f0; border-color: #ffccc7; }
body.crm-ui .crm-analytics__kpi.tone-rose::before { background: #f5222d; }
body.crm-ui .crm-analytics__kpi.tone-sun { background: #fffbe6; border-color: #ffe58f; }
body.crm-ui .crm-analytics__kpi.tone-sun::before { background: #faad14; }
body.crm-ui .crm-analytics__kpi.tone-peach { background: #fff7e6; border-color: #ffd591; }
body.crm-ui .crm-analytics__kpi.tone-peach::before { background: #fa8c16; }

body.crm-ui .crm-analytics__kpi-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--crm-muted);
    margin-bottom: 6px;
}

body.crm-ui .crm-analytics__kpi-value {
    display: flex;
    align-items: baseline;
    gap: 4px;
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--crm-ink);
    line-height: 1.1;
}

body.crm-ui .crm-analytics__kpi-suffix {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--crm-muted);
}

body.crm-ui .crm-analytics__kpi-meta {
    margin-top: 8px;
    font-size: 12px;
    color: var(--crm-muted);
}

body.crm-ui .crm-analytics__grid {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 12px;
}

body.crm-ui .crm-analytics__grid--tops {
    grid-template-columns: 1fr 1fr;
}

body.crm-ui .crm-analytics__panel {
    margin: 0;
}

body.crm-ui .crm-analytics__panel .card-header h2 {
    font-size: 15px;
}

body.crm-ui .crm-analytics__bars {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    height: 140px;
    padding-top: 8px;
}

body.crm-ui .crm-analytics__bar {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    height: 100%;
    min-width: 0;
    gap: 4px;
}

body.crm-ui .crm-analytics__bar i {
    display: block;
    width: 100%;
    max-width: 28px;
    min-height: 2px;
    border-radius: 6px 6px 2px 2px;
    background: linear-gradient(180deg, #69c0ff 0%, #1677ff 100%);
}

body.crm-ui .crm-analytics__bar span {
    font-size: 10px;
    color: var(--crm-muted);
    white-space: nowrap;
    transform: scale(0.92);
}

body.crm-ui .crm-analytics__bar span.is-muted {
    visibility: hidden;
}

body.crm-ui .crm-analytics__pay-wrap {
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
}

body.crm-ui .crm-analytics__donut-wrap {
    width: 160px;
    height: 160px;
    flex: 0 0 auto;
}

body.crm-ui .crm-analytics__legend {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1 1 160px;
}

body.crm-ui .crm-analytics__legend li {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

body.crm-ui .crm-analytics__legend strong {
    display: block;
    font-size: 13px;
}

body.crm-ui .crm-analytics__legend em {
    display: block;
    font-style: normal;
    font-size: 12px;
    color: var(--crm-muted);
}

body.crm-ui .crm-analytics__swatch {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-top: 4px;
    background: #95de64;
    flex: 0 0 auto;
}

body.crm-ui .crm-analytics__swatch.tone-0 { background: #95de64; }
body.crm-ui .crm-analytics__swatch.tone-1 { background: #b37feb; }
body.crm-ui .crm-analytics__swatch.tone-2 { background: #69c0ff; }
body.crm-ui .crm-analytics__swatch.tone-3 { background: #ffc069; }

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

body.crm-ui .crm-analytics__rank li {
    display: grid;
    grid-template-columns: 28px 1fr auto;
    gap: 10px;
    align-items: center;
}

body.crm-ui .crm-analytics__rank-n {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: var(--crm-track);
    color: var(--crm-muted);
    font-size: 12px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

body.crm-ui .crm-analytics__rank-main strong {
    display: block;
    font-size: 13px;
    margin-bottom: 4px;
}

body.crm-ui .crm-analytics__rank-bar {
    height: 6px;
    border-radius: 999px;
    background: #f0f2f5;
    overflow: hidden;
}

body.crm-ui .crm-analytics__rank-bar i {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #69c0ff, #1677ff);
    min-width: 4px;
}

body.crm-ui .crm-analytics__rank-bar.tone-lilac i {
    background: linear-gradient(90deg, #d3adf7, #722ed1);
}

body.crm-ui .crm-analytics__rank-bar.tone-sun i {
    background: linear-gradient(90deg, #ffe58f, #faad14);
}

body.crm-ui .crm-analytics__sub {
    margin: 0 0 10px;
    font-size: 13px;
    color: var(--crm-muted);
}

body.crm-ui .crm-analytics__rank strong.is-muted {
    color: var(--crm-muted);
    font-weight: 500;
}

body.crm-ui .crm-analytics__rank-meta {
    font-size: 12px;
    color: var(--crm-muted);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

body.crm-ui .crm-analytics__empty-inline,
body.crm-ui .crm-analytics__empty .field-help {
    margin: 0;
    color: var(--crm-muted);
    font-size: 13px;
}

body.crm-ui .crm-analytics__empty h2 {
    margin: 0 0 8px;
    font-size: 16px;
}

body.crm-ui .crm-analytics__actions {
    margin-top: 0;
}

/* Desk shift mini-dashboard */
body.crm-ui.desk-app .desk-shift-dash {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 14px;
}

body.crm-ui.desk-app .desk-shift-dash__card {
    position: relative;
    padding: 14px 14px 12px;
    border-radius: 12px;
    border: 1px solid var(--crm-line);
    background: var(--surface);
    overflow: hidden;
    opacity: 0;
    transform: translateY(6px);
    animation: crmAnalyticsFadeIn 0.4s ease forwards;
}

body.crm-ui.desk-app .desk-shift-dash__card:nth-child(1) { animation-delay: 0ms; }
body.crm-ui.desk-app .desk-shift-dash__card:nth-child(2) { animation-delay: 50ms; }
body.crm-ui.desk-app .desk-shift-dash__card:nth-child(3) { animation-delay: 100ms; }
body.crm-ui.desk-app .desk-shift-dash__card:nth-child(4) { animation-delay: 150ms; }
body.crm-ui.desk-app .desk-shift-dash__card:nth-child(5) { animation-delay: 200ms; }
body.crm-ui.desk-app .desk-shift-dash__card:nth-child(6) { animation-delay: 250ms; }

body.crm-ui.desk-app .desk-shift-dash__card::before {
    content: "";
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 4px;
}

body.crm-ui.desk-app .desk-shift-dash__card.tone-revenue { background: #f6ffed; border-color: #d9f7be; }
body.crm-ui.desk-app .desk-shift-dash__card.tone-revenue::before { background: #52c41a; }
body.crm-ui.desk-app .desk-shift-dash__card.tone-cash { background: #e8f6f0; border-color: #b5dfc8; }
body.crm-ui.desk-app .desk-shift-dash__card.tone-cash::before { background: #0f9d58; }
body.crm-ui.desk-app .desk-shift-dash__card.tone-kaspi { background: #ffeae7; border-color: #ffc2b8; }
body.crm-ui.desk-app .desk-shift-dash__card.tone-kaspi::before { background: #f04438; }
body.crm-ui.desk-app .desk-shift-dash__card.tone-sales { background: #e6f4ff; border-color: #bae0ff; }
body.crm-ui.desk-app .desk-shift-dash__card.tone-sales::before { background: #1677ff; }
body.crm-ui.desk-app .desk-shift-dash__card.tone-marks { background: #f9f0ff; border-color: #efdbff; }
body.crm-ui.desk-app .desk-shift-dash__card.tone-marks::before { background: #722ed1; }
body.crm-ui.desk-app .desk-shift-dash__card.tone-visits { background: #fffbe6; border-color: #ffe58f; }
body.crm-ui.desk-app .desk-shift-dash__card.tone-visits::before { background: #faad14; }

body.crm-ui.desk-app .desk-shift-dash__label {
    font-size: 11px;
    font-weight: 600;
    color: var(--crm-muted);
    margin-bottom: 4px;
}

body.crm-ui.desk-app .desk-shift-dash__value {
    font-size: 1.45rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--crm-ink);
    font-variant-numeric: tabular-nums;
}

body.crm-ui.desk-app .desk-shift-dash__meta {
    margin-top: 4px;
    font-size: 11px;
    color: var(--crm-muted);
}

body.crm-ui.desk-app .desk-shift-dash__head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 10px;
}

body.crm-ui.desk-app .desk-shift-dash__head h2 {
    margin: 0;
    font-size: 15px;
}

body.crm-ui.desk-app .desk-shift-dash__head span {
    font-size: 12px;
    color: var(--crm-muted);
}

@media (max-width: 1100px) {
    body.crm-ui .crm-analytics__kpis {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    body.crm-ui .crm-analytics__grid,
    body.crm-ui .crm-analytics__grid--tops {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 900px) {
    body.crm-ui.desk-app .desk-shift-dash {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    body.crm-ui .crm-analytics__kpis {
        grid-template-columns: 1fr;
    }
    body.crm-ui .crm-analytics__range-label {
        margin-left: 0;
        width: 100%;
    }
}

/* ===== Compact lists (Tamara) — .crm-list* / .crm-person* / .crm-kpi* ===== */
body.crm-ui .crm-kpis {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 14px;
}

body.crm-ui .crm-kpi {
    position: relative;
    padding: 12px 14px 12px 16px;
    border-radius: 10px;
    border: 1px solid var(--crm-line);
    background: var(--surface);
    overflow: hidden;
}

body.crm-ui .crm-kpi::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 3px;
    background: var(--crm-blue);
}

body.crm-ui .crm-kpi--sky { background: #e6f4ff; border-color: #bae0ff; }
body.crm-ui .crm-kpi--sky::before { background: #1677ff; }
body.crm-ui .crm-kpi--mint { background: #f6ffed; border-color: #d9f7be; }
body.crm-ui .crm-kpi--mint::before { background: #52c41a; }
body.crm-ui .crm-kpi--sun { background: #fffbe6; border-color: #ffe58f; }
body.crm-ui .crm-kpi--sun::before { background: #faad14; }
body.crm-ui .crm-kpi--lilac { background: #f9f0ff; border-color: #efdbff; }
body.crm-ui .crm-kpi--lilac::before { background: #722ed1; }

body.crm-ui .crm-kpi__label {
    font-size: 11px;
    font-weight: 600;
    color: var(--crm-muted);
    margin-bottom: 4px;
    line-height: 1.3;
}

body.crm-ui .crm-kpi__value {
    font-size: 1.45rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--crm-ink);
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}

body.crm-ui .crm-kpi__meta {
    margin-top: 4px;
    font-size: 11px;
    color: var(--crm-muted);
    line-height: 1.3;
}

body.crm-ui .crm-list {
    display: flex;
    flex-direction: column;
}

body.crm-ui .crm-list__row {
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 10px 16px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--crm-line);
    background: var(--surface);
}

body.crm-ui .crm-list__row[hidden],
body.crm-ui .crm-list__row.is-filtered-out,
body.crm-ui .client-card[hidden],
body.crm-ui .client-card.is-filtered-out,
body.crm-ui .clients-empty-filter[hidden] {
    display: none !important;
}

body.crm-ui .crm-list__row:last-child {
    border-bottom: none;
}

body.crm-ui .crm-list__row:hover {
    background: var(--crm-hover);
}

body.crm-ui .crm-list__row.is-pending {
    background: #fffbe6;
}

body.crm-ui .crm-list__row.is-pending:hover {
    background: #fff7d6;
}

body.crm-ui .crm-list__row.is-trial {
    box-shadow: inset 3px 0 0 #faad14;
}

body.crm-ui .crm-trial-chip {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    height: 18px;
    padding: 0 7px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.04em;
    line-height: 1;
    text-transform: uppercase;
    white-space: nowrap;
    background: #fff1b8;
    color: #ad4e00;
    border: 1px solid #ffc53d;
}

body.crm-ui .crm-trial-links {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0;
}

body.crm-ui .crm-trial-link {
    font-size: 0.75rem;
    font-weight: 650;
    color: var(--crm-blue);
    text-decoration: none;
    white-space: nowrap;
}

body.crm-ui .crm-trial-link:hover,
body.crm-ui .crm-trial-link:focus-visible {
    text-decoration: underline;
}

body.crm-ui .crm-person {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 0 1 220px;
    max-width: 260px;
}

body.crm-ui .crm-person__avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    display: block;
    background: #e6edf4;
}

body.crm-ui .crm-person__avatar--initials {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--crm-blue);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.02em;
    line-height: 1;
    user-select: none;
}

body.crm-ui .crm-person__text {
    min-width: 0;
}

body.crm-ui .crm-person:has(.crm-trial-chip) {
    flex-basis: 240px;
    max-width: 300px;
}

body.crm-ui .crm-person__name {
    display: block;
    font-size: 0.92rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--crm-ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

body.crm-ui .crm-person__meta {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    margin-top: 2px;
}

body.crm-ui .crm-person__meta .crm-person__phone {
    margin-top: 0;
    flex: 1 1 auto;
    min-width: 0;
}

body.crm-ui .crm-person__phone {
    display: block;
    margin-top: 2px;
    font-size: 0.78rem;
    color: var(--crm-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

body.crm-ui .crm-list__body {
    flex: 0 1 340px;
    max-width: 380px;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: flex-start;
}

body.crm-ui .crm-list__title {
    font-size: 0.9rem;
    font-weight: 650;
    color: var(--crm-ink);
}

body.crm-ui .crm-list__sub {
    font-size: 0.78rem;
    color: var(--crm-muted);
}

body.crm-ui .crm-list__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 6px;
    font-size: 0.78rem;
    color: var(--crm-muted);
}

body.crm-ui .crm-list__dot {
    opacity: 0.45;
}

body.crm-ui .crm-list__subs {
    margin: 4px 0 0;
    padding: 0;
    list-style: none;
    width: 100%;
}

body.crm-ui .crm-list__subs li {
    padding: 6px 0 0;
    font-size: 0.82rem;
}

body.crm-ui .crm-list__subs li .crm-trial-chip {
    margin-left: 6px;
    vertical-align: middle;
}

body.crm-ui .crm-list__side {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
    flex: 0 0 auto;
    margin-left: 8px;
}

body.crm-ui .crm-list__badges {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 6px;
    justify-content: flex-end;
    align-items: center;
}

body.crm-ui .crm-list__date {
    display: block;
    width: 100%;
    text-align: right;
    font-size: 0.75rem;
    color: var(--crm-muted);
}

body.crm-ui .crm-list__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: flex-end;
    align-items: center;
}

body.crm-ui .crm-list-page .clients-card .card-body,
body.crm-ui .crm-list-page > .card-body {
    padding: 0;
}

body.crm-ui .crm-list-page .empty-state {
    padding: 28px 20px;
}

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

@media (max-width: 860px) {
    body.crm-ui .crm-list__row {
        flex-wrap: wrap;
    }

    body.crm-ui .crm-person {
        flex: 1 1 180px;
        max-width: none;
    }

    body.crm-ui .crm-list__body {
        flex: 1 1 100%;
        order: 3;
    }

    body.crm-ui .crm-list__side {
        margin-left: 0;
        align-items: flex-start;
    }

    body.crm-ui .crm-list__badges,
    body.crm-ui .crm-list__actions {
        justify-content: flex-start;
    }

    body.crm-ui .crm-list__date {
        text-align: left;
    }
}

@media (max-width: 640px) {
    body.crm-ui .main-content {
        overflow-x: clip;
    }

    body.crm-ui .page-header {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        margin-bottom: 14px;
    }

    body.crm-ui .page-header .btn {
        width: 100%;
        min-height: 44px;
    }

    body.crm-ui ol.crm-steps > li {
        flex: 1 1 calc(50% - 8px);
        min-width: 0;
        font-size: 12px;
    }

    body.crm-ui .crm-list-page,
    body.crm-ui .clients-page:not(.clients-sheet),
    body.crm-ui .clients-card:not(.clients-sheet),
    body.crm-ui .card.crm-list-page {
        max-width: 100%;
        min-width: 0;
        overflow-x: clip;
    }

    body.crm-ui .crm-list-page .clients-toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        padding: 14px 12px 4px;
    }

    body.crm-ui .crm-list-page .clients-search {
        min-width: 0;
        width: 100%;
    }

    body.crm-ui .crm-list-page .clients-filters,
    body.crm-ui .clients-filters--inline {
        padding: 8px 12px 12px;
        gap: 6px;
        width: 100%;
    }

    body.crm-ui .clients-filters--inline {
        border: 0;
        padding-left: 0;
        padding-right: 0;
    }

    body.crm-ui .clients-filter {
        min-height: 36px;
        padding: 6px 10px;
        max-width: 100%;
    }

    body.crm-ui .crm-list,
    body.crm-ui .crm-list__row,
    body.crm-ui .crm-list__open,
    body.crm-ui .crm-list__body,
    body.crm-ui .crm-list__side {
        min-width: 0;
        max-width: 100%;
    }

    body.crm-ui .crm-list__row,
    body.crm-ui .crm-list .crm-list__row.client-card,
    body.crm-ui .clients-page--partner .crm-list .client-card {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
        padding: 12px;
    }

    body.crm-ui .crm-list__open,
    body.crm-ui .crm-person,
    body.crm-ui .crm-person:has(.crm-trial-chip) {
        flex: 1 1 auto;
        width: 100%;
        max-width: none;
    }

    body.crm-ui .crm-list__body,
    body.crm-ui .crm-list__side {
        flex: 1 1 auto;
        width: 100%;
        order: 0;
        margin-left: 0;
        align-items: stretch;
    }

    body.crm-ui .crm-list__badges,
    body.crm-ui .crm-list__actions {
        justify-content: flex-start;
        width: 100%;
    }

    body.crm-ui .crm-list__date {
        width: auto;
        text-align: left;
    }

    body.crm-ui .crm-list__title,
    body.crm-ui .crm-list__sub,
    body.crm-ui .crm-list__meta,
    body.crm-ui .client-memberships-summary {
        overflow-wrap: anywhere;
        max-width: 100%;
    }

    body.crm-ui .crm-list__actions .inline-form {
        display: inline-flex;
        margin-left: 0;
    }

    body.crm-ui .crm-list__actions .btn {
        min-height: 40px;
        padding: 8px 12px;
        white-space: normal;
        text-align: center;
        line-height: 1.25;
        max-width: 100%;
    }

    body.crm-ui .crm-list__actions .btn-cta,
    body.crm-ui .crm-list__actions .btn-primary {
        flex: 1 1 10rem;
    }

    body.crm-ui .crm-assign-schedule {
        width: 100%;
    }

    body.crm-ui .crm-assign-schedule select {
        max-width: 100%;
        min-width: 0;
        flex: 1 1 140px;
    }

    body.crm-ui.desk-app .desk-shift {
        flex-wrap: wrap;
        align-items: stretch;
        gap: 8px;
    }

    body.crm-ui.desk-app .desk-shift .desk-btn {
        min-height: 40px;
    }
}

@media (max-width: 560px) {
    body.crm-ui .crm-kpis {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }

    body.crm-ui .crm-kpi {
        padding: 10px 10px 10px 12px;
    }

    body.crm-ui .crm-kpi__label,
    body.crm-ui .crm-kpi__meta {
        font-size: 10px;
    }

    body.crm-ui .crm-kpi__value {
        font-size: 1.25rem;
    }
}

@media (max-width: 400px) {
    body.crm-ui ol.crm-steps > li {
        flex: 1 1 100%;
    }
}

body.crm-ui.desk-app .desk-avatar.crm-person__avatar {
    border-radius: 50%;
    object-fit: cover;
    padding: 0;
}
body.crm-ui.desk-app img.desk-avatar {
    background: #e6edf4;
}

/* Override stretched panel.css .client-card grid when using compact list rows */
body.crm-ui .crm-list .crm-list__row.client-card,
body.crm-ui .clients-page--partner .crm-list .client-card {
    display: flex;
    grid-template-columns: none;
    align-items: center;
    gap: 10px 14px;
    padding: 8px 14px;
}

/* ===== Catalog: абонементы и тренеры ===== */
body.crm-ui .crm-catalog-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

body.crm-ui .crm-catalog-page,
body.crm-ui .crm-catalog-form {
    max-width: 100%;
    min-width: 0;
}

body.crm-ui .crm-catalog-page .crm-person {
    flex: 1 1 280px;
    max-width: 420px;
    align-items: flex-start;
}

body.crm-ui .crm-catalog-page .crm-person__name {
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.25;
    max-height: 2.55em;
    word-break: break-word;
}

body.crm-ui .crm-catalog-page .crm-list__title,
body.crm-ui .crm-catalog-page .crm-list__sub,
body.crm-ui .crm-catalog-page .crm-person__phone {
    overflow-wrap: break-word;
    word-break: break-word;
}

body.crm-ui .crm-catalog-page .crm-list__actions .inline-form {
    margin-left: 0;
}

body.crm-ui .crm-catalog-page .clients-toolbar {
    padding: 16px 16px 6px;
}

body.crm-ui .crm-catalog-page .clients-filters {
    padding: 8px 16px 12px;
}

body.crm-ui .crm-list__row.is-hidden {
    opacity: 0.72;
}

body.crm-ui .crm-list__price {
    font-size: 0.98rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--crm-ink);
    font-variant-numeric: tabular-nums;
}

body.crm-ui .crm-kind-avatar--membership { background: var(--crm-blue); }
body.crm-ui .crm-kind-avatar--single { background: #52c41a; }
body.crm-ui .crm-kind-avatar--trial { background: #faad14; }

body.crm-ui .crm-kind-pill,
body.crm-ui .crm-rate-pill {
    display: inline-flex;
    align-items: center;
    height: 22px;
    padding: 0 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 650;
    line-height: 1;
    border: 1px solid transparent;
    white-space: nowrap;
}

body.crm-ui .crm-kind-pill--membership,
body.crm-ui .crm-rate-pill.tone-salary {
    background: var(--crm-soft);
    color: var(--crm-soft-ink);
    border-color: var(--crm-soft-line);
}

body.crm-ui .crm-kind-pill--single,
body.crm-ui .crm-rate-pill.tone-fixed {
    background: #f6ffed;
    color: #389e0d;
    border-color: #d9f7be;
}

body.crm-ui .crm-kind-pill--trial,
body.crm-ui .crm-rate-pill.tone-pct {
    background: #fffbe6;
    color: #ad6800;
    border-color: #ffe58f;
}

body.crm-ui .crm-kind-pill--hall {
    background: #e6fffb;
    color: #006d75;
    border-color: #87e8de;
}

body.crm-ui .crm-kind-pill--group {
    background: #f9f0ff;
    color: #531dab;
    border-color: #d3adf7;
}

body.crm-ui .crm-rate-pill.tone-none {
    background: var(--crm-well);
    color: var(--crm-muted);
    border-color: var(--crm-line);
}

body.crm-ui .crm-rate-pill.tone-branch {
    background: #e6f4ff;
    color: #0958d9;
    border-color: #91caff;
}

/* Картинка тарифа в списке: скруглённый квадрат, как карточка товара. */
body.crm-ui .crm-tariff-thumb {
    border-radius: 10px;
    object-fit: cover;
    background: var(--crm-well);
    box-shadow: inset 0 0 0 1px rgba(15, 23, 42, .06);
}

body.crm-ui .crm-form-thumb {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    font-size: 13px;
}

body.crm-ui .crm-form-thumb img {
    border-radius: 10px;
    object-fit: cover;
    box-shadow: inset 0 0 0 1px rgba(15, 23, 42, .08);
}

body.crm-ui .crm-rate-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0 0 12px;
}

body.crm-ui .crm-period-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

body.crm-ui .crm-period-form {
    display: flex;
    align-items: center;
    gap: 8px;
}

body.crm-ui .crm-period-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--crm-muted);
}

body.crm-ui .crm-period-input {
    min-height: 34px;
    padding: 4px 10px;
    border: 1px solid var(--crm-line);
    border-radius: 8px;
    background: var(--surface);
    color: var(--crm-ink);
    font: inherit;
    font-size: 13px;
}

body.crm-ui .crm-form-dense .card-body {
    padding: 18px 18px 16px;
}

body.crm-ui .crm-form-dense .form-section {
    margin-bottom: 18px;
    padding-bottom: 16px;
}

body.crm-ui .crm-form-dense .form-section h3 {
    margin: 0 0 10px;
    font-size: 0.92rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

body.crm-ui .crm-form-dense .form-grid {
    gap: 12px;
}

body.crm-ui .crm-form-dense .form-group label {
    margin-bottom: 5px;
    font-size: 0.8rem;
}

body.crm-ui .crm-form-dense .form-control,
body.crm-ui .crm-form-dense .partner-form input,
body.crm-ui .crm-form-dense .partner-form select,
body.crm-ui .crm-form-dense .partner-form textarea {
    padding: 8px 11px;
    border-radius: 8px;
    font-size: 0.9rem;
}

body.crm-ui .crm-form-dense .form-control[readonly] {
    background: color-mix(in srgb, var(--crm-line) 35%, var(--surface));
    cursor: default;
}

body.crm-ui .crm-form-dense .form-actions {
    margin-top: 14px;
}

body.crm-ui .crm-form-dense .crm-section-lead {
    margin: -4px 0 10px;
}

body.crm-ui .crm-kind > div,
body.crm-ui .crm-kind ul {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    list-style: none;
    margin: 0;
    padding: 0;
}

body.crm-ui .crm-kind li,
body.crm-ui .crm-kind > div > div {
    margin: 0;
}

body.crm-ui .crm-kind label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin: 0;
    min-height: 34px;
    padding: 7px 14px;
    border: 1px solid var(--crm-line);
    border-radius: 999px;
    background: var(--surface);
    color: var(--crm-ink);
    font-size: 13px;
    font-weight: 650;
    cursor: pointer;
}

body.crm-ui .crm-kind input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

body.crm-ui .crm-kind label:has(input:checked) {
    background: var(--crm-blue);
    border-color: var(--crm-blue);
    color: #fff;
}

body.crm-ui .crm-person__avatar--lg {
    width: 72px;
    height: 72px;
    font-size: 22px;
}

body.crm-ui .crm-trainer-profile {
    display: grid;
    grid-template-columns: 148px minmax(0, 1fr);
    gap: 16px 20px;
    align-items: start;
}

body.crm-ui .crm-trainer-photo {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
}

body.crm-ui .crm-trainer-photo input[type="file"] {
    width: 100%;
    font-size: 12px;
}

body.crm-ui .crm-file-label {
    font-size: 0.8rem;
    font-weight: 600;
}

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

body.crm-ui .crm-file {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    position: relative;
}

body.crm-ui .crm-file-name {
    font-size: 0.8rem;
    color: var(--crm-muted);
    word-break: break-word;
}

body.crm-ui .crm-file-current {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 8px;
    font-size: 0.8rem;
    color: var(--crm-muted);
}

body.crm-ui .crm-file-clear {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
    color: var(--crm-ink);
}

body.crm-ui .crm-trainer-fields {
    margin: 0;
}

body.crm-ui .crm-catalog-form .form-group,
body.crm-ui .crm-catalog-form .form-control,
body.crm-ui .crm-catalog-form .partner-form input,
body.crm-ui .crm-catalog-form .partner-form select,
body.crm-ui .crm-catalog-form .partner-form textarea {
    max-width: 100%;
    min-width: 0;
}

@media (max-width: 860px) {
    body.crm-ui .page-header:has(.crm-catalog-actions) {
        align-items: stretch;
    }

    body.crm-ui .page-header:has(.crm-catalog-actions) > div {
        min-width: 0;
        flex: 1 1 220px;
    }

    body.crm-ui .crm-catalog-actions {
        flex: 1 1 220px;
    }

    body.crm-ui .crm-catalog-page .crm-list__row {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    body.crm-ui .crm-catalog-page .crm-person,
    body.crm-ui .crm-catalog-page .crm-list__body,
    body.crm-ui .crm-catalog-page .crm-list__side {
        flex: 1 1 auto;
        width: 100%;
        max-width: none;
        order: 0;
        margin-left: 0;
        align-items: flex-start;
    }

    body.crm-ui .crm-catalog-page .crm-list__body {
        max-width: none;
    }

    body.crm-ui .crm-catalog-page .crm-list__badges,
    body.crm-ui .crm-catalog-page .crm-list__actions {
        justify-content: flex-start;
        width: 100%;
    }
}

@media (max-width: 720px) {
    body.crm-ui .crm-trainer-profile {
        grid-template-columns: 1fr;
    }

    body.crm-ui .page-header:has(.crm-catalog-actions) {
        flex-direction: column;
        gap: 10px;
        margin-bottom: 16px;
    }

    body.crm-ui .page-header:has(.crm-catalog-actions) > div,
    body.crm-ui .crm-catalog-actions {
        flex: 1 1 auto;
        width: 100%;
    }

    body.crm-ui .crm-period-bar.crm-catalog-actions {
        align-items: stretch;
    }

    body.crm-ui .crm-period-form {
        flex-wrap: wrap;
        flex: 1 1 auto;
        min-width: 0;
        width: 100%;
    }

    body.crm-ui .crm-period-input {
        flex: 1 1 140px;
        min-width: 0;
        max-width: 100%;
    }

    body.crm-ui .crm-catalog-actions .btn-cta {
        flex: 1 1 auto;
        min-height: 42px;
    }

    body.crm-ui .crm-catalog-page .crm-person__name {
        -webkit-line-clamp: unset;
        display: block;
        max-height: none;
        overflow: visible;
        text-overflow: unset;
    }

    body.crm-ui .crm-catalog-page .clients-search {
        min-width: 0;
        width: 100%;
    }

    body.crm-ui .crm-catalog-form .form-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 560px) {
    body.crm-ui .crm-catalog-page .crm-kpis {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
        margin-bottom: 12px;
    }

    body.crm-ui .crm-catalog-page .crm-kpi {
        padding: 10px 10px 10px 12px;
    }

    body.crm-ui .crm-catalog-page .crm-kpi__value {
        font-size: 1.2rem;
        overflow-wrap: anywhere;
    }

    body.crm-ui .crm-catalog-page .crm-kpi__meta {
        overflow-wrap: break-word;
    }

    body.crm-ui .crm-catalog-page .crm-list__row {
        padding: 12px;
    }

    body.crm-ui .crm-catalog-page .crm-list__actions .btn {
        min-height: 36px;
    }

    body.crm-ui .crm-catalog-page .clients-toolbar,
    body.crm-ui .crm-catalog-page .clients-filters {
        padding-left: 12px;
        padding-right: 12px;
    }

    body.crm-ui .crm-catalog-page .clients-filter {
        min-height: 34px;
    }

    body.crm-ui .crm-form-dense.crm-catalog-form .card-body {
        padding: 14px 12px 12px;
    }

    body.crm-ui .crm-form-dense.crm-catalog-form .form-section {
        margin-bottom: 14px;
        padding-bottom: 12px;
    }

    body.crm-ui .crm-form-dense.crm-catalog-form .form-actions {
        flex-wrap: wrap;
        gap: 8px;
        margin-top: 10px;
    }

    body.crm-ui .crm-form-dense.crm-catalog-form .form-actions .btn {
        flex: 1 1 140px;
        min-height: 42px;
    }

    body.crm-ui .crm-catalog-form .form-control,
    body.crm-ui .crm-catalog-form .partner-form input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
    body.crm-ui .crm-catalog-form .partner-form select,
    body.crm-ui .crm-catalog-form .partner-form textarea {
        width: 100%;
        max-width: 100%;
        min-width: 0;
    }

    body.crm-ui .crm-kind {
        width: 100%;
    }

    body.crm-ui .crm-kind > div,
    body.crm-ui .crm-kind ul {
        width: 100%;
    }

    body.crm-ui .crm-kind label {
        flex: 1 1 calc(50% - 8px);
        justify-content: center;
        min-height: 40px;
    }

    body.crm-ui .crm-file {
        width: 100%;
    }

    body.crm-ui .crm-file-pick {
        min-height: 36px;
    }

    body.crm-ui .crm-rate-legend {
        gap: 6px;
    }
}

/* ===== Dark CRM palette (Tamara-style) ===== */
html[data-theme="dark"] body.crm-ui {
    --crm-blue: #3b82f6;
    --crm-blue-hover: #60a5fa;
    --crm-blue-soft: rgba(59, 130, 246, 0.18);
    --crm-sidebar: #111827;
    --crm-canvas: #0b1220;
    --crm-line: #243044;
    --crm-ink: rgba(255, 255, 255, 0.92);
    --crm-muted: rgba(255, 255, 255, 0.52);
    --crm-soft: rgba(59, 130, 246, 0.16);
    --crm-soft-ink: #93c5fd;
    --crm-soft-line: rgba(147, 197, 253, 0.32);
    --crm-hover: rgba(255, 255, 255, 0.04);
    --crm-track: #1a2436;
    --crm-well: #121a2a;
    --sidebar: #111827;
    --sidebar-hover: rgba(59, 130, 246, 0.12);
    --sidebar-active-bg: #2563eb;
    --sidebar-text: rgba(255, 255, 255, 0.78);
    --sidebar-text-hover: #93c5fd;
    --sidebar-border: #243044;
    --bg: #0b1220;
    --surface: #151c2c;
    --surface-muted: #0f1624;
    --border: #243044;
    --text: rgba(255, 255, 255, 0.92);
    --text-muted: rgba(255, 255, 255, 0.52);
    --primary: #3b82f6;
    --primary-hover: #60a5fa;
    --accent: #3b82f6;
    --brand-grad: #3b82f6;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
    --desk-ink: rgba(255, 255, 255, 0.92);
    --desk-muted: rgba(255, 255, 255, 0.52);
    --desk-line: #243044;
    --desk-card: #151c2c;
    --desk-bg: #0b1220;
    color-scheme: dark;
}

html[data-theme="dark"] body.crm-ui .nav-section-label {
    color: #7b879c;
}

html[data-theme="dark"] body.crm-ui input,
html[data-theme="dark"] body.crm-ui select,
html[data-theme="dark"] body.crm-ui textarea {
    background: var(--surface);
    color: var(--crm-ink);
    border-color: var(--crm-line);
    color-scheme: dark;
}

html[data-theme="dark"] body.crm-ui .sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.14);
}

html[data-theme="dark"] body.crm-ui .nav-chevron {
    background: rgba(255, 255, 255, 0.06);
}

html[data-theme="dark"] body.crm-ui .nav-chevron::before {
    border-color: #7b879c;
}

html[data-theme="dark"] body.crm-ui .clients-search svg {
    color: #7b879c;
}

html[data-theme="dark"] body.crm-ui .data-table tbody tr:hover,
html[data-theme="dark"] body.crm-ui .client-card:hover {
    background: var(--crm-hover);
}

html[data-theme="dark"] body.crm-ui .data-table tbody tr.is-pending,
html[data-theme="dark"] body.crm-ui .crm-list__row.is-pending {
    background: rgba(250, 173, 20, 0.12);
}

html[data-theme="dark"] body.crm-ui .data-table tbody tr.is-pending:hover,
html[data-theme="dark"] body.crm-ui .crm-list__row.is-pending:hover {
    background: rgba(250, 173, 20, 0.18);
}

html[data-theme="dark"] body.crm-ui .crm-week-card.tone-mint { background: #e8f8ee; border-color: #b7ebc6; }
html[data-theme="dark"] body.crm-ui .crm-week-card.tone-sun { background: #fff4d6; border-color: #ffe58f; }
html[data-theme="dark"] body.crm-ui .crm-week-card.tone-lilac { background: #f3e8ff; border-color: #d3adf7; }
html[data-theme="dark"] body.crm-ui .crm-week-card.tone-rose { background: #ffe8e6; border-color: #ffa39e; }
html[data-theme="dark"] body.crm-ui .crm-week-card.tone-sky { background: #e6f4ff; border-color: #91caff; }
html[data-theme="dark"] body.crm-ui .crm-week-card.tone-peach { background: #fff1e6; border-color: #ffbb96; }
html[data-theme="dark"] body.crm-ui .crm-week-card,
html[data-theme="dark"] body.crm-ui .crm-week-card strong,
html[data-theme="dark"] body.crm-ui .crm-week-card__name {
    color: rgba(0, 0, 0, 0.88);
}

html[data-theme="dark"] body.crm-ui .crm-analytics__kpi.tone-mint { background: #16301f; border-color: #245c38; }
html[data-theme="dark"] body.crm-ui .crm-analytics__kpi.tone-lilac { background: #2a1d3d; border-color: #4c2d78; }
html[data-theme="dark"] body.crm-ui .crm-analytics__kpi.tone-sky { background: #102a44; border-color: #1d4f7a; }
html[data-theme="dark"] body.crm-ui .crm-analytics__kpi.tone-rose { background: #3a1c1c; border-color: #7a2e2e; }
html[data-theme="dark"] body.crm-ui .crm-analytics__kpi.tone-sun { background: #3a2e14; border-color: #7a6418; }
html[data-theme="dark"] body.crm-ui .crm-analytics__kpi.tone-peach { background: #3a2414; border-color: #7a4a18; }

html[data-theme="dark"] body.crm-ui .crm-kpi--mint { background: #16301f; border-color: #245c38; }
html[data-theme="dark"] body.crm-ui .crm-kpi--lilac { background: #2a1d3d; border-color: #4c2d78; }
html[data-theme="dark"] body.crm-ui .crm-kpi--sky { background: #102a44; border-color: #1d4f7a; }
html[data-theme="dark"] body.crm-ui .crm-kpi--sun { background: #3a2e14; border-color: #7a6418; }

html[data-theme="dark"] body.crm-ui.desk-app .desk-shift-dash__card.tone-revenue { background: #16301f; border-color: #245c38; }
html[data-theme="dark"] body.crm-ui.desk-app .desk-shift-dash__card.tone-cash { background: #143028; border-color: #1f5c45; }
html[data-theme="dark"] body.crm-ui.desk-app .desk-shift-dash__card.tone-kaspi { background: #3a1c1c; border-color: #7a2e2e; }
html[data-theme="dark"] body.crm-ui.desk-app .desk-shift-dash__card.tone-sales { background: #102a44; border-color: #1d4f7a; }
html[data-theme="dark"] body.crm-ui.desk-app .desk-shift-dash__card.tone-marks { background: #2a1d3d; border-color: #4c2d78; }
html[data-theme="dark"] body.crm-ui.desk-app .desk-shift-dash__card.tone-visits { background: #3a2e14; border-color: #7a6418; }

html[data-theme="dark"] body.crm-ui .sheet-summary-item.tone-present { background: #16301f; border-color: #245c38; }
html[data-theme="dark"] body.crm-ui .sheet-summary-item.tone-qr { background: #102a44; border-color: #1d4f7a; }
html[data-theme="dark"] body.crm-ui .sheet-summary-item.tone-missed { background: #3a1c1c; border-color: #7a2e2e; }
html[data-theme="dark"] body.crm-ui .sheet-summary-item.tone-pending { background: #3a2e14; border-color: #7a6418; }

html[data-theme="dark"] body.crm-ui .sheet-chip.tone-present { background: #245c38; border-color: #2f7a4a; color: #b7eb8f; }
html[data-theme="dark"] body.crm-ui .sheet-chip.tone-qr { background: #1d4f7a; border-color: #2563a8; color: #bae0ff; }
html[data-theme="dark"] body.crm-ui .sheet-chip.tone-auto { background: #164e4e; border-color: #1d7373; color: #87e8de; }
html[data-theme="dark"] body.crm-ui .sheet-chip.tone-missed { background: #7a2e2e; border-color: #a33b3b; color: #ffccc7; }
html[data-theme="dark"] body.crm-ui .sheet-chip.tone-pending { background: #7a6418; border-color: #a3841f; color: #ffe58f; }
html[data-theme="dark"] body.crm-ui .sheet-chip.tone-upcoming { background: #1d4f7a; border-color: #2563a8; color: #91caff; }
html[data-theme="dark"] body.crm-ui .sheet-chip.tone-none { background: #1a2233; border-color: #243044; color: rgba(255, 255, 255, 0.45); }

html[data-theme="dark"] body.crm-ui .sheet:not(.sheet--crm) .sheet-cell.tone-present { color: #b7eb8f; background: #16301f; }
html[data-theme="dark"] body.crm-ui .sheet:not(.sheet--crm) .sheet-cell.tone-qr { color: #91caff; background: #102a44; }
html[data-theme="dark"] body.crm-ui .sheet:not(.sheet--crm) .sheet-cell.tone-missed { color: #ffa39e; background: #3a1c1c; }
html[data-theme="dark"] body.crm-ui .sheet:not(.sheet--crm) .sheet-cell.tone-pending { color: #ffe58f; background: #3a2e14; }
html[data-theme="dark"] body.crm-ui .sheet:not(.sheet--crm) .sheet-cell.tone-upcoming { color: #91caff; background: #102a44; }
html[data-theme="dark"] body.crm-ui .sheet:not(.sheet--crm) .sheet-cell.tone-auto { color: #87e8de; background: #164e4e; }

html[data-theme="dark"] body.crm-ui .sheet-pop-ok { background: #16301f; color: #b7eb8f; border-color: #245c38; }
html[data-theme="dark"] body.crm-ui .sheet-pop-no { background: #3a1c1c; color: #ffa39e; border-color: #7a2e2e; }

html[data-theme="dark"] body.crm-demo .crm-demo-note {
    background: #16301f;
    color: #b7eb8f;
}

html[data-theme="dark"] body.crm-ui .crm-demo-task {
    background: var(--crm-well);
}

html[data-theme="dark"] body.crm-ui.desk-app img.desk-avatar {
    background: #1a2436;
}

html[data-theme="dark"] body.crm-ui .theme-toggle {
    border-color: var(--crm-line);
    background: var(--surface);
    color: var(--crm-ink);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}

html[data-theme="dark"] body.crm-ui .theme-toggle:hover {
    border-color: var(--crm-blue);
    color: var(--crm-blue);
    background: var(--crm-blue-soft);
}

html[data-theme="dark"] body.crm-ui .crm-kind-pill--single,
html[data-theme="dark"] body.crm-ui .crm-rate-pill.tone-fixed {
    background: #16301f;
    color: #b7eb8f;
    border-color: #245c38;
}

html[data-theme="dark"] body.crm-ui .crm-kind-pill--trial,
html[data-theme="dark"] body.crm-ui .crm-rate-pill.tone-pct {
    background: #3a2e14;
    color: #ffe58f;
    border-color: #7a6418;
}

html[data-theme="dark"] body.crm-ui .crm-kind-pill--hall {
    background: #112f2e;
    color: #87e8de;
    border-color: #1d5c58;
}

html[data-theme="dark"] body.crm-ui .crm-kind-pill--group {
    background: #2a1a3a;
    color: #d3adf7;
    border-color: #522c7a;
}

html[data-theme="dark"] body.crm-ui .crm-list__row.is-trial {
    box-shadow: inset 3px 0 0 #d48806;
}

html[data-theme="dark"] body.crm-ui .crm-trial-chip {
    background: #5c4310;
    color: #ffe58f;
    border-color: #d48806;
}

html[data-theme="dark"] body.crm-ui .crm-kind-avatar--single { background: #389e0d; }
html[data-theme="dark"] body.crm-ui .crm-kind-avatar--trial { background: #d48806; }

html[data-theme="dark"] body.crm-ui .crm-chip.is-present,
html[data-theme="dark"] body.crm-ui .crm-journal-kpis .is-present { background: #16301f; border-color: #245c38; color: #b7eb8f; }
html[data-theme="dark"] body.crm-ui .crm-chip.is-present b,
html[data-theme="dark"] body.crm-ui .crm-journal-kpis .is-present b { color: #b7eb8f; }
html[data-theme="dark"] body.crm-ui .crm-chip.is-missed,
html[data-theme="dark"] body.crm-ui .crm-journal-kpis .is-missed { background: #3a1c1c; border-color: #7a2e2e; color: #ffa39e; }
html[data-theme="dark"] body.crm-ui .crm-chip.is-missed b,
html[data-theme="dark"] body.crm-ui .crm-journal-kpis .is-missed b { color: #ffa39e; }
html[data-theme="dark"] body.crm-ui .crm-chip.is-pending,
html[data-theme="dark"] body.crm-ui .crm-journal-kpis .is-pending { background: #3a2e14; border-color: #7a6418; color: #ffe58f; }
html[data-theme="dark"] body.crm-ui .crm-chip.is-pending b,
html[data-theme="dark"] body.crm-ui .crm-journal-kpis .is-pending b { color: #ffe58f; }
html[data-theme="dark"] body.crm-ui .crm-chip.is-qr { background: #102a44; border-color: #1d4f7a; color: #91caff; }
html[data-theme="dark"] body.crm-ui .crm-chip.is-qr b { color: #91caff; }
html[data-theme="dark"] body.crm-ui .crm-sheet-stat.is-present { background: #16301f; border-color: #245c38; }
html[data-theme="dark"] body.crm-ui .crm-sheet-stat.is-qr { background: #102a44; border-color: #1d4f7a; }
html[data-theme="dark"] body.crm-ui .crm-sheet-stat.is-missed { background: #3a1c1c; border-color: #7a2e2e; }
html[data-theme="dark"] body.crm-ui .crm-sheet-stat.is-pending { background: #3a2e14; border-color: #7a6418; }
html[data-theme="dark"] body.crm-ui .crm-journal-guide {
    background: var(--surface);
    border-color: var(--crm-line);
}
html[data-theme="dark"] body.crm-ui .crm-journal-read i {
    background: var(--crm-blue);
}
html[data-theme="dark"] body.crm-ui .crm-journal-left { background: #16301f; color: #86efac; }
html[data-theme="dark"] body.crm-ui .crm-journal-left.is-low { background: #3a2414; color: #fdba74; }
html[data-theme="dark"] body.crm-ui .crm-journal-table thead .crm-journal-client em { color: #86efac; }
html[data-theme="dark"] body.crm-ui .crm-journal-table tbody td.is-today,
html[data-theme="dark"] body.crm-ui .crm-journal-table tbody tr:nth-child(even) td.is-today {
    background: rgba(59, 130, 246, 0.14);
    box-shadow: inset 0 0 0 1px rgba(59, 130, 246, 0.18);
}
html[data-theme="dark"] body.crm-ui .crm-journal-table thead th.is-today {
    background: rgba(59, 130, 246, 0.18);
    box-shadow: inset 0 -3px 0 var(--crm-blue);
}
html[data-theme="dark"] body.crm-ui .crm-journal-card {
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.28), 0 12px 28px rgba(0, 0, 0, 0.18);
}
html[data-theme="dark"] body.crm-ui .crm-journal-card.is-nearest {
    border-color: #2563a8;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.28), 0 12px 28px rgba(0, 0, 0, 0.18);
}
html[data-theme="dark"] body.crm-ui .crm-now-class {
    background: var(--surface);
    border-color: var(--crm-line);
}
html[data-theme="dark"] body.crm-ui .crm-now-class.is-now {
    background: linear-gradient(180deg, #16301f 0%, var(--surface) 56px);
    border-color: #245c38;
}
html[data-theme="dark"] body.crm-ui .crm-now-class.is-soon {
    background: linear-gradient(180deg, #102a44 0%, var(--surface) 56px);
    border-color: #1d4f7a;
}
html[data-theme="dark"] body.crm-ui .crm-now-class.is-done {
    background: linear-gradient(180deg, #3a2e14 0%, var(--surface) 56px);
    border-color: #7a6418;
}
html[data-theme="dark"] body.crm-ui .crm-now-class__time { background: #0b1220; }
html[data-theme="dark"] body.crm-ui .crm-now-class.is-now .crm-now-class__phase {
    background: #16301f; border-color: #245c38; color: #b7eb8f;
}
html[data-theme="dark"] body.crm-ui .crm-now-class.is-soon .crm-now-class__phase {
    background: #102a44; border-color: #1d4f7a; color: #91caff;
}
html[data-theme="dark"] body.crm-ui .crm-now-class.is-done .crm-now-class__phase {
    background: #3a2e14; border-color: #7a6418; color: #ffe58f;
}
html[data-theme="dark"] body.crm-ui .crm-now-roster {
    background: var(--crm-well);
    border-color: var(--crm-line);
}
html[data-theme="dark"] body.crm-ui .crm-journal-jump a.is-nearest {
    background: #102a44;
    border-color: #1d4f7a;
    color: #91caff;
}
html[data-theme="dark"] body.crm-ui .crm-journal-table .crm-journal-client {
    box-shadow: 12px 0 18px -14px rgba(0, 0, 0, 0.65);
}
html[data-theme="dark"] body.crm-ui .crm-journal-add {
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 8px 18px rgba(37, 99, 235, 0.28);
}
html[data-theme="dark"] body.crm-ui .crm-avatar.tone-mint { background: #16301f; color: #86efac; }
html[data-theme="dark"] body.crm-ui .crm-avatar.tone-sun { background: #3a2e14; color: #fde68a; }
html[data-theme="dark"] body.crm-ui .crm-avatar.tone-lilac { background: #2a1d3d; color: #ddd6fe; }
html[data-theme="dark"] body.crm-ui .crm-avatar.tone-rose { background: #3a1c1c; color: #fecdd3; }
html[data-theme="dark"] body.crm-ui .crm-avatar.tone-sky { background: #102a44; color: #bfdbfe; }
html[data-theme="dark"] body.crm-ui .crm-avatar.tone-peach { background: #3a2414; color: #fed7aa; }
html[data-theme="dark"] body.crm-ui .crm-journal-pop {
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
}

/* --- Расписание: фильтры и правая панель отметки --- */
body.crm-ui .crm-schedule-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin: 0 0 12px;
}

body.crm-ui .crm-schedule-filters .crm-sheet-select {
    min-width: 160px;
    height: 34px;
    font-size: 13px;
}

body.crm-ui .crm-schedule-filters .crm-sheet-search {
    margin-left: auto;
    min-width: 200px;
    height: 34px;
}

body.crm-ui .crm-trainer-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin: -4px 0 12px;
}

body.crm-ui .crm-trainer-filters__label {
    margin-right: 2px;
    font-size: 12px;
    font-weight: 650;
    color: var(--crm-muted, rgba(0, 0, 0, 0.52));
}

body.crm-ui .crm-trainer-chip {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 4px 10px;
    border: 1px solid var(--crm-line, #e6edf4);
    border-radius: 999px;
    background: var(--surface, #fff);
    color: var(--crm-ink, rgba(0, 0, 0, 0.82));
    font-size: 12px;
    font-weight: 600;
    line-height: 1.2;
    text-decoration: none;
}

body.crm-ui .crm-trainer-chip:hover {
    border-color: var(--crm-blue, #1677ff);
    color: var(--crm-blue, #1677ff);
}

body.crm-ui .crm-trainer-chip.is-on {
    border-color: var(--crm-blue, #1677ff);
    background: var(--crm-blue-soft, rgba(22, 119, 255, 0.12));
    color: var(--crm-blue, #1677ff);
}

html[data-theme="dark"] body.crm-ui .crm-trainer-chip {
    background: #fff;
    border-color: #e6edf4;
    color: rgba(0, 0, 0, 0.82);
}

html[data-theme="dark"] body.crm-ui .crm-trainer-chip.is-on,
html[data-theme="dark"] body.crm-ui .crm-trainer-chip:hover {
    border-color: #1677ff;
    background: rgba(22, 119, 255, 0.12);
    color: #1677ff;
}

.crm-drawer-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.32);
    z-index: 80;
}

.crm-drawer {
    --crm-ink: rgba(0, 0, 0, 0.88);
    --crm-muted: rgba(0, 0, 0, 0.45);
    --crm-line: #e6edf4;
    --crm-well: #f8fafc;
    --crm-hover: #f7faff;
    --crm-blue: #1677ff;
    --crm-blue-hover: #0958d9;
    --crm-blue-soft: rgba(22, 119, 255, 0.12);
    --surface: #ffffff;
    --text: rgba(0, 0, 0, 0.88);
    --text-muted: rgba(0, 0, 0, 0.45);
    --border: #e6edf4;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(420px, 100vw);
    z-index: 90;
    display: flex;
    flex-direction: column;
    background: #fff;
    color: rgba(0, 0, 0, 0.88);
    color-scheme: light;
    box-shadow: -12px 0 40px rgba(15, 23, 42, 0.16);
    overflow: auto;
}

.crm-drawer__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 20px 8px;
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 1;
}

.crm-drawer__head h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.03em;
}

.crm-drawer__lead {
    margin: 4px 0 0;
    font-size: 13px;
    color: var(--crm-muted);
}

.crm-drawer__close {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--crm-muted);
    text-decoration: none;
    font-size: 22px;
    line-height: 1;
}

.crm-drawer__close:hover {
    background: var(--crm-hover);
    color: var(--crm-ink);
}

.crm-drawer__edit {
    margin-left: 8px;
    color: var(--crm-blue);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
}

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

.crm-drawer__delete {
    display: inline;
    margin-left: 10px;
}

.crm-drawer__delete button {
    border: 0;
    background: none;
    padding: 0;
    color: #c2410c;
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.crm-drawer__delete button:hover {
    text-decoration: underline;
}

.crm-cover-pill,
.crm-week-card__cover {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 6px;
    border-radius: 999px;
    font-size: 10px;
    font-style: normal;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: #7a4d00;
    background: #ffe8a3;
    vertical-align: middle;
}

.crm-cover-instead {
    display: block;
    margin-top: 2px;
    font-size: 12px;
    font-weight: 500;
    color: var(--crm-muted, rgba(0, 0, 0, 0.5));
}

.crm-cover-box {
    margin: 0 20px 12px;
    padding: 10px 12px;
    border: 1px solid var(--crm-line, rgba(15, 23, 42, 0.08));
    border-radius: 12px;
    background: var(--crm-soft, #f7f8fa);
}

.crm-cover-form {
    display: grid;
    gap: 8px;
}

.crm-cover-form__row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.crm-cover-cancel {
    margin-bottom: 8px;
}

.crm-cover-cancel .crm-drawer__edit {
    margin-left: 0;
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer;
}

.crm-drawer__meta {
    margin: 0;
    padding: 8px 20px 12px;
    display: grid;
    gap: 8px 16px;
}

.crm-drawer__meta div {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 8px;
    font-size: 13px;
}

.crm-drawer__meta dt {
    margin: 0;
    color: var(--crm-muted);
}

.crm-drawer__meta dd {
    margin: 0;
    font-weight: 600;
}

.crm-drawer__note {
    margin: 0 20px 10px;
    padding: 8px 10px;
    border-radius: 8px;
    background: #fff7e6;
    color: #ad6800;
    font-size: 13px;
}

.crm-drawer__note--ok {
    background: #f6ffed;
    color: #389e0d;
}

.crm-drawer__cta {
    display: inline-flex;
    margin-left: 6px;
    color: inherit;
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.crm-drawer-group {
    list-style: none;
    margin: 2px 0 0;
    padding: 6px 8px 0;
    font-size: 12px;
    font-weight: 600;
    color: var(--crm-muted);
}

.crm-drawer__hint {
    margin: -4px 20px 12px;
    font-size: 12px;
    color: var(--crm-muted);
    line-height: 1.4;
}

.crm-drawer-status {
    display: inline-flex;
    align-items: center;
    align-self: flex-start;
    min-height: 22px;
    padding: 0 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    background: var(--crm-well);
    color: var(--crm-muted);
}

.crm-drawer-status.is-ok {
    background: #ecfdf3;
    color: #15803d;
}

.crm-drawer-status.is-miss {
    background: #fff1f0;
    color: #cf1322;
}

.crm-drawer__section {
    margin: 8px 20px 8px;
    font-size: 12px;
    font-weight: 600;
    color: var(--crm-muted);
}

.crm-drawer__form {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.crm-drawer-people {
    list-style: none;
    margin: 0;
    padding: 0 16px 4px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.crm-drawer-person {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px;
    background: #fff;
    border: 1px solid #eef0f4;
    border-left: 4px solid #e5e7eb;
    border-radius: 14px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
    transition: border-color 0.15s ease;
}

.crm-drawer-person.is-ok {
    border-left-color: #22c55e;
}

.crm-drawer-person.is-miss {
    border-left-color: #ff4d4f;
}

.crm-drawer-person__head {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.crm-drawer-person__toggles {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.crm-mark-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 0 12px;
    border: 1.5px solid #e5e7eb;
    border-radius: 12px;
    background: #fff;
    color: #374151;
    font: inherit;
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.crm-mark-btn__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    font-size: 12px;
}

.crm-mark-btn.is-ok .crm-mark-btn__icon {
    background: #ecfdf3;
    color: #16a34a;
}

.crm-mark-btn.is-miss .crm-mark-btn__icon {
    background: #fff1f0;
    color: #ef4444;
}

.crm-mark-btn__text {
    display: inline;
}

.crm-mark-btn:disabled {
    cursor: default;
    opacity: 0.55;
}

.crm-mark-btn.is-ok:not(:disabled):hover {
    border-color: #86efac;
    background: #f6fef9;
}

.crm-mark-btn.is-miss:not(:disabled):hover {
    border-color: #fca5a5;
    background: #fff8f8;
}

.crm-mark-btn.is-ok.is-on:not(.is-saved) {
    border-color: #22c55e;
    background: #ecfdf3;
    color: #15803d;
}

.crm-mark-btn.is-miss.is-on:not(.is-saved) {
    border-color: #ff4d4f;
    background: #fff1f0;
    color: #cf1322;
}

.crm-mark-btn.is-ok.is-on.is-saved {
    border-color: #22c55e;
    background: #22c55e;
    color: #fff;
}

.crm-mark-btn.is-miss.is-on.is-saved {
    border-color: #ff4d4f;
    background: #ff4d4f;
    color: #fff;
}

.crm-mark-btn.is-on.is-saved .crm-mark-btn__icon {
    background: rgba(255, 255, 255, 0.24);
    color: #fff;
}

.crm-drawer-person__body {
    min-width: 0;
    flex: 1;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 8px;
}

.crm-drawer-person__more {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.crm-drawer-person__more .crm-drawer-chips {
    margin-top: 0;
    align-items: center;
}

.crm-drawer-chips__label {
    color: var(--crm-muted);
    font-size: 11px;
    margin-right: 2px;
}

.crm-drawer-comment {
    width: 100%;
    min-height: 32px;
    margin-top: 2px;
    padding: 0 8px;
    border: 1px solid var(--crm-line);
    border-radius: 8px;
    font: inherit;
    font-size: 12px;
}

.crm-drawer-comment.is-hidden {
    display: none;
}

.crm-drawer-move {
    display: block;
    width: 100%;
    margin-top: 8px;
    min-height: 34px;
    padding: 0 8px;
    border: 1px solid var(--crm-line);
    border-radius: 8px;
    background: #fff;
    font: inherit;
    font-size: 13px;
}

.crm-drawer-del {
    width: 32px;
    height: 32px;
    margin-left: auto;
    padding: 0;
    border: 0;
    background: transparent;
    color: #ff4d4f;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.crm-drawer-del svg {
    width: 18px;
    height: 18px;
}

.crm-drawer-tick {
    margin-top: 4px;
}

.crm-drawer-person__body strong {
    font-size: 14px;
}

.crm-drawer-person__body .crm-drawer-hint {
    display: inline;
    margin-top: 0;
}

.crm-drawer-hint {
    display: block;
    margin-top: 2px;
    font-size: 12px;
    color: var(--crm-muted);
}

.crm-drawer-hint.is-warn {
    color: #d4380d;
}

.crm-drawer-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
}

.crm-chip {
    height: 24px;
    padding: 0 8px;
    border-radius: 999px;
    border: 1px solid var(--crm-line);
    background: var(--crm-well);
    color: var(--crm-muted);
    font: inherit;
    font-size: 11px;
    cursor: pointer;
}

.crm-chip.is-on {
    background: #fff1f0;
    border-color: #ffa39e;
    color: #cf1322;
}

.crm-drawer-empty {
    padding: 16px 8px;
    color: var(--crm-muted);
    font-size: 13px;
}

.crm-drawer__actions {
    display: flex;
    gap: 8px;
    padding: 12px 20px 8px;
    position: sticky;
    bottom: 0;
    background: linear-gradient(to top, #fff 70%, transparent);
}

.crm-drawer__actions .btn:disabled,
.crm-drawer__actions .btn[disabled] {
    opacity: 0.42;
    cursor: default;
    pointer-events: none;
}

.crm-drawer-add {
    padding: 8px 20px 24px;
    border-top: 1px solid var(--crm-line);
}

.crm-drawer-add__row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 10px;
}

.crm-drawer-add__row select,
.crm-drawer-new select {
    flex: 1;
    min-height: 36px;
    padding: 0 10px;
    border: 1px solid var(--crm-line);
    border-radius: 8px;
    background: var(--surface);
    color: var(--crm-ink);
    font: inherit;
    font-size: 13px;
}

.crm-drawer-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1 1 120px;
    min-width: 0;
}

.crm-drawer-field--full {
    flex: 1 1 100%;
}

.crm-drawer-field > span {
    font-size: 12px;
    font-weight: 650;
    line-height: 1.2;
    color: var(--crm-muted, rgba(0, 0, 0, 0.52));
}

.crm-drawer-field--phone {
    flex: 1 1 180px;
}

.crm-drawer-field--phone .kz-phone,
.crm-drawer-new .crm-drawer-field input {
    width: 100%;
    flex: 1 1 auto;
}

.crm-drawer-add__row.is-enhanced [data-drawer-client-select] {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.crm-drawer-search {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1 1 100%;
    height: 38px;
    padding: 0 12px;
    border: 1px solid var(--crm-line, #e6edf4);
    border-radius: 10px;
    background: var(--surface, #fff);
    color: var(--crm-muted, rgba(0, 0, 0, 0.45));
}

.crm-drawer-search[hidden],
.crm-drawer-picks[hidden],
.crm-drawer-search__empty[hidden] {
    display: none !important;
}

.crm-drawer-search svg {
    width: 16px;
    height: 16px;
    flex: 0 0 auto;
}

.crm-drawer-search input {
    flex: 1;
    min-width: 0;
    border: 0;
    outline: 0;
    background: transparent;
    font: inherit;
    font-size: 13px;
    color: var(--crm-ink, rgba(0, 0, 0, 0.88));
}

.crm-drawer-picks {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1 1 100%;
    max-height: 228px;
    overflow: auto;
    padding-right: 2px;
}

.crm-drawer-pick[hidden] {
    display: none !important;
}

.crm-drawer-pick {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 48px;
    padding: 6px 10px;
    border: 1px solid var(--crm-line, #e6edf4);
    border-radius: 10px;
    background: var(--surface, #fff);
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.crm-drawer-pick:hover,
.crm-drawer-pick.is-on {
    border-color: var(--crm-blue, #1677ff);
    background: var(--crm-blue-soft, rgba(22, 119, 255, 0.12));
}

.crm-drawer-pick__ava {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #eef3f8;
    color: rgba(0, 0, 0, 0.62);
    font-size: 12px;
    font-weight: 700;
    flex: 0 0 auto;
}

.crm-drawer-pick__text {
    min-width: 0;
}

.crm-drawer-pick__text strong,
.crm-drawer-pick__text small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.crm-drawer-pick__text strong {
    font-size: 13px;
    font-weight: 650;
    color: var(--crm-ink, rgba(0, 0, 0, 0.88));
}

.crm-drawer-pick__text small {
    margin-top: 1px;
    font-size: 12px;
    color: var(--crm-muted, rgba(0, 0, 0, 0.52));
}

.crm-drawer-search__empty {
    flex: 1 1 100%;
    margin: 0;
    font-size: 12px;
    color: var(--crm-muted, rgba(0, 0, 0, 0.52));
}

.crm-drawer-kind {
    flex: 1 1 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.crm-drawer-kind label {
    min-height: 32px;
    padding: 4px 10px;
    font-size: 12px;
}

.crm-drawer-add__toggle {
    display: inline-flex;
    align-items: center;
    margin: 0 0 10px;
    padding: 0;
    border: 0;
    background: none;
    color: var(--crm-blue);
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

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

.crm-drawer-new[hidden] {
    display: none !important;
}

.crm-drawer-new input {
    flex: 1 1 120px;
    min-height: 36px;
    padding: 0 10px;
    border: 1px solid var(--crm-line);
    border-radius: 8px;
    background: var(--surface);
    color: var(--crm-ink);
    font: inherit;
    font-size: 13px;
}

.crm-drawer-new__actions {
    display: flex;
    gap: 8px;
    width: 100%;
}

.crm-drawer-await {
    margin-top: 12px;
    font-size: 13px;
}

.crm-drawer-await ul {
    list-style: none;
    margin: 8px 0 0;
    padding: 0;
}

.crm-drawer-await li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 0;
    border-top: 1px solid var(--crm-line);
}

html[data-theme="dark"] body.crm-ui .crm-week-card span,
html[data-theme="dark"] body.crm-ui .crm-week-card small,
html[data-theme="dark"] body.crm-ui .crm-week-person,
html[data-theme="dark"] body.crm-ui .crm-week-more {
    color: rgba(0, 0, 0, 0.55);
}

html[data-theme="dark"] body.crm-ui .crm-week-card__trainer {
    color: rgba(0, 0, 0, 0.86);
}

html[data-theme="dark"] body.crm-ui .crm-week-trial {
    background: #fffbe6;
    border-color: #ffe58f;
    color: #ad6800 !important;
}

html[data-theme="dark"] body.crm-ui .crm-drawer,
html[data-theme="dark"] body.crm-ui .crm-drawer__head,
html[data-theme="dark"] body.crm-ui .crm-drawer__actions {
    background: #fff;
    color: rgba(0, 0, 0, 0.88);
}

html[data-theme="dark"] body.crm-ui .crm-drawer-backdrop {
    background: rgba(0, 0, 0, 0.55);
}

html[data-theme="dark"] body.crm-ui .crm-drawer h2,
html[data-theme="dark"] body.crm-ui .crm-drawer dd,
html[data-theme="dark"] body.crm-ui .crm-drawer strong,
html[data-theme="dark"] body.crm-ui .crm-drawer .crm-drawer-person__body {
    color: rgba(0, 0, 0, 0.88);
}

html[data-theme="dark"] body.crm-ui .crm-drawer dt,
html[data-theme="dark"] body.crm-ui .crm-drawer .crm-drawer__lead,
html[data-theme="dark"] body.crm-ui .crm-drawer .crm-drawer__hint,
html[data-theme="dark"] body.crm-ui .crm-drawer .crm-drawer__section,
html[data-theme="dark"] body.crm-ui .crm-drawer .crm-drawer-group,
html[data-theme="dark"] body.crm-ui .crm-drawer .crm-drawer-empty {
    color: rgba(0, 0, 0, 0.45);
}

html[data-theme="dark"] body.crm-ui .crm-drawer .crm-mark-btn {
    background: #fff;
    border-color: #e5e7eb;
    color: #374151;
}

html[data-theme="dark"] body.crm-ui .crm-drawer .crm-mark-btn.is-ok.is-on:not(.is-saved) {
    border-color: #22c55e;
    background: #ecfdf3;
    color: #15803d;
}

html[data-theme="dark"] body.crm-ui .crm-drawer .crm-mark-btn.is-ok.is-on.is-saved {
    border-color: #22c55e;
    background: #22c55e;
    color: #fff;
}

html[data-theme="dark"] body.crm-ui .crm-drawer .crm-mark-btn.is-miss.is-on:not(.is-saved) {
    border-color: #ff4d4f;
    background: #fff1f0;
    color: #cf1322;
}

html[data-theme="dark"] body.crm-ui .crm-drawer .crm-mark-btn.is-miss.is-on.is-saved {
    border-color: #ff4d4f;
    background: #ff4d4f;
    color: #fff;
}

html[data-theme="dark"] body.crm-ui .crm-drawer .crm-chip {
    background: #f5f7fa;
    border-color: #e8edf3;
    color: rgba(0, 0, 0, 0.45);
}

html[data-theme="dark"] body.crm-ui .crm-drawer .crm-chip.is-on {
    background: #fff1f0;
    border-color: #ffa39e;
    color: #cf1322;
}

html[data-theme="dark"] body.crm-ui .crm-drawer__note {
    background: #fff7e6;
    color: #ad6800;
}

html[data-theme="dark"] body.crm-ui .crm-drawer__note--ok {
    background: #f6ffed;
    color: #389e0d;
}

html[data-theme="dark"] body.crm-ui .crm-drawer-status.is-ok {
    background: #ecfdf3;
    color: #15803d;
}

html[data-theme="dark"] body.crm-ui .crm-drawer-status.is-miss {
    background: #fff1f0;
    color: #cf1322;
}

html[data-theme="dark"] body.crm-ui .crm-drawer-hint.is-warn {
    color: #d4380d;
}

html[data-theme="dark"] body.crm-ui .crm-drawer input,
html[data-theme="dark"] body.crm-ui .crm-drawer select,
html[data-theme="dark"] body.crm-ui .crm-drawer textarea,
html[data-theme="dark"] body.crm-ui .crm-drawer .crm-drawer-add__row select,
html[data-theme="dark"] body.crm-ui .crm-drawer .crm-drawer-new input,
html[data-theme="dark"] body.crm-ui .crm-drawer .crm-drawer-comment,
html[data-theme="dark"] body.crm-ui .crm-drawer .crm-drawer-search,
html[data-theme="dark"] body.crm-ui .crm-drawer .crm-drawer-pick {
    background: #fff;
    border-color: #e6edf4;
    color: rgba(0, 0, 0, 0.88);
    color-scheme: light;
}

html[data-theme="dark"] body.crm-ui .crm-drawer .crm-drawer-pick.is-on,
html[data-theme="dark"] body.crm-ui .crm-drawer .crm-drawer-pick:hover {
    border-color: #1677ff;
    background: rgba(22, 119, 255, 0.12);
}

html[data-theme="dark"] body.crm-ui .crm-drawer .btn-secondary,
html[data-theme="dark"] body.crm-ui .crm-drawer .btn.btn-secondary {
    background: #fff;
    color: rgba(0, 0, 0, 0.88);
    border: 1px solid #e6edf4;
}

html[data-theme="dark"] body.crm-ui .crm-drawer .btn-primary,
html[data-theme="dark"] body.crm-ui .crm-drawer .btn.btn-primary {
    background: #1677ff;
    color: #fff;
}

html[data-theme="dark"] body.crm-ui .crm-drawer .btn-primary:disabled,
html[data-theme="dark"] body.crm-ui .crm-drawer .btn.btn-primary:disabled,
html[data-theme="dark"] body.crm-ui .crm-drawer .btn-primary[disabled] {
    background: #c5cdd6;
    color: #fff;
}

body.crm-ui ol.crm-steps {
    list-style: none;
    margin: 0 0 16px;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

body.crm-ui ol.crm-steps > li {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 36px;
    padding: 6px 12px;
    border-radius: 999px;
    background: var(--crm-track);
    color: var(--crm-muted);
    font-size: 13px;
    font-weight: 600;
}

body.crm-ui ol.crm-steps > li > a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: inherit;
    text-decoration: none;
}

body.crm-ui ol.crm-steps > li span:first-child {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: #fff;
    color: var(--crm-ink);
    font-size: 12px;
    font-weight: 800;
    flex-shrink: 0;
}

body.crm-ui ol.crm-steps > li.is-on {
    background: var(--crm-soft);
    color: var(--crm-soft-ink);
}

body.crm-ui ol.crm-steps > li.is-on span:first-child {
    color: var(--crm-soft-ink);
}

html[data-theme="dark"] body.crm-ui ol.crm-steps > li {
    background: #141a24;
}

html[data-theme="dark"] body.crm-ui ol.crm-steps > li span:first-child {
    background: #1e293b;
    color: #e8edf5;
}

html[data-theme="dark"] body.crm-ui ol.crm-steps > li.is-on {
    background: #102a44;
    color: #91caff;
}

.crm-week-stack {
    display: none;
}

body.crm-ui .crm-list__open {
    display: flex;
    min-width: 0;
    color: inherit;
    text-decoration: none;
}

body.crm-ui .crm-list__open:hover .crm-person__name,
body.crm-ui .crm-list__open:focus-visible .crm-person__name {
    color: var(--crm-blue);
}

body.crm-ui .crm-client-hero {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 16px;
    margin: 0 0 18px;
    padding: 14px 16px;
    border: 1px solid var(--crm-line);
    border-radius: 14px;
    background: var(--surface);
}

body.crm-ui .crm-client-hero .crm-person {
    flex: 1 1 220px;
    max-width: none;
}

body.crm-ui .crm-client-hero__tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

body.crm-ui .crm-client-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.9fr);
    gap: 16px;
    align-items: start;
}

body.crm-ui .crm-client-sub {
    margin: 16px 0 8px;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-muted, #64748b);
}

body.crm-ui .crm-client-sub:first-child {
    margin-top: 0;
}

@media (max-width: 860px) {
    body.crm-ui .crm-client-grid {
        grid-template-columns: 1fr;
    }
}

body.crm-ui .wa-reminders,
body.crm-ui .wa-reminders__block,
body.crm-ui .wa-reminders__fields,
body.crm-ui .wa-reminders__nums,
body.crm-ui .wa-reminders .form-group,
body.crm-ui .wa-reminders .checkbox-group {
    min-width: 0;
    max-width: 100%;
}

body.crm-ui .wa-reminders {
    overflow-x: clip;
}

body.crm-ui .wa-reminders__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px 12px;
    flex-wrap: wrap;
    min-width: 0;
}

body.crm-ui .wa-reminders__head h3 {
    margin: 0;
    min-width: 0;
    overflow-wrap: anywhere;
}

body.crm-ui .wa-reminders__head .status-badge {
    flex: 0 0 auto;
}

body.crm-ui .wa-reminders__lead {
    margin: 8px 0 14px;
    overflow-wrap: anywhere;
}

body.crm-ui .wa-reminders__block {
    margin-bottom: 10px;
    padding: 12px 14px;
    border: 1px solid var(--crm-line);
    border-radius: 12px;
    background: var(--crm-well);
}

body.crm-ui .wa-reminders .checkbox-label {
    align-items: flex-start;
    min-width: 0;
}

body.crm-ui .wa-reminders .checkbox-label input {
    flex: 0 0 auto;
    margin-top: 2px;
}

body.crm-ui .wa-reminders .checkbox-label span,
body.crm-ui .wa-reminders .field-help,
body.crm-ui .wa-reminders label {
    min-width: 0;
    overflow-wrap: anywhere;
}

body.crm-ui .wa-reminders__fields {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
    margin-top: 8px;
}

body.crm-ui .wa-reminders textarea.form-control {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    resize: vertical;
    overflow-wrap: anywhere;
    word-break: break-word;
}

body.crm-ui .wa-reminders__nums {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

body.crm-ui .wa-reminders__num {
    width: 100%;
    max-width: 132px;
    min-width: 0;
    box-sizing: border-box;
}

body.crm-ui .wa-reminders__placeholders {
    margin-top: 8px;
    min-width: 0;
}

body.crm-ui .wa-reminders__placeholders summary {
    cursor: pointer;
    font-size: 0.82rem;
    color: var(--crm-muted);
}

body.crm-ui .wa-reminders__codes {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

body.crm-ui .wa-reminders__codes code {
    white-space: nowrap;
}

@media (max-width: 720px) {
    body.crm-ui .form-card:has(.wa-reminders) .card-body {
        padding: 16px 14px 18px;
    }

    body.crm-ui .wa-reminders__head {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    body.crm-ui .wa-reminders__block {
        padding: 10px;
    }

    body.crm-ui .wa-reminders__fields,
    body.crm-ui .wa-reminders__nums {
        grid-template-columns: minmax(0, 1fr);
    }

    body.crm-ui .wa-reminders__num {
        max-width: 9rem;
    }
}

/* --- Расписание / drawer: телефон и узкий планшет (Chrome mobile) --- */
@media (max-width: 768px) {
    body.crm-ui {
        overflow-x: hidden;
    }

    body.crm-ui .main-content {
        overflow-x: hidden;
        padding-left: 12px;
        padding-right: 12px;
    }

    .crm-toolbar,
    .crm-schedule-toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        max-width: 100%;
    }

    .crm-week-nav {
        width: 100%;
        display: flex;
        flex-wrap: wrap;
        justify-content: space-between;
        gap: 6px;
    }

    .crm-week-arrow,
    .crm-week-today {
        width: auto;
        min-width: 44px;
        min-height: 44px;
        height: 44px;
    }

    .crm-week-range {
        flex: 1;
        min-width: 0;
        padding: 0 6px;
        font-size: 14px;
    }

    .crm-view-switch {
        width: 100%;
        flex-wrap: wrap;
    }

    .crm-view-switch a,
    .crm-view-switch button {
        flex: 1 1 auto;
        min-height: 44px;
        padding: 10px 12px;
        text-align: center;
    }

    body.crm-ui .crm-schedule-filters {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
        align-items: stretch;
    }

    body.crm-ui .crm-schedule-filters .crm-sheet-select,
    body.crm-ui .crm-schedule-filters .crm-sheet-search {
        width: 100%;
        min-width: 0;
        margin-left: 0;
        min-height: 36px;
        height: 36px;
    }

    body.crm-ui .crm-schedule-filters .crm-sheet-search {
        grid-column: 1 / -1;
    }

    body.crm-ui .crm-trainer-filters {
        margin-bottom: 10px;
    }

    body.crm-ui .crm-trainer-chip {
        min-height: 32px;
        padding: 4px 10px;
    }

    .crm-week.crm-week--grid {
        display: block;
        max-width: 100%;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-x: contain;
    }

    .crm-week--grid .crm-week-head,
    .crm-week--grid .crm-week-body {
        grid-template-columns: 36px repeat(7, minmax(104px, 1fr));
        min-width: 764px;
    }

    .crm-week--grid.crm-day-grid .crm-week-head,
    .crm-week--grid.crm-day-grid .crm-week-body {
        grid-template-columns: 36px repeat(var(--cols, 1), minmax(120px, 1fr));
        min-width: calc(36px + (var(--cols, 1) * 120px));
    }

    .crm-week--grid .crm-week-body {
        grid-template-rows: repeat(var(--slots), 32px);
        background-size: calc((100% - 36px) / 7) 32px;
        background-position: 36px 0;
        min-height: calc(var(--slots) * 32px);
    }

    .crm-week--grid.crm-day-grid .crm-week-body {
        background-size: calc((100% - 36px) / var(--cols, 1)) 32px;
    }

    .crm-week--grid .crm-week-day {
        padding: 6px 2px;
    }

    .crm-week--grid .crm-week-day span {
        font-size: 10px;
    }

    .crm-week--grid .crm-week-day b {
        font-size: 12px;
        margin-top: 0;
    }

    .crm-week--grid .crm-week-time {
        position: sticky;
        left: 0;
        z-index: 3;
        padding: 2px 4px 0 0;
        font-size: 10px;
        background: var(--surface);
    }

    .crm-week--grid .crm-week-corner {
        position: sticky;
        left: 0;
        z-index: 4;
        background: var(--crm-well);
    }

    .crm-week--grid .crm-week-card {
        margin: 2px 3px;
        padding: 4px 5px 4px 7px;
        border-radius: 6px;
        border-left-width: 3px;
    }

    .crm-week--grid .crm-week-card strong,
    .crm-week--grid .crm-week-card__name {
        font-size: 11px;
        line-height: 1.2;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .crm-week--grid .crm-week-card__trainer {
        font-size: 11px;
        margin-top: 1px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .crm-week--grid .crm-week-card span,
    .crm-week--grid .crm-week-card small {
        font-size: 10px;
        margin-top: 1px;
    }

    .crm-week--grid .crm-week-people,
    .crm-week--grid .crm-week-hover {
        display: none;
    }

    .crm-week-stack {
        display: none;
    }

    .crm-week-stack__day {
        background: var(--surface);
        border: 1px solid var(--crm-line);
        border-radius: 10px;
        overflow: hidden;
    }

    .crm-week-stack__day.is-today {
        border-color: var(--crm-soft-line);
    }

    .crm-week-stack__day.is-selected {
        box-shadow: 0 0 0 2px var(--crm-blue);
    }

    .crm-week-stack__head {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
        min-height: 44px;
        padding: 10px 14px;
        background: var(--crm-well);
        border-bottom: 1px solid var(--crm-line);
        color: inherit;
        text-decoration: none;
    }

    .crm-week-stack__head b {
        font-size: 15px;
    }

    .crm-week-stack__head span {
        font-size: 12px;
        font-weight: 600;
        color: var(--crm-blue);
    }

    .crm-week-stack__cards {
        display: flex;
        flex-direction: column;
        gap: 8px;
        padding: 10px;
        min-width: 0;
    }

    .crm-week-stack__cards:not(:has(.crm-week-card))::after {
        content: "Нет занятий";
        display: block;
        padding: 8px 4px 4px;
        color: var(--crm-muted);
        font-size: 13px;
    }

    .crm-week-stack__empty {
        margin: 0;
        padding: 14px;
        color: var(--crm-muted);
        font-size: 13px;
    }

    .crm-week-stack .crm-week-card {
        display: block;
        margin: 0;
        padding: 12px 14px;
        min-height: 56px;
        border-radius: 8px;
        grid-column: auto;
        grid-row: auto;
    }

    .crm-week-stack .crm-week-card strong {
        font-size: 15px;
        line-height: 1.3;
    }

    .crm-week-stack .crm-week-card span,
    .crm-week-stack .crm-week-card small {
        display: block;
        white-space: normal;
        font-size: 12px;
    }

    .crm-week-stack .crm-week-trial {
        display: inline-flex !important;
    }

    .crm-week-stack .crm-week-hover {
        display: none;
    }

    .crm-list-view {
        max-width: 100%;
        min-width: 0;
    }

    .crm-list-view .table-wrap {
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .crm-list-view .btn {
        min-height: 44px;
        padding: 10px 14px;
    }

    .crm-drawer-backdrop {
        inset: 0;
    }

    .crm-drawer {
        inset: 0;
        top: 0;
        right: 0;
        bottom: 0;
        left: 0;
        width: auto;
        max-width: none;
        height: 100%;
        height: 100dvh;
        border-radius: 0;
        box-shadow: none;
        padding-bottom: env(safe-area-inset-bottom, 0);
    }

    .crm-drawer__head {
        padding: 14px 16px 8px;
        padding-top: max(14px, env(safe-area-inset-top, 0px));
    }

    .crm-drawer__close {
        width: 44px;
        height: 44px;
        font-size: 26px;
    }

    .crm-drawer__meta {
        padding: 8px 16px 12px;
    }

    .crm-drawer__meta div {
        grid-template-columns: 1fr;
        gap: 2px;
    }

    .crm-drawer__note,
    .crm-drawer__hint,
    .crm-drawer__section {
        margin-left: 16px;
        margin-right: 16px;
    }

    .crm-drawer-people {
        padding: 0 8px;
    }

    .crm-drawer-person {
        gap: 8px;
        padding: 12px 10px;
    }

    .crm-drawer-del {
        width: 44px;
        height: 44px;
    }

    .crm-drawer-comment {
        min-height: 44px;
    }

    .crm-mark-btn {
        min-height: 48px;
        font-size: 15px;
    }

    .crm-mark-btn__text {
        display: inline;
    }

    .crm-drawer__actions {
        flex-direction: column;
        padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
    }

    .crm-drawer__actions .btn,
    .crm-drawer-add__row .btn,
    .crm-drawer-new__actions .btn,
    .crm-drawer-await .btn {
        min-height: 44px;
        width: 100%;
        padding: 10px 14px;
    }

    .crm-drawer-add {
        padding: 8px 16px calc(24px + env(safe-area-inset-bottom, 0px));
    }

    .crm-drawer-add__row,
    .crm-drawer-new,
    .crm-drawer-new__actions {
        flex-direction: column;
    }

    .crm-drawer-add__row select,
    .crm-drawer-new input,
    .crm-drawer-search,
    .crm-drawer-pick {
        min-height: 44px;
        width: 100%;
        flex: 1 1 auto;
    }

    .crm-drawer-picks {
        max-height: 260px;
    }

    .crm-drawer-add__toggle {
        min-height: 44px;
        padding: 10px 0;
    }

    .crm-drawer-await li {
        flex-wrap: wrap;
    }
}

@media (max-width: 480px) {
    .crm-week-stack__cards {
        padding: 8px;
    }

    .crm-week-stack .crm-week-card {
        padding: 12px;
    }

    .crm-week-people {
        margin-top: 6px;
    }
}

/* ===== Tasks & calls journal ===== */
body.crm-ui .crm-tasks-page {
    min-width: 0;
    max-width: 100%;
}

body.crm-ui .crm-tasks-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0 0 10px;
    padding: 0 0 2px;
    border-bottom: none;
    max-width: 100%;
}

body.crm-ui .crm-tasks-filters .clients-filter {
    min-height: 32px;
}

body.crm-ui .crm-task-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

body.crm-ui .crm-task-card {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px 16px;
    min-width: 0;
    padding: 10px 14px;
    border: 1px solid var(--crm-line);
    border-radius: 10px;
    background: var(--surface);
    box-sizing: border-box;
}

body.crm-ui .crm-task-card.is-done {
    opacity: 0.78;
}

body.crm-ui .crm-task-card.is-overdue {
    border-color: #ffccc7;
}

body.crm-ui .crm-task-card__main {
    flex: 1 1 auto;
    min-width: 0;
}

body.crm-ui .crm-task-card__title-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    min-width: 0;
}

body.crm-ui .crm-call-card__who {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

body.crm-ui .crm-task-card__title {
    display: block;
    font-size: 0.92rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--crm-ink);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

body.crm-ui .crm-call-card__phone {
    font-size: 0.78rem;
    color: var(--crm-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

body.crm-ui .crm-task-badge {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    height: 22px;
    padding: 0 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 650;
    line-height: 1;
    white-space: nowrap;
    border: 1px solid transparent;
}

body.crm-ui .crm-task-badge--new {
    background: var(--crm-soft);
    color: var(--crm-soft-ink);
    border-color: var(--crm-soft-line);
}

body.crm-ui .crm-task-badge--progress {
    background: #fff7e6;
    color: #ad6800;
    border-color: #ffe58f;
}

body.crm-ui .crm-task-badge--done {
    background: #f6ffed;
    color: #389e0d;
    border-color: #d9f7be;
}

body.crm-ui .crm-task-badge--overdue {
    background: #fff2f0;
    color: #cf1322;
    border-color: #ffccc7;
}

body.crm-ui .crm-task-card__note {
    display: -webkit-box;
    margin: 4px 0 0;
    overflow: hidden;
    font-size: 0.82rem;
    line-height: 1.35;
    color: var(--crm-ink);
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

body.crm-ui .crm-task-card__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 10px;
    margin-top: 4px;
    font-size: 0.75rem;
    color: var(--crm-muted);
}

body.crm-ui .crm-task-card__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex: 0 0 auto;
}

body.crm-ui .crm-task-card__actions .inline-form {
    display: inline-flex;
    margin-left: 0;
}

body.crm-ui .crm-call-status-form {
    display: flex;
    align-items: center;
    gap: 6px;
}

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

body.crm-ui .crm-call-status-select {
    max-width: 140px;
    min-height: 32px;
    padding: 4px 8px;
    border: 1px solid var(--crm-line);
    border-radius: 8px;
    background: var(--surface);
    color: var(--crm-ink);
    font: inherit;
    font-size: 0.8rem;
}

body.crm-ui .crm-task-link {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    padding: 0 6px;
    border: 0;
    background: none;
    color: var(--crm-blue);
    font: inherit;
    font-size: 0.8rem;
    font-weight: 650;
    text-decoration: none;
    cursor: pointer;
}

body.crm-ui .crm-task-link--danger {
    color: #cf1322;
}

body.crm-ui .crm-tasks-empty {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    padding: 28px 16px;
    border: 1px dashed var(--crm-line);
    border-radius: 10px;
    background: var(--surface);
    color: var(--crm-muted);
}

body.crm-ui .crm-tasks-empty p {
    margin: 0;
}

html[data-theme="dark"] body.crm-ui .crm-task-card {
    background: var(--surface);
    border-color: var(--crm-line);
}

html[data-theme="dark"] body.crm-ui .crm-task-badge--progress {
    background: #3a2e14;
    color: #ffe58f;
    border-color: #7a6418;
}

html[data-theme="dark"] body.crm-ui .crm-task-badge--done {
    background: #16351f;
    color: #86efac;
    border-color: #275433;
}

html[data-theme="dark"] body.crm-ui .crm-task-badge--overdue {
    background: #3b1515;
    color: #ffa39e;
    border-color: #7a2e2e;
}

html[data-theme="dark"] body.crm-ui .crm-call-status-select {
    background: #141a24;
    border-color: #334155;
    color: #e8edf5;
}

html[data-theme="dark"] body.crm-ui .crm-task-link--danger {
    color: #ffa39e;
}

@media (max-width: 720px) {
    body.crm-ui .crm-tasks-filters .clients-filter {
        flex: 1 1 calc(50% - 6px);
        justify-content: center;
        min-height: 44px;
        box-sizing: border-box;
    }

    body.crm-ui .crm-task-card {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        padding: 12px;
    }

    body.crm-ui .crm-task-card__title,
    body.crm-ui .crm-call-card__phone {
        white-space: normal;
        overflow: visible;
        text-overflow: unset;
        overflow-wrap: anywhere;
    }

    body.crm-ui .crm-task-card__note {
        -webkit-line-clamp: 4;
        overflow-wrap: anywhere;
    }

    body.crm-ui .crm-task-card__actions {
        justify-content: stretch;
        width: 100%;
    }

    body.crm-ui .crm-call-status-form {
        flex: 1 1 100%;
        flex-direction: column;
        align-items: stretch;
        gap: 4px;
    }

    body.crm-ui .crm-call-status-form__label {
        position: static;
        width: auto;
        height: auto;
        margin: 0;
        overflow: visible;
        clip: auto;
        white-space: normal;
        font-size: 0.75rem;
        font-weight: 650;
        color: var(--crm-muted);
    }

    body.crm-ui .crm-call-status-select {
        max-width: none;
        width: 100%;
        min-height: 44px;
        padding: 8px 12px;
        font-size: 16px;
        box-sizing: border-box;
    }

    body.crm-ui .crm-task-card__actions > .crm-task-link,
    body.crm-ui .crm-task-card__actions > .inline-form {
        flex: 1 1 calc(50% - 4px);
    }

    body.crm-ui .crm-task-card__actions > .inline-form {
        display: flex;
    }

    body.crm-ui .crm-task-card__actions > .crm-task-link,
    body.crm-ui .crm-task-card__actions > .inline-form .crm-task-link {
        width: 100%;
        min-height: 44px;
        justify-content: center;
        padding: 0 12px;
        border: 1px solid var(--crm-line);
        border-radius: 8px;
        background: var(--surface);
        box-sizing: border-box;
    }

    body.crm-ui .crm-task-card__actions > .inline-form .crm-task-link--danger {
        background: #fff2f0;
        border-color: #ffccc7;
        color: #cf1322;
    }

    body.crm-ui .crm-task-card__actions .btn {
        min-height: 44px;
        width: 100%;
        flex: 1 1 100%;
    }

    body.crm-ui .crm-tasks-empty {
        align-items: stretch;
    }

    body.crm-ui .crm-tasks-empty .btn,
    body.crm-ui .crm-call-page-action {
        min-height: 44px;
        justify-content: center;
    }

    body.crm-ui .crm-form-dense .card-body {
        padding: 14px 12px 16px;
    }

    body.crm-ui .crm-form-dense .form-control,
    body.crm-ui .crm-form-dense .partner-form input,
    body.crm-ui .crm-form-dense .partner-form select,
    body.crm-ui .crm-form-dense .partner-form textarea {
        width: 100%;
        max-width: 100%;
        min-height: 44px;
        font-size: 16px;
        box-sizing: border-box;
    }

    body.crm-ui .crm-form-dense textarea.form-control,
    body.crm-ui .crm-form-dense .partner-form textarea {
        min-height: 96px;
    }

    body.crm-ui .crm-form-dense .form-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
        margin-top: 16px;
    }

    body.crm-ui .crm-form-dense .form-actions .btn {
        width: 100%;
        min-height: 44px;
        box-sizing: border-box;
    }

    html[data-theme="dark"] body.crm-ui .crm-task-card__actions > .inline-form .crm-task-link--danger {
        background: #3b1515;
        border-color: #7a2e2e;
        color: #ffa39e;
    }
}

/* Ссылка на приложение клуба — партнёр и стойка */
.app-share {
    --app-share-teal: #0f766e;
    --app-share-mint: #14c4b0;
    margin: 16px 0;
    padding: 16px 16px 14px;
    border-radius: 16px;
    background:
        radial-gradient(120% 90% at 100% 0%, rgba(20, 196, 176, 0.16), transparent 48%),
        linear-gradient(180deg, #f4fdfb, #ecfdf8);
    border: 1px solid #b7e4db;
    color: #134e4a;
}

.app-share--compact {
    margin: 14px 0 0;
    padding: 14px 14px 12px;
}

.app-share__head {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px;
}

.app-share__icon {
    flex: 0 0 40px;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    color: #0f766e;
    background: rgba(20, 196, 176, 0.16);
}

.app-share__icon svg {
    width: 22px;
    height: 22px;
}

.app-share__title {
    margin: 0 0 4px;
    font-size: 16px;
    font-weight: 750;
    letter-spacing: -0.02em;
    color: #115e59;
}

.app-share__hint {
    margin: 0;
    font-size: 13px;
    line-height: 1.4;
    color: #3f6f69;
}

.app-share__row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 8px 8px 12px;
    border-radius: 12px;
    background: #fff;
    border: 1px solid #cce8e2;
}

.app-share__url {
    flex: 1;
    min-width: 0;
    font-size: 13px;
    word-break: break-all;
    color: #134e4a;
}

.app-share__copy {
    border-color: #99d5cb;
    color: #0f766e;
    background: #ecfdf8;
}

.app-share__stores {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.app-share__store {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 36px;
    padding: 0 12px 0 10px;
    border-radius: 10px;
    background: #111;
    color: #fff;
    font-size: 13px;
    font-weight: 650;
    text-decoration: none;
}

.app-share__store:hover {
    color: #fff;
}

.app-share__store-icon {
    width: 16px;
    height: 16px;
    background: center / contain no-repeat;
}

.app-share__store--ios .app-share__store-icon {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M16.365 1.43c0 1.14-.467 2.226-1.223 3.037-.836.906-2.204 1.604-3.31 1.508-.153-1.09.422-2.248 1.18-3.02.84-.858 2.282-1.496 3.353-1.525zM20.25 17.08c-.585 1.35-.86 1.944-1.608 3.135-1.043 1.68-2.513 3.78-4.334 3.795-1.62.013-2.037-1.05-4.234-1.044-2.197.006-2.62 1.06-4.24 1.047-1.826-.014-3.35-2.205-4.393-3.884-3.012-4.837-3.332-10.52-1.465-13.546 1.32-2.18 3.407-3.465 5.367-3.465 1.996 0 3.25 1.05 4.9 1.05 1.613 0 2.593-1.05 4.876-1.05 1.74 0 3.588.945 4.908 2.577-4.32 2.355-3.62 8.484.753 10.334z'/%3E%3C/svg%3E");
}

.app-share__store--play .app-share__store-icon {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%234285F4' d='M3.9 12c0-.66.11-1.29.31-1.88L1.05 7.19A10.96 10.96 0 0 0 1 12c0 1.77.42 3.45 1.17 4.93l3.16-2.93A5.9 5.9 0 0 1 3.9 12z'/%3E%3Cpath fill='%2334A853' d='M12.04 4.75c1.48 0 2.81.51 3.86 1.51l2.89-2.89C17.45 1.68 14.97 1 12.04 1 7.7 1 3.99 3.47 2.18 7.19l3.16 2.93C6.45 6.67 8.97 4.75 12.04 4.75z'/%3E%3Cpath fill='%23FBBC05' d='M12.04 22c2.83 0 5.21-.94 6.95-2.55l-3.16-2.93c-.88.59-2.01.94-3.79.94-3.07 0-5.59-1.92-6.5-4.61l-3.17 2.93C3.99 20.53 7.7 23 12.04 23z'/%3E%3Cpath fill='%23EA4335' d='M21.99 12c0-.82-.07-1.42-.22-2.05H12v3.93h5.62a4.7 4.7 0 0 1-2.04 3.08l3.16 2.93C20.94 18.5 21.99 15.57 21.99 12z'/%3E%3C/svg%3E");
}

html[data-theme="dark"] .app-share {
    background:
        radial-gradient(120% 90% at 100% 0%, rgba(20, 196, 176, 0.16), transparent 50%),
        linear-gradient(180deg, #12211f, #0f1a18);
    border-color: #24524c;
    color: #d7ebe6;
}

html[data-theme="dark"] .app-share__title {
    color: #ecfdf8;
}

html[data-theme="dark"] .app-share__hint {
    color: #9bb8b2;
}

html[data-theme="dark"] .app-share__row {
    background: #111827;
    border-color: #24524c;
}

html[data-theme="dark"] .app-share__url {
    color: #d7ebe6;
}

html[data-theme="dark"] .app-share__icon {
    color: #14c4b0;
    background: rgba(20, 196, 176, 0.12);
}

/* ===== Clients table + right drawer (Tamara) ===== */
.clients-sheet,
.clients-drawer-root,
.clients-drawer {
    --ct-blue: var(--crm-blue, var(--primary, #1677ff));
    --ct-ink: var(--crm-ink, var(--text, rgba(0, 0, 0, 0.88)));
    --ct-muted: var(--crm-muted, var(--text-muted, rgba(0, 0, 0, 0.45)));
    --ct-line: var(--crm-line, var(--border, #e6edf4));
    --ct-hover: var(--crm-hover, #f5f7fa);
    --ct-surface: var(--surface, #ffffff);
    --ct-soft: var(--crm-soft, #e6f4ff);
}

.clients-sheet {
    background: var(--ct-surface);
    border: 1px solid var(--ct-line);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

body.crm-ui:has(.clients-sheet) .page-header {
    display: none;
}

body.crm-ui:has(.clients-sheet) .crm-steps {
    display: none;
}

body.crm-ui:has(.clients-sheet) .page-body {
    padding-top: 0;
}

body.crm-ui:has(.clients-sheet) .crm-demo-note {
    margin: 0 0 10px;
}

body.crm-ui .clients-page.clients-sheet,
body.crm-ui .clients-card.clients-sheet {
    overflow: hidden;
}

.clients-sheet__toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--ct-line);
    background: var(--ct-surface);
}

.clients-sheet .clients-filters {
    padding: 0;
    border: 0;
    flex: 1 1 auto;
    min-width: 0;
}

.clients-sheet .clients-filter {
    height: 32px;
    min-height: 32px;
    padding: 0 10px;
    font-size: 13px;
    font-weight: 500;
    color: var(--ct-ink);
    background: var(--ct-surface);
    border: 1px solid var(--ct-line);
    border-radius: 999px;
}

.clients-sheet .clients-filter em {
    margin-left: 2px;
    font-style: normal;
    font-variant-numeric: tabular-nums;
    color: var(--ct-muted);
}

.clients-sheet .clients-filter.is-active,
.clients-sheet .clients-filter.is-on {
    background: var(--ct-soft);
    border-color: transparent;
    color: var(--ct-blue);
}

.clients-sheet .clients-filter.is-active em,
.clients-sheet .clients-filter.is-on em {
    color: inherit;
    opacity: 0.8;
}

.clients-sheet__tools {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
}

.bekzat-card-scan {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 12px;
    padding: 10px 12px;
    border: 1px solid #d6e4ff;
    border-radius: 14px;
    background: linear-gradient(180deg, #f7faff 0%, #fff 100%);
}

.bekzat-card-scan__mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: #e6f4ff;
    color: #1677ff;
    flex: 0 0 auto;
}

.bekzat-card-scan__mark svg {
    width: 20px;
    height: 20px;
}

.bekzat-card-scan__label {
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
}

.bekzat-card-scan input {
    flex: 1 1 220px;
    min-width: 0;
    height: 38px;
    padding: 0 12px;
    border: 1px solid #d6e4ff;
    border-radius: 10px;
    background: #fff;
    font: inherit;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.04em;
}

.bekzat-card-scan input:focus {
    outline: none;
    border-color: #91caff;
    box-shadow: 0 0 0 3px rgba(22, 119, 255, 0.15);
}

.bekzat-card-scan__hint,
.bekzat-card-scan__miss {
    margin: 0;
    font-size: 12px;
    line-height: 1.35;
    white-space: nowrap;
}

.bekzat-card-scan__hint {
    color: var(--ct-muted, rgba(0, 0, 0, 0.45));
}

.bekzat-card-scan__miss {
    color: #cf1322;
}

@media (max-width: 800px) {
    .bekzat-card-scan {
        flex-wrap: wrap;
    }
    .bekzat-card-scan__hint,
    .bekzat-card-scan__miss {
        flex: 1 1 100%;
        white-space: normal;
        padding-left: 46px;
    }
}

.clients-selection {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 14px;
    background: var(--ct-soft, #e6f4ff);
    border-bottom: 1px solid #bae0ff;
}

.clients-selection[hidden] {
    display: none !important;
}

.clients-selection__count {
    margin: 0;
    color: var(--ct-blue, #1677ff);
    font-size: 13px;
    font-weight: 650;
    white-space: nowrap;
}

.clients-selection__hint {
    margin: 0;
    flex: 1 1 auto;
    color: var(--ct-muted, rgba(0, 0, 0, 0.45));
    font-size: 12px;
    line-height: 1.35;
}

.clients-selection form {
    margin: 0;
    flex: 0 0 auto;
}

.clients-selection .btn-danger {
    height: 32px;
    padding: 0 14px;
    border-radius: 999px;
    background: #fff1f0;
    color: #cf1322;
    border: 1px solid #ffa39e;
    font-weight: 650;
}

.clients-selection .btn-danger:hover {
    background: #ffccc7;
}

.clients-sheet .clients-search {
    min-width: 196px;
    width: 220px;
}

.clients-sheet .clients-search input {
    height: 32px;
    border-radius: 999px;
    background: var(--ct-surface);
    font-size: 13px;
}

.clients-sheet__add {
    height: 32px;
    min-height: 32px;
    padding: 0 14px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

.clients-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.clients-table {
    width: 100%;
    min-width: 860px;
    border-collapse: collapse;
    background: var(--ct-surface);
}

.clients-table--people {
    table-layout: fixed;
    width: 100%;
    min-width: 980px;
}

.clients-table--people:has(.clients-table__col-card) {
    min-width: 1120px;
}

.clients-table--people .clients-table__col-check,
.clients-table--people th.clients-table__check,
.clients-table--people td.clients-table__check {
    width: 44px;
}

.clients-table--people .clients-table__col-name,
.clients-table--people th.clients-table__name-col,
.clients-table--people td.clients-table__person {
    width: 280px;
    min-width: 240px;
}

.clients-table--people .clients-table__col-status,
.clients-table--people th.clients-table__status-col,
.clients-table--people td.clients-table__status {
    width: 200px;
    min-width: 180px;
    white-space: normal;
}

.clients-table__status-row {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    max-width: 100%;
}

.clients-table__status .crm-label-pill {
    padding: 2px 8px;
}

.clients-table__pack {
    margin: 4px 0 0;
    max-width: 100%;
    font-size: 12px;
    line-height: 1.35;
    color: var(--ct-muted, rgba(0, 0, 0, 0.55));
    white-space: normal;
}

.clients-table__pack.is-low,
.clients-table__pack.is-out {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 8px;
    font-weight: 600;
}

.clients-table__pack.is-low {
    background: #fff7e6;
    color: #ad4e00;
}

.clients-table__pack.is-out {
    background: #fff1f0;
    color: #cf1322;
}

.clients-filter.is-warn:not(.is-active) {
    border-color: #ffd591;
    background: #fff7e6;
    color: #ad4e00;
}

.clients-filter.is-warn:not(.is-active) em {
    color: #ad4e00;
}

.clients-table--people .clients-table__col-actions,
.clients-table--people th.clients-table__actions-col,
.clients-table--people td.clients-table__actions {
    width: 44px;
    padding-left: 4px;
    padding-right: 12px;
    text-align: right;
}

.clients-row-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid var(--ct-line, #e6edf4);
    background: var(--ct-surface, #fff);
    color: var(--ct-muted, rgba(0, 0, 0, 0.45));
    text-decoration: none;
}

.clients-row-action svg {
    width: 16px;
    height: 16px;
}

.clients-row-action:hover {
    color: var(--ct-blue, #1677ff);
    border-color: #91caff;
    background: var(--ct-soft, #e6f4ff);
}

.clients-table--people .clients-table__col-card,
.clients-table--people th.clients-table__card-col,
.clients-table--people td.clients-table__card {
    width: 148px;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.clients-table--people .clients-table__col-comment,
.clients-table--people td.clients-table__comment {
    width: 180px;
    max-width: 180px;
}

.clients-table--people .clients-table__col-source,
.clients-table--people td.clients-table__source {
    width: 120px;
    max-width: 120px;
}

.clients-table--people .clients-table__col-date,
.clients-table--people td.clients-table__date {
    width: 118px;
}

.clients-table--people .clients-table__col-partner,
.clients-table--people th.clients-table__partner-col,
.clients-table--people td.clients-table__partner {
    width: 150px;
}

.clients-table__partner-link {
    color: inherit;
    text-decoration: none;
    font-weight: 500;
}

.clients-table__partner-link:hover {
    color: #1677ff;
    text-decoration: underline;
}

.clients-table th,
.clients-table td {
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid var(--ct-line);
    vertical-align: middle;
    font-size: 14px;
    color: var(--ct-ink);
}

.clients-table th {
    background: var(--ct-surface);
    color: var(--ct-muted);
    font-size: 13px;
    font-weight: 500;
    text-transform: none;
    letter-spacing: 0;
    white-space: nowrap;
}

/* Стрелки — только на реально сортируемых колонках (th[data-sort]). */
.clients-table th.is-sortable {
    cursor: pointer;
    user-select: none;
}

.clients-table th.is-sortable:hover {
    color: var(--ct-ink);
}

.clients-table th.is-sortable::after {
    content: "⇅";
    margin-left: 6px;
    font-size: 10px;
    opacity: 0.45;
}

.clients-table th.is-sortable.is-sorted-asc::after {
    content: "↑";
    opacity: 1;
    color: var(--ct-accent, #2563eb);
}

.clients-table th.is-sortable.is-sorted-desc::after {
    content: "↓";
    opacity: 1;
    color: var(--ct-accent, #2563eb);
}

.clients-table th.clients-table__check::after {
    content: none;
}

.clients-table__check {
    width: 36px;
    padding-left: 16px;
    padding-right: 8px;
}

.clients-table__check input {
    width: 16px;
    height: 16px;
    margin: 0;
    accent-color: var(--ct-blue);
}

.clients-table tbody tr:hover {
    background: var(--ct-hover);
}

.clients-table tbody tr.is-filtered-out,
.clients-table tbody tr[hidden] {
    display: none;
}

.clients-table__name {
    color: #1677ff;
    font-weight: 600;
    text-decoration: none;
    letter-spacing: -0.01em;
}

.clients-table__name:hover {
    text-decoration: underline;
}

.clients-table__name.clients-cell-edit {
    display: block;
    max-width: none;
    cursor: text;
    color: #1677ff;
}

.clients-table__name.clients-cell-edit:hover {
    text-decoration: none;
}

.clients-table__name.clients-cell-edit .clients-cell-edit__text {
    display: inline;
    max-width: none;
    padding: 0;
    margin: 0;
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
    overflow-wrap: break-word;
    word-break: break-word;
}

.clients-table__name.clients-cell-edit:hover .clients-cell-edit__text,
.clients-table__name.clients-cell-edit:focus-visible .clients-cell-edit__text {
    background: transparent;
    box-shadow: none;
}

.clients-table__name.clients-cell-edit:hover,
.clients-table__name.clients-cell-edit:focus-visible {
    background: #eef2f7;
    box-shadow: inset 0 0 0 1px #dbe3ee;
    border-radius: 6px;
    margin: -2px -6px;
    padding: 2px 6px;
}

.clients-table__name.clients-cell-edit .clients-cell-edit__input {
    max-width: 100%;
}

.clients-table__name.clients-cell-edit.is-saved {
    background: #dcfce7;
    box-shadow: inset 0 0 0 1px #bbf7d0;
}

.clients-table__name.clients-cell-edit.is-error {
    background: #fee2e2;
    box-shadow: inset 0 0 0 1px #fecaca;
}

.clients-cell-edit__text.is-placeholder {
    color: var(--ct-muted);
    font-weight: 500;
    font-style: italic;
}

.clients-table__ava-link {
    flex: 0 0 36px;
    line-height: 0;
    border-radius: 50%;
}

.clients-table__ava-link:focus-visible {
    outline: 2px solid #1677ff;
    outline-offset: 2px;
}

.clients-table__phone {
    margin-top: 2px;
    color: var(--ct-muted);
    font-size: 12px;
    line-height: 1.3;
}

.clients-table__date {
    color: var(--ct-muted);
    font-size: 13px;
    white-space: nowrap;
}

.clients-table__comment,
.clients-table__source {
    max-width: 240px;
    color: var(--ct-ink);
    font-size: 13px;
    font-weight: 400;
    line-height: 1.35;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.clients-table__source {
    color: var(--ct-muted);
}

/* Инлайн-правка ячеек: нажал на поле — печатаешь на месте, как в больших CRM. */
.clients-cell-edit {
    cursor: text;
}

.clients-cell-edit .clients-cell-edit__text {
    display: inline-block;
    min-width: 28px;
    max-width: 100%;
    padding: 2px 6px;
    margin: -2px -6px;
    border-radius: 6px;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: bottom;
    transition: background .15s ease;
}

.clients-cell-edit .clients-cell-edit__text[hidden] {
    /* Пока открыт инпут, старый текст не показываем (inline-block перебил бы hidden). */
    display: none;
}

.clients-cell-edit:hover .clients-cell-edit__text,
.clients-cell-edit:focus-visible .clients-cell-edit__text {
    background: #eef2f7;
    box-shadow: inset 0 0 0 1px #dbe3ee;
}

.clients-cell-edit:focus-visible {
    outline: none;
}

.clients-cell-edit__input {
    width: 100%;
    max-width: 230px;
    border: 1px solid #2563eb;
    border-radius: 8px;
    padding: 4px 8px;
    font: inherit;
    font-size: 13px;
    color: var(--ct-ink);
    background: #fff;
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .14);
}

.clients-cell-edit.is-saved .clients-cell-edit__text {
    background: #dcfce7;
    box-shadow: inset 0 0 0 1px #bbf7d0;
}

.clients-cell-edit.is-error .clients-cell-edit__text {
    background: #fee2e2;
    box-shadow: inset 0 0 0 1px #fecaca;
}

.clients-sheet__foot {
    margin: 0;
    padding: 10px 16px 12px;
    color: var(--ct-muted);
    font-size: 13px;
}

.clients-sheet .clients-empty-filter {
    margin: 0;
    padding: 24px 16px;
    text-align: center;
    color: var(--ct-muted);
}

.crm-status-pill,
.clients-chip {
    display: inline-flex;
    align-items: center;
    max-width: 220px;
    height: 22px;
    padding: 0 8px;
    border-radius: 999px;
    border: 1px solid transparent;
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.crm-status-dd {
    position: relative;
    display: inline-flex;
    vertical-align: middle;
}

.crm-status-dd__btn {
    cursor: pointer;
    gap: 4px;
    max-width: 180px;
    padding-right: 6px;
}

.crm-status-dd__caret {
    width: 0;
    height: 0;
    margin-left: 2px;
    border-left: 3.5px solid transparent;
    border-right: 3.5px solid transparent;
    border-top: 4px solid currentColor;
    opacity: 0.7;
}

.crm-status-dd__menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 40;
    min-width: 188px;
    max-height: 320px;
    overflow-y: auto;
    padding: 6px;
    border: 1px solid var(--ct-line, #e6edf4);
    border-radius: 10px;
    background: var(--ct-surface, #fff);
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.12);
}

.crm-status-dd.is-open {
    z-index: 45;
}

.crm-status-dd__menu[hidden] {
    display: none !important;
}

.crm-status-dd__opt {
    display: flex;
    width: 100%;
    border: 0;
    background: transparent;
    padding: 5px 6px;
    border-radius: 8px;
    cursor: pointer;
    text-align: left;
}

.crm-status-dd__opt:hover,
.crm-status-dd__opt.is-on {
    background: var(--ct-hover, #f5f7fa);
}

.clients-drawer__note {
    margin: 0 0 14px;
    padding: 12px 14px;
    border-radius: 12px;
    background: var(--ct-hover, #f5f7fa);
    border: 1px solid var(--ct-line, #e6edf4);
    color: var(--ct-ink);
    font-size: 14px;
    line-height: 1.5;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

/* Заметка о клиенте — первая в карточке, текст читается целиком */
.clients-drawer__note-form {
    margin: 4px 0 14px;
}

.clients-drawer__note-form.is-note {
    margin: 4px 0 16px;
    padding: 12px 12px 10px;
    border-radius: 12px;
    background: var(--ct-hover, #f5f7fa);
    border: 1px solid var(--ct-line, #e6edf4);
}

.client-profile {
    margin: 4px 0 14px;
}

.client-profile.is-collapsed {
    margin: 4px 0 14px;
    border: 1px solid var(--ct-line, #e6edf4);
    border-radius: 12px;
    background: var(--ct-surface, #fff);
}

.client-profile.is-collapsed > summary {
    cursor: pointer;
    padding: 11px 12px;
    color: var(--ct-ink, rgba(0, 0, 0, 0.88));
    font-size: 13px;
    font-weight: 650;
    list-style: none;
}

.client-profile.is-collapsed > summary::-webkit-details-marker {
    display: none;
}

.client-profile.is-collapsed > summary::before {
    content: '▸';
    display: inline-block;
    margin-right: 6px;
    color: var(--ct-muted, #667085);
}

.client-profile.is-collapsed[open] > summary::before {
    content: '▾';
}

.client-profile__body {
    padding: 0 12px 12px;
}

.client-profile__phone-hint {
    display: block;
    margin-top: 4px;
    color: var(--ct-muted, #667085);
    font-size: 12px;
    font-weight: 500;
    line-height: 1.4;
}

.client-profile__grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 10px;
}

.client-profile label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin: 0 0 10px;
    color: var(--ct-muted, #667085);
    font-size: 12px;
    font-weight: 650;
}

.client-profile .form-control,
.client-profile input[type="text"],
.client-profile input[type="email"],
.client-profile input[type="date"] {
    width: 100%;
    min-height: 38px;
}

.client-profile__error {
    margin: 0 0 10px;
}

.client-profile__ok {
    margin: 0 0 10px;
    color: var(--ct-green, #12824a);
    font-size: 13px;
    font-weight: 650;
}

.client-profile__delete {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin: 0 0 14px;
}

.client-profile__hint {
    margin: 0 0 14px;
    color: var(--ct-muted, #667085);
    font-size: 13px;
    line-height: 1.45;
}

@media (max-width: 520px) {
    .client-profile__grid {
        grid-template-columns: 1fr;
    }
}

.clients-drawer__label {
    display: block;
    margin-bottom: 6px;
    color: var(--ct-muted);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.clients-drawer__note-form textarea.form-control {
    min-height: 64px;
    resize: vertical;
    font-size: 14px;
    line-height: 1.45;
}

.clients-drawer__note-form.is-note textarea.form-control {
    display: block;
    width: 100%;
    box-sizing: border-box;
    min-height: 88px;
    max-height: 240px;
    field-sizing: content;
    resize: vertical;
    overflow: auto;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    background: var(--ct-surface, #fff);
    color: var(--ct-ink, rgba(0, 0, 0, 0.88));
    line-height: 1.5;
}

.clients-drawer__note-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 6px;
}

/* Задачи по клиенту */
.clients-drawer__tab-count {
    display: inline-block;
    min-width: 18px;
    padding: 0 5px;
    margin-left: 2px;
    border-radius: 999px;
    background: var(--ct-blue, #1677ff);
    color: #fff;
    font-size: 11px;
    line-height: 18px;
    text-align: center;
}

.clients-drawer__task-add {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 6px;
    margin-bottom: 12px;
}

.clients-drawer__task-add .form-control {
    height: 36px;
    min-height: 36px;
    padding: 0 10px;
    font-size: 14px;
}

.clients-drawer__task-add .btn-sm {
    height: 36px;
    min-height: 36px;
    white-space: nowrap;
}

.clients-drawer__tasks {
    list-style: none;
    margin: 0;
    padding: 0;
}

.clients-drawer__tasks li {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid var(--ct-line, #e6edf4);
}

.clients-drawer__tasks li:last-child {
    border-bottom: 0;
}

.clients-drawer__task-check {
    width: 22px;
    height: 22px;
    flex: 0 0 auto;
    margin-top: 1px;
    border: 2px solid var(--ct-line-strong, #cbd5e1);
    border-radius: 6px;
    background: var(--ct-surface, #fff);
    color: #fff;
    font-size: 13px;
    line-height: 18px;
    cursor: pointer;
    padding: 0;
}

.clients-drawer__tasks li.is-done .clients-drawer__task-check {
    background: #52c41a;
    border-color: #52c41a;
}

.clients-drawer__task-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    font-size: 14px;
}

.clients-drawer__tasks li.is-done .clients-drawer__task-title {
    color: var(--ct-muted);
    text-decoration: line-through;
}

.clients-drawer__tasks li.is-overdue .text-muted {
    color: #cf1322;
}

.clients-drawer__tasks-all {
    display: inline-block;
    margin-top: 12px;
    color: var(--ct-blue, #1677ff);
    font-size: 13px;
    text-decoration: none;
}

@media (max-width: 480px) {
    /* Пять вкладок помещаются на 390px без прокрутки */
    .clients-drawer__tabs {
        gap: 0;
        padding: 0 8px;
    }

    .clients-drawer__tab {
        padding: 10px 7px;
        font-size: 12.5px;
    }

    .clients-drawer__task-add {
        grid-template-columns: 1fr 1fr;
    }

    .clients-drawer__task-add input[name="title"] {
        grid-column: 1 / -1;
    }
}

.clients-drawer__pay-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: baseline;
}

.crm-status-pill--active {
    background: #f6ffed;
    color: #389e0d;
    border-color: #b7eb8f;
}

.crm-status-pill--trial {
    background: #fff7e6;
    color: #d46b08;
    border-color: #ffd591;
}

.crm-status-pill--pending {
    background: #fffbe6;
    color: #d48806;
    border-color: #ffe58f;
}

.crm-status-pill--ending {
    background: #fff2e8;
    color: #d4380d;
    border-color: #ffbb96;
}

.crm-status-pill--new {
    background: #e6f4ff;
    color: #1677ff;
    border-color: #91caff;
}

.crm-status-pill--empty,
.crm-status-pill--expired {
    background: #fafafa;
    color: #8c8c8c;
    border-color: #d9d9d9;
}

.crm-status-pill--inactive {
    background: #fff1f0;
    color: #cf1322;
    border-color: #ffa39e;
}

.crm-status-pill--single {
    background: #f9f0ff;
    color: #722ed1;
    border-color: #d3adf7;
}

.crm-status-pill--renew {
    background: #fff1f0;
    color: #cf1322;
    border-color: #ffa39e;
}

/* ===== Доска «Абонементы» (одна строка — одна покупка) ===== */
.crm-board__filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--ct-line);
    background: var(--ct-surface);
}

.crm-board__select select {
    height: 32px;
    min-width: 132px;
    max-width: 220px;
    padding: 0 28px 0 10px;
    border: 1px solid var(--ct-line);
    border-radius: 8px;
    background: var(--ct-surface) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path d='M1 1l4 4 4-4' fill='none' stroke='%238c8c8c' stroke-width='1.5' stroke-linecap='round'/></svg>") no-repeat right 10px center;
    color: var(--ct-ink);
    font-size: 13px;
    font-weight: 500;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    text-overflow: ellipsis;
}

.crm-board__select select:focus-visible {
    outline: 2px solid var(--ct-soft);
    border-color: var(--ct-blue);
}

.crm-board__reset {
    font-size: 13px;
    color: var(--ct-blue);
    text-decoration: none;
    white-space: nowrap;
}

.crm-board__spacer {
    flex: 1 1 auto;
}

.crm-board__filters .clients-search {
    width: 200px;
    min-width: 160px;
}

.crm-board__stats {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--ct-line);
    background: var(--ct-surface);
}

.crm-board__stats-label {
    margin-right: 4px;
    color: var(--ct-muted);
    font-size: 13px;
}

.crm-board__stat {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    height: 26px;
    padding: 0 9px;
    border: 1px solid var(--ct-line);
    border-radius: 999px;
    background: var(--ct-surface);
    color: var(--ct-muted);
    font: inherit;
    font-size: 12.5px;
    white-space: nowrap;
}

.crm-board__stat b {
    color: var(--ct-ink);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.crm-board__stat.is-link {
    cursor: pointer;
}

.crm-board__stat.is-link:hover {
    background: var(--ct-hover);
}

.crm-board__stat.is-money b { color: #389e0d; }
.crm-board__stat.is-debt b { color: #cf1322; }
.crm-board__stat.is-renew b { color: #cf1322; }
.crm-board__stat.is-ending b { color: #d4380d; }
.crm-board__stat.is-pending b { color: #d48806; }

.crm-board__chips {
    padding-top: 8px;
    padding-bottom: 8px;
}

.crm-board__table {
    min-width: 1080px;
}

.crm-board__table th,
.crm-board__table td {
    padding: 9px 12px;
}

.crm-board__num {
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.crm-board__num.is-missed {
    color: #cf1322;
    font-weight: 600;
}

.crm-board__left {
    font-weight: 600;
}

.crm-board__left.is-low,
.crm-board__left.is-out {
    display: inline-block;
    min-width: 22px;
    padding: 1px 7px;
    border-radius: 999px;
    text-align: center;
}

.crm-board__left.is-low {
    background: #fff7e6;
    color: #ad4e00;
}

.crm-board__left.is-out {
    background: #fff1f0;
    color: #cf1322;
}

.crm-board__more {
    position: relative;
}

.crm-board__more-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 32px;
    padding: 0 12px;
    border: 1px solid var(--ct-line);
    border-radius: 8px;
    background: var(--ct-surface);
    color: var(--ct-ink);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    list-style: none;
    user-select: none;
}

.crm-board__more-btn::-webkit-details-marker {
    display: none;
}

.crm-board__more-btn svg {
    width: 16px;
    height: 16px;
}

.crm-board__more-btn em {
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--ct-blue);
    color: #fff;
    font-style: normal;
    font-size: 11px;
    line-height: 18px;
    text-align: center;
}

.crm-board__more[open] .crm-board__more-btn {
    border-color: var(--ct-blue);
    color: var(--ct-blue);
}

.crm-board__more-pane {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 30;
    display: grid;
    gap: 8px;
    width: 260px;
    padding: 12px;
    border: 1px solid var(--ct-line);
    border-radius: 12px;
    background: var(--ct-surface);
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.14);
}

.crm-board__more-pane .crm-board__select select {
    width: 100%;
    max-width: none;
}

.crm-board__active {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--ct-line);
    background: var(--ct-surface);
}

.crm-board__pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 28px;
    padding: 0 10px;
    border-radius: 999px;
    background: var(--ct-soft, #e6f4ff);
    color: var(--ct-blue, #1677ff);
    font-size: 12.5px;
    font-weight: 600;
    text-decoration: none;
}

.crm-board__pill span {
    font-size: 11px;
    opacity: 0.8;
}

.crm-board__pill:hover {
    filter: brightness(0.96);
}

.clients-filter__extra {
    margin-left: 6px;
    color: #cf1322;
    font-weight: 700;
    font-size: 12px;
}

.crm-board__of {
    margin-left: 1px;
    color: var(--ct-muted);
    font-size: 12px;
}

.crm-board__sub {
    margin-top: 2px;
    color: var(--ct-muted);
    font-size: 12px;
    line-height: 1.3;
    max-width: 220px;
    white-space: normal;
}

.crm-board__sub.is-warn {
    color: #d4380d;
}

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

.crm-board__pay {
    white-space: nowrap;
}

.crm-board__pay-amount {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.crm-board__pay-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    flex: 0 0 auto;
    background: #52c41a;
    position: relative;
}

.crm-board__pay-dot::after {
    content: "";
    position: absolute;
    left: 4px;
    top: 3px;
    width: 4px;
    height: 7px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.crm-board__pay--debt .crm-board__pay-dot {
    background: #ff4d4f;
}

.crm-board__pay--debt .crm-board__pay-dot::after {
    left: 6px;
    top: 3px;
    width: 0;
    height: 7px;
    border-width: 0 2px 0 0;
    transform: none;
}

.crm-board__pay--pending .crm-board__pay-dot {
    background: #faad14;
}

.crm-board__pay-method,
.crm-board__pay-debt {
    display: block;
    margin-top: 2px;
    color: var(--ct-muted);
    font-size: 12px;
}

.crm-board__pay-debt {
    color: #cf1322;
    font-weight: 600;
}

.crm-board__status {
    white-space: nowrap;
}

.crm-board__renew {
    display: block;
    margin-top: 4px;
    font-weight: 600;
}

/* Новый клиент: блок «Абонемент» в той же форме */
.crm-add-membership {
    margin-top: 18px;
    padding: 14px 16px 6px;
    border: 1px dashed var(--ct-line);
    border-radius: 12px;
    background: var(--ct-surface-2, #f7f9fc);
}

.crm-add-membership__head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 12px;
    margin-bottom: 10px;
}

.crm-add-membership__head h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
}

.crm-add-membership__head .text-muted {
    font-size: 13px;
}

.crm-add-membership__more:not([hidden]) {
    display: contents;
}

html[data-theme="dark"] .crm-add-membership {
    background: #141a24;
}

/* Внести оплату: раскрывашка прямо в ячейке */
.crm-pay-pop {
    position: relative;
    margin-top: 4px;
}

.crm-pay-pop > summary {
    list-style: none;
    cursor: pointer;
    font-weight: 600;
}

.crm-pay-pop > summary::-webkit-details-marker {
    display: none;
}

.crm-pay-form {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
}

/* В потоке, не absolute: обёртка таблицы с overflow иначе обрезает попап. */
.crm-pay-pop[open] > .crm-pay-form {
    flex-wrap: wrap;
    width: max-content;
    max-width: 100%;
    padding: 8px;
    border: 1px solid var(--ct-line);
    border-radius: 10px;
    background: var(--ct-surface-2, #f7f9fc);
}

.crm-pay-pop[open] > summary {
    color: var(--ct-muted);
}

.crm-pay-form input.form-control,
.crm-pay-form select.form-control {
    height: 32px;
    min-height: 32px;
    padding: 0 8px;
    font-size: 13px;
}

.crm-pay-form input.form-control {
    width: 104px;
}

.crm-pay-form select.form-control {
    width: auto;
}

.crm-pay-form .btn-sm {
    height: 32px;
    min-height: 32px;
    padding: 0 12px;
    font-size: 13px;
    white-space: nowrap;
}

.clients-drawer__debt {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
}

.clients-drawer__payments li.has-debt {
    border-left: 3px solid #ff4d4f;
    padding-left: 10px;
}

.crm-board__status .crm-trial-links {
    display: block;
    margin-top: 4px;
}

/* Пробник: пришёл / не пришёл — сразу видно, кого дожимать. */
.crm-trial-visit {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    font-weight: 600;
}

.crm-trial-visit--yes {
    color: #16a34a;
}

.crm-trial-visit--no {
    color: #d97706;
}

/* Удалённый счёт Kaspi на доске «Абонементы». */
.crm-board__invoice {
    display: block;
    margin-top: 2px;
}

.crm-board__invoice .crm-board__add--invoice {
    background: none;
    border: 0;
    padding: 0;
    cursor: pointer;
    font: inherit;
    color: #d3223a;
    font-size: 12px;
    font-weight: 650;
}

.crm-board__invoice .crm-board__add--invoice:hover {
    text-decoration: underline;
}

/* «Вход по QR»: ручная отметка по карте/телефону + список с аватарами. */
.crm-visit-checkin {
    padding: 14px 16px;
    margin-bottom: 14px;
}

.crm-visit-checkin__body {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

.crm-visit-checkin__field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1 1 240px;
    min-width: 0;
}

.crm-visit-checkin__field--branch {
    flex: 0 1 200px;
}

.crm-visit-checkin__label {
    font-size: 12px;
    font-weight: 600;
    color: var(--ct-muted, #6b7280);
}

.crm-visit-checkin__btn {
    flex: 0 0 auto;
}

.crm-visit-checkin__hint {
    margin: 8px 0 0;
    font-size: 12px;
    color: var(--ct-muted, #6b7280);
}

.crm-visits-search {
    max-width: 340px;
    margin-bottom: 10px;
}

.crm-visits-card .crm-board__filters,
.crm-visits-card .crm-board__stats,
.crm-visits-card .crm-board__chips {
    border-left: 0;
    border-right: 0;
}

.crm-visits-card .crm-board__filters {
    border-top: 0;
    border-radius: 12px 12px 0 0;
}

.crm-visits-date {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--ct-muted);
    font-size: 12px;
    font-weight: 600;
}

.crm-visits-date input[type="date"] {
    height: 32px;
    padding: 0 8px;
    border: 1px solid var(--ct-line);
    border-radius: 8px;
    background: var(--ct-surface);
    color: var(--ct-ink);
    font-size: 13px;
}

.crm-visits-search-field {
    width: 200px;
    min-width: 160px;
    margin-bottom: 0;
}

.crm-visits-scope {
    margin: 0;
    padding: 8px 12px;
    border-bottom: 1px solid var(--ct-line);
    background: var(--ct-surface);
    font-size: 13px;
    color: var(--ct-muted);
}

.crm-visits-scope a {
    margin-left: 8px;
    color: var(--ct-blue);
    text-decoration: none;
}

.crm-client-visits {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 8px;
}

.crm-client-visits li {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid var(--ct-line);
}

.crm-client-visits li:last-child {
    border-bottom: 0;
}

.crm-client-visits__main {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.crm-client-visits__main time {
    font-size: 12px;
    color: var(--ct-muted);
}

.crm-client-visits__meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    flex: 0 0 auto;
}

.crm-client-visits__meta small {
    font-size: 12px;
    color: var(--ct-muted);
}

.crm-client-visits__more {
    display: inline-block;
    margin-top: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--ct-blue);
    text-decoration: none;
}

.crm-client-visits__empty {
    margin: 0 0 8px;
}

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

.crm-visits-person__who {
    min-width: 0;
}

.crm-visits-person__name {
    font-weight: 600;
    color: inherit;
    text-decoration: none;
}

.crm-visits-person__name:hover {
    text-decoration: underline;
}

.crm-visits-person__phone {
    font-size: 12px;
    color: var(--ct-muted, #6b7280);
}

@media (max-width: 640px) {
    .crm-visit-checkin__body {
        flex-direction: column;
        align-items: stretch;
    }

    .crm-visit-checkin__field {
        flex: none;
    }

    .crm-visits-table .crm-visits-table__date {
        white-space: normal;
    }
}

.crm-board__row-actions {
    display: flex;
    gap: 6px;
    margin-top: 6px;
}

.crm-board__row-actions .btn-sm {
    height: 26px;
    min-height: 26px;
    padding: 0 10px;
    font-size: 12px;
}

.crm-board__bind,
.crm-board__tariff {
    max-width: 210px;
}

.crm-board__bind-name,
.crm-board__tariff-name,
.crm-board__bind .crm-board__sub,
.crm-board__tariff .crm-board__sub,
.clients-table__person .crm-board__sub {
    display: block;
    max-width: 210px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

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

.crm-board__assign select {
    height: 26px;
    max-width: 200px;
    padding: 0 8px;
    border: 1px dashed var(--ct-line);
    border-radius: 6px;
    background: transparent;
    color: var(--ct-blue);
    font-size: 13px;
    cursor: pointer;
}

.crm-row-actions { width: 44px; text-align: center; }
.crm-row-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #94a3b8;
    cursor: pointer;
}
.crm-row-icon svg { width: 18px; height: 18px; }
.crm-row-icon:hover { background: #fef2f2; color: #c0392b; }
.crm-row-restore {
    border: 0;
    background: transparent;
    color: #1677ff;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
}

.crm-board__add {
    color: var(--ct-blue);
    font-size: 13px;
    text-decoration: none;
}

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

.crm-board__term {
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

html[data-theme="dark"] .crm-status-pill--single {
    background: #2a1c44;
    color: #d3adf7;
    border-color: #4c2f7a;
}

html[data-theme="dark"] .crm-status-pill--renew {
    background: #3a1c1c;
    color: #ffa39e;
    border-color: #7a2e2e;
}

html[data-theme="dark"] .crm-board__select select {
    background-color: var(--ct-surface);
    border-color: rgba(255, 255, 255, 0.1);
}

/* Телефон: строка таблицы → карточка */
@media (max-width: 760px) {
    .crm-board__filters {
        gap: 6px;
    }

    .crm-board__select {
        flex: 1 1 calc(50% - 3px);
        min-width: 0;
    }

    .crm-board__more-pane {
        width: min(300px, calc(100vw - 32px));
    }

    .crm-board__select select {
        width: 100%;
        min-width: 0;
        max-width: none;
    }

    .crm-board__spacer {
        display: none;
    }

    .crm-board__filters .clients-search {
        width: 100%;
        min-width: 0;
        flex: 1 1 100%;
    }

    .crm-board__filters .clients-sheet__add {
        flex: 1 1 100%;
        text-align: center;
    }

    .crm-board__stats {
        overflow-x: auto;
        flex-wrap: nowrap;
        scrollbar-width: none;
    }

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

    .crm-board__chips .clients-filters {
        overflow-x: auto;
        flex-wrap: nowrap;
        scrollbar-width: none;
    }

    .crm-board__chips .clients-filters::-webkit-scrollbar {
        display: none;
    }

    .clients-sheet .clients-table-wrap:has(.crm-board__table) {
        overflow: visible;
    }

    .clients-sheet .clients-table.crm-board__table {
        min-width: 0;
        width: 100%;
        display: block;
    }

    .crm-board__table thead {
        display: none;
    }

    .crm-board__table tbody,
    .crm-board__table tr {
        display: block;
    }

    .crm-board__table tr {
        display: grid;
        grid-template-columns: 1fr auto;
        grid-template-areas:
            "person status"
            "pay left"
            "bind term"
            "tariff tariff";
        gap: 4px 10px;
        padding: 12px 14px;
        border-bottom: 1px solid var(--ct-line);
    }

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

    .crm-board__table td {
        display: block;
        padding: 0;
        border: 0;
        font-size: 13px;
    }

    .crm-board__table .clients-table__check,
    .crm-board__table td.crm-board__num--visited,
    .crm-board__table td.crm-board__num--missed {
        display: none;
    }

    .crm-board__table .clients-table__person {
        grid-area: person;
        display: flex;
        align-items: center;
        gap: 8px;
        min-width: 0;
    }

    .crm-board__table .crm-board__status {
        grid-area: status;
        justify-self: end;
        text-align: right;
    }

    .crm-board__table .crm-board__pay {
        grid-area: pay;
    }

    .crm-board__table td.crm-board__num--left {
        grid-area: left;
        justify-self: end;
        align-self: center;
    }

    .crm-board__table td.crm-board__num--left::before {
        content: "Осталось ";
        color: var(--ct-muted);
        font-weight: 400;
        font-size: 12px;
    }

    .crm-board__table .crm-board__bind {
        grid-area: bind;
        min-width: 0;
    }

    .crm-board__table .crm-board__bind > .crm-board__muted {
        display: none;
    }

    .crm-board__table .crm-board__term {
        grid-area: term;
        justify-self: end;
        text-align: right;
        white-space: normal;
    }

    .crm-board__table .crm-board__tariff {
        grid-area: tariff;
        max-width: none;
        color: var(--ct-muted);
        font-size: 12px;
    }

    .crm-board__table .crm-board__bind,
    .crm-board__table .crm-board__bind-name,
    .crm-board__table .crm-board__tariff-name,
    .crm-board__table .crm-board__bind .crm-board__sub,
    .crm-board__table .crm-board__tariff .crm-board__sub,
    .crm-board__table .clients-table__person .crm-board__sub {
        max-width: none;
        white-space: normal;
    }

    .crm-board__table .crm-board__tariff-name {
        display: inline;
    }

    .crm-board__table .crm-board__tariff .crm-board__sub {
        display: inline;
    }

    .crm-board__table .crm-board__tariff .crm-board__sub::before {
        content: " · ";
    }

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

    .crm-pay-pop[open] > .crm-pay-form {
        width: 100%;
    }

    /* Открыта карточка клиента — кнопка помощника не должна закрывать её действия. */
    body.clients-drawer-open .q-assist-fab {
        display: none;
    }

    /* Кнопки форм на телефоне — в столбик, во всю ширину (выдача тарифа и т.п.). */
    body.crm-ui .partner-form .form-actions {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    body.crm-ui .partner-form .form-actions .btn {
        width: 100%;
        min-height: 44px;
        box-sizing: border-box;
        text-align: center;
    }

    .crm-pay-form input.form-control {
        flex: 1 1 90px;
    }

    .crm-pay-form select.form-control {
        flex: 1 1 110px;
    }

    .crm-pay-form .btn-sm {
        flex: 1 1 100%;
    }
}

.clients-chip {
    background: #f5f7fa;
    color: var(--ct-ink);
    border-color: #e6edf4;
    font-weight: 500;
}

.clients-chip--active { background: #e6f4ff; color: #1677ff; border-color: #bae0ff; }
.clients-chip--trial { background: #fff7e6; color: #d46b08; border-color: #ffd591; }
.clients-chip--pending { background: #fffbe6; color: #d48806; border-color: #ffe58f; }
.clients-chip--expired,
.clients-chip--empty { color: var(--ct-muted); }

.clients-table .crm-trial-chip {
    height: 22px;
}

body.clients-drawer-open {
    overflow: hidden;
}

.clients-drawer-root {
    position: fixed;
    inset: 0;
    z-index: 80;
}

.clients-drawer-root[hidden] {
    display: none !important;
}

.clients-drawer-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.28);
}

.clients-table tbody tr.is-open {
    background: var(--ct-hover);
}

.clients-drawer {
    position: absolute;
    top: 0;
    right: 0;
    width: min(440px, 36vw);
    min-width: min(340px, 100%);
    height: 100%;
    display: flex;
    flex-direction: column;
    background: var(--ct-surface, #fff);
    box-shadow: -12px 0 32px rgba(15, 23, 42, 0.12);
    color: var(--ct-ink, rgba(0, 0, 0, 0.88));
}

.clients-drawer__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 18px 8px;
}

.clients-drawer__id {
    margin: 0;
    color: var(--ct-muted, rgba(0, 0, 0, 0.45));
    font-size: 12px;
}

.clients-drawer__head h2 {
    margin: 2px 0 0;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: var(--ct-ink, rgba(0, 0, 0, 0.88));
}

.clients-drawer__close {
    width: 32px;
    height: 32px;
    border: 0;
    background: transparent;
    color: var(--ct-muted, rgba(0, 0, 0, 0.45));
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    border-radius: 8px;
}

.clients-drawer__close:hover {
    background: var(--ct-hover, #f5f7fa);
    color: var(--ct-ink, rgba(0, 0, 0, 0.88));
}

.clients-drawer__tabs {
    display: flex;
    flex-shrink: 0;
    gap: 4px;
    padding: 0 14px;
    border-bottom: 1px solid var(--ct-line, #e6edf4);
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.clients-drawer__tabs::-webkit-scrollbar {
    display: none;
}

.clients-drawer__tab {
    flex: 0 0 auto;
    white-space: nowrap;
    border: 0;
    background: transparent;
    color: var(--ct-muted, rgba(0, 0, 0, 0.45));
    padding: 10px 12px;
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}

.clients-drawer__tab.is-on {
    color: var(--ct-blue, #1677ff);
    border-bottom-color: var(--ct-blue, #1677ff);
}

.clients-drawer__body {
    flex: 1 1 auto;
    overflow: auto;
    padding: 8px 18px 16px;
}

.clients-drawer__meta {
    display: grid;
    gap: 12px;
    margin: 12px 0 16px;
}

.clients-drawer__meta div {
    display: grid;
    grid-template-columns: 150px minmax(0, 1fr);
    gap: 10px;
    align-items: center;
}

.clients-drawer__meta dt {
    margin: 0;
    color: var(--ct-muted, rgba(0, 0, 0, 0.45));
    font-size: 13px;
}

.clients-drawer__meta dd {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

.clients-drawer__sub {
    margin: 14px 0 8px;
    font-size: 13px;
    font-weight: 700;
}

.clients-drawer__subs {
    list-style: none;
    margin: 0;
    padding: 0;
}

.clients-drawer__subs li {
    padding: 10px 0;
    border-bottom: 1px solid var(--ct-line, #e6edf4);
}

.clients-drawer__subs li:last-child {
    border-bottom: 0;
}

.clients-drawer__trial {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 14px;
}

.clients-drawer__foot {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 18px 16px;
    border-top: 1px solid var(--ct-line, #e6edf4);
    background: var(--ct-surface, #fff);
}

.clients-drawer__foot .btn {
    min-height: 36px;
    border-radius: 999px;
}

.clients-drawer__contact {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    flex: 1 1 100%;
    margin-bottom: 2px;
}

.clients-table__person {
    min-width: 220px;
}

.clients-table__person-inner {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    min-width: 0;
}

.clients-table__person:not(:has(.clients-table__person-inner)) {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
}

.clients-table--people td.clients-table__person {
    display: table-cell;
    vertical-align: middle;
}

.clients-table--people td.clients-table__person:not(:has(.clients-table__person-inner)) {
    display: flex;
}

.clients-table__who {
    min-width: 0;
    flex: 1 1 auto;
    overflow: hidden;
}

.clients-table__person .wa-write,
.clients-table__person-inner .wa-write {
    margin-left: auto;
    flex-shrink: 0;
}

/* Аватар клиента в таблицах: фото или цветные инициалы — живее и понятнее, как в больших CRM. */
.clients-table__ava {
    flex: 0 0 36px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 0 0 2px #fff, 0 1px 4px rgba(15, 23, 42, .12);
}

.clients-table__ava--initials {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .02em;
    color: #fff;
    background: #94a3b8;
    user-select: none;
}

.clients-table__ava--t0 { background: #6366f1; }
.clients-table__ava--t1 { background: #0ea5e9; }
.clients-table__ava--t2 { background: #10b981; }
.clients-table__ava--t3 { background: #f59e0b; }
.clients-table__ava--t4 { background: #ef4444; }
.clients-table__ava--t5 { background: #8b5cf6; }
.clients-table__ava--t6 { background: #14b8a6; }
.clients-table__ava--t7 { background: #f97316; }
.clients-table__ava--t8 { background: #ec4899; }
.clients-table__ava--t9 { background: #3b82f6; }

.wa-write {
    position: relative;
    display: inline-flex;
    flex-shrink: 0;
}

.wa-write__split {
    display: inline-flex;
    align-items: stretch;
    overflow: hidden;
    border-radius: 999px;
    background: #1fad4f;
    box-shadow: 0 1px 2px rgba(16, 94, 38, 0.18);
}

.wa-write__go,
.wa-write__more,
.wa-call {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: 0;
    text-decoration: none;
    cursor: pointer;
    font: inherit;
    font-weight: 700;
    line-height: 1;
}

.wa-write__go {
    color: #fff;
    background: transparent;
    min-height: 36px;
    padding: 0 12px;
}

.wa-write--button .wa-write__go,
.wa-write--cta .wa-write__go {
    padding: 0 14px 0 12px;
}

.wa-write--icon .wa-write__go {
    width: 34px;
    min-height: 34px;
    padding: 0;
}

.wa-write__more {
    color: #fff;
    background: rgba(0, 0, 0, 0.12);
    width: 28px;
    min-height: 36px;
    padding: 0;
    border-left: 1px solid rgba(255, 255, 255, 0.18);
}

.wa-write--icon .wa-write__more {
    width: 22px;
    min-height: 34px;
}

.wa-write__go:hover,
.wa-write__more:hover {
    background: rgba(0, 0, 0, 0.1);
}

.wa-write__icon,
.wa-write__more svg,
.wa-call svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.wa-write--icon .wa-write__icon {
    width: 18px;
    height: 18px;
}

.wa-write__menu {
    min-width: 220px;
    max-width: min(300px, calc(100vw - 24px));
    padding: 8px;
    border-radius: 14px;
    border: 1px solid var(--ct-line, #e6edf4);
    background: var(--ct-surface, #fff);
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.16);
}

.wa-write__caption {
    margin: 0 8px 6px;
    color: var(--ct-muted, rgba(0, 0, 0, 0.45));
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.wa-write__item {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 8px 10px;
    border-radius: 10px;
    color: var(--ct-ink, #111);
    text-decoration: none;
}

.wa-write__item:hover,
.wa-write__item:focus-visible {
    background: rgba(31, 173, 79, 0.1);
}

.wa-write__item strong {
    font-size: 13px;
    font-weight: 700;
}

.wa-write__item span {
    color: var(--ct-muted, rgba(0, 0, 0, 0.5));
    font-size: 12px;
    line-height: 1.35;
}

.wa-write__item.is-plain strong {
    color: #14803c;
}

.wa-call {
    min-height: 36px;
    padding: 0 14px;
    border-radius: 999px;
    border: 1px solid var(--ct-line, #d9e2ec);
    background: var(--ct-surface, #fff);
    color: var(--ct-ink, #1d2b3a);
    font-weight: 650;
}

.wa-call:hover {
    border-color: #9ab0c6;
    background: var(--ct-hover, #f6f8fb);
}

.crm-drawer__note--wa {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.crm-drawer-person__body .wa-write {
    margin-left: 2px;
}

.crm-drawer-person__body .wa-write--icon .wa-write__go,
.crm-drawer-person__body .wa-write--icon .wa-write__more {
    min-height: 28px;
}

.crm-drawer-person__body .wa-write--icon .wa-write__go {
    width: 28px;
}

.clients-drawer-await,
.clients-drawer-empty {
    padding: 24px 18px;
    color: var(--ct-muted, rgba(0, 0, 0, 0.45));
}

.clients-drawer .app-share {
    margin-top: 8px;
}

@media (max-width: 900px) {
    .clients-sheet__toolbar {
        flex-wrap: wrap;
    }

    .clients-sheet .clients-search,
    .clients-sheet__tools {
        width: 100%;
    }

    .clients-sheet .clients-search {
        min-width: 0;
        flex: 1 1 auto;
    }

    .clients-drawer {
        width: 100%;
        min-width: 0;
    }

    .clients-drawer__meta div {
        grid-template-columns: 1fr;
        gap: 2px;
    }

    .clients-table {
        min-width: 560px;
    }

    .clients-table-wrap {
        overflow-x: auto;
    }

    .clients-table-wrap:has(.clients-table--people) {
        overflow: visible;
    }

    .clients-table--people {
        table-layout: auto;
        width: 100%;
        min-width: 0;
        display: block;
    }

    .clients-table--people colgroup,
    .clients-table--people thead {
        display: none;
    }

    .clients-table--people tbody {
        display: block;
    }

    .clients-table--people tr {
        display: grid;
        grid-template-columns: 28px minmax(0, 1fr) auto auto 36px;
        grid-template-areas:
            "check person person person actions"
            ". status status status status"
            ". card card card card"
            ". comment source date date"
            ". partner partner partner partner";
        align-items: start;
        gap: 6px 10px;
        padding: 12px 14px;
        border-bottom: 1px solid var(--ct-line);
    }

    .clients-table--people tr[hidden],
    .clients-table--people tr.is-filtered-out {
        display: none;
    }

    .clients-table--people th,
    .clients-table--people td {
        width: auto !important;
        min-width: 0 !important;
        max-width: none !important;
        padding: 0;
        border: 0;
        white-space: normal;
    }

    .clients-table--people td.clients-table__check {
        grid-area: check;
        padding-top: 10px;
    }

    .clients-table--people td.clients-table__person {
        grid-area: person;
        display: flex;
        align-items: center;
        gap: 10px;
        min-width: 0;
    }

    .clients-table--people .clients-table__person-inner {
        width: 100%;
        min-width: 0;
    }

    .clients-table--people td.clients-table__status {
        grid-area: status;
    }

    .clients-table--people td.clients-table__card {
        grid-area: card;
        font-size: 12px;
    }

    .clients-table--people td.clients-table__card:not(.is-empty)::before {
        content: "Карта · ";
        color: var(--ct-muted);
    }

    .clients-table--people td.clients-table__actions {
        grid-area: actions;
        padding-top: 2px;
        text-align: right;
    }

    .clients-table--people td.clients-table__comment {
        grid-area: comment;
        color: var(--ct-ink);
        font-size: 12px;
    }

    .clients-table--people td.clients-table__source {
        grid-area: source;
        color: var(--ct-muted);
        font-size: 12px;
    }

    .clients-table--people td.clients-table__date {
        grid-area: date;
        color: var(--ct-muted);
        font-size: 12px;
        justify-self: end;
    }

    .clients-table--people td.clients-table__partner {
        grid-area: partner;
        font-size: 12px;
    }

    .clients-table--people td.clients-table__source::before {
        content: "Источник · ";
    }

    .clients-table--people td.clients-table__date::before {
        content: "Дата · ";
    }

    .clients-table--people td.is-empty,
    .clients-table--people td.clients-table__comment:has(.is-placeholder),
    .clients-table--people td.clients-table__source:has(.is-placeholder),
    .clients-table--people td.clients-table__date:has(.is-placeholder),
    .clients-table--people td.clients-table__card.is-empty {
        display: none;
    }
}

html[data-theme="dark"] .clients-sheet,
html[data-theme="dark"] .clients-drawer {
    --ct-hover: rgba(255, 255, 255, 0.04);
}

html[data-theme="dark"] .crm-status-dd__menu {
    background: var(--ct-surface, #141414);
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
}

html[data-theme="dark"] .clients-drawer-backdrop {
    background: rgba(0, 0, 0, 0.55);
}

html[data-theme="dark"] .crm-status-pill--active {
    background: #16301f;
    color: #b7eb8f;
    border-color: #245c38;
}

html[data-theme="dark"] .crm-status-pill--trial,
html[data-theme="dark"] .clients-chip--trial {
    background: #3a2e14;
    color: #ffe58f;
    border-color: #7a6418;
}

html[data-theme="dark"] .crm-status-pill--pending,
html[data-theme="dark"] .clients-chip--pending {
    background: #3a2e14;
    color: #ffe58f;
    border-color: #7a6418;
}

html[data-theme="dark"] .crm-status-pill--ending {
    background: #3a2414;
    color: #ffbb96;
    border-color: #7a4a18;
}

html[data-theme="dark"] .crm-status-pill--new,
html[data-theme="dark"] .clients-chip--active {
    background: #102a44;
    color: #91caff;
    border-color: #1d4f7a;
}

html[data-theme="dark"] .crm-status-pill--empty,
html[data-theme="dark"] .crm-status-pill--expired,
html[data-theme="dark"] .clients-chip,
html[data-theme="dark"] .clients-chip--empty,
html[data-theme="dark"] .clients-chip--expired {
    background: #1a2436;
    color: rgba(255, 255, 255, 0.62);
    border-color: #243044;
}

html[data-theme="dark"] .crm-status-pill--inactive {
    background: #3a1c1c;
    color: #ffa39e;
    border-color: #7a2e2e;
}

html[data-theme="dark"] .wa-write__split {
    background: #1a9a47;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}

html[data-theme="dark"] .wa-write__menu {
    background: var(--ct-surface, #141414);
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
}

html[data-theme="dark"] .wa-write__item {
    color: rgba(255, 255, 255, 0.9);
}

html[data-theme="dark"] .wa-write__item:hover,
html[data-theme="dark"] .wa-write__item:focus-visible {
    background: rgba(31, 173, 79, 0.18);
}

html[data-theme="dark"] .wa-write__item.is-plain strong {
    color: #7ddea0;
}

html[data-theme="dark"] .wa-call {
    background: transparent;
    border-color: rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.86);
}

html[data-theme="dark"] .wa-call:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.2);
}

@media (max-width: 430px) {
    .clients-drawer__contact {
        width: 100%;
    }

    .clients-drawer__contact .wa-write,
    .clients-drawer__contact .wa-write__split {
        flex: 1 1 auto;
    }

    .clients-drawer__contact .wa-write__go {
        flex: 1 1 auto;
        min-height: 40px;
    }

    .clients-drawer__contact .wa-call {
        min-height: 40px;
    }

    .wa-write__menu {
        max-width: calc(100vw - 20px);
    }
}

/* Журнал push-рассылок партнёра */
body.crm-ui .crm-push-history .card-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
}

body.crm-ui .crm-push-history__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 10px;
}

body.crm-ui .crm-push-history__item {
    display: grid;
    grid-template-columns: 180px minmax(0, 1fr) auto;
    gap: 16px;
    align-items: start;
    padding: 12px 0;
    border-bottom: 1px solid var(--crm-line);
}

body.crm-ui .crm-push-history__item:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

body.crm-ui .crm-push-history__item:first-child {
    padding-top: 0;
}

body.crm-ui .crm-push-history__when time {
    display: block;
    font-weight: 600;
    color: var(--crm-ink);
}

body.crm-ui .crm-push-history__meta {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    color: var(--crm-muted);
}

body.crm-ui .crm-push-history__text strong {
    display: block;
    margin-bottom: 4px;
}

body.crm-ui .crm-push-history__text p {
    margin: 0;
    color: var(--crm-muted);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

@media (max-width: 760px) {
    body.crm-ui .crm-push-history__item {
        grid-template-columns: 1fr;
        gap: 8px;
    }
}

body.crm-ui .crm-shifts-toolbar {
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

body.crm-ui .crm-shifts-branch {
    margin-left: auto;
}

body.crm-ui .crm-shifts-branch .form-control {
    min-height: 36px;
    min-width: 180px;
}

body.crm-ui .crm-shifts-table td .text-muted {
    font-size: 12px;
}

body.crm-ui .crm-trainer-visibility {
    margin-bottom: 16px;
}

body.crm-ui .crm-trainer-visibility .card-header h2 {
    margin: 0;
    font-size: 15px;
}

body.crm-ui .crm-trainer-visibility > summary {
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

body.crm-ui .crm-trainer-visibility > summary::-webkit-details-marker {
    display: none;
}

body.crm-ui .crm-trainer-visibility > summary::after {
    content: '▾';
    color: var(--crm-muted);
    transition: transform 0.15s ease;
}

body.crm-ui .crm-trainer-visibility[open] > summary::after {
    transform: rotate(180deg);
}

body.crm-ui .crm-trainer-visibility:not([open]) > summary {
    border-bottom: 0;
}

body.crm-ui .trainer-period {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

body.crm-ui .trainer-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px 16px;
}

body.crm-ui .trainer-bar .clients-filters {
    margin: 0;
}

body.crm-ui .trainer-sort {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0 16px 0 0;
    color: var(--crm-muted);
    font-size: 13px;
}

body.crm-ui .trainer-sort select {
    min-height: 36px;
    padding: 0 10px;
    border: 1px solid var(--crm-line);
    border-radius: 10px;
    background: #fff;
    font: inherit;
    font-size: 13px;
    color: var(--crm-ink, #1f2937);
}

body.crm-ui .trainer-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    margin: 10px 0 4px;
    max-width: 560px;
}

body.crm-ui .trainer-stats > div {
    padding: 8px 10px;
    border-radius: 10px;
    background: var(--crm-well, #f5f7fa);
}

body.crm-ui .trainer-stats dt {
    margin: 0 0 2px;
    color: var(--crm-muted);
    font-size: 11px;
}

body.crm-ui .trainer-stats dd {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
}

body.crm-ui .trainer-stats > div.is-good dd {
    color: #15803d;
}

body.crm-ui .trainer-stats > div.is-low dd {
    color: #cf1322;
}

@media (max-width: 560px) {
    body.crm-ui .trainer-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

body.crm-ui .crm-trainer-visibility__form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 14px 20px;
}

body.crm-ui .crm-trainer-visibility__form .checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    font-weight: 600;
}

body.crm-ui .crm-contract {
    display: grid;
    gap: 16px;
}

body.crm-ui .crm-contract__body {
    min-height: 280px;
    font-family: inherit;
    line-height: 1.5;
}

body.crm-ui .crm-contract__journal .card-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}

body.crm-ui .crm-contract__journal .card-header h2 {
    margin-right: auto;
}

.crm-week-card.is-live-flash,
.crm-week-person.is-live-flash,
.crm-drawer-person.is-live-flash,
.crm-journal-td.is-live-flash,
.sheet-td.is-live-flash,
.crm-day-roster li.is-live-flash {
    animation: live-flash .7s ease;
}

.clients-table tr.is-live-flash > td {
    animation: live-row-flash 1.6s ease;
}

@keyframes live-row-flash {
    0% { background-color: rgba(22, 119, 255, .14); }
    100% { background-color: transparent; }
}

@keyframes live-flash {
    0% { box-shadow: 0 0 0 0 rgba(22, 119, 255, .45); }
    100% { box-shadow: 0 0 0 10px rgba(22, 119, 255, 0); }
}

.trial-sheet { container-type: inline-size; font-size: 14px; max-width: 100%; min-width: 0; width: 100%; }
.trial-sheet__nav {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 12px;
}
.trial-sheet__zoom { margin-left: auto; display: inline-flex; gap: 4px; }
.trial-sheet__zoom button {
    width: 28px;
    height: 28px;
    border: 1px solid var(--crm-line, #e5e7eb);
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
}
.trial-sheet__nav a,
.trial-sheet__arrow {
    color: var(--crm-ink, #1f2937);
    text-decoration: none;
    font-size: 14px;
}
.trial-sheet__arrow {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--crm-line, #e5e7eb);
    border-radius: 8px;
    background: #fff;
}
.trial-sheet__branches {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 12px;
}
.trial-sheet__branches a,
.trial-branch-lock,
.trial-sheet__save select {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 0 12px;
    border: 1px solid var(--crm-line, #e5e7eb);
    border-radius: 999px;
    background: #fff;
    color: inherit;
    text-decoration: none;
    font-size: 13px;
    font-weight: 700;
}
.trial-sheet__branches a.is-on {
    background: #9d2740;
    border-color: #9d2740;
    color: #fff;
}
.trial-branch-lock { margin: 0 0 12px; color: #9d2740; }
.trial-branch {
    display: inline-block;
    margin-left: 6px;
    color: #9d2740;
    font-size: 11px;
    font-weight: 700;
}
.trial-sheet__stats {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
}
.trial-stat {
    display: flex;
    flex-direction: column;
    min-width: 92px;
    padding: 8px 10px;
    border: 1px solid var(--crm-line, #e5e7eb);
    border-radius: 10px;
    background: #fff;
    text-decoration: none;
    color: inherit;
}
.trial-stat b { font-size: 18px; line-height: 1.1; }
.trial-stat span { font-size: 11px; color: #64748b; }
.trial-stat.is-on { border-color: #1677ff; box-shadow: inset 0 0 0 1px #1677ff; }
.trial-stat.is-arrived { background: #ecfdf3; }
.trial-stat.is-missed { background: #fef2f2; }
.trial-stat.is-membership { background: #fee2e2; }
.trial-stat.is-left { background: #f0fdf4; }
.trial-stat.is-rescheduled { background: #eff6ff; }
.trial-sheet__add-form { display: none; }
.trial-sheet__scroll {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    border-radius: 10px;
}
.trial-sheet__save {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 10px;
    padding: 10px 12px;
    border: 1px solid #ead5dc;
    border-radius: 10px;
    background: #fff;
}
.trial-sheet__save p { margin: 0; color: #3f3f46; font-size: 13px; }
.trial-add-btn--bar {
    width: auto;
    height: auto;
    min-height: 36px;
    padding: 0 14px;
    font-size: 14px;
    white-space: nowrap;
}
.trial-helper {
    margin: 0 0 12px;
    padding: 10px 12px;
    border: 1px solid #ead5dc;
    border-radius: 10px;
    background: #fff7f9;
}
.trial-helper b { color: #9d2740; }
.trial-helper p, .trial-helper li { margin: 4px 0 0; color: #3f3f46; font-size: 13px; }
.trial-helper ul { margin: 6px 0 0; padding-left: 18px; }
.trial-mail { white-space: normal; min-width: 168px; }
.trial-mail__chip {
    display: inline-block;
    margin: 1px;
    padding: 2px 5px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 800;
    background: #f4f4f5;
    color: #71717a;
}
.trial-mail__form { margin-top: 6px; }
.trial-mail__form button {
    border: 0;
    border-radius: 8px;
    padding: 4px 8px;
    background: #9d2740;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
}
.trial-mail__chip.is-sent { background: #d9f5df; color: #1b7a34; }
.trial-mail__chip.is-skip { background: #f8d0d0; color: #c0392b; }
.trial-mail__chip.is-miss { background: #fde7c7; color: #9a5b00; }
.trial-mail__chip.is-wait { background: #e8eef8; color: #1d4f91; }
.trial-sheet__table {
    width: max-content;
    min-width: 100%;
    border-collapse: collapse;
    background: #fff;
    font-size: inherit;
}
.trial-sheet__table th {
    background: #c4899a;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.15;
    text-align: center;
    padding: 8px 3px;
    white-space: normal;
}
.trial-sheet__table td {
    border-bottom: 1px solid #eceff3;
    padding: 3px 4px;
    vertical-align: middle;
    text-align: center;
}
.trial-sheet__table th:nth-child(n+2):nth-child(-n+7),
.trial-sheet__table td:nth-child(n+2):nth-child(-n+7) { width: 58px; }
.trial-col-fio, .trial-fio { text-align: left; }
.trial-col-note, .trial-note { text-align: left; min-width: 140px; }
.trial-sheet__new { background: #fbf7f8; }
.trial-sheet__table input[type="text"],
.trial-sheet__table input[type="tel"],
.trial-sheet__table input[type="date"],
.trial-sheet__table input[type="time"] {
    width: 100%;
    min-width: 0;
    border: 1px solid transparent;
    background: transparent;
    font: inherit;
    color: inherit;
    padding: 3px 2px;
    border-radius: 6px;
}
.trial-sheet__table input[type="checkbox"] { width: 16px; height: 16px; margin: 0; accent-color: #3f3f46; }
.trial-sheet__table td:has(input[type="date"]) { min-width: 146px; }
.trial-sheet__table td:has(input[type="time"]) { min-width: 104px; }
.trial-sheet__table input[type="date"],
.trial-sheet__table input[type="time"] {
    display: block;
    width: 100%;
    min-height: 32px;
    box-sizing: border-box;
}
.trial-fio { text-align: left; min-width: 390px; white-space: nowrap; }
.trial-fio input[type="text"] { width: 158px; font-weight: 600; }
.trial-fio input[type="tel"] { color: #64748b; }
.trial-app {
    display: inline-block;
    margin: 0 4px 2px 0;
    padding: 1px 6px;
    border-radius: 999px;
    background: #efe7f8;
    color: #6d28d9;
    font-size: 10px;
    font-weight: 700;
    vertical-align: middle;
}
.trial-sheet__table input:focus { border-color: #c4899a; background: #fff; outline: none; }
.trial-pill {
    appearance: none;
    -webkit-appearance: none;
    width: 100%;
    min-width: 124px;
    border: 0;
    border-radius: 6px;
    padding: 5px 16px 5px 6px;
    font: inherit;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .02em;
    text-align: center;
    cursor: pointer;
    color: #64748b;
    background-color: transparent;
    background-image:
        linear-gradient(45deg, transparent 50%, currentColor 50%),
        linear-gradient(135deg, currentColor 50%, transparent 50%);
    background-position: calc(100% - 11px) calc(50% - 1px), calc(100% - 7px) calc(50% - 1px);
    background-size: 4px 4px, 4px 4px;
    background-repeat: no-repeat;
}
.trial-pill:focus { outline: 2px solid #c4899a; outline-offset: 1px; }
.trial-pill.is-arrived, .trial-pill.is-left { background-color: #d9f5df; color: #1b7a34; }
.trial-pill.is-missed { background-color: #f8d0d0; color: #c0392b; }
.trial-pill.is-membership { background-color: #9d2740; color: #fff; }
.trial-pill.is-rescheduled { background-color: #c5daf6; color: #1d4f91; }
.trial-delete, .trial-add-btn {
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #94a3b8;
    font-size: 18px;
    cursor: pointer;
    line-height: 1;
}
.trial-add-btn { background: #c4899a; color: #fff; font-weight: 700; }
.trial-sheet__empty { color: #64748b; text-align: left; padding: 14px 8px !important; }
html[data-theme="dark"] .trial-stat,
html[data-theme="dark"] .trial-sheet__table,
html[data-theme="dark"] .trial-sheet__arrow,
html[data-theme="dark"] .trial-sheet__new { background: #151c27; color: #e5e7eb; }
html[data-theme="dark"] .trial-sheet__table th { background: #c4899a; color: #fff; }
html[data-theme="dark"] .trial-sheet__table td { border-color: #243044; }
html[data-theme="dark"] .trial-sheet__table input { color: #e5e7eb; background: transparent; }
html[data-theme="dark"] .trial-fio input[type="tel"] { color: #94a3b8; }
html[data-theme="dark"] .trial-sheet__zoom button,
html[data-theme="dark"] .trial-sheet__save { background: #151c27; color: #e5e7eb; }
html[data-theme="dark"] .trial-sheet__save p { color: #e5e7eb; }

/* Журнал пробных: фиксированные колонки, ресайз, автосохранение, iPad */
.trial-sheet .trial-sheet__table { table-layout: fixed; width: max-content; min-width: 100%; }
.trial-sheet .trial-sheet__table th {
  position: relative; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  hyphens: none; word-break: normal; line-height: 1.2; padding: 8px 6px; vertical-align: middle;
}
.trial-sheet .trial-sheet__table td { overflow: hidden; padding: 5px 6px; vertical-align: middle; }
.trial-sheet .trial-sheet__table th:nth-child(n+2):nth-child(-n+7),
.trial-sheet .trial-sheet__table td:nth-child(n+2):nth-child(-n+7),
.trial-sheet .trial-sheet__table td:has(input[type="date"]),
.trial-sheet .trial-sheet__table td:has(input[type="time"]),
.trial-sheet .trial-note, .trial-sheet .trial-mail { width: auto; min-width: 0; }
.trial-sheet .trial-fio { min-width: 0; white-space: normal; }
.trial-sheet .trial-sheet__table input[type="text"],
.trial-sheet .trial-sheet__table input[type="tel"],
.trial-sheet .trial-sheet__table input[type="date"],
.trial-sheet .trial-sheet__table input[type="time"],
.trial-sheet .trial-sheet__table select { width: 100%; min-width: 0; max-width: 100%; box-sizing: border-box; }
.trial-sheet .trial-phone > * { width: 100%; min-width: 0; }
.trial-sheet .trial-app { display: block; margin-top: 2px; font-size: 10px; color: #1677ff; }
.trial-hall__select { border: 1px solid #e4e4e7; border-radius: 8px; padding: 5px 6px; background: #fff; font: inherit; }
.trial-hall__select.is-empty { border-color: #f59e0b; background: #fffbeb; }

/* № и имя всегда на виду при горизонтальной прокрутке */
.trial-sheet .trial-sheet__table td.trial-num,
.trial-sheet .trial-sheet__table th.trial-col-num { position: sticky; left: 0; z-index: 2; background: #fff; }
.trial-sheet .trial-sheet__table td.trial-fio,
.trial-sheet .trial-sheet__table th.trial-col-fio { position: sticky; left: 44px; z-index: 2; background: #fff; box-shadow: 1px 0 0 #e4e4e7; }
.trial-sheet .trial-sheet__new td.trial-fio,
.trial-sheet .trial-sheet__new td.trial-num { background: #fbf7f8; }
.trial-sheet .trial-sheet__table thead th.trial-col-fio,
.trial-sheet .trial-sheet__table thead th.trial-col-num { z-index: 3; background: #c4899a; color: #fff; }
html[data-theme="dark"] .trial-sheet .trial-sheet__table td.trial-num,
html[data-theme="dark"] .trial-sheet .trial-sheet__table td.trial-fio { background: #151c27; }

/* Ресайз колонок */
.trial-col-grip { position: absolute; top: 0; right: -4px; width: 10px; height: 100%; cursor: col-resize; touch-action: none; z-index: 4; }
.trial-col-grip::after { content: ''; position: absolute; top: 25%; bottom: 25%; left: 4px; width: 2px; border-radius: 2px; background: transparent; }
.trial-sheet__table th:hover .trial-col-grip::after, .trial-sheet.is-resizing .trial-col-grip::after { background: #9d2740; }
.trial-sheet.is-resizing { cursor: col-resize; user-select: none; }
@media (pointer: coarse) { .trial-col-grip { width: 22px; right: -11px; } .trial-col-grip::after { left: 10px; background: #d4d4d8; } }

/* Индикатор сохранения */
.trial-sheet td.is-saving { box-shadow: inset 0 -2px 0 #93c5fd; }
.trial-sheet td.is-saved { box-shadow: inset 0 -2px 0 #22c55e; transition: box-shadow .6s; }
.trial-sheet td.is-error { box-shadow: inset 0 0 0 2px #ef4444; }

/* Нижняя панель не обрезает кнопку */
.trial-sheet .trial-sheet__save { flex-wrap: wrap; gap: 8px 12px; }
.trial-sheet .trial-sheet__save p { flex: 1 1 260px; min-width: 0; }
.trial-sheet__reset { border: 1px solid #e4e4e7; background: #fff; border-radius: 8px; padding: 6px 10px; font: inherit; font-size: 12px; cursor: pointer; }
.trial-sheet__nav, .trial-sheet__stats, .trial-sheet__branches { flex-wrap: wrap; }

/* Телефон вертикально: строки превращаются в карточки */
@container (max-width: 640px) {
  .trial-sheet .trial-sheet__table { table-layout: auto; width: 100%; min-width: 0; }
  .trial-sheet .trial-sheet__table colgroup, .trial-sheet .trial-sheet__table thead { display: none; }
  .trial-sheet .trial-sheet__table, .trial-sheet .trial-sheet__table tbody,
  .trial-sheet .trial-sheet__table tr, .trial-sheet .trial-sheet__table td { display: block; width: auto; }
  .trial-sheet .trial-sheet__table tr { border: 1px solid #e4e4e7; border-radius: 12px; margin: 0 0 10px; padding: 6px 10px; background: #fff; }
  .trial-sheet .trial-sheet__table td { display: grid; grid-template-columns: 110px 1fr; align-items: center; gap: 8px; border: 0; padding: 4px 0; text-align: left; }
  .trial-sheet .trial-sheet__table td::before { content: attr(data-label); font-size: 12px; color: #71717a; }
  .trial-sheet .trial-sheet__table td.trial-fio,
  .trial-sheet .trial-sheet__table td.trial-num { position: static; box-shadow: none; }
  .trial-sheet .trial-sheet__table td.trial-sheet__empty { display: block; }
  .trial-sheet .trial-sheet__table td.trial-sheet__empty::before { content: none; }
}

.trial-sheet .trial-sheet__save .trial-add-btn--bar { width: auto; height: auto; min-height: 38px; padding: 0 18px; font-size: 14px; flex: 0 0 auto; margin-left: auto; }
.trial-sheet .trial-num { color: #71717a; font-size: 12px; font-variant-numeric: tabular-nums; }
.trial-sheet .trial-num--new { color: #9d2740; font-weight: 700; font-size: 16px; }
.trial-filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px 10px; margin: 0 0 12px; padding: 10px 12px; border: 1px solid #ead5dc; border-radius: 10px; background: #fff; }
.trial-filters label { display: flex; flex-direction: column; gap: 3px; flex: 0 1 150px; min-width: 120px; }
.trial-filters label span { font-size: 11px; color: #71717a; }
.trial-filters .trial-filters__search { flex: 1 1 220px; }
.trial-filters input, .trial-filters select { height: 34px; border: 1px solid #e4e4e7; border-radius: 8px; padding: 0 8px; font: inherit; font-size: 13px; background: #fff; width: 100%; box-sizing: border-box; }
.trial-filters__reset { align-self: center; color: #9d2740; font-size: 13px; }
.trial-filters__found { align-self: center; font-size: 13px; color: #3f3f46; }
html[data-theme="dark"] .trial-filters { background: #151c27; border-color: #2a3444; }
html[data-theme="dark"] .trial-filters input, html[data-theme="dark"] .trial-filters select { background: #0f141c; color: #e5e7eb; border-color: #2a3444; }

/* Связи: карточка клиента из журнала, филиалы, пробные в карточке, выдача в карточке */
.crm-hall-chip {
  display: inline-flex; align-items: center; gap: 4px; max-width: 100%;
  padding: 2px 8px; border-radius: 999px; background: #f4ecef; color: #7a2338;
  font-size: 11px; font-weight: 600; line-height: 1.5; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  vertical-align: middle;
}
.crm-hall-chip::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .55; flex: 0 0 auto; }
html[data-theme="dark"] .crm-hall-chip { background: #3a1f28; color: #f3c3d0; }
.crm-board__hall { max-width: 170px; }
@media (max-width: 760px) { .crm-board__table .crm-board__hall { grid-column: 1 / -1; } }

.trial-sheet .trial-fio__line { display: flex; align-items: center; gap: 4px; min-width: 0; }
.trial-sheet .trial-fio__line input { flex: 1 1 auto; min-width: 0; }
.trial-card-btn {
  flex: 0 0 auto; display: inline-grid; place-items: center; width: 30px; height: 30px;
  border: 1px solid #e7cdd5; border-radius: 8px; background: #fff; color: #9d2740; cursor: pointer; padding: 0;
}
.trial-card-btn svg { width: 17px; height: 17px; }
.trial-card-btn:hover { background: #9d2740; color: #fff; border-color: #9d2740; }
.trial-card-btn.is-new { border-style: dashed; color: #71717a; }
.trial-card-btn.is-new:hover { background: #3f3f46; border-color: #3f3f46; color: #fff; }
.trial-card-btn:disabled { opacity: .5; cursor: progress; }
.trial-badge {
  display: inline-block; max-width: 100%; margin-top: 3px; padding: 1px 7px; border-radius: 6px;
  font-size: 11px; font-weight: 600; text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.trial-badge.is-active { background: #dcfce7; color: #166534; }
.trial-badge.is-trial { background: #e0ecff; color: #1d4f91; }
.trial-badge.is-pending { background: #fef3c7; color: #92400e; }
@media (pointer: coarse) { .trial-card-btn { width: 36px; height: 36px; } }

.client-trials { margin-top: 16px; }
.client-trials__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.client-trials__list li { border: 1px solid var(--ct-line, #e4e4e7); border-radius: 10px; padding: 8px 10px; }
.client-trials__head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.client-trials__marks { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.client-trials__note { margin: 4px 0 0; font-size: 12px; color: #52525b; }
.trial-mini { padding: 1px 7px; border-radius: 6px; font-size: 11px; font-weight: 600; background: #f4f4f5; color: #52525b; }
.trial-mini.is-arrived, .trial-mini.is-left { background: #dcfce7; color: #166534; }
.trial-mini.is-missed { background: #fee2e2; color: #b91c1c; }
.trial-mini.is-membership { background: #9d2740; color: #fff; }
.trial-mini.is-rescheduled { background: #dbeafe; color: #1d4f91; }

.clients-drawer__tab--accent { color: #9d2740; font-weight: 700; }
.clients-drawer__link { border: 0; background: none; padding: 0; color: #9d2740; font: inherit; font-weight: 600; cursor: pointer; }
.client-issue { display: grid; gap: 6px; }
.client-issue .form-control, .client-issue select { width: 100%; box-sizing: border-box; }
.client-issue__row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.client-issue__hint { margin: 0; font-size: 12px; color: #71717a; }
.client-issue__error { margin: 0 0 6px; padding: 8px 10px; border-radius: 8px; background: #fef2f2; color: #b91c1c; font-size: 13px; }
.client-issue__actions { margin-top: 8px; }
.client-issue__actions .btn { width: 100%; min-height: 42px; }
body.crm-ui.desk-app .desk-btn--cta { white-space: nowrap; flex-shrink: 0; }
.clients-drawer__foot .btn.is-disabled { opacity: 0.6; cursor: not-allowed; pointer-events: none; }
.client-issue__kinds { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 4px; padding: 4px; border-radius: 12px; background: #f4f4f5; }
.client-issue__kinds[hidden] { display: none; }
.client-issue__kind { min-height: 40px; padding: 6px 10px; border: 0; border-radius: 9px; background: transparent; color: #52525b; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.client-issue__kind:hover { color: #18181b; }
.client-issue__kind.is-on { background: #fff; color: #9f1239; box-shadow: 0 1px 3px rgba(24, 24, 27, 0.12); }
html[data-theme="dark"] .client-issue__kinds { background: #1f2937; }
html[data-theme="dark"] .client-issue__kind { color: #cbd5e1; }
html[data-theme="dark"] .client-issue__kind.is-on { background: #0f172a; color: #fda4af; }
@media (max-width: 420px) { .client-issue__row { grid-template-columns: 1fr; } }

.legacy-guide-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin: 12px 0 4px;
    padding: 14px 16px;
    border-radius: 14px;
    background: #fff7ed;
    border: 1px solid #fdba74;
    color: #9a3412;
    text-decoration: none;
}
.legacy-guide-banner strong { display: block; font-size: 15px; }
.legacy-guide-banner em { display: block; margin-top: 2px; font-style: normal; font-size: 13px; color: #7c2d12; }
.legacy-guide-banner__go { flex: none; font-weight: 700; }
.legacy-guide-inline { margin: 0 0 12px; padding: 10px 12px; border-radius: 10px; background: #fff7ed; color: #9a3412; font-size: 14px; }
.legacy-guide-inline a { color: #9a3412; font-weight: 700; }
.legacy-guide { display: grid; gap: 18px; max-width: 760px; }
.legacy-guide__step { display: grid; gap: 8px; padding: 16px; border: 1px solid #e4e4e7; border-radius: 16px; background: #fff; }
.legacy-guide__step h2 { margin: 0; font-size: 18px; }
.legacy-guide__step p { margin: 0; color: #3f3f46; }
.legacy-guide__num { display: inline-grid; place-items: center; width: 28px; height: 28px; margin-right: 8px; border-radius: 999px; background: #9d2740; color: #fff; font-size: 14px; vertical-align: middle; }
.legacy-guide__shot { width: 100%; border-radius: 12px; border: 1px solid #e4e4e7; }
.legacy-guide__note { margin: 0; padding: 12px 14px; border-radius: 12px; background: #f4f4f5; color: #3f3f46; }
@media (max-width: 640px) {
    .legacy-guide-banner { flex-direction: column; align-items: flex-start; }
}

/* Скидка при выдаче абонемента */
.issue-discount { display: grid; gap: 6px; padding: 10px 12px; border: 1px dashed #d4d4d8; border-radius: 10px; background: #fafafa; }
.issue-discount__label { font-size: 13px; font-weight: 600; color: #3f3f46; margin: 0; }
.issue-discount__opt { font-weight: 400; color: #a1a1aa; font-size: 12px; }
.issue-discount__row { display: grid; grid-template-columns: 1fr 72px; gap: 8px; }
.issue-discount__chips { display: flex; flex-wrap: wrap; gap: 6px; }
.issue-discount__chip { border: 1px solid #e4e4e7; background: #fff; border-radius: 999px; padding: 4px 10px; font-size: 12px; color: #3f3f46; cursor: pointer; }
.issue-discount__chip:hover { border-color: #a1a1aa; }
.issue-discount__total { margin: 2px 0 0; font-size: 13px; font-weight: 600; color: #15803d; }
.purchase-discount-note { display: block; font-size: 11px; color: #15803d; }

/* Пробные на планшете: компактные колонки и подсказка, что таблица листается */
.trial-sheet__scroll.has-more {
  -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 36px), rgba(0, 0, 0, .25));
  mask-image: linear-gradient(to right, #000 calc(100% - 36px), rgba(0, 0, 0, .25));
}
.trial-sheet__scroll-hint {
  display: flex; align-items: center; justify-content: flex-end; width: 100%;
  margin: 0 0 6px; padding: 0; border: 0; background: none;
  font: inherit; font-size: 12px; font-weight: 600; color: #9d2740; cursor: pointer;
}
.trial-sheet__scroll-hint[hidden] { display: none; }
.trial-sheet.is-compact .trial-sheet__table td { padding: 4px 4px; }
.trial-sheet.is-compact .trial-sheet__table th { padding-left: 4px; padding-right: 4px; font-size: 11px; }
.trial-sheet.is-compact .trial-head-sub th { font-size: 10px; letter-spacing: 0; }
.trial-sheet.is-compact .trial-sheet__table input[type="text"],
.trial-sheet.is-compact .trial-sheet__table input[type="tel"],
.trial-sheet.is-compact .trial-sheet__table input[type="date"],
.trial-sheet.is-compact .trial-sheet__table input[type="time"],
.trial-sheet.is-compact .trial-sheet__table select { font-size: 13px; padding-left: 6px; padding-right: 4px; }
.trial-sheet.is-compact .trial-sheet__table td:has(input[type="date"]),
.trial-sheet.is-compact .trial-sheet__table td:has(input[type="time"]) { min-width: 0; }
.trial-sheet.is-compact .trial-sheet__table td.trial-fio,
.trial-sheet.is-compact .trial-sheet__table th.trial-col-fio { left: 44px; }

.sidebar-nav[data-menu-scope] [data-menu-key] {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

.sidebar-nav.is-menu-dragging {
    cursor: grabbing;
}

.sidebar-nav.is-menu-dragging [data-menu-key] {
    transition: transform .15s ease;
}

.sidebar-nav [data-menu-key].is-menu-lifted {
    position: relative;
    z-index: 5;
    transform: scale(1.03);
    background: var(--surface, #fff);
    border-radius: 12px;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.18), 0 0 0 2px rgba(22, 119, 255, 0.35);
}
