.medflex-schedule {
    --mfs-primary: #19b5ba;
    --mfs-text: inherit;
    --mfs-heading: #111827;
    --mfs-small-heading: #475569;
    --mfs-text-weight: 400;
    --mfs-heading-weight: 500;
    --mfs-small-heading-weight: 500;
    color: var(--mfs-text);
    font: inherit;
    font-weight: var(--mfs-text-weight);
    line-height: 1.5;
    margin-bottom: 70px;
    scroll-margin-top: 104px;
    text-align: left;
}

.medflex-schedule [hidden] {
    display: none !important;
}

.medflex-schedule__shell {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 24px;
    overflow: hidden;
    padding: 28px 25px 25px;
    position: relative;
}

.medflex-schedule__shell::before {
    background: var(--mfs-primary);
    content: '';
    height: 6px;
    inset: 0 0 auto;
    position: absolute;
}

.medflex-schedule__skeleton {
    display: none;
}

.medflex-schedule.is-booting .medflex-schedule__skeleton {
    display: block;
}

.medflex-schedule.is-booting .medflex-schedule__selection,
.medflex-schedule.is-booting .medflex-schedule__form-panel,
.medflex-schedule.is-booting .medflex-schedule__success {
    display: none !important;
}

.medflex-schedule__skeleton-item {
    animation: medflex-schedule-skeleton 1.4s ease-in-out infinite;
    background: linear-gradient(
        90deg,
        color-mix(in srgb, var(--mfs-primary) 7%, white) 25%,
        color-mix(in srgb, var(--mfs-primary) 15%, white) 50%,
        color-mix(in srgb, var(--mfs-primary) 7%, white) 75%
    );
    background-size: 200% 100%;
    border-radius: 10px;
}

.medflex-schedule__skeleton-title {
    height: 31px;
    max-width: 300px;
    width: 42%;
}

.medflex-schedule__skeleton-label {
    height: 14px;
    margin: 28px 0 10px;
    max-width: 150px;
    width: 22%;
}

.medflex-schedule__skeleton-cards {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.medflex-schedule__skeleton-card {
    height: 58px;
}

.medflex-schedule__skeleton-field {
    height: 50px;
    width: 100%;
}

.medflex-schedule__skeleton-button {
    height: 54px;
    margin-top: 36px;
    width: 100%;
}

.medflex-schedule__title,
.medflex-schedule__dialog h2 {
    color: var(--mfs-heading);
    font-weight: var(--mfs-heading-weight);
    letter-spacing: -0.03em;
    line-height: 1.12;
    margin: 0;
}

.medflex-schedule__title {
    font-size: 28px;
}

.medflex-schedule__dialog h2 {
    font-size: 32px;
}

.medflex-schedule__dialog h2 {
    padding-right: 32px;
}

.medflex-schedule__step {
    border-top: 1px solid #e2e8f0;
    margin-top: 20px;
    padding-top: 16px;
}

.medflex-schedule__step-title {
    color: var(--mfs-small-heading);
    display: block;
    font-size: 14px;
    font-weight: var(--mfs-small-heading-weight);
    letter-spacing: 0.02em;
    line-height: 1.45;
    margin: 0 0 7px;
}

.medflex-schedule__choices {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
}

.medflex-schedule button,
.medflex-schedule input,
.medflex-schedule select {
    font: inherit;
}

.medflex-schedule__choice,
.medflex-schedule__date,
.medflex-schedule__time {
    appearance: none;
    background: #fff;
    border: 1px solid #cbd5e1;
    color: #1e293b;
    cursor: pointer;
    margin: 0;
    text-align: left;
    transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease, color 160ms ease, transform 160ms ease;
}

.medflex-schedule__choice {
    border-radius: 14px;
    min-height: 58px;
    padding: 10px 48px 10px 14px;
    position: relative;
}

.medflex-schedule__choice::after {
    align-items: center;
    background: #fff;
    border: 1px solid #cbd5e1;
    border-radius: 50%;
    color: #fff;
    content: '';
    display: flex;
    font-size: 12px;
    height: 20px;
    justify-content: center;
    line-height: 1;
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
}

.medflex-schedule__choice.is-selected,
.medflex-schedule__date.is-selected,
.medflex-schedule__time.is-selected {
    background: color-mix(in srgb, var(--mfs-primary) 12%, white);
    border-color: var(--mfs-primary);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--mfs-primary) 18%, transparent);
}

.medflex-schedule__choice.is-selected::after {
    background: var(--mfs-primary);
    border-color: var(--mfs-primary);
    content: '✓';
}

