/* --- МОДАЛЬ ГРАФІК --- */
.schedule-overlay {
    z-index: var(--z-overlay);
}

body.app-shell-pending .main-container,
body.app-setup-pending .main-container {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: scale(0.98) translateY(12px);
}

.schedule-overlay.setup-mode {
    z-index: var(--z-overlay-schedule);
}

.schedule-card {
    max-width: 380px;
    max-height: 80vh;
    overflow-y: auto;
}

.schedule-intro {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    margin-bottom: var(--space-3);
}

.schedule-title {
    font-family: var(--font-family-display);
    font-size: var(--type-display-modal-size);
    font-weight: 800;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    text-align: center;
    letter-spacing: var(--type-display-modal-track);
    line-height: var(--type-display-modal-line);
}

.schedule-title-emoji {
    font-size: 0.76em;
    line-height: 1;
    transform: translateY(-1px);
    opacity: 0.92;
    margin-right: 0;
}

.schedule-onboarding {
    display: none;
    margin: 0;
    padding: var(--surface-block-padding-lg) var(--surface-block-padding-lg) var(--surface-block-padding-md);
    border-radius: var(--surface-block-radius-lg);
    background: var(--surface-panel-accent);
    border: 1px solid var(--surface-panel-accent-border);
    box-shadow: none;
}

.schedule-overlay.setup-mode .schedule-onboarding {
    display: block;
}

.schedule-onboarding-kicker {
    display: inline-flex;
    align-items: center;
    margin-bottom: var(--space-3);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-pill);
    background: var(--kicker-bg);
    border: 1px solid var(--kicker-border);
    color: var(--accent);
    font-size: var(--type-label-xs-size);
    font-weight: 700;
    line-height: var(--type-label-xs-line);
    letter-spacing: var(--type-label-xs-track);
    text-transform: none;
}

.schedule-onboarding-text {
    margin: 0;
    max-width: none;
    font-size: var(--type-body-md-size);
    line-height: var(--type-body-md-line);
    font-weight: 700;
    color: var(--text-primary);
    text-align: left;
    text-wrap: pretty;
    letter-spacing: -0.02em;
}

.schedule-templates {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-4);
    margin-bottom: var(--space-6);
}

.schedule-btn {
    position: relative;
    overflow: hidden;
    min-height: 110px;
    padding: var(--space-5) var(--space-4);
    border: 1px solid var(--card-border);
    border-radius: var(--surface-block-radius-md);
    background: var(--surface-panel-subtle);
    color: var(--text-primary);
    font-weight: 600;
    font-size: var(--type-body-md-size);
    cursor: pointer;
    transition: var(--control-transition);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    text-align: center;
    box-shadow: none;
}

.schedule-btn::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: var(--surface-shell-gloss);
    opacity: 0.85;
}

.schedule-btn strong,
.schedule-btn-label {
    position: relative;
    z-index: var(--z-base);
}

.schedule-btn strong {
    font-family: var(--font-family-numeric);
    font-size: var(--type-number-sm-size);
    letter-spacing: var(--type-number-sm-track);
}

.schedule-btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: var(--icon-size-md);
    line-height: 1;
    transform: translateY(-1px);
}

.schedule-btn-icon .icon-glyph {
    width: 1.1em;
    height: 1.1em;
}

.schedule-btn:hover {
    border-color: var(--accent);
    background: var(--surface-control);
    transform: var(--button-hover-transform);
    box-shadow: none;
}

.schedule-btn.active {
    border-color: var(--interactive-active-border);
    background: var(--interactive-active-bg);
    color: var(--interactive-active-color);
    box-shadow: var(--interactive-active-inset), var(--interactive-active-shadow);
}

.schedule-btn.active::before {
    opacity: 0.22;
}

.schedule-btn.active .schedule-btn-label {
    opacity: 1;
}

.schedule-btn-label {
    font-size: var(--type-body-ui-size);
    opacity: 0.9;
    font-weight: 600;
    line-height: var(--type-body-ui-line);
}

.schedule-custom {
    margin-bottom: var(--space-5);
    display: block;
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transform: translateY(var(--expand-reveal-offset));
    margin-top: 0;
    pointer-events: none;
    box-shadow: none;
    transition: max-height var(--expand-reveal-size-duration) var(--expand-reveal-easing), opacity var(--expand-reveal-fade-duration) var(--expand-reveal-easing), transform var(--expand-reveal-fade-duration) var(--expand-reveal-easing), margin-top var(--expand-reveal-fade-duration) var(--expand-reveal-easing);
}

