.cvc-dsm-wrapper {
    direction: rtl;
    font-family: inherit;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
    padding: 28px;
}

.cvc-dsm-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.cvc-dsm-header-text h3 {
    margin: 0 0 6px;
    font-size: 22px;
    color: #1a1a2e;
}

.cvc-dsm-header-text p {
    margin: 0;
    color: #666;
    font-size: 14px;
    line-height: 1.6;
}

.cvc-dsm-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 10px;
    border: 1px solid transparent;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.cvc-dsm-btn-primary {
    background: var(--e-global-color-primary, #4054b2);
    color: #fff;
    border-color: transparent;
}

.cvc-dsm-btn-primary:hover {
    filter: brightness(1.08);
    transform: translateY(-1px);
}

.cvc-dsm-btn-ghost {
    background: #f5f6fa;
    color: #444;
    border-color: #e0e0e0;
}

.cvc-dsm-btn-ghost:hover {
    background: #eef0f5;
}

.cvc-dsm-btn-danger {
    background: #fff5f5;
    color: #c0392b;
    border-color: #f5c6cb;
}

.cvc-dsm-btn-danger:hover {
    background: #fdecea;
}

.cvc-dsm-btn-sm {
    padding: 7px 12px;
    font-size: 13px;
}

.cvc-dsm-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 14px;
    margin-bottom: 22px;
}

.cvc-dsm-doctor-filter-wrap {
    min-width: 220px;
}

.cvc-dsm-doctor-filter-wrap .cvc-dsm-label {
    margin-bottom: 6px;
}

.cvc-dsm-doctor-filter {
    min-width: 200px;
}

.cvc-dsm-search-wrap {
    flex: 1;
    min-width: 200px;
    position: relative;
}

.cvc-dsm-search-wrap i {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    font-size: 16px;
    pointer-events: none;
}

.cvc-dsm-search {
    width: 100%;
    padding: 11px 42px 11px 14px;
    border: 1px solid #e4e6ef;
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s;
}

.cvc-dsm-search:focus {
    outline: none;
    border-color: var(--e-global-color-primary, #4054b2);
    box-shadow: 0 0 0 3px rgba(64, 84, 178, 0.12);
}

.cvc-dsm-filter-tabs {
    display: flex;
    gap: 6px;
    background: #f5f6fa;
    padding: 4px;
    border-radius: 10px;
}

.cvc-dsm-filter {
    border: none;
    background: transparent;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    color: #666;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
}

.cvc-dsm-filter.is-active {
    background: #fff;
    color: var(--e-global-color-primary, #4054b2);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.cvc-dsm-loading {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 48px;
    color: #666;
}

.cvc-dsm-loading.is-active {
    display: flex;
}

.cvc-dsm-grid.is-hidden {
    display: none;
}

.cvc-dsm-empty {
    display: none;
}

.cvc-dsm-empty.is-visible {
    display: block;
}

.cvc-dsm-spinner {
    width: 28px;
    height: 28px;
    border: 3px solid #e8eaf0;
    border-top-color: var(--e-global-color-primary, #4054b2);
    border-radius: 50%;
    animation: cvc-dsm-spin 0.7s linear infinite;
}

@keyframes cvc-dsm-spin {
    to { transform: rotate(360deg); }
}

.cvc-dsm-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 18px;
}

.cvc-dsm-card {
    background: #fafbfc;
    border: 1px solid #e8eaf0;
    border-radius: 14px;
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: box-shadow 0.2s, border-color 0.2s;
}

.cvc-dsm-card:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.07);
    border-color: #d8dce8;
}

.cvc-dsm-card.is-inactive {
    opacity: 0.72;
    background: #f4f4f6;
}