.medflex-schedule__choice.is-selected:hover,
.medflex-schedule__choice.is-selected:focus,
.medflex-schedule__choice.is-selected:active,
.medflex-schedule__date.is-selected:hover,
.medflex-schedule__date.is-selected:focus,
.medflex-schedule__date.is-selected:active,
.medflex-schedule__time.is-selected:hover,
.medflex-schedule__time.is-selected:focus,
.medflex-schedule__time.is-selected:active {
    background: color-mix(in srgb, var(--mfs-primary) 12%, white);
    border-color: var(--mfs-primary);
    color: #1e293b;
    transform: none;
}

.medflex-schedule__choice:hover:not(.is-selected),
.medflex-schedule__choice:focus:not(.is-selected),
.medflex-schedule__choice:active:not(.is-selected),
.medflex-schedule__date:hover:not(.is-selected),
.medflex-schedule__date:focus:not(.is-selected),
.medflex-schedule__date:active:not(.is-selected),
.medflex-schedule__time:hover:not(.is-selected),
.medflex-schedule__time:focus:not(.is-selected),
.medflex-schedule__time:active:not(.is-selected) {
    background: var(--mfs-primary);
    border-color: var(--mfs-primary);
    color: #fff;
    transform: translateY(-1px);
}

.medflex-schedule__choice:hover:not(.is-selected) .medflex-schedule__choice-title,
.medflex-schedule__choice:hover:not(.is-selected) .medflex-schedule__choice-description,
.medflex-schedule__choice:focus:not(.is-selected) .medflex-schedule__choice-title,
.medflex-schedule__choice:focus:not(.is-selected) .medflex-schedule__choice-description,
.medflex-schedule__choice:active:not(.is-selected) .medflex-schedule__choice-title,
.medflex-schedule__choice:active:not(.is-selected) .medflex-schedule__choice-description,
.medflex-schedule__date:hover:not(.is-selected) .medflex-schedule__date-weekday,
.medflex-schedule__date:hover:not(.is-selected) .medflex-schedule__date-day,
.medflex-schedule__date:hover:not(.is-selected) .medflex-schedule__date-month,
.medflex-schedule__date:focus:not(.is-selected) .medflex-schedule__date-weekday,
.medflex-schedule__date:focus:not(.is-selected) .medflex-schedule__date-day,
.medflex-schedule__date:focus:not(.is-selected) .medflex-schedule__date-month,
.medflex-schedule__date:active:not(.is-selected) .medflex-schedule__date-weekday,
.medflex-schedule__date:active:not(.is-selected) .medflex-schedule__date-day,
.medflex-schedule__date:active:not(.is-selected) .medflex-schedule__date-month {
    color: #fff;
}

.medflex-schedule__date:hover:not(.is-selected) .medflex-schedule__date-dot,
.medflex-schedule__date:focus:not(.is-selected) .medflex-schedule__date-dot,
.medflex-schedule__date:active:not(.is-selected) .medflex-schedule__date-dot {
    background: #fff;
}

.medflex-schedule__choice-title,
.medflex-schedule__choice-description {
    display: block;
}

.medflex-schedule__choice-title {
    font-weight: 500;
}

.medflex-schedule__choice-description {
    color: #64748b;
    font-size: 13px;
    margin-top: 3px;
}

.medflex-schedule__choice--doctor {
    align-items: center;
    display: flex;
    gap: 12px;
}

img.medflex-schedule__doctor-avatar {
    aspect-ratio: 1;
    border-radius: 9999px !important;
    flex: 0 0 44px;
    height: 44px;
    object-fit: cover;
    object-position: top;
    width: 44px;
}

.medflex-schedule__doctor-details {
    display: block;
    min-width: 0;
}

.medflex-schedule__select,
.medflex-schedule__field input {
    appearance: none;
    background-color: #fff;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    color: #0f172a;
    line-height: 1.3;
    margin: 0;
    min-height: 50px;
    outline: none;
    padding: 12px 14px;
    width: 100%;
}

.medflex-schedule__select {
    background-image: linear-gradient(45deg, transparent 50%, #64748b 50%), linear-gradient(135deg, #64748b 50%, transparent 50%);
    background-position: calc(100% - 20px) 21px, calc(100% - 15px) 21px;
    background-repeat: no-repeat;
    background-size: 5px 5px, 5px 5px;
    padding-right: 42px;
}

.medflex-schedule__select:focus,
.medflex-schedule__select:active,
.medflex-schedule__field input:focus,
.medflex-schedule__field input:active {
    border-color: var(--mfs-primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--mfs-primary) 16%, transparent);
}

.medflex-schedule__select:focus,
.medflex-schedule__select:active {
    border-width: 1px;
}

.medflex-schedule__select:disabled {
    background-color: #f8fafc;
    color: #94a3b8;
}

.medflex-schedule__dates {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding: 2px 2px 8px;
    scrollbar-width: thin;
}