.schedule-custom.active {
    max-height: 320px;
    opacity: 1;
    transform: translateY(0);
    margin-top: 0;
    pointer-events: auto;
}

.schedule-custom-inner {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    padding: var(--surface-block-padding-lg);
    border-radius: var(--surface-block-radius-md);
    background: var(--surface-panel-subtle);
    border: 1px solid var(--surface-panel-subtle-border);
}

.custom-input-group {
    margin-bottom: var(--space-4);
}

.schedule-custom .custom-input-group:last-child {
    margin-bottom: 0;
}

.custom-input-label {
    font-size: var(--type-label-sm-size);
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: var(--space-2);
    display: block;
    text-transform: uppercase;
    line-height: var(--type-label-sm-line);
    letter-spacing: var(--type-label-xs-track);
}

.custom-input {
    padding: var(--space-3);
    font-weight: 600;
}

.schedule-info {
    margin: 0;
    padding: 0 var(--space-1);
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
    max-width: none;
    justify-content: flex-start;
    text-align: left;
    color: color-mix(in srgb, var(--text-secondary) 90%, transparent);
    font-size: var(--type-body-xs-size);
    line-height: var(--type-body-ui-line);
    white-space: nowrap;
    opacity: 1;
}

.schedule-info::before {
    content: "";
    flex: 0 0 auto;
    width: var(--marker-cube-size);
    height: var(--marker-cube-size);
    border-radius: var(--radius-pill);
    background: color-mix(in srgb, var(--accent) 68%, white);
    box-shadow: 0 0 0 4px var(--accent-soft);
    transform: translateY(2px);
    opacity: 0.92;
}

.schedule-overlay.setup-mode .schedule-info {
    margin-bottom: 0;
}

.schedule-buttons {
    display: flex;
    gap: var(--space-3);
    position: sticky;
    bottom: 0;
    padding-top: var(--space-5);
    margin-top: var(--space-3);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0), var(--main-container-bg) 36%);
    z-index: var(--z-content);
}

[data-theme="dark"] .schedule-buttons {
    background: linear-gradient(180deg, rgba(18, 26, 40, 0), var(--main-container-bg) 36%);
}

.schedule-overlay.setup-mode .schedule-close,
.schedule-overlay.setup-mode .schedule-btn-action.secondary {
    display: none;
}

.schedule-overlay.setup-mode .schedule-card {
    background: var(--main-container-bg);
    border-color: var(--card-border);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    max-width: 440px;
    max-height: min(92vh, 760px);
    padding: calc(var(--space-7) + 4px) var(--space-7) var(--space-7);
}

.schedule-overlay.setup-mode .schedule-title {
    font-family: var(--font-family-display);
    font-size: var(--type-display-setup-size);
    line-height: var(--type-display-setup-line);
    margin-bottom: var(--space-1);
    text-wrap: balance;
}

body[data-theme="dark"] .schedule-onboarding {
    background: var(--surface-panel-accent);
    border-color: var(--surface-panel-accent-border);
    box-shadow: var(--surface-panel-accent-shadow);
}

body[data-theme="dark"] .schedule-onboarding-kicker {
    background: color-mix(in srgb, white 7%, transparent);
    color: color-mix(in srgb, var(--accent) 62%, white);
}

body[data-theme="dark"] .schedule-info {
    background: transparent;
    border-color: transparent;
    box-shadow: none;
}

.schedule-overlay.setup-mode .schedule-card > * {
    animation: scheduleSetupFadeIn var(--motion-duration-enter) var(--motion-ease-emphasized) both;
}

.schedule-overlay.setup-mode .schedule-title {
    animation-delay: 0.03s;
}

.schedule-overlay.setup-mode .schedule-onboarding {
    animation-delay: 0.08s;
}

.schedule-overlay.setup-mode .schedule-info {
    animation-delay: 0.12s;
}

.schedule-overlay.setup-mode .schedule-templates {
    animation-delay: 0.16s;
}

.schedule-overlay.setup-mode .custom-input-group,
.schedule-overlay.setup-mode .schedule-buttons,
.schedule-overlay.setup-mode .schedule-custom {
    animation-delay: 0.2s;
}

@keyframes scheduleSetupFadeIn {
    from {
        opacity: 0;
        transform: translateY(8px) scale(0.985);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}
