/* BizFlow CRM — crm.css
   Використовує CSS vars з style.css
   Всі класи з префіксом crm-
*/

/* ========== RESET / BASE ========== */
*, *::before, *::after { box-sizing: border-box; }

body.crm-auth-body {
    min-height: 100vh;
    background: #f3f4f6;
    font-family: 'Inter', sans-serif;
}

/* ========== AUTH ========== */
.crm-auth {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
}

.crm-auth__container {
    background: #fff;
    border-radius: 16px;
    padding: 40px 36px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 4px 24px rgba(0,0,0,.08);
}

.crm-auth__container--wide {
    max-width: 500px;
}

.crm-auth__logo {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    margin-bottom: 28px;
}

.crm-auth__title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #111827;
    margin: 0 0 6px;
}

.crm-auth__subtitle {
    font-size: .875rem;
    color: #6b7280;
    margin: 0 0 24px;
}

.crm-auth__error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: .875rem;
    margin-bottom: 16px;
}

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

.crm-auth__field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.crm-auth__field label {
    font-size: .8125rem;
    font-weight: 600;
    color: #374151;
}

.crm-auth__field input,
.crm-auth__field select {
    padding: 10px 14px;
    border: 1.5px solid #e5e7eb;
    border-radius: 8px;
    font-size: .9375rem;
    font-family: 'Inter', sans-serif;
    color: #111827;
    outline: none;
    transition: border-color .15s;
    background: #fff;
}

.crm-auth__field input:focus,
.crm-auth__field select:focus {
    border-color: #818cf8;
    box-shadow: 0 0 0 3px rgba(129,140,248,.15);
}

.crm-auth__btn {
    padding: 12px 20px;
    background: #818cf8;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: .9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s, transform .1s;
    margin-top: 4px;
}