.medflex-schedule__dates.has-overflow {
    -webkit-mask-image: linear-gradient(to right, #000 0, #000 calc(100% - 48px), transparent 100%);
    -webkit-mask-repeat: no-repeat;
    -webkit-mask-size: 100% 100%;
    mask-image: linear-gradient(to right, #000 0, #000 calc(100% - 48px), transparent 100%);
    mask-repeat: no-repeat;
    mask-size: 100% 100%;
}

.medflex-schedule__date {
    border-radius: 14px;
    flex: 0 0 78px;
    max-width: 60px;
    min-height: 98px;
    padding: 8px 7px;
    text-align: center;
    width: 60px;
}

.medflex-schedule__date-weekday,
.medflex-schedule__date-day,
.medflex-schedule__date-month,
.medflex-schedule__date-dot {
    display: block;
}

.medflex-schedule__date-weekday {
    color: #64748b;
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.06em;
    line-height: 1.2;
}

.medflex-schedule__date-day {
    color: var(--mfs-heading);
    font-size: 24px;
    font-weight: 500;
    line-height: 1.05;
    margin-top: 7px;
    white-space: nowrap;
}

.medflex-schedule__date-month {
    color: #64748b;
    font-size: 12px;
    line-height: 1.2;
    margin-top: 4px;
}

.medflex-schedule__date-dot {
    background: var(--mfs-primary);
    border-radius: 50%;
    height: 5px;
    margin: 9px auto 0;
    width: 5px;
}

.medflex-schedule__times {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.medflex-schedule__time {
    border-radius: 10px;
    font-weight: 500;
    min-width: 78px;
    padding: 10px 15px;
    text-align: center;
}

.medflex-schedule__price {
    color: var(--mfs-heading);
    font-size: 16px;
    font-weight: 500;
    line-height: 1.4;
    margin: 16px 0 0;
}

.medflex-schedule__status,
.medflex-schedule__form-error {
    color: #64748b;
    font-size: 14px;
    margin: 20px 0 0;
    min-height: 21px;
}

.medflex-schedule__status[data-state='error'],
.medflex-schedule__form-error {
    color: #b91c1c;
}

.medflex-schedule__status[data-state='loading']::before {
    animation: medflex-schedule-spin 700ms linear infinite;
    border: 2px solid #cbd5e1;
    border-radius: 50%;
    border-top-color: var(--mfs-primary);
    content: '';
    display: inline-block;
    height: 15px;
    margin-right: 8px;
    vertical-align: -2px;
    width: 15px;
}

.medflex-schedule__primary {
    align-items: center;
    appearance: none;
    background: var(--mfs-primary);
    border: 0;
    border-radius: 13px;
    color: #fff;
    cursor: pointer;
    display: inline-flex;
    font-weight: 500;
    justify-content: center;
    margin: 36px 0 0;
    min-height: 54px;
    padding: 13px 28px;
    text-decoration: none;
    transition: color 160ms ease, filter 160ms ease, transform 160ms ease, opacity 160ms ease;
    width: 100%;
}

.medflex-schedule__primary:hover:not(:disabled),
.medflex-schedule__primary:focus:not(:disabled),
.medflex-schedule__primary:active:not(:disabled) {
    background: var(--mfs-primary);
    color: #fff;
    filter: brightness(0.92);
    transform: translateY(-1px);
}

.medflex-schedule__primary:disabled {
    cursor: not-allowed;
    opacity: 0.42;
}

.medflex-schedule__choice:focus-visible,
.medflex-schedule__date:focus-visible,
.medflex-schedule__time:focus-visible,
.medflex-schedule__primary:focus-visible,
.medflex-schedule__back:focus-visible,
.medflex-schedule__dialog-close:focus-visible,
.medflex-schedule__choice:active,
.medflex-schedule__date:active,
.medflex-schedule__time:active,
.medflex-schedule__primary:active,
.medflex-schedule__back:active,
.medflex-schedule__dialog-close:active {
    outline: 3px solid color-mix(in srgb, var(--mfs-primary) 35%, transparent);
    outline-offset: 2px;
}

.medflex-schedule__back {
    align-items: center;
    appearance: none;
    background: transparent;
    border: 0 solid transparent;
    color: var(--mfs-primary);
    cursor: pointer;
    display: inline-flex;
    font-weight: 500;
    gap: 7px;
    margin-bottom: 22px;
    opacity: 1;
    padding: 0;
    transition: opacity 160ms ease;
}

.medflex-schedule__back:hover,
.medflex-schedule__back:focus,
.medflex-schedule__back:active {
    background: transparent;
    border: 0 solid transparent;
    color: var(--mfs-primary);
    opacity: 0.8;
}

.medflex-schedule__back-icon {
    fill: none;
    flex: 0 0 18px;
    height: 18px;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
    width: 18px;
}

.medflex-schedule__summary {
    background: color-mix(in srgb, var(--mfs-primary) 6%, white);
    border-radius: 14px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 32px;
    padding: 14px;
}

.medflex-schedule__summary span {
    color: #334155;
    font-size: 14px;
}

.medflex-schedule__summary span:not(:last-child)::after {
    color: #94a3b8;
    content: '•';
    margin-left: 8px;
}

.medflex-schedule__form-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.medflex-schedule__field {
    display: block;
}

.medflex-schedule__field > span {
    color: var(--mfs-small-heading);
    display: block;
    font-size: 13px;
    font-weight: var(--mfs-small-heading-weight);
    line-height: 1.45;
    margin-bottom: 7px;
}

.medflex-schedule__field--wide {
    grid-column: 1 / -1;
}

.medflex-schedule__consent {
    margin-top: 20px;
}

.medflex-schedule__consent input {
    accent-color: var(--mfs-primary);
    flex: 0 0 auto;
    height: 18px;
    margin: 1px 0 0;
    width: 18px;
}

.medflex-schedule__consent a {
    color: var(--mfs-primary);
}

.medflex-schedule__honeypot {
    height: 1px;
    left: -10000px;
    overflow: hidden;
    position: absolute;
    top: auto;
    width: 1px;
}

.medflex-schedule__success {
    color: var(--mfs-heading);
    font-size: 20px;
    padding: clamp(30px, 7vw, 70px) 0;
    text-align: center;
}

.medflex-schedule__success-icon {
    align-items: center;
    background: color-mix(in srgb, var(--mfs-primary) 12%, white);
    border-radius: 50%;
    color: var(--mfs-primary);
    display: flex;
    font-size: 34px;
    font-weight: 500;
    height: 76px;
    justify-content: center;
    margin: 0 auto 22px;
    width: 76px;
}

.medflex-schedule__dialog {
    background: #fff;
    border: 0;
    border-radius: 20px;
    box-shadow: 0 24px 90px rgba(15, 23, 42, 0.28);
    color: var(--mfs-text);
    max-width: min(92vw, 460px);
    padding: 30px;
    width: 100%;
}

.medflex-schedule__dialog::backdrop {
    background: rgba(15, 23, 42, 0.58);
    backdrop-filter: blur(3px);
}

.medflex-schedule__dialog-text {
    color: #64748b;
    font-size: 14px;
    margin: 12px 0 22px;
}

.medflex-schedule__dialog-close {
    appearance: none;
    background: #f1f5f9;
    border: 0;
    border-radius: 50%;
    color: #475569;
    cursor: pointer;
    font-size: 23px;
    height: 34px;
    line-height: 1;
    padding: 0;
    position: absolute;
    right: 18px;
    top: 18px;
    width: 34px;
}

.medflex-schedule__dialog-close:hover,
.medflex-schedule__dialog-close:focus,
.medflex-schedule__dialog-close:active {
    background: var(--mfs-primary);
    color: #fff;
}

@keyframes medflex-schedule-spin {
    to { transform: rotate(360deg); }
}

@keyframes medflex-schedule-skeleton {
    from {
        background-position: 200% 0;
    }
    to {
        background-position: -200% 0;
    }
}

.medflex-schedule [data-mfs-panel].is-sliding-left {
    animation: medflex-schedule-slide-left 360ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.medflex-schedule [data-mfs-panel].is-sliding-right {
    animation: medflex-schedule-slide-right 300ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes medflex-schedule-slide-left {
    from {
        opacity: 0;
        transform: translateX(48px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes medflex-schedule-slide-right {
    from {
        opacity: 0;
        transform: translateX(-36px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@media (max-width: 1200px) {
    .medflex-schedule__title {
        font-size: 26px;
    }
}

@media (max-width: 768px) {
    .medflex-schedule__shell {
        padding: 28px 25px 25px;
    }

    .medflex-schedule__dialog h2 {
        font-size: 26px;
    }
}

@media (max-width: 620px) {
    .medflex-schedule__shell {
        border-radius: 18px;
        padding: 26px 18px;
    }

    .medflex-schedule__form-grid {
        grid-template-columns: 1fr;
    }

    .medflex-schedule__field--wide {
        grid-column: auto;
    }

    .medflex-schedule__skeleton-label {
        width: 38%;
    }

    .medflex-schedule__skeleton-cards {
        grid-template-columns: 1fr;
    }

    .medflex-schedule__dialog {
        border-radius: 18px 18px 0 0;
        margin: auto 0 0;
        max-width: none;
        padding: 28px 20px max(28px, env(safe-area-inset-bottom));
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .medflex-schedule *,
    .medflex-schedule *::before,
    .medflex-schedule *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }
}