.cvc-dsm-card-top {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.cvc-dsm-card-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.cvc-dsm-card-title-wrap {
    flex: 1;
    min-width: 0;
}

.cvc-dsm-card-title {
    margin: 0 0 4px;
    font-size: 16px;
    font-weight: 700;
    color: #222;
    line-height: 1.4;
}

.cvc-dsm-card-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.cvc-dsm-badge {
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 6px;
}

.cvc-dsm-badge-type {
    background: #e8f0fe;
    color: #1a56db;
}

.cvc-dsm-badge-cat {
    background: #f3e8ff;
    color: #6b21a8;
}

.cvc-dsm-badge-active {
    background: #e6f7ed;
    color: #1e7e34;
}

.cvc-dsm-badge-inactive {
    background: #fff3cd;
    color: #856404;
}

.cvc-dsm-card-meta {
    font-size: 13px;
    color: #555;
    line-height: 1.7;
}

.cvc-dsm-card-meta strong {
    color: #333;
}

.cvc-dsm-card-prices {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: baseline;
}

.cvc-dsm-price-main {
    font-size: 17px;
    font-weight: 700;
    color: #1a1a2e;
}

.cvc-dsm-price-sale {
    font-size: 14px;
    color: #27ae60;
    font-weight: 600;
}

.cvc-dsm-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: auto;
    padding-top: 8px;
    border-top: 1px solid #e8eaf0;
}

.cvc-dsm-toggle-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-right: auto;
    font-size: 12px;
    color: #666;
}