.crm-auth__btn:hover  { background: #6366f1; }
.crm-auth__btn:active { transform: scale(.98); }

.crm-auth__footer {
    text-align: center;
    font-size: .875rem;
    color: #6b7280;
    margin: 12px 0 0;
}

.crm-auth__footer a {
    color: #818cf8;
    text-decoration: none;
    font-weight: 500;
}

.crm-auth__terms {
    font-size: .75rem;
    color: #9ca3af;
    text-align: center;
    margin: 0;
}

.crm-auth__terms a {
    color: #6b7280;
}

/* ========== TRIAL BANNER ========== */
.crm-trial-banner {
    background: linear-gradient(90deg, #818cf8, #a78bfa);
    color: #fff;
    text-align: center;
    padding: 8px 16px;
    font-size: .8125rem;
    font-weight: 500;
    position: sticky;
    top: 0;
    z-index: 100;
}

.crm-trial-banner a {
    color: #fff;
    text-decoration: underline;
    margin-left: 12px;
    font-weight: 600;
}

.crm-trial-banner--urgent {
    background: linear-gradient(90deg, #f59e0b, #ef4444);
}

.crm-trial-banner--expired {
    background: #374151;
}

/* ========== SHELL LAYOUT ========== */
.crm-shell {
    display: flex;
    height: calc(100vh - 37px);
    font-family: 'Inter', sans-serif;
    background: #f9fafb;
}

/* ========== SIDEBAR ========== */
.crm-sidebar {
    width: 200px;
    min-width: 200px;
    background: #1e1b4b;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow-y: auto;
}

.crm-sidebar__logo {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 20px 16px 16px;
    color: #e0e7ff;
    font-size: .8125rem;
    font-weight: 600;
    border-bottom: 1px solid rgba(255,255,255,.08);
    min-height: 60px;
    word-break: break-word;
}

/* ========== NAV ========== */
.crm-nav {
    display: flex;
    flex-direction: column;
    padding: 12px 8px;
    flex: 1;
    gap: 2px;
}

.crm-nav__item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 8px;
    color: #a5b4fc;
    text-decoration: none;
    font-size: .8125rem;
    font-weight: 500;
    transition: background .15s, color .15s;
}

.crm-nav__item:hover {
    background: rgba(165,180,252,.12);
    color: #c7d2fe;
}

.crm-nav__item.is-active {
    background: rgba(129,140,248,.25);
    color: #fff;
}

.crm-nav__item svg {
    flex-shrink: 0;
    opacity: .8;
}

/* ========== SIDEBAR USER ========== */
.crm-sidebar__user {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 12px 16px;
    border-top: 1px solid rgba(255,255,255,.08);
}

.crm-user-avatar {
    width: 30px;
    height: 30px;
    min-width: 30px;
    border-radius: 50%;
    background: #818cf8;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .75rem;
    font-weight: 700;
}

.crm-user-info {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    flex: 1;
}

.crm-user-name {
    font-size: .75rem;
    font-weight: 600;
    color: #e0e7ff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.crm-user-role {
    font-size: .6875rem;
    color: #818cf8;
}

.crm-user-logout {
    color: #6b7280;
    text-decoration: none;
    padding: 4px;
    border-radius: 4px;
    transition: color .15s;
    display: flex;
    align-items: center;
}

.crm-user-logout:hover { color: #f87171; }

/* ========== MAIN AREA ========== */
.crm-main {
    flex: 1;
    overflow-y: auto;
    padding: 24px 28px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.crm-page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.crm-page-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #111827;
    margin: 0 0 4px;
}

.crm-page-date {
    font-size: .8125rem;
    color: #9ca3af;
}

/* ========== BUTTONS ========== */
.crm-btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    background: #818cf8;
    color: #fff;
    border-radius: 8px;
    font-size: .875rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    border: none;
    transition: background .15s;
    white-space: nowrap;
}

.crm-btn-primary:hover { background: #6366f1; }

.crm-btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    background: #f3f4f6;
    color: #374151;
    border-radius: 8px;
    font-size: .875rem;
    font-weight: 500;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: background .15s;
}

.crm-btn-secondary:hover { background: #e5e7eb; }

/* ========== KPIs ========== */
.crm-kpis {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.crm-kpi {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    border: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.crm-kpi--green { border-top: 3px solid #10b981; }
.crm-kpi--blue  { border-top: 3px solid #818cf8; }

.crm-kpi__val {
    font-size: 1.625rem;
    font-weight: 800;
    color: #111827;
    line-height: 1;
}

.crm-kpi__label {
    font-size: .75rem;
    color: #6b7280;
    font-weight: 500;
}

/* ========== GRID ========== */
.crm-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

/* ========== WIDGET ========== */
.crm-widget {
    background: #fff;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

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

.crm-widget__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 4px;
    border-bottom: 1px solid #f3f4f6;
}

.crm-widget__title {
    font-size: .875rem;
    font-weight: 600;
    color: #374151;
}

.crm-widget__link {
    font-size: .8125rem;
    color: #818cf8;
    text-decoration: none;
    font-weight: 500;
}

/* ========== MASTER ROW ========== */
.crm-master-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.crm-master-avatar {
    width: 32px;
    height: 32px;
    min-width: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .8125rem;
    font-weight: 700;
    color: #fff;
}

.crm-master-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: .8125rem;
    font-weight: 500;
    color: #374151;
}

.crm-master-bar {
    height: 4px;
    background: #f3f4f6;
    border-radius: 2px;
    overflow: hidden;
}

.crm-master-bar > div {
    height: 100%;
    border-radius: 2px;
    transition: width .3s;
}

.crm-master-rev {
    font-size: .8125rem;
    font-weight: 600;
    color: #111827;
    white-space: nowrap;
}

.crm-master-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 4px;
    vertical-align: middle;
}

/* ========== TABLE ========== */
.crm-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .8125rem;
}

.crm-table th {
    text-align: left;
    padding: 8px 10px;
    font-size: .75rem;
    font-weight: 600;
    color: #9ca3af;
    border-bottom: 1px solid #f3f4f6;
    white-space: nowrap;
}

.crm-table td {
    padding: 10px 10px;
    color: #374151;
    border-bottom: 1px solid #f9fafb;
    vertical-align: middle;
}

.crm-table tr:last-child td { border-bottom: none; }
.crm-table tr:hover td { background: #fafafa; }

/* ========== BADGES ========== */
.crm-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 99px;
    font-size: .6875rem;
    font-weight: 600;
    white-space: nowrap;
}

.crm-badge--gray   { background: #f3f4f6; color: #6b7280; }
.crm-badge--blue   { background: #eff6ff; color: #3b82f6; }
.crm-badge--green  { background: #ecfdf5; color: #10b981; }
.crm-badge--red    { background: #fef2f2; color: #ef4444; }
.crm-badge--accent { background: #ede9fe; color: #7c3aed; }

/* ========== EMPTY STATE ========== */
.crm-empty {
    color: #9ca3af;
    font-size: .875rem;
    text-align: center;
    padding: 20px 0;
    margin: 0;
}

.crm-empty a {
    color: #818cf8;
    text-decoration: none;
    font-weight: 500;
}

/* ========== MOBILE ========== */
@media (max-width: 768px) {
    .crm-shell {
        flex-direction: column;
        height: auto;
        min-height: calc(100vh - 37px);
    }

    .crm-sidebar {
        width: 100%;
        height: auto;
        flex-direction: row;
        flex-wrap: wrap;
        padding: 8px;
    }

    .crm-sidebar__logo {
        width: 100%;
        border-bottom: none;
        padding: 8px 8px 4px;
    }

    .crm-nav {
        flex-direction: row;
        flex-wrap: wrap;
        padding: 4px;
        width: 100%;
    }

    .crm-nav__item span { display: none; }
    .crm-nav__item { padding: 8px; }

    .crm-sidebar__user {
        padding: 8px;
        border-top: none;
        border-left: 1px solid rgba(255,255,255,.08);
        margin-left: auto;
    }

    .crm-user-info { display: none; }

    .crm-main {
        padding: 16px;
    }

    .crm-kpis {
        grid-template-columns: repeat(2, 1fr);
    }

    .crm-grid-2 {
        grid-template-columns: 1fr;
    }

    .crm-page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .crm-auth__container {
        padding: 28px 20px;
    }
}

@media (max-width: 480px) {
    .crm-kpis { grid-template-columns: 1fr 1fr; }
    .crm-kpi__val { font-size: 1.25rem; }
}

/* ========== FLASH ========== */
.crm-flash {
    padding: 10px 16px;
    border-radius: 8px;
    font-size: .8125rem;
    font-weight: 500;
}

.crm-flash--success {
    background: #ecfdf5;
    color: #10b981;
    border: 1px solid #d1fae5;
}

.crm-flash--error {
    background: #fef2f2;
    color: #ef4444;
    border: 1px solid #fecaca;
}

/* ========== HELPERS ========== */
.crm-text-muted {
    color: #9ca3af;
    font-size: .75rem;
}

.crm-link {
    color: #818cf8;
    text-decoration: none;
    font-weight: 600;
}

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

.crm-widget--narrow {
    max-width: 560px;
}

.crm-widget--table {
    padding: 0;
    overflow-x: auto;
}

.crm-widget--table .crm-table {
    min-width: 640px;
}

.crm-widget--table .crm-table th:first-child,
.crm-widget--table .crm-table td:first-child {
    padding-left: 20px;
}

.crm-widget--table .crm-table th:last-child,
.crm-widget--table .crm-table td:last-child {
    padding-right: 20px;
}

.crm-widget--table .crm-table thead tr,
.crm-widget--table .crm-table tbody tr {
    display: table-row;
}

.crm-widget--table .crm-table {
    border-spacing: 0;
}

.crm-widget--table .crm-table th,
.crm-widget--table .crm-table td {
    padding-top: 12px;
    padding-bottom: 12px;
}

/* ========== ICON BUTTON ========== */
.crm-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: .9375rem;
    text-decoration: none;
    transition: background .15s;
}

.crm-icon-btn:hover { background: #f3f4f6; }

/* ========== SMALL / DANGER BUTTONS ========== */
.crm-btn-sm {
    padding: 6px 12px;
    font-size: .8125rem;
}

.crm-btn-danger {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    background: #fef2f2;
    color: #ef4444;
    border-radius: 8px;
    font-size: .875rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: background .15s, color .15s;
}

.crm-btn-danger:hover { background: #ef4444; color: #fff; }

/* ========== FILTERS ========== */
.crm-filters {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.crm-filters__tabs {
    display: flex;
    gap: 4px;
    background: #f3f4f6;
    border-radius: 8px;
    padding: 3px;
}

.crm-filters__tab {
    padding: 7px 14px;
    border-radius: 6px;
    font-size: .8125rem;
    font-weight: 500;
    color: #6b7280;
    text-decoration: none;
    transition: background .15s, color .15s;
}

.crm-filters__tab:hover { color: #374151; }

.crm-filters__tab.is-active {
    background: #fff;
    color: #111827;
    box-shadow: 0 1px 2px rgba(0,0,0,.06);
}

.crm-filters__select,
.crm-filters__search {
    padding: 9px 14px;
    border: 1.5px solid #e5e7eb;
    border-radius: 8px;
    font-size: .8125rem;
    font-family: 'Inter', sans-serif;
    color: #111827;
    background: #fff;
    outline: none;
}

.crm-filters__select:focus,
.crm-filters__search:focus {
    border-color: #818cf8;
}

.crm-filters__search {
    flex: 1;
    min-width: 180px;
}

/* ========== FORMS ========== */
.crm-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.crm-form__error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: .8125rem;
}

.crm-form__row {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.crm-form__row--inline {
    flex-direction: row;
    align-items: center;
}

.crm-form__row label {
    font-size: .8125rem;
    font-weight: 600;
    color: #374151;
}

.crm-form__row input,
.crm-form__row select,
.crm-form__row textarea {
    padding: 10px 14px;
    border: 1.5px solid #e5e7eb;
    border-radius: 8px;
    font-size: .875rem;
    font-family: 'Inter', sans-serif;
    color: #111827;
    background: #fff;
    outline: none;
    transition: border-color .15s;
}

.crm-form__row input:focus,
.crm-form__row select:focus,
.crm-form__row textarea:focus {
    border-color: #818cf8;
    box-shadow: 0 0 0 3px rgba(129,140,248,.15);
}

.crm-form__row textarea {
    resize: vertical;
    font-family: 'Inter', sans-serif;
}

.crm-form__grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.crm-form__actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 4px;
}

.crm-form--inline-add {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #f3f4f6;
}

.crm-form--inline-add input {
    padding: 8px 12px;
    border: 1.5px solid #e5e7eb;
    border-radius: 8px;
    font-size: .8125rem;
    font-family: 'Inter', sans-serif;
    outline: none;
}

.crm-form--inline-add input[name="name"] { flex: 2; min-width: 140px; }
.crm-form--inline-add input[name="category"] { flex: 1; min-width: 100px; }
.crm-form--inline-add input[name="duration_min"],
.crm-form--inline-add input[name="price"] { width: 90px; }

/* ========== CHECKBOX ========== */
.crm-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: .8125rem;
    font-weight: 500;
    color: #374151;
    cursor: pointer;
}

.crm-checkbox input { width: 16px; height: 16px; }

/* ========== CLIENT SEARCH ========== */
.crm-client-search {
    position: relative;
}

.crm-search-results {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,.08);
    z-index: 20;
    max-height: 220px;
    overflow-y: auto;
}

.crm-search-results__item {
    padding: 10px 14px;
    font-size: .8125rem;
    color: #374151;
    cursor: pointer;
    border-bottom: 1px solid #f9fafb;
}

.crm-search-results__item:last-child { border-bottom: none; }
.crm-search-results__item:hover { background: #f9fafb; }

.crm-inline-panel {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.crm-inline-panel[hidden] {
    display: none;
}

.crm-inline-panel input {
    padding: 9px 14px;
    border: 1.5px solid #e5e7eb;
    border-radius: 8px;
    font-size: .8125rem;
    font-family: 'Inter', sans-serif;
    outline: none;
    flex: 1;
    min-width: 140px;
}

/* ========== MASTER CARDS (форма вибору) ========== */
.crm-master-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
}

.crm-master-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 6px;
    padding: 14px 10px;
    border: 1.5px solid #e5e7eb;
    border-radius: 10px;
    cursor: pointer;
    transition: border-color .15s, background .15s;
}

.crm-master-card input { position: absolute; opacity: 0; pointer-events: none; }

.crm-master-card:hover { border-color: #c7d2fe; }

.crm-master-card.is-selected {
    border-color: #818cf8;
    background: #f5f3ff;
}

.crm-master-card__avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .875rem;
    font-weight: 700;
    color: #fff;
}

.crm-master-card__name {
    font-size: .8125rem;
    font-weight: 600;
    color: #111827;
}

.crm-master-card__spec {
    font-size: .6875rem;
    color: #9ca3af;
}

/* ========== COLOR PRESETS ========== */
.crm-color-presets {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.crm-color-swatch {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color .15s, transform .1s;
}

.crm-color-swatch input { position: absolute; opacity: 0; pointer-events: none; }

.crm-color-swatch:has(input:checked) {
    border-color: #111827;
    transform: scale(1.1);
}

/* ========== STATUS BUTTONS / SELECT ========== */
.crm-status-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.crm-status-btn {
    padding: 8px 14px;
    border-radius: 8px;
    border: 1.5px solid #e5e7eb;
    background: #fff;
    color: #6b7280;
    font-size: .8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: border-color .15s, color .15s, background .15s;
}

.crm-status-btn:hover { border-color: #c7d2fe; }

.crm-status-btn.is-active {
    background: #818cf8;
    border-color: #818cf8;
    color: #fff;
}

.crm-status-select {
    padding: 6px 10px;
    border: none;
    border-radius: 99px;
    font-size: .75rem;
    font-weight: 600;
    cursor: pointer;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    text-align: center;
}

.crm-status-select.crm-badge--gray   { background: #f3f4f6; color: #6b7280; }
.crm-status-select.crm-badge--blue   { background: #eff6ff; color: #3b82f6; }
.crm-status-select.crm-badge--green  { background: #ecfdf5; color: #10b981; }
.crm-status-select.crm-badge--red    { background: #fef2f2; color: #ef4444; }
.crm-status-select.crm-badge--accent { background: #ede9fe; color: #7c3aed; }

/* ========== INLINE SERVICE EDIT ========== */
.crm-edit-input {
    width: 100%;
    padding: 6px 8px;
    border: 1.5px solid #818cf8;
    border-radius: 6px;
    font-size: .8125rem;
    font-family: 'Inter', sans-serif;
    outline: none;
}

.crm-edit-duration,
.crm-edit-price {
    width: 80px;
}

/* ========== PAGINATION ========== */
.crm-pagination {
    display: flex;
    gap: 6px;
    justify-content: center;
    padding-top: 8px;
}

.crm-pagination__item {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: #f3f4f6;
    color: #374151;
    text-decoration: none;
    font-size: .8125rem;
    font-weight: 500;
    transition: background .15s, color .15s;
}

.crm-pagination__item:hover { background: #e5e7eb; }

.crm-pagination__item.is-active {
    background: #818cf8;
    color: #fff;
}

/* ========== INFO GRID ========== */
.crm-info-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    font-size: .8125rem;
    color: #111827;
}

.crm-info-notes {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid #f3f4f6;
}

.crm-info-notes p {
    margin: 6px 0 0;
    font-size: .8125rem;
    color: #374151;
    line-height: 1.5;
}

/* ========== MASTERS GRID ========== */
.crm-master-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}

.crm-master-card-big {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 8px;
}

.crm-master-card-big.is-inactive { opacity: .55; }

.crm-master-card-big__avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.125rem;
    font-weight: 700;
    color: #fff;
}

.crm-master-card-big__name {
    font-size: .9375rem;
    font-weight: 700;
    color: #111827;
}

.crm-master-card-big__spec {
    font-size: .75rem;
    color: #9ca3af;
}

.crm-master-card-big__stats {
    display: flex;
    gap: 20px;
    margin: 6px 0;
}

.crm-master-card-big__stats > div {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.crm-master-card-big__val {
    font-size: 1.0625rem;
    font-weight: 800;
    color: #111827;
}

.crm-master-card-big__actions {
    display: flex;
    gap: 8px;
    margin-top: 4px;
}

/* ========== ANALYTICS CHART ========== */
.crm-chart-wrap {
    width: 100%;
    overflow-x: auto;
}

.crm-bar-chart {
    width: 100%;
    height: auto;
    display: block;
}

/* ========== MOBILE: NEW COMPONENTS ========== */
@media (max-width: 768px) {
    .crm-form__grid {
        grid-template-columns: 1fr;
    }

    .crm-master-cards {
        grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    }

    .crm-info-grid {
        grid-template-columns: 1fr 1fr;
    }

    .crm-master-grid {
        grid-template-columns: 1fr;
    }

    .crm-filters {
        flex-direction: column;
        align-items: stretch;
    }

    .crm-filters__tabs {
        overflow-x: auto;
    }

    .crm-form--inline-add {
        flex-direction: column;
        align-items: stretch;
    }

    .crm-form--inline-add input { width: 100% !important; }

    .crm-page-header .crm-btn-secondary,
    .crm-page-header .crm-btn-primary {
        align-self: flex-start;
    }
}

/* ========== ОНЛАЙН-ЗАПИС (/book/{slug}/) ========== */
.crm-book-body {
    background: #f3f4f6;
    min-height: 100vh;
}

.crm-book {
    max-width: 640px;
    margin: 0 auto;
    padding: 24px 16px 60px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.crm-book__header {
    padding: 8px 0 4px;
}

.crm-book__brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.crm-book__logo {
    background: #818cf8;
    color: #fff;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.125rem;
    flex-shrink: 0;
}

.crm-book__title {
    font-size: 1.25rem;
    font-weight: 800;
    color: #111827;
    margin: 0;
}

.crm-book__meta {
    font-size: .8125rem;
    color: #6b7280;
    margin: 2px 0 0;
}

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

.crm-book__step {
    flex: 1;
    text-align: center;
    padding: 10px 6px;
    border-radius: 8px;
    background: #fff;
    border: 1.5px solid #e5e7eb;
    font-size: .75rem;
    font-weight: 600;
    color: #9ca3af;
}

.crm-book__step span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #e5e7eb;
    color: #6b7280;
    font-size: .6875rem;
    margin-right: 4px;
}

.crm-book__step.is-active {
    border-color: #818cf8;
    color: #4f46e5;
}

.crm-book__step.is-active span {
    background: #818cf8;
    color: #fff;
}

.crm-book__step.is-done {
    color: #10b981;
}

.crm-book__step.is-done span {
    background: #10b981;
    color: #fff;
}

.crm-book__panel {
    background: #fff;
    border-radius: 14px;
    border: 1px solid #e5e7eb;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.crm-book__panel-title {
    font-size: 1.0625rem;
    font-weight: 700;
    color: #111827;
    margin: 0;
}

.crm-book__back {
    align-self: flex-start;
    background: none;
    border: none;
    color: #6366f1;
    font-size: .8125rem;
    font-weight: 600;
    cursor: pointer;
    padding: 0;
}

.crm-book__category h3 {
    font-size: .875rem;
    font-weight: 700;
    color: #374151;
    margin: 0 0 8px;
}

.crm-book__service-grid,
.crm-book__master-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.crm-book__service-card {
    display: flex;
    flex-direction: column;
    gap: 4px;
    text-align: left;
    padding: 12px 14px;
    border: 1.5px solid #e5e7eb;
    border-radius: 10px;
    background: #fff;
    cursor: pointer;
    transition: border-color .15s, background .15s;
    font-family: 'Inter', sans-serif;
}

.crm-book__service-card:hover { border-color: #c7d2fe; }

.crm-book__service-card.is-selected {
    border-color: #818cf8;
    background: #f5f3ff;
}

.crm-book__service-name {
    font-size: .875rem;
    font-weight: 600;
    color: #111827;
}

.crm-book__service-meta {
    font-size: .75rem;
    color: #9ca3af;
}

.crm-book__master-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 6px;
    padding: 14px 10px;
    border: 1.5px solid #e5e7eb;
    border-radius: 10px;
    background: #fff;
    cursor: pointer;
    transition: border-color .15s, background .15s;
    font-family: 'Inter', sans-serif;
}

.crm-book__master-card:hover { border-color: #c7d2fe; }

.crm-book__master-card.is-selected {
    border-color: #818cf8;
    background: #f5f3ff;
}

.crm-book__master-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
}

.crm-book__master-name {
    font-size: .8125rem;
    font-weight: 600;
    color: #111827;
}

.crm-book__master-spec {
    font-size: .6875rem;
    color: #9ca3af;
}

.crm-book__days {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
}

.crm-book__day {
    flex: 0 0 auto;
    padding: 8px 12px;
    border-radius: 8px;
    border: 1.5px solid #e5e7eb;
    background: #fff;
    font-size: .75rem;
    font-weight: 600;
    color: #374151;
    cursor: pointer;
    white-space: nowrap;
}

.crm-book__day.is-active {
    border-color: #818cf8;
    background: #f5f3ff;
    color: #4f46e5;
}

.crm-book__day.is-empty {
    color: #d1d5db;
    cursor: not-allowed;
}

.crm-book__slots {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.crm-book__slot {
    padding: 10px 6px;
    border-radius: 8px;
    border: 1.5px solid #e5e7eb;
    background: #fff;
    font-size: .8125rem;
    font-weight: 600;
    color: #374151;
    cursor: pointer;
    transition: border-color .15s, background .15s;
}

.crm-book__slot:hover {
    border-color: #818cf8;
    background: #f5f3ff;
}

.crm-book__summary {
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: #f9fafb;
    border-radius: 10px;
    padding: 14px 16px;
}

.crm-book__summary-row {
    display: flex;
    justify-content: space-between;
    font-size: .875rem;
    color: #6b7280;
}

.crm-book__summary-row strong {
    color: #111827;
}

.crm-book__hp {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.crm-book__disabled {
    text-align: center;
    padding: 30px 10px;
    color: #6b7280;
}

.crm-book__disabled h2 {
    font-size: 1.125rem;
    color: #111827;
    margin: 0 0 8px;
}

.crm-book__success {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    padding: 10px;
}

.crm-book__success-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #d1fae5;
    color: #10b981;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    font-weight: 800;
}

.crm-book__success h2 {
    font-size: 1.25rem;
    color: #111827;
    margin: 0;
}

.crm-book__success-sub {
    font-size: .875rem;
    color: #6b7280;
    margin: -8px 0 0;
}

.crm-book__success .crm-book__summary {
    width: 100%;
}

.crm-book__footer {
    text-align: center;
    font-size: .75rem;
    color: #9ca3af;
}

.crm-book__footer a {
    color: #6366f1;
    font-weight: 600;
    text-decoration: none;
}

@media (max-width: 480px) {
    .crm-book__service-grid,
    .crm-book__master-grid {
        grid-template-columns: 1fr 1fr;
    }

    .crm-book__slots {
        grid-template-columns: repeat(3, 1fr);
    }
}