.cvc-dsm-toggle {
    position: relative;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

.cvc-dsm-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.cvc-dsm-toggle-slider {
    position: absolute;
    inset: 0;
    background: #ccc;
    border-radius: 24px;
    cursor: pointer;
    transition: 0.25s;
}

.cvc-dsm-toggle-slider::before {
    content: '';
    position: absolute;
    height: 18px;
    width: 18px;
    right: 3px;
    bottom: 3px;
    background: #fff;
    border-radius: 50%;
    transition: 0.25s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.cvc-dsm-toggle input:checked + .cvc-dsm-toggle-slider::before {
    transform: translateX(-20px);
}

.cvc-dsm-empty.is-visible {
    text-align: center;
    padding: 56px 24px;
    color: #888;
}

.cvc-dsm-empty.is-visible i {
    font-size: 48px;
    color: #ccc;
    margin-bottom: 12px;
    display: block;
}

body.cvc-dsm-modal-open {
    overflow: hidden;
}

/* Modal */
.cvc-dsm-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
    backdrop-filter: blur(3px);
}

.cvc-dsm-modal-overlay.is-open {
    opacity: 1;
    visibility: visible;
}

.cvc-dsm-modal {
    width: 100%;
    max-width: 620px;
    max-height: min(92vh, 860px);
    background: #f4f6fb;
    border-radius: 16px;
    box-shadow: 0 24px 48px rgba(15, 23, 42, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(16px) scale(0.98);
    transition: transform 0.28s ease;
}

.cvc-dsm-modal-overlay.is-open .cvc-dsm-modal {
    transform: translateY(0) scale(1);
}

.cvc-dsm-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 22px;
    background: linear-gradient(135deg, var(--e-global-color-primary, #4054b2) 0%, #5a6fd6 100%);
    color: #fff;
    flex-shrink: 0;
}

.cvc-dsm-modal-header-text {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.cvc-dsm-modal-header-text i {
    font-size: 22px;
    opacity: 0.9;
}

.cvc-dsm-modal-title {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: #fff;
}

.cvc-dsm-modal-close {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    transition: background 0.2s;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.cvc-dsm-modal-close:hover {
    background: rgba(255, 255, 255, 0.28);
}

.cvc-dsm-modal-form {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.cvc-dsm-modal-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 16px 18px 8px;
    -webkit-overflow-scrolling: touch;
}

.cvc-dsm-modal-panel {
    background: #fff;
    border: 1px solid #e8ecf4;
    border-radius: 12px;
    padding: 16px 18px;
    margin-bottom: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.cvc-dsm-panel-title {
    margin: 0 0 14px;
    font-size: 14px;
    font-weight: 700;
    color: var(--e-global-color-primary, #4054b2);
    padding-bottom: 10px;
    border-bottom: 1px solid #eef1f7;
}

.cvc-dsm-panel-hint {
    margin: -8px 0 12px;
}

.cvc-dsm-form-section {
    margin-bottom: 14px;
}

.cvc-dsm-form-section:last-child {
    margin-bottom: 0;
}

.cvc-dsm-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.cvc-dsm-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #444;
    margin-bottom: 6px;
}

.cvc-dsm-label .required {
    color: #e74c3c;
}

.cvc-dsm-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e0e3eb;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    box-sizing: border-box;
}

.cvc-dsm-input:focus {
    outline: none;
    border-color: var(--e-global-color-primary, #4054b2);
}

.cvc-dsm-textarea {
    resize: vertical;
    min-height: 88px;
}

.cvc-dsm-hint {
    margin: 4px 0 0;
    font-size: 12px;
    color: #888;
}

.cvc-dsm-switch-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.cvc-dsm-switch-card {
    display: block;
    cursor: pointer;
    margin: 0;
}

.cvc-dsm-switch-card input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.cvc-dsm-switch-card-body {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px 14px;
    border: 2px solid #e8ecf4;
    border-radius: 10px;
    background: #fafbfc;
    transition: border-color 0.2s, background 0.2s;
}

.cvc-dsm-switch-card input:checked + .cvc-dsm-switch-card-body {
    border-color: var(--e-global-color-primary, #4054b2);
    background: color-mix(in srgb, var(--e-global-color-primary, #4054b2) 6%, #fff);
}

.cvc-dsm-switch-card-body strong {
    font-size: 13px;
    color: #222;
}

.cvc-dsm-switch-card-body small {
    font-size: 11px;
    color: #777;
    line-height: 1.4;
}

.cvc-dsm-days-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cvc-dsm-day-row {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 12px;
    align-items: center;
    padding: 12px 14px;
    background: #f8f9fc;
    border: 1px solid #e8eaf0;
    border-radius: 10px;
    transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}

.cvc-dsm-day-row.is-active {
    background: #fff;
    border-color: color-mix(in srgb, var(--e-global-color-primary, #4054b2) 35%, #e8eaf0);
    box-shadow: 0 2px 8px rgba(64, 84, 178, 0.08);
}

.cvc-dsm-day-row.is-disabled .cvc-dsm-day-times {
    opacity: 0.35;
    pointer-events: none;
}

.cvc-dsm-day-name {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    margin: 0;
}

.cvc-dsm-day-name input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--e-global-color-primary, #4054b2);
}

.cvc-dsm-day-times {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.cvc-dsm-time-label {
    font-size: 12px;
    color: #888;
}

.cvc-dsm-day-times input[type="time"] {
    width: 96px;
    padding: 7px 8px;
    border: 1px solid #dde2ec;
    border-radius: 8px;
    font-size: 13px;
    font-family: inherit;
    background: #fff;
}

.cvc-dsm-modal-footer {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    padding: 14px 18px;
    border-top: 1px solid #e0e4ef;
    flex-shrink: 0;
    background: #fff;
}

.cvc-dsm-modal-footer .cvc-dsm-btn-primary {
    min-width: 140px;
}

.cvc-dsm-header-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.cvc-dsm-cat-modal {
    max-width: 720px;
}

.cvc-dsm-cat-form-bar {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 12px;
    align-items: end;
    padding: 16px 18px;
    border-bottom: 1px solid #e8ebf2;
    background: #fafbfe;
}

.cvc-dsm-cat-form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.cvc-dsm-cat-body {
    position: relative;
    min-height: 220px;
    max-height: min(52vh, 480px);
    overflow: auto;
    padding: 14px 18px 18px;
}

.cvc-dsm-cat-loading {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 40px 16px;
    color: #666;
}

.cvc-dsm-cat-loading.is-active {
    display: flex;
}

.cvc-dsm-cat-empty {
    text-align: center;
    padding: 36px 16px;
    color: #777;
}

.cvc-dsm-cat-empty i {
    font-size: 36px;
    color: #c5cbe0;
    margin-bottom: 10px;
    display: block;
}

.cvc-dsm-cat-tree,
.cvc-dsm-cat-tree ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.cvc-dsm-cat-tree-level {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.cvc-dsm-cat-children {
    margin-top: 6px;
    margin-right: 18px;
    padding-right: 12px;
    border-right: 2px solid #e8ebf2;
}

.cvc-dsm-cat-row {
    display: grid;
    grid-template-columns: 28px 1fr auto auto;
    gap: 10px;
    align-items: center;
    padding: 10px 12px;
    border: 1px solid #e8ebf2;
    border-radius: 10px;
    background: #fff;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.cvc-dsm-cat-row.is-editing {
    border-color: var(--e-global-color-primary, #4054b2);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--e-global-color-primary, #4054b2) 15%, transparent);
}

.cvc-dsm-cat-toggle,
.cvc-dsm-cat-toggle-spacer {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.cvc-dsm-cat-toggle {
    border: none;
    background: #f0f2f8;
    border-radius: 8px;
    color: #555;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.cvc-dsm-cat-toggle:not(.is-expanded) {
    transform: rotate(-90deg);
}

.cvc-dsm-cat-name {
    font-weight: 600;
    color: #1a1a2e;
    font-size: 14px;
}

.cvc-dsm-cat-status {
    font-size: 11px;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 999px;
    white-space: nowrap;
}

.cvc-dsm-cat-status--empty,
.cvc-dsm-cat-status--empty_with_children {
    background: #f3f4f6;
    color: #6b7280;
}

.cvc-dsm-cat-status--has_direct_services,
.cvc-dsm-cat-status--has_child_services {
    background: #e8f5e9;
    color: #2e7d32;
}

.cvc-dsm-cat-row-actions {
    display: flex;
    gap: 4px;
}

.cvc-dsm-cat-row-actions button {
    width: 32px;
    height: 32px;
    border: 1px solid #e0e4ef;
    border-radius: 8px;
    background: #fff;
    color: #555;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, color 0.2s ease;
}

.cvc-dsm-cat-row-actions button:hover {
    background: #f5f6fa;
    color: #1a1a2e;
}

.cvc-dsm-cat-delete:hover {
    background: #fff5f5 !important;
    color: #c0392b !important;
    border-color: #f5c6cb !important;
}

.cvc-dsm-cat-form.is-saving .cvc-dsm-btn-primary {
    opacity: 0.7;
    pointer-events: none;
}

.cvc-dsm-modal-form.is-saving .cvc-dsm-btn-primary {
    opacity: 0.7;
    pointer-events: none;
}

@media (max-width: 640px) {
    .cvc-dsm-wrapper {
        padding: 18px;
    }

    .cvc-dsm-modal-overlay {
        padding: 0;
        align-items: flex-end;
    }

    .cvc-dsm-modal {
        max-width: 100%;
        max-height: 94vh;
        border-radius: 16px 16px 0 0;
    }

    .cvc-dsm-form-row {
        grid-template-columns: 1fr;
    }

    .cvc-dsm-switch-cards {
        grid-template-columns: 1fr;
    }

    .cvc-dsm-day-row {
        grid-template-columns: 1fr;
    }

    .cvc-dsm-day-times {
        justify-content: flex-start;
    }

    .cvc-dsm-modal-footer {
        flex-direction: column-reverse;
    }

    .cvc-dsm-modal-footer .cvc-dsm-btn {
        width: 100%;
    }

    .cvc-dsm-cat-form-bar {
        grid-template-columns: 1fr;
    }

    .cvc-dsm-cat-row {
        grid-template-columns: 28px 1fr;
        grid-template-areas:
            "toggle name"
            "toggle status"
            "toggle actions";
    }

    .cvc-dsm-cat-status {
        grid-column: 2;
        justify-self: start;
    }

    .cvc-dsm-cat-row-actions {
        grid-column: 2;
    }
}
