:root {
    /* Тёмная тема по умолчанию */
    --tg-theme-bg-color: #1a1a1a;
    --tg-theme-text-color: #ffffff;
    --tg-theme-hint-color: #8b8b8b;
    --tg-theme-link-color: #60a5fa;
    --tg-theme-button-color: #3b82f6;
    --tg-theme-button-text-color: #ffffff;
    --tg-theme-secondary-bg-color: #2d2d2d;
    --tg-theme-section-separator-color: #404040;
    --color-bg: var(--tg-theme-bg-color);
    --color-surface: var(--tg-theme-secondary-bg-color);
    --color-text: var(--tg-theme-text-color);
    --color-muted: var(--tg-theme-hint-color);
    --color-accent: var(--tg-theme-button-color);
    --color-accent-text: var(--tg-theme-button-text-color);
    --color-border: var(--tg-theme-section-separator-color);
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.14);
    --shadow-md: 0 6px 20px rgba(0, 0, 0, 0.18);
    --motion-fast: 140ms;
    --motion-base: 220ms;
    --motion-emphasis: 320ms;
    --motion-toast-out: 160ms;
    --motion-banner-out: 160ms;
    --motion-overlay: 180ms;
    --motion-enter-x: 22px;
    --motion-exit-x: 18px;
    --motion-enter-y: 12px;
    --motion-sheet-y: 24px;
    --motion-toast-y: 14px;
    --motion-banner-y: -10px;
    --ease-standard: cubic-bezier(.2, .8, .2, 1);
    --ease-decelerate: cubic-bezier(.16, 1, .3, 1);
    --ease-accelerate: cubic-bezier(.7, 0, .84, 0);
    --safe-area-bottom: env(safe-area-inset-bottom, 0px);
    --viewport-offset-bottom: 0px;
    --screen-bottom-inset: max(var(--safe-area-bottom), var(--viewport-offset-bottom));
    --bottom-toolbar-height: 84px;
    --bottom-toolbar-screen-gap: clamp(8px, calc(18px - var(--screen-bottom-inset)), 18px);
    --sticky-header-visual-progress: 0;
    --sticky-compact-progress: var(--sticky-header-visual-progress);
    --bottom-toolbar-visual-progress: 0;
    --bottom-toolbar-compact-progress: var(--bottom-toolbar-visual-progress);
    --sticky-header-height: 0px;
    --bottom-toolbar-offset: calc(var(--bottom-toolbar-height) + var(--screen-bottom-inset) + var(--bottom-toolbar-screen-gap));
    --page-bottom-offset: calc(var(--bottom-toolbar-offset) + 16px);
    --floating-bottom-offset: calc(var(--bottom-toolbar-offset) + 10px);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    background-color: var(--tg-theme-bg-color);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--tg-theme-bg-color);
    color: var(--tg-theme-text-color);
    padding: 0;
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
}

body.modal-open {
    overflow: hidden;
    touch-action: none;
}

.is-entering,
.is-exiting {
    --motion-translate-x: 0px;
    --motion-translate-y: 0px;
    --motion-duration: var(--motion-base);
    --motion-exit-duration: var(--motion-toast-out);
    animation-fill-mode: both;
    will-change: transform, opacity;
}

.is-entering {
    animation-name: motionEnter;
    animation-duration: var(--motion-duration);
    animation-timing-function: var(--ease-decelerate);
}

.is-exiting {
    animation-name: motionExit;
    animation-duration: var(--motion-exit-duration);
    animation-timing-function: var(--ease-accelerate);
    pointer-events: none;
}

.from-left {
    --motion-translate-x: calc(var(--motion-enter-x) * -1);
}

.from-right {
    --motion-translate-x: var(--motion-enter-x);
}

.from-bottom {
    --motion-translate-y: var(--motion-sheet-y);
}

.from-top {
    --motion-translate-y: var(--motion-banner-y);
}

.shared-axis-y {
    --motion-translate-y: var(--motion-enter-y);
}

.fade-only {
    --motion-translate-x: 0px;
    --motion-translate-y: 0px;
}

@keyframes motionEnter {
    from {
        opacity: 0;
        transform: translate3d(var(--motion-translate-x), var(--motion-translate-y), 0);
    }

    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

@keyframes motionExit {
    from {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }

    to {
        opacity: 0;
        transform: translate3d(var(--motion-translate-x), var(--motion-translate-y), 0);
    }
}

.stagger-item {
    --stagger-index: 0;
    --stagger-step: 24ms;
    animation: motionRevealUp var(--motion-base) var(--ease-decelerate) both;
    animation-delay: calc(var(--stagger-index) * var(--stagger-step));
    will-change: transform, opacity, box-shadow;
}

.stagger-item.current-glow {
    animation-name: motionRevealUp, lessonCurrentGlow;
    animation-duration: var(--motion-base), var(--motion-emphasis);
    animation-timing-function: var(--ease-decelerate), var(--ease-decelerate);
    animation-fill-mode: both, both;
    animation-delay: calc(var(--stagger-index) * var(--stagger-step)), calc(var(--stagger-index) * var(--stagger-step) + 40ms);
}

@keyframes motionRevealUp {
    from {
        opacity: 0;
        transform: translate3d(0, 12px, 0);
    }

    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

@keyframes lessonCurrentGlow {
    0% {
        box-shadow: 0 0 0 0 rgba(59, 130, 246, 0);
    }

    35% {
        box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.24);
    }

    100% {
        box-shadow: 0 0 0 2px var(--tg-theme-button-color);
    }
}

.motion-spin-once {
    animation: motionSpinOnce var(--motion-emphasis) var(--ease-decelerate) 1;
    transform-origin: center;
}

@keyframes motionSpinOnce {
    from {
        transform: rotate(-18deg) scale(0.94);
        opacity: 0.65;
    }

    to {
        transform: rotate(0deg) scale(1);
        opacity: 1;
    }
}


.container {
    max-width: 100%;
    margin: 0 auto;
    padding: 0;
    min-height: 100vh;
    min-height: 100dvh;
    background: var(--tg-theme-bg-color);
}

.header {
    background: var(--color-surface, #f4f4f5);
    padding: 10px 12px;
    border-bottom: 1px solid var(--color-border, #e4e4e7);
}

.sticky-header {
    --sticky-header-visual-progress: 0;
    --sticky-compact-progress: var(--sticky-header-visual-progress);
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--color-bg, #ffffff);
    transition: background var(--motion-base) var(--ease-standard);
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}

.header-content {
    flex: 1;
    min-width: 0;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex-shrink: 0;
}

.schedule-context {
    display: block;
    padding: 0;
    border: none;
    background: none;
}

.schedule-context-main {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.schedule-context-row {
    display: flex;
    align-items: center;
    gap: 6px;
    min-height: 0;
    flex-wrap: wrap;
}

.context-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    width: fit-content;
    max-width: 100%;
    padding: 3px 7px;
    border-radius: 999px;
    background: rgba(59, 130, 246, 0.14);
    color: var(--color-accent);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    opacity: 1;
    transform: translate3d(0, calc(-1px * var(--sticky-header-visual-progress)), 0);
    transition: opacity var(--motion-fast) var(--ease-standard), transform var(--motion-fast) var(--ease-standard);
    will-change: transform, opacity;
}

.context-title {
    font-size: 18px;
    font-weight: 700;
    line-height: 1.05;
    color: var(--color-text);
    word-break: break-word;
    transform: translate3d(0, calc(-2px * var(--sticky-header-visual-progress)), 0);
    transform-origin: left center;
    will-change: transform;
}

.context-subtitle {
    font-size: 12px;
    color: var(--color-muted);
    line-height: 1.25;
    min-height: 15px;
    opacity: calc(1 - var(--sticky-header-visual-progress));
    overflow: hidden;
    transform: translate3d(0, calc(-5px * var(--sticky-header-visual-progress)), 0);
    transition: opacity var(--motion-fast) var(--ease-standard), transform var(--motion-fast) var(--ease-standard);
    will-change: transform, opacity;
}

.view-btn.icon-btn-sm {
    flex: 0 0 auto;
    width: 40px;
    min-width: 40px;
    min-height: 40px;
    height: 40px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--color-bg, #ffffff);
    border: 1px solid rgba(148, 163, 184, 0.14);
    border-radius: 10px;
    box-shadow: none;
    transform: translate3d(0, calc(-1px * var(--sticky-header-visual-progress)), 0);
    transition: transform var(--motion-fast) var(--ease-standard);
    will-change: transform;
}

.view-btn.icon-btn-sm i {
    font-size: 16px;
}

html.is-scroll-linked-chrome .context-pill,
html.is-scroll-linked-chrome .context-title,
html.is-scroll-linked-chrome .context-subtitle,
html.is-scroll-linked-chrome .view-btn.icon-btn-sm {
    transition: none;
}

button:focus-visible,
a:focus-visible,
input:focus-visible {
    outline: 2px solid var(--color-accent, #3b82f6);
    outline-offset: 2px;
}

.help-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1150;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
}

.help-modal.show {
    display: flex;
    opacity: 1;
}

.help-content {
    background: var(--color-surface, #ffffff);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 18px;
    width: min(360px, 100%);
    box-shadow: var(--shadow-md);
    will-change: transform, opacity;
}

.help-hero {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.help-icon {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(59, 130, 246, 0.14);
    color: var(--color-accent);
    font-size: 20px;
    flex: 0 0 auto;
}

.help-heading {
    min-width: 0;
}

.help-content h3 {
    margin: 0;
    color: var(--color-text);
    font-size: 20px;
    line-height: 1.2;
    text-align: left;
}

.help-content p {
    margin: 0 0 16px 0;
    color: var(--color-muted);
    font-size: 14px;
    line-height: 1.45;
}

.help-close {
    width: 100%;
    min-height: 44px;
    padding: 10px 14px;
    background: var(--tg-theme-button-color, #3b82f6);
    color: var(--tg-theme-button-text-color, #ffffff);
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
}

.help-version {
    font-size: 12px;
    color: var(--color-muted);
    margin: 4px 0 0;
    text-align: left;
}

.help-info {
    display: grid;
    gap: 10px;
    margin-bottom: 16px;
}

.help-info-row {
    display: grid;
    grid-template-columns: 30px minmax(0, 1fr);
    gap: 10px;
    align-items: start;
    padding: 10px;
    border-radius: 8px;
    background: rgba(148, 163, 184, 0.08);
    border: 1px solid rgba(148, 163, 184, 0.16);
    color: var(--color-text);
    font-size: 14px;
    line-height: 1.4;
}

.help-info-row i {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(59, 130, 246, 0.12);
    color: var(--color-accent);
    font-size: 13px;
}

.help-credits {
    padding-top: 12px;
    border-top: 1px solid var(--color-border);
    font-size: 13px !important;
}

.user-info {
    font-size: 13px;
    color: var(--tg-theme-hint-color, #71717a);
    margin-bottom: 8px;
    line-height: 1.25;
}

.user-info.mode-user-info {
    margin-bottom: 4px;
}

.mode-user-top {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.mode-entity-name {
    margin-top: 3px;
    font-size: 14px;
    font-weight: 600;
    color: var(--tg-theme-text-color, #000000);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mode-entity-subtitle {
    margin-top: 1px;
    font-size: 11px;
    color: var(--tg-theme-hint-color, #71717a);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.schedule-controls {
    margin-top: 10px;
    opacity: 1;
    transform: translate3d(0, calc(-2px * var(--sticky-header-visual-progress)), 0);
    will-change: transform, opacity;
}

.schedule-days-strip {
    min-height: 0;
    padding-top: 0;
}

.schedule-days-strip.hidden {
    display: none;
}

.mode-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 16px 12px;
    background: rgba(59, 130, 246, 0.08);
    border-bottom: 1px solid var(--color-border, #e4e4e7);
}

.mode-banner.hidden {
    display: none;
}

.mode-banner-copy {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.mode-banner-title {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--color-accent);
}

.mode-banner-text {
    font-size: 13px;
    line-height: 1.35;
    color: var(--color-text);
}

.mode-banner-action {
    flex: 0 0 auto;
    min-height: 36px;
    padding: 0 12px;
    border: 1px solid rgba(59, 130, 246, 0.28);
    border-radius: 999px;
    background: rgba(59, 130, 246, 0.16);
    color: var(--color-text);
    font-size: 12px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    white-space: nowrap;
}

.view-btn {
    flex: 1;
    min-height: 44px;
    padding: 10px 12px;
    background: var(--color-surface, #f4f4f5);
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: var(--tg-theme-text-color, #000000);
    cursor: pointer;
    transition:
        background var(--motion-fast) var(--ease-standard),
        color var(--motion-fast) var(--ease-standard),
        box-shadow var(--motion-fast) var(--ease-standard),
        transform var(--motion-fast) var(--ease-standard);
    font-weight: 600;
}

.view-btn.active {
    background: var(--tg-theme-button-color, #3b82f6);
    color: var(--tg-theme-button-text-color, #ffffff);
    box-shadow: 0 10px 20px rgba(59, 130, 246, 0.18);
}

.view-btn:active {
    transform: scale(0.98);
}

.bottom-toolbar-shell {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    padding:
        0
        10px
        calc(10px + var(--screen-bottom-inset) + var(--bottom-toolbar-screen-gap));
    background: linear-gradient(180deg, rgba(0, 0, 0, 0) 0%, var(--tg-theme-bg-color) 100%);
    pointer-events: none;
    transform: translate3d(0, calc(3px * var(--bottom-toolbar-visual-progress)), 0);
    will-change: transform;
}

.bottom-toolbar {
    pointer-events: auto;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
    padding: 6px;
    border: 1px solid var(--color-border);
    border-radius: 18px;
    background: var(--color-surface);
    box-shadow: var(--shadow-md);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    transform: translate3d(0, calc(1px * var(--bottom-toolbar-visual-progress)), 0);
    transform-origin: center bottom;
    will-change: transform;
}

.bottom-toolbar-btn {
    min-height: 58px;
    padding:
        8px
        6px
        7px;
    border: none;
    border-radius: 14px;
    background: transparent;
    color: var(--color-muted);
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    cursor: pointer;
    transition:
        background var(--motion-fast) var(--ease-standard),
        color var(--motion-fast) var(--ease-standard),
        box-shadow var(--motion-fast) var(--ease-standard),
        transform var(--motion-fast) var(--ease-standard);
    font-size: 11px;
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: 0.01em;
}

.bottom-toolbar-btn i {
    font-size: 18px;
    line-height: 1;
}

html.is-scroll-linked-chrome .bottom-toolbar-shell,
html.is-scroll-linked-chrome .bottom-toolbar {
    transition: none;
}

html.is-scroll-linked-chrome .bottom-toolbar-btn {
    transition:
        background var(--motion-fast) var(--ease-standard),
        color var(--motion-fast) var(--ease-standard),
        box-shadow var(--motion-fast) var(--ease-standard),
        transform var(--motion-fast) var(--ease-standard);
}

html.is-scroll-linked-chrome .bottom-toolbar-btn i {
    transition: none;
}

.bottom-toolbar-btn span {
    white-space: nowrap;
}

.bottom-toolbar-btn.active {
    background: var(--tg-theme-button-color);
    color: var(--tg-theme-button-text-color);
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.18);
}

.bottom-toolbar-btn:active {
    transform: scale(0.98);
}

.days-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    overflow-x: auto;
    padding: 0 1px 2px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.days-nav::-webkit-scrollbar {
    display: none;
}

.days-nav.hidden {
    display: none;
}

.day-btn {
    flex: 0 0 auto;
    min-width: 60px;
    min-height: 42px;
    padding: 6px 10px 7px;
    background: rgba(148, 163, 184, 0.1);
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: 12px;
    font-size: 13px;
    color: var(--color-text);
    cursor: pointer;
    transition:
        background var(--motion-fast) var(--ease-standard),
        color var(--motion-fast) var(--ease-standard),
        box-shadow var(--motion-fast) var(--ease-standard),
        transform var(--motion-fast) var(--ease-standard),
        border-color var(--motion-fast) var(--ease-standard);
    white-space: nowrap;
    font-weight: 600;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    box-shadow: none;
}

.day-btn-label {
    font-size: 9px;
    line-height: 1;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--color-muted);
    transition: color var(--motion-fast) var(--ease-standard);
}

.day-btn-date {
    font-size: 12px;
    line-height: 1;
    color: var(--color-text);
    transition: color var(--motion-fast) var(--ease-standard);
}

.day-btn.active {
    background: rgba(59, 130, 246, 0.16);
    border-color: rgba(96, 165, 250, 0.34);
    color: var(--color-accent);
    box-shadow: none;
}

.day-btn.active .day-btn-label {
    color: var(--color-accent);
}

.day-btn.active .day-btn-date {
    color: var(--color-text);
}

.day-btn:active {
    transform: scale(0.97);
}

.schedule-content {
    padding: 16px 16px var(--page-bottom-offset);
    background: var(--tg-theme-bg-color);
}

.next-lesson-summary {
    position: relative;
    overflow: hidden;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 10px 12px;
    margin-bottom: var(--space-2);
    box-shadow: var(--shadow-sm);
    will-change: transform, opacity;
}

.next-lesson-summary::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0;
    background: linear-gradient(110deg,
            transparent 0%,
            rgba(255, 255, 255, 0.04) 35%,
            rgba(255, 255, 255, 0.14) 50%,
            rgba(255, 255, 255, 0.04) 65%,
            transparent 100%);
    transform: translate3d(-24%, 0, 0);
}

.next-lesson-summary.hidden {
    display: none;
}

.next-lesson-summary.motion-update {
    animation: summaryRefresh 220ms var(--ease-standard);
}

.next-lesson-summary.motion-update::after {
    animation: summarySweep 320ms var(--ease-decelerate);
}

.next-lesson-summary.motion-update .next-lesson-summary-title {
    animation: summaryFadeUp 160ms var(--ease-decelerate) 20ms both;
}

.next-lesson-summary.motion-update .next-lesson-summary-subject {
    animation: summaryFadeUp 180ms var(--ease-decelerate) 45ms both;
}

.next-lesson-summary.motion-update .next-lesson-summary-empty {
    animation: summaryFadeUp 180ms var(--ease-decelerate) 45ms both;
}

.next-lesson-summary.motion-update .next-lesson-summary-empty-icon,
.next-lesson-summary.motion-update .next-lesson-summary-action {
    animation: summaryChipIn 180ms var(--ease-decelerate) both;
}

.next-lesson-summary.motion-update .next-lesson-summary-empty-icon {
    animation-delay: 70ms;
}

.next-lesson-summary.motion-update .next-lesson-summary-action {
    animation-delay: 100ms;
}

.next-lesson-summary.motion-update .next-lesson-summary-detail {
    animation: summaryChipIn 180ms var(--ease-decelerate) both;
}

.next-lesson-summary.motion-update .next-lesson-summary-detail:nth-child(1) {
    animation-delay: 70ms;
}

.next-lesson-summary.motion-update .next-lesson-summary-detail:nth-child(2) {
    animation-delay: 100ms;
}

.next-lesson-summary.motion-update .next-lesson-summary-detail:nth-child(3) {
    animation-delay: 130ms;
}

.next-lesson-summary.motion-update .next-lesson-summary-detail.status {
    animation:
        summaryChipIn 180ms var(--ease-decelerate) 130ms both,
        summaryStatusAccent 320ms var(--ease-decelerate) 160ms both;
}

@keyframes summaryRefresh {
    from {
        opacity: 0;
        transform: translate3d(0, 8px, 0);
    }

    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

@keyframes summarySweep {
    0% {
        opacity: 0;
        transform: translate3d(-24%, 0, 0);
    }

    35% {
        opacity: 1;
    }

    100% {
        opacity: 0;
        transform: translate3d(24%, 0, 0);
    }
}

@keyframes summaryFadeUp {
    from {
        opacity: 0;
        transform: translate3d(0, 8px, 0);
    }

    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

@keyframes summaryChipIn {
    from {
        opacity: 0;
        transform: translate3d(0, 10px, 0) scale(0.98);
    }

    to {
        opacity: 1;
        transform: translate3d(0, 0, 0) scale(1);
    }
}

@keyframes summaryStatusAccent {
    0% {
        box-shadow: 0 0 0 0 rgba(59, 130, 246, 0);
    }

    45% {
        box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.16);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(59, 130, 246, 0);
    }
}

.next-lesson-summary-title {
    font-size: 11px;
    color: var(--color-muted);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.next-lesson-summary-subject {
    font-size: 16px;
    font-weight: 700;
    line-height: 1.3;
}

.next-lesson-summary-details {
    margin-top: var(--space-2);
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-2);
}

.next-lesson-summary-detail {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 8px;
    border-radius: 8px;
    border: 1px solid var(--color-border);
    background: rgba(148, 163, 184, 0.12);
    color: var(--color-muted);
    font-size: 13px;
    line-height: 1.2;
}

.next-lesson-summary-detail i {
    flex: 0 0 auto;
    color: var(--color-accent);
    font-size: 11px;
}

.next-lesson-summary-detail span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.next-lesson-summary-room {
    border-color: var(--tg-theme-button-color, #3b82f6);
    background: var(--tg-theme-button-color, #3b82f6);
    color: var(--tg-theme-button-text-color, #ffffff);
    box-shadow:
        inset 0 0 0 1px rgba(255, 255, 255, 0.14),
        0 6px 14px rgba(59, 130, 246, 0.22);
}

.next-lesson-summary-room i {
    color: var(--tg-theme-button-text-color, #ffffff);
    font-size: 12px;
}

.next-lesson-summary-room span {
    color: var(--tg-theme-button-text-color, #ffffff);
    font-weight: 800;
    letter-spacing: 0.01em;
}

.next-lesson-summary-detail.status {
    grid-column: 1 / -1;
    font-weight: 600;
    font-size: 12px;
    color: var(--color-text);
    background: rgba(59, 130, 246, 0.12);
}

.next-lesson-summary-detail.status span {
    white-space: normal;
}

.next-lesson-summary-empty {
    margin-top: 2px;
    display: grid;
    grid-template-columns: 24px minmax(0, 1fr);
    column-gap: 8px;
    row-gap: 2px;
    align-items: start;
    padding: 0;
    border: none;
    background: transparent;
}

.next-lesson-summary-empty-icon {
    width: 24px;
    height: 24px;
    border-radius: 7px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(59, 130, 246, 0.12);
    color: var(--color-accent);
    font-size: 12px;
    grid-column: 1;
    grid-row: 1 / span 2;
}

.next-lesson-summary-empty-heading {
    font-size: 13px;
    font-weight: 700;
    line-height: 1.2;
    color: var(--color-text);
    grid-column: 2;
}

.next-lesson-summary-empty-text {
    font-size: 11px;
    line-height: 1.3;
    color: var(--color-muted);
    grid-column: 2;
}

.next-lesson-summary-action {
    min-height: 28px;
    margin-top: 3px;
    padding: 0 10px;
    border: 1px solid rgba(59, 130, 246, 0.18);
    border-radius: 999px;
    background: rgba(59, 130, 246, 0.12);
    color: var(--color-text);
    font-size: 11px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    width: fit-content;
    max-width: 100%;
    grid-column: 2;
    transition:
        transform var(--motion-fast) var(--ease-standard),
        box-shadow var(--motion-fast) var(--ease-standard),
        opacity var(--motion-fast) var(--ease-standard);
    box-shadow: none;
}

.next-lesson-summary-action:active {
    transform: scale(0.98);
}

.next-lesson-summary-action[hidden] {
    display: none;
}

.schedule-content.list-view {
    padding: 0 0 var(--page-bottom-offset);
}

.schedule-content.list-view .day-section .date-header {
    position: static;
    background: var(--color-bg);
    margin: 0 -16px 10px;
    padding: 12px 16px 10px;
    border-bottom: 1px solid var(--color-border);
    box-shadow: none;
}

.list-sticky-day-header {
    position: fixed;
    left: 0;
    right: 0;
    top: var(--sticky-header-height);
    z-index: 9;
    padding: 12px 16px 10px;
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-border);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.08);
    color: var(--color-muted);
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    opacity: 0;
    transform: translateY(-6px);
    pointer-events: none;
    transition:
        opacity var(--motion-fast) var(--ease-standard),
        transform var(--motion-fast) var(--ease-standard);
}

.list-sticky-day-header.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.schedule-content.list-view .day-section {
    padding: 0 16px 16px;
    background: var(--tg-theme-bg-color);
}

.schedule-content.list-view .day-section:last-child {
    padding-bottom: 8px;
}

.schedule-content.list-view .lesson-card {
    margin-top: 8px;
    margin-bottom: 12px;
}

.schedule-content.list-view .lesson-card:last-child {
    margin-bottom: 0;
}

.schedule-content.list-view .day-section .lesson-card:first-child,
.schedule-content.list-view .day-section .status-card:first-child {
    margin-top: 0;
}

.schedule-content.list-view .day-empty {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px dashed var(--color-border);
    background: rgba(148, 163, 184, 0.08);
    color: var(--color-muted);
}

.schedule-content.list-view .day-empty i {
    flex: 0 0 auto;
    font-size: 14px;
    color: var(--color-accent);
}

.schedule-content.list-view .day-empty-text {
    font-size: 13px;
    line-height: 1.35;
}

.day-section {
    padding: 16px;
    border-bottom: 2px solid var(--tg-theme-section-separator-color, #e4e4e7);
}

.day-section:last-child {
    border-bottom: none;
}

.day-section[data-today="true"] .date-header {
    color: var(--tg-theme-link-color, #3b82f6);
    font-weight: 700;
}

.date-header {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--color-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}


.lesson-info {
    font-size: 16px;
    line-height: 1.5;
    color: var(--tg-theme-text-color, #000000);
}

.lesson-subject {
    font-weight: 600;
    color: var(--tg-theme-text-color, #000000);
    font-size: 15px;
    margin-bottom: 6px;
}

.lesson-room-number {
    color: var(--tg-theme-link-color, #3b82f6);
    font-weight: 600;
}

.no-lessons {
    text-align: center;
    padding: 40px 20px;
    color: var(--tg-theme-hint-color, #71717a);
    font-size: 16px;
}

.loading {
    text-align: center;
    padding: 40px 20px;
    color: var(--tg-theme-hint-color, #71717a);
    font-size: 16px;
}

/* Скелетон-загрузка */
.skeleton-container {
    padding: 0;
}

.skeleton-card {
    background: var(--color-surface, #f4f4f5);
    border-radius: 12px;
    padding: 14px;
    margin-bottom: 12px;
}

.skeleton-line {
    background: linear-gradient(90deg,
            var(--tg-theme-hint-color, #e4e4e7) 25%,
            var(--tg-theme-secondary-bg-color, #f4f4f5) 50%,
            var(--tg-theme-hint-color, #e4e4e7) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 4px;
    opacity: 0.3;
}

.skeleton-time {
    width: 100px;
    height: 18px;
    margin-bottom: 10px;
}

.skeleton-subject {
    width: 85%;
    height: 16px;
    margin-bottom: 8px;
}

.skeleton-room {
    width: 60%;
    height: 14px;
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

.error {
    text-align: center;
    padding: 20px;
    color: #f87171;
    font-size: 16px;
    background: rgba(239, 68, 68, 0.15);
    border-radius: 8px;
    margin: 16px;
}

.separator {
    height: 1px;
    background: var(--tg-theme-section-separator-color, #e4e4e7);
    margin: 16px 0;
}

/* Экран выбора группы */
.group-select-screen {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    height: 100vh;
    height: 100dvh;
    background: var(--color-bg, #ffffff);
    z-index: 1000;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    opacity: 0;
}

.group-select-screen.show {
    display: block;
    opacity: 1;
}

.group-select-content {
    width: min(100%, 640px);
    height: 100%;
    min-height: 100%;
    padding: 16px 16px calc(28px + var(--screen-bottom-inset));
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    background: var(--color-bg, #ffffff);
}

.group-select-top {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr);
    gap: 12px;
    align-items: start;
    padding: 2px 0 16px;
    margin-bottom: 14px;
    border-bottom: 1px solid var(--color-border);
}

.group-select-screen-primary .group-select-top {
    grid-template-columns: minmax(0, 1fr);
}

.group-select-heading {
    min-width: 0;
}

.group-select-pill {
    margin-bottom: 8px;
}

.screen-subtitle {
    margin: 6px 0 0;
    color: var(--color-muted);
    font-size: 13px;
    line-height: 1.45;
}

.group-select-back {
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 8px;
    background: var(--color-surface);
    color: var(--color-accent);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition:
        transform var(--motion-fast) var(--ease-standard),
        border-color var(--motion-fast) var(--ease-standard),
        background var(--motion-fast) var(--ease-standard);
}

.group-select-back[hidden] {
    display: none;
}

.group-select-back:active {
    transform: scale(0.98);
}

.group-select-title {
    margin: 0;
    color: var(--color-text);
    font-size: 24px;
    font-weight: 800;
    line-height: 1.15;
    word-break: break-word;
}

.install-logo {
    font-size: 64px;
    text-align: center;
    margin-bottom: 16px;
    color: var(--tg-theme-link-color);
}

.install-logo i {
    display: inline-block;
}

.install-title {
    font-size: 24px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 8px;
    color: var(--tg-theme-text-color, #000000);
}

.install-subtitle {
    font-size: 16px;
    text-align: center;
    color: var(--tg-theme-hint-color, #71717a);
    margin-bottom: 32px;
}

.search-container {
    margin-bottom: 16px;
    position: relative;
}

.group-select-search-row {
    position: sticky;
    top: 0;
    z-index: 2;
    margin: 0 0 12px;
    padding-bottom: 4px;
    background: var(--color-bg, #ffffff);
}


.search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--tg-theme-hint-color);
    font-size: 16px;
}

.group-search {
    width: 100%;
    padding: 14px 16px 14px 44px;
    font-size: 16px;
    border: 2px solid var(--tg-theme-section-separator-color);
    border-radius: 8px;
    background: var(--tg-theme-secondary-bg-color);
    color: var(--tg-theme-text-color);
    outline: none;
    transition: border-color 0.2s;
}

.group-search:focus {
    border-color: var(--tg-theme-button-color);
}

.group-search::placeholder {
    color: var(--tg-theme-hint-color);
}

.group-list {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 2px 0;
}

.group-item {
    display: grid;
    grid-template-columns: 46px 3px minmax(0, 1fr) 28px;
    align-items: center;
    gap: 12px;
    min-height: 76px;
    padding: 14px;
    background: var(--tg-theme-secondary-bg-color);
    width: 100%;
    border-radius: 8px;
    margin-bottom: 12px;
    cursor: pointer;
    transition:
        background var(--motion-fast) var(--ease-standard),
        border-color var(--motion-fast) var(--ease-standard),
        box-shadow var(--motion-fast) var(--ease-standard),
        transform var(--motion-fast) var(--ease-standard);
    color: var(--color-text);
    border: 1px solid transparent;
    box-shadow: var(--shadow-sm);
    text-align: left;
    font: inherit;
    appearance: none;
    -webkit-appearance: none;
}

.group-item:active {
    transform: scale(0.98);
}

.group-item:focus-visible {
    outline: 2px solid var(--tg-theme-button-color);
    outline-offset: 2px;
}

.group-item:hover {
    border-color: rgba(59, 130, 246, 0.5);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.group-item-icon {
    width: 46px;
    height: 46px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(59, 130, 246, 0.12);
    color: var(--tg-theme-button-color);
    font-size: 18px;
}

.group-item-divider {
    width: 3px;
    height: 48px;
    border-radius: 2px;
    background: linear-gradient(to bottom, var(--tg-theme-button-color), var(--tg-theme-link-color));
}

.group-item-content {
    min-width: 0;
}

.group-item-name {
    color: var(--color-text);
    font-size: 16px;
    font-weight: 800;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.group-item-hint {
    margin-top: 4px;
    color: var(--color-muted);
    font-size: 12px;
    font-weight: 500;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.group-item-action {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--color-muted);
    background: rgba(148, 163, 184, 0.12);
    font-size: 12px;
}

.no-groups {
    text-align: center;
    padding: 18px 16px;
    color: var(--color-muted);
    font-size: 14px;
    line-height: 1.45;
    background: rgba(148, 163, 184, 0.08);
    border: 1px dashed var(--color-border);
    border-radius: 8px;
}

/* Кнопка преподавателя */
.teacher-btn {
    flex: 0 0 auto !important;
    width: 44px;
    padding: 8px !important;
}

.teacher-btn i {
    font-size: 16px;
}

/* Модальное окно преподавателя */
.teacher-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    height: 100vh;
    height: 100dvh;
    max-height: 100vh;
    max-height: 100dvh;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1000;
    align-items: flex-end;
    justify-content: center;
    overflow: hidden;
    opacity: 0;
}

.teacher-modal.show {
    display: flex;
    opacity: 1;
}

.teacher-modal.closing {
    display: flex;
    pointer-events: none;
}

.teacher-modal-content {
    background: var(--tg-theme-bg-color);
    border-radius: 16px 16px 0 0;
    width: 100%;
    height: 85vh;
    height: 85dvh;
    padding: 20px;
    padding-top: 16px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    will-change: transform, opacity;
}

.modal-search-row {
    flex-shrink: 0;
    margin-bottom: 12px;
}

.modal-search-row .search-container {
    margin-bottom: 0;
}

.modal-results-wrap {
    flex: 1 1 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal-results-wrap .teacher-modal-header,
.modal-results-wrap .room-tabs {
    flex-shrink: 0;
}

.modal-list-scroll {
    flex: 1 1 0;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.modal-results-wrap .teacher-list,
.modal-results-wrap .room-list {
    max-height: none;
    overflow-y: visible;
}

.teacher-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.teacher-modal-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--tg-theme-text-color);
}

.teacher-modal-header h3 i {
    margin-right: 8px;
    color: var(--tg-theme-link-color);
}

.teacher-modal-close {
    background: var(--tg-theme-secondary-bg-color);
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--tg-theme-hint-color);
    font-size: 16px;
}

.teacher-list {
    max-height: 50vh;
    max-height: 50dvh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    flex: 1;
    min-height: 0;
}

.teacher-item {
    padding: var(--space-3) var(--space-4);
    background: var(--tg-theme-secondary-bg-color);
    border-radius: 10px;
    margin-bottom: 8px;
    cursor: pointer;
    transition:
        background var(--motion-fast) var(--ease-standard),
        border-color var(--motion-fast) var(--ease-standard),
        transform var(--motion-fast) var(--ease-standard);
    border: 1px solid transparent;
}

.teacher-item:active {
    transform: scale(0.98);
}

.teacher-item:hover {
    background: var(--tg-theme-button-color);
}

.teacher-item:hover .teacher-name,
.teacher-item:hover .teacher-subjects {
    color: var(--tg-theme-button-text-color);
}

.teacher-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--tg-theme-text-color);
    margin-bottom: 4px;
}

.teacher-subjects {
    font-size: 12px;
    color: var(--tg-theme-hint-color);
}

.search-modal-content {
    height: 88vh;
    height: 88dvh;
    background:
        radial-gradient(circle at 10% 0%, rgba(59, 130, 246, 0.16) 0%, rgba(59, 130, 246, 0) 35%),
        var(--tg-theme-bg-color);
}

.search-switch {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    flex-shrink: 0;
}

.search-switch-btn {
    flex: 1;
    min-height: 44px;
    border: 1px solid var(--color-border);
    border-radius: 10px;
    background: var(--color-surface);
    color: var(--color-text);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--motion-fast) ease;
    padding: 0 8px;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.search-switch-btn.active {
    background: var(--color-accent);
    border-color: var(--color-accent);
    color: var(--color-accent-text);
}

.search-mode-switch {
    margin-bottom: 14px;
}

.search-mode-btn {
    border-radius: 12px;
    min-height: 46px;
}

.search-mode-btn i {
    width: 16px;
    text-align: center;
    color: var(--color-accent);
    transition: color var(--motion-fast) ease;
}

.search-mode-btn.active i {
    color: var(--color-accent-text);
}

.unified-search-row.hidden {
    display: none;
}

.search-mode-stage {
    position: relative;
    flex: 1 1 0;
    min-height: 0;
    overflow: hidden;
}

.search-mode-empty {
    height: 100%;
    border: 1px dashed var(--color-border);
    border-radius: 14px;
    padding: 24px 18px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--color-muted);
    background: rgba(148, 163, 184, 0.08);
}

.search-mode-empty.hidden {
    display: none;
}

.search-mode-empty-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
    color: var(--color-accent);
    background: rgba(59, 130, 246, 0.18);
    font-size: 20px;
}

.search-mode-empty-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--tg-theme-text-color);
    margin-bottom: 6px;
}

.search-mode-empty-text {
    font-size: 13px;
    line-height: 1.4;
    max-width: 260px;
}

.search-quick-actions {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 18px;
}

.search-quick-action {
    border: 1px solid var(--color-border);
    border-radius: 14px;
    background: var(--color-surface);
    color: var(--color-text);
    padding: 14px 12px;
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 6px;
    cursor: pointer;
}

.search-quick-action i {
    color: var(--color-accent);
    font-size: 16px;
}

.search-quick-action-title {
    font-size: 14px;
    font-weight: 700;
}

.search-quick-action-text {
    font-size: 12px;
    color: var(--color-muted);
    line-height: 1.35;
}

.search-hint {
    margin-bottom: 12px;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid var(--color-border);
    background: rgba(148, 163, 184, 0.08);
    font-size: 12px;
    line-height: 1.45;
    color: var(--color-muted);
}

.search-pane {
    position: absolute;
    inset: 0;
    display: none;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    opacity: 0;
}

.search-pane.active {
    display: flex;
    opacity: 1;
}

.search-pane.slide-out-left {
    animation: searchSlideOutLeft 0.18s var(--ease-accelerate) forwards;
}

.search-pane.slide-out-right {
    animation: searchSlideOutRight 0.18s var(--ease-accelerate) forwards;
}

.search-pane.slide-in-left {
    animation: searchSlideInLeft 0.22s var(--ease-decelerate) forwards;
}

.search-pane.slide-in-right {
    animation: searchSlideInRight 0.22s var(--ease-decelerate) forwards;
}

@keyframes searchSlideOutLeft {
    from {
        opacity: 1;
        transform: translateX(0);
    }

    to {
        opacity: 0;
        transform: translateX(-20px);
    }
}

@keyframes searchSlideOutRight {
    from {
        opacity: 1;
        transform: translateX(0);
    }

    to {
        opacity: 0;
        transform: translateX(20px);
    }
}

@keyframes searchSlideInLeft {
    from {
        opacity: 0;
        transform: translateX(20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes searchSlideInRight {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Режим преподавателя в шапке */
.teacher-mode-info {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex-wrap: nowrap;
}

.teacher-mode-badge {
    background: var(--tg-theme-button-color);
    color: var(--tg-theme-button-text-color);
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    flex: 0 0 auto;
    max-width: 130px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.back-to-group {
    background: none;
    border: none;
    color: var(--tg-theme-link-color);
    font-size: 12px;
    cursor: pointer;
    padding: 2px 0;
    line-height: 1.2;
    flex: 1 1 auto;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: left;
}

/* Модальное окно аудиторий */
.room-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    height: 100vh;
    height: 100dvh;
    max-height: 100vh;
    max-height: 100dvh;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1000;
    align-items: flex-end;
    justify-content: center;
    overflow: hidden;
    opacity: 0;
}

.room-modal.show {
    display: flex;
    opacity: 1;
}

.room-modal.closing {
    display: flex;
    pointer-events: none;
}

.room-modal-content {
    background: var(--tg-theme-bg-color);
    border-radius: 16px 16px 0 0;
    width: 100%;
    height: 85vh;
    height: 85dvh;
    padding: 20px;
    padding-top: 16px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    will-change: transform, opacity;
}


.room-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.room-tab {
    flex: 1;
    min-height: 44px;
    padding: 10px;
    border: none;
    background: var(--tg-theme-secondary-bg-color);
    color: var(--tg-theme-text-color);
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.room-tab.active {
    background: var(--tg-theme-button-color);
    color: var(--tg-theme-button-text-color);
}

.room-search-content {
    display: none;
}

.room-search-content.active {
    display: block;
}

.room-item {
    padding: var(--space-3) var(--space-4);
    background: var(--tg-theme-secondary-bg-color);
    border-radius: 10px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}

.room-item:active {
    transform: scale(0.98);
}

.room-item:hover {
    background: var(--tg-theme-button-color);
}

.room-item:hover .room-name,
.room-item:hover .room-info {
    color: var(--tg-theme-button-text-color);
}

.room-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--tg-theme-text-color);
    margin-bottom: 4px;
}

.room-info {
    font-size: 12px;
    color: var(--tg-theme-hint-color);
}

.room-list {
    max-height: 50vh;
    max-height: 50dvh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    flex: 1;
    min-height: 0;
}

.free-room-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.free-room-badge {
    background: #22c55e;
    color: white;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
}

.time-select-group {
    margin-bottom: 16px;
}

.time-select-label {
    font-size: 13px;
    color: var(--tg-theme-hint-color);
    margin-bottom: 8px;
    display: block;
}

.time-select {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--tg-theme-secondary-bg-color);
    border-radius: 8px;
    background: var(--tg-theme-secondary-bg-color);
    color: var(--tg-theme-text-color);
    font-size: 16px;
}

/* Модальное окно настроек */
.settings-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    height: 100vh;
    height: 100dvh;
    max-height: 100vh;
    max-height: 100dvh;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1000;
    align-items: flex-end;
    justify-content: center;
    overflow: hidden;
    opacity: 0;
}

.settings-modal.show {
    display: flex;
    opacity: 1;
}

.settings-modal.closing {
    display: flex;
    pointer-events: none;
}

.settings-modal-content {
    background: var(--tg-theme-bg-color);
    border-radius: 16px 16px 0 0;
    width: 100%;
    max-height: 70vh;
    max-height: 70dvh;
    padding: 20px;
    will-change: transform, opacity;
}

.settings-section {
    margin-bottom: 20px;
}

.settings-section-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--tg-theme-hint-color);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

.settings-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-3) var(--space-4);
    background: var(--tg-theme-secondary-bg-color);
    border-radius: 10px;
    margin-bottom: 8px;
}

button.settings-item {
    width: 100%;
    border: none;
    text-align: left;
    cursor: pointer;
}

.settings-item-label {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 15px;
    color: var(--tg-theme-text-color);
}

.settings-item-label i {
    color: var(--tg-theme-link-color);
    width: 20px;
    text-align: center;
}

/* Toggle switch */
.toggle-switch {
    position: relative;
    width: 50px;
    height: 28px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #52525b;
    transition: 0.3s;
    border-radius: 28px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

input:checked+.toggle-slider {
    background-color: var(--tg-theme-button-color);
}

input:checked+.toggle-slider:before {
    transform: translateX(22px);
}

/* Светлая тема */
.light-theme {
    --tg-theme-bg-color: #f4f7fb;
    --tg-theme-text-color: #0b1220;
    --tg-theme-hint-color: #5f6f84;
    --tg-theme-link-color: #1d4ed8;
    --tg-theme-button-color: #0f766e;
    --tg-theme-button-text-color: #ffffff;
    --tg-theme-secondary-bg-color: #ffffff;
    --tg-theme-section-separator-color: #d3deea;
    --color-bg: #f4f7fb;
    --color-surface: #ffffff;
    --color-text: #0b1220;
    --color-muted: #5f6f84;
    --color-border: #d3deea;
    --color-accent: #0f766e;
    --color-accent-text: #ffffff;
    --shadow-sm: 0 2px 10px rgba(15, 23, 42, 0.08);
    --shadow-md: 0 10px 28px rgba(15, 23, 42, 0.10);
    color-scheme: light;
}

.light-theme .toggle-slider {
    background-color: #d4d4d8;
}

.light-theme .lesson-card.past {
    opacity: 0.72;
}

.light-theme .sticky-header {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--color-bg, #ffffff);
    transition: background var(--motion-fast) var(--ease-standard);
}

.light-theme .header {
    background: var(--color-bg, #ffffff);
}

.light-theme .schedule-controls {
    margin-top: 10px;
}

.light-theme .bottom-toolbar-shell {
    background: linear-gradient(180deg, rgba(248, 250, 252, 0) 0%, rgba(248, 250, 252, 0.76) 32%, rgba(248, 250, 252, 0.98) 100%);
}

.light-theme .bottom-toolbar {
    background: rgba(255, 255, 255, 0.94);
    border-color: #d6dde6;
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.10);
}

.light-theme .view-btn:not(.active),
.light-theme .day-btn:not(.active),
.light-theme .view-btn.icon-btn-sm,
.light-theme .search-mode-btn {
    background: #ffffff;
    border: 1px solid var(--tg-theme-section-separator-color);
    color: var(--tg-theme-text-color);
}

.light-theme .bottom-toolbar-btn {
    color: #607284;
}

.light-theme .view-btn.active,
.light-theme .room-tab.active,
.light-theme .search-switch-btn.active {
    box-shadow: 0 4px 12px rgba(15, 118, 110, 0.22);
}

.light-theme .bottom-toolbar-btn.active {
    background: rgba(37, 99, 235, 0.12);
    color: #1d4ed8;
    box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.14);
}

.light-theme .day-btn.active {
    box-shadow: none;
    background: rgba(37, 99, 235, 0.12);
    border-color: rgba(37, 99, 235, 0.24);
}

.light-theme .next-lesson-summary,
.light-theme .lesson-card,
.light-theme .no-lessons {
    border: 1px solid var(--tg-theme-section-separator-color);
    box-shadow: var(--shadow-sm);
}

.light-theme .no-lessons {
    border-radius: var(--radius-md);
    background: #ffffff;
}

.light-theme .teacher-modal-content,
.light-theme .room-modal-content,
.light-theme .settings-modal-content,
.light-theme .help-content,
.light-theme .update-modal-content {
    background: #ffffff;
    border: 1px solid var(--tg-theme-section-separator-color);
}

.light-theme .search-modal-content {
    background:
        radial-gradient(circle at 10% 0%, rgba(15, 118, 110, 0.14) 0%, rgba(15, 118, 110, 0) 34%),
        #ffffff;
}

.light-theme .group-search,
.light-theme .time-select {
    background: #f8fbff;
    border-color: var(--tg-theme-section-separator-color);
    color: var(--tg-theme-text-color);
}

.light-theme .group-search::placeholder {
    color: #7b8ca4;
}

.light-theme .teacher-modal-close {
    background: #f1f5f9;
    color: #334155;
    border: 1px solid var(--tg-theme-section-separator-color);
}

.light-theme .teacher-item,
.light-theme .room-item,
.light-theme .group-item,
.light-theme .settings-item {
    background: #ffffff;
    border: 1px solid var(--tg-theme-section-separator-color);
}

.light-theme .room-tab:not(.active),
.light-theme .search-switch-btn:not(.active) {
    background: #f8fbff;
    border: 1px solid var(--tg-theme-section-separator-color);
    color: var(--tg-theme-text-color);
}

.light-theme .teacher-item:hover,
.light-theme .room-item:hover,
.light-theme .group-item:hover {
    background: #eaf3ff;
    border-color: #bfdbfe;
}

.light-theme .teacher-item:hover .teacher-name,
.light-theme .room-item:hover .room-name,
.light-theme .group-item:hover {
    color: var(--tg-theme-text-color);
}

.light-theme .teacher-item:hover .teacher-subjects,
.light-theme .room-item:hover .room-info,
.light-theme .group-item:hover .group-item-hint {
    color: var(--tg-theme-hint-color);
}

.light-theme .teacher-modal,
.light-theme .room-modal,
.light-theme .search-modal,
.light-theme .settings-modal,
.light-theme .help-modal,
.light-theme .update-modal {
    background: rgba(15, 23, 42, 0.35);
}

.light-theme .search-mode-empty {
    border-color: #c6d7eb;
    background: #f8fbff;
    color: #5f6f84;
}

.light-theme .search-mode-empty-icon {
    background: #e4f1ff;
    color: #0f766e;
}

.light-theme .offline-banner {
    border-bottom-color: var(--tg-theme-section-separator-color);
}

.light-theme .offline-banner[data-variant="offline"] {
    background: #fff7e6;
    color: #92400e;
}

.light-theme .offline-banner[data-variant="context"] {
    background: #eff6ff;
    color: #1d4ed8;
}

.light-theme .offline-banner[data-variant="warning"] {
    background: #fef2f2;
    color: #b91c1c;
}

.light-theme .date-header,
.light-theme .next-lesson-summary-subject {
    color: #0b1220;
}

.light-theme .next-lesson-summary-title {
    color: #5f6f84;
}

.light-theme .next-lesson-summary-detail {
    background: #f8fbff;
    border-color: #d3deea;
    color: #4f627a;
}

.light-theme .next-lesson-summary-room {
    background: #e8f5f3;
    border-color: #8fcfc7;
    color: #0b3f3a;
    box-shadow:
        inset 0 0 0 1px rgba(15, 118, 110, 0.12),
        0 6px 14px rgba(15, 118, 110, 0.12);
}

.light-theme .next-lesson-summary-room i,
.light-theme .next-lesson-summary-room span {
    color: #0f766e;
}

.light-theme .next-lesson-summary-detail.status {
    background: #e8f5f3;
    border-color: #b8ddd8;
    color: #0f4f49;
}

.light-theme .next-lesson-summary-empty {
    background: transparent;
}

.light-theme .next-lesson-summary-empty-icon {
    background: #eaf1f8;
    color: #1d4ed8;
}

.light-theme .next-lesson-summary-empty-heading {
    color: #0b1220;
}

.light-theme .next-lesson-summary-empty-text {
    color: #5f6f84;
}

.light-theme .next-lesson-summary-action {
    border-color: rgba(37, 99, 235, 0.18);
    background: rgba(37, 99, 235, 0.1);
    color: #0b1220;
    box-shadow: none;
}

/* Анимации переходов */
.schedule-content {
    position: relative;
    overflow: hidden;
    min-height: calc(100vh - 240px);
    touch-action: pan-y;
    background: var(--tg-theme-bg-color);
}

#scheduleContainer {
    will-change: transform, opacity;
    background: var(--tg-theme-bg-color);
}

#scheduleContainer.slide-out-left {
    animation: slideOutLeft 180ms var(--ease-accelerate) forwards;
}

#scheduleContainer.slide-out-right {
    animation: slideOutRight 180ms var(--ease-accelerate) forwards;
}

#scheduleContainer.slide-in-left {
    animation: slideInLeft 240ms var(--ease-decelerate) forwards;
}

#scheduleContainer.slide-in-right {
    animation: slideInRight 240ms var(--ease-decelerate) forwards;
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translate3d(var(--motion-enter-x), 0, 0);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translate3d(calc(var(--motion-enter-x) * -1), 0, 0);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideOutLeft {
    from {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }

    to {
        opacity: 0;
        transform: translate3d(calc(var(--motion-exit-x) * -1), 0, 0);
    }
}

@keyframes slideOutRight {
    from {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }

    to {
        opacity: 0;
        transform: translate3d(var(--motion-exit-x), 0, 0);
    }
}

/* Новый дизайн карточек */
.lesson-card {
    background: var(--tg-theme-secondary-bg-color);
    border-radius: 14px;
    padding: var(--space-3) var(--space-4);
    padding-top: 18px;
    margin-bottom: 16px;
    margin-top: 10px;
    display: flex;
    align-items: center;
    gap: 14px;
    position: relative;
    opacity: 1;
    box-shadow: var(--shadow-sm);
}

.lesson-card.current {
    background: linear-gradient(135deg, #1e3a5f 0%, var(--tg-theme-secondary-bg-color) 100%);
    box-shadow: 0 0 0 2px var(--tg-theme-button-color);
}

.lesson-card.soon {
    box-shadow: 0 0 0 1px rgba(251, 191, 36, 0.6);
}

.lesson-card.past {
    opacity: 0.66;
}

.lesson-card.has-subgroups {
    flex-direction: column;
    align-items: stretch;
}

.lesson-card.window-card {
    background: var(--tg-theme-secondary-bg-color);
    padding-top: 12px;
    padding-bottom: 12px;
    min-height: 0;
}

.lesson-card.window-card .pair-num,
.lesson-card.window-card .lesson-subject,
.lesson-card.window-card .info-row,
.lesson-card.window-card .time-range {
    color: var(--tg-theme-hint-color);
}

.lesson-card.lunch-card .pair-num {
    font-size: 18px;
    letter-spacing: 0.02em;
}

.lesson-card.window-card .divider {
    background: linear-gradient(to bottom, rgba(120, 120, 125, 0.9), rgba(92, 92, 96, 0.7));
}

.lesson-card.window-card .info-row i {
    color: rgba(148, 163, 184, 0.88);
}

.lesson-card.window-card .lesson-subject {
    margin-bottom: 0;
}

.lesson-card .time-block {
    text-align: center;
    min-width: 50px;
    flex-shrink: 0;
}

.lesson-card .pair-num {
    font-size: 24px;
    font-weight: 800;
    color: var(--tg-theme-button-color);
    line-height: 1;
}

.lesson-card .time-range {
    font-size: 10px;
    color: var(--tg-theme-hint-color);
    margin-top: 2px;
}

.lesson-card .divider {
    width: 3px;
    min-height: 45px;
    align-self: stretch;
    background: linear-gradient(to bottom, var(--tg-theme-button-color), var(--tg-theme-link-color));
    border-radius: 2px;
    flex-shrink: 0;
}

.lesson-card .card-content {
    flex: 1;
    min-width: 0;
}

.lesson-card.single-subgroup-layout .subgroups-vertical {
    margin-top: 10px;
    padding-top: 10px;
    gap: 8px;
}

.lesson-card.single-subgroup-layout .subgroup-card {
    background: var(--tg-theme-bg-color);
    padding: 10px 11px;
}

.lesson-card .card-header {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
}

.lesson-card .lesson-subject {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 6px;
    line-height: 1.3;
    color: var(--tg-theme-text-color);
}

.lesson-card .info-details {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.lesson-card .info-row {
    font-size: 12px;
    color: var(--tg-theme-hint-color);
    display: flex;
    align-items: center;
    gap: 6px;
}

.lesson-card .info-row i {
    width: 14px;
    color: var(--tg-theme-button-color);
    font-size: 11px;
}

.lesson-card .room-badge {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--tg-theme-button-color);
    color: var(--tg-theme-button-text-color);
    padding: 4px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
    z-index: 1;
}

/* Подгруппы */
.lesson-card .subgroups-vertical {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px dashed var(--tg-theme-hint-color);
}

.lesson-card .subgroup-card {
    background: var(--tg-theme-bg-color);
    border-radius: 10px;
    padding: 12px;
    border-left: 3px solid var(--tg-theme-button-color);
}

.lesson-card .subgroup-card:nth-child(2) {
    border-left-color: #22c55e;
}

.lesson-card .subgroup-card.green {
    border-left-color: #22c55e;
}

.lesson-card .subgroup-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.lesson-card .subgroup-badge {
    width: 22px;
    height: 22px;
    background: var(--tg-theme-button-color);
    color: var(--tg-theme-button-text-color);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
}

.lesson-card .subgroup-badge.green {
    background: #22c55e;
}

.lesson-card .subgroup-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--tg-theme-text-color);
}

.lesson-card .subgroup-details {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.lesson-card .subgroup-badge-inline {
    font-size: 12px;
    color: var(--tg-theme-hint-color, #6b7280);
    font-weight: 600;
    margin-left: 4px;
}

.lesson-card .room-inline {
    background: var(--tg-theme-button-color);
    color: var(--tg-theme-button-text-color);
    padding: 2px 8px;
    border-radius: 5px;
    font-size: 12px;
    font-weight: 600;
}

.lesson-card .room-inline.green {
    background: #22c55e;
}


@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUpPast {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 0.5;
        transform: translateY(0);
    }
}

/* Светлая тема для карточек */
.light-theme .lesson-card.current {
    background: linear-gradient(135deg, #e6f6f3 0%, #ffffff 58%);
    border-color: #0f766e;
    box-shadow: 0 0 0 1px rgba(15, 118, 110, 0.2), var(--shadow-sm);
}

.light-theme .lesson-card.soon {
    box-shadow: 0 0 0 1px rgba(217, 119, 6, 0.45), var(--shadow-sm);
}

.light-theme .lesson-card.window-card {
    background: var(--tg-theme-secondary-bg-color);
}

.light-theme .lesson-card .subgroups-vertical {
    border-top-color: #d4d4d8;
}

.light-theme .lesson-card.single-subgroup-layout .subgroup-card {
    background: var(--tg-theme-bg-color);
}

.light-theme .context-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    width: fit-content;
    max-width: 100%;
    padding: 3px 7px;
    border-radius: 999px;
    background: rgba(59, 130, 246, 0.14);
    color: var(--color-accent);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.light-theme .mode-banner {
    background: #eef8f6;
    border-bottom-color: var(--tg-theme-section-separator-color);
}

.light-theme .mode-banner-action {
    background: rgba(15, 118, 110, 0.12);
    border-color: rgba(15, 118, 110, 0.22);
}

.light-theme .search-quick-action,
.light-theme .search-hint {
    background: #ffffff;
    border-color: var(--tg-theme-section-separator-color);
}

.light-theme .group-select-screen,
.light-theme .download-screen {
    background: var(--tg-theme-bg-color);
    color: var(--tg-theme-text-color);
}

.light-theme .group-select-back,
.light-theme .download-info,
.light-theme .status-card,
.light-theme .action-toast,
.light-theme .update-toast,
.light-theme .download-btn-secondary {
    background: #ffffff;
    border: 1px solid var(--tg-theme-section-separator-color);
    color: var(--tg-theme-text-color);
}

.light-theme .download-progress {
    background: #dbe6f2;
}

.light-theme .download-screen .push-toggle-row {
    border-top-color: var(--tg-theme-section-separator-color);
}

/* Экран скачивания расписания */
.download-screen {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--color-bg, #ffffff);
    z-index: 1100;
    overflow-y: auto;
    opacity: 0;
}

.download-screen.show {
    display: block;
    opacity: 1;
}

.download-screen-content {
    padding: 40px 24px;
    max-width: 400px;
    margin: 0 auto;
}

.download-info {
    background: var(--color-surface, #f4f4f5);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 20px;
}

.download-info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    color: var(--tg-theme-text-color);
    padding: 6px 0;
}

.download-info-item span:first-child {
    color: var(--tg-theme-hint-color, #71717a);
}

.download-progress {
    width: 100%;
    height: 6px;
    background: var(--tg-theme-secondary-bg-color, #e4e4e7);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 20px;
    transform-origin: top;
    will-change: transform, opacity;
}

.download-progress-bar {
    height: 100%;
    background: var(--tg-theme-button-color, #3b82f6);
    border-radius: 3px;
    width: 0%;
    transition: width 0.3s var(--ease-standard);
}

.download-btn {
    width: 100%;
    padding: 14px;
    background: var(--tg-theme-button-color, #3b82f6);
    color: var(--tg-theme-button-text-color, #ffffff);
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.download-btn:active {
    transform: scale(0.98);
}

.download-btn-secondary {
    background: var(--color-surface, #f4f4f5);
    color: var(--tg-theme-text-color, #000000);
}

.download-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Переключатель уведомлений в экране скачивания */
.download-screen .push-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    margin: 16px 0 0;
    padding: 16px 0;
    border-top: 1px solid var(--tg-theme-section-separator-color, #e4e4e7);
}

.download-screen .push-toggle-row .push-toggle-label {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 15px;
    color: var(--tg-theme-text-color);
    flex: 1;
    min-width: 0;
}

.download-screen .push-toggle-row .push-toggle-label i {
    color: var(--tg-theme-link-color);
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

.download-screen .push-toggle-row .toggle-switch {
    flex-shrink: 0;
}

.download-screen .push-status {
    font-size: 12px;
    color: var(--tg-theme-hint-color);
    margin: 4px 0 20px 0;
    padding: 0;
    text-align: left;
    line-height: 1.4;
}

/* Модалка обновления расписания */
.update-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1200;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
}

.update-modal.show {
    display: flex;
    opacity: 1;
}

.update-modal-content {
    background: var(--color-surface, #ffffff);
    border-radius: 16px;
    padding: 28px 24px;
    max-width: 320px;
    width: 100%;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    will-change: transform, opacity;
}

.update-icon {
    font-size: 48px;
    color: var(--tg-theme-link-color, #3b82f6);
    margin-bottom: 16px;
}

.update-modal-content h3 {
    margin: 0 0 8px 0;
    font-size: 18px;
    color: var(--tg-theme-text-color);
}

.update-modal-content p {
    margin: 0 0 20px 0;
    font-size: 16px;
    color: var(--tg-theme-hint-color, #71717a);
    line-height: 1.5;
}

/* Офлайн-баннер */
.offline-banner {
    text-align: left;
    padding: 7px 16px;
    font-size: 11px;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 6px;
    border-bottom: 1px solid var(--color-border);
    will-change: transform, opacity;
}

.offline-banner i {
    font-size: 11px;
    opacity: 0.9;
}

.offline-banner[data-variant="offline"] {
    background: rgba(245, 158, 11, 0.14);
    color: #fbbf24;
}

.offline-banner[data-variant="context"] {
    background: rgba(37, 99, 235, 0.14);
    color: #93c5fd;
}

.offline-banner[data-variant="warning"] {
    background: rgba(239, 68, 68, 0.14);
    color: #fca5a5;
}

.status-card {
    border: 1px solid var(--color-border);
    border-radius: 16px;
    padding: 18px 16px;
    background: var(--color-surface);
    text-align: center;
    color: var(--color-text);
    box-shadow: var(--shadow-sm);
}

.status-card i {
    font-size: 20px;
    margin-bottom: 10px;
    color: var(--color-accent);
}

.status-card-title {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 6px;
}

.status-card-text {
    font-size: 13px;
    color: var(--color-muted);
    line-height: 1.45;
}

.status-card.error i,
.status-card.error .status-card-title {
    color: #ef4444;
}

.status-card.success i {
    color: #22c55e;
}

.offline-banner.hidden {
    display: none;
}

.mode-banner {
    will-change: transform, opacity;
}

.list-load-more-wrap {
    padding: 12px 16px 20px;
}

.list-load-more-btn {
    width: 100%;
}

.update-toast {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: var(--floating-bottom-offset);
    z-index: 1200;
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px;
    border-radius: 12px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-md);
    will-change: transform, opacity;
}

.update-toast.show {
    display: flex;
}

.update-toast button {
    min-width: 120px;
}

.update-toast .view-btn {
    flex: 0 0 auto;
    min-height: 40px;
    padding: 8px 12px;
}

.action-toast {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: var(--floating-bottom-offset);
    z-index: 1250;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    color: var(--color-text);
    box-shadow: var(--shadow-md);
    display: none;
    align-items: center;
    gap: 10px;
    will-change: transform, opacity;
}

.action-toast.show {
    display: flex;
}

.action-toast i {
    color: var(--color-accent);
}

@media (min-width: 900px) {
    :root {
        --bottom-toolbar-height: 0px;
        --desktop-rail-width: min(920px, calc(100vw - 48px));
        --page-bottom-offset: 116px;
        --floating-bottom-offset: 104px;
    }

    body {
        background:
            linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0)),
            var(--tg-theme-bg-color);
    }

    .container {
        max-width: 100%;
        min-height: 100vh;
        padding: 28px 24px 128px;
        background: transparent;
    }

    .sticky-header {
        top: 16px;
        width: var(--desktop-rail-width);
        margin: 0 auto 18px;
        border: 1px solid var(--color-border);
        border-radius: 8px;
        overflow: hidden;
        box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
    }

    .header {
        padding: 20px 22px 18px;
    }

    .header-top {
        align-items: center;
        gap: 20px;
    }

    .context-pill {
        border-radius: 8px;
        padding: 5px 9px;
        font-size: 11px;
        letter-spacing: 0;
    }

    .context-title {
        font-size: 28px;
        line-height: 1.15;
        word-break: normal;
    }

    .context-subtitle {
        max-height: none;
        opacity: 1;
        transform: none;
        font-size: 14px;
        line-height: 1.35;
    }

    .view-btn.icon-btn-sm {
        width: 44px;
        min-width: 44px;
        min-height: 44px;
        height: 44px;
        border-radius: 8px;
    }

    .schedule-controls {
        margin-top: 18px;
    }

    .days-nav {
        display: grid;
        grid-template-columns: repeat(10, minmax(0, 1fr));
        gap: 8px;
        overflow-x: visible;
        padding-bottom: 0;
    }

    .day-btn {
        width: 100%;
        min-width: 0;
        min-height: 56px;
        border-radius: 8px;
        padding: 8px 12px;
    }

    .day-btn-label,
    .day-btn-date {
        letter-spacing: 0;
    }

    .day-btn-label {
        font-size: 11px;
    }

    .day-btn-date {
        font-size: 14px;
    }

    .schedule-content {
        width: var(--desktop-rail-width);
        max-width: none;
        min-height: auto;
        margin: 0 auto;
        padding: 0 0 var(--page-bottom-offset);
        overflow: visible;
    }

    .schedule-content.list-view {
        padding: 0 0 var(--page-bottom-offset);
    }

    .schedule-content.list-view .day-section {
        padding: 0 0 22px;
    }

    .schedule-content.list-view .day-section .date-header {
        margin: 0 0 14px;
        padding: 14px 0 10px;
        border-bottom: 1px solid var(--color-border);
    }

    .list-sticky-day-header {
        left: 50%;
        right: auto;
        width: var(--desktop-rail-width);
        transform: translate(-50%, -6px);
        padding: 12px 0 10px;
        background: var(--color-bg);
    }

    .list-sticky-day-header.is-visible {
        transform: translate(-50%, 0);
    }

    .next-lesson-summary {
        border-radius: 8px;
        padding: 18px 20px;
        margin-bottom: 18px;
    }

    .next-lesson-summary-title {
        letter-spacing: 0;
    }

    .next-lesson-summary-subject {
        font-size: 21px;
    }

    .next-lesson-summary-details {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .next-lesson-summary-detail.status {
        grid-column: auto;
    }

    .day-section {
        padding: 0;
        border-bottom: none;
    }

    .date-header {
        margin-bottom: 16px;
        font-size: 15px;
        letter-spacing: 0;
    }

    .lesson-card {
        border-radius: 8px;
        padding: 20px 22px;
        margin: 0 0 16px;
        gap: 20px;
    }

    .lesson-card .time-block {
        min-width: 92px;
    }

    .lesson-card .pair-num {
        font-size: 28px;
    }

    .lesson-card .time-range {
        font-size: 12px;
    }

    .lesson-card .divider {
        min-height: 54px;
    }

    .lesson-card .lesson-subject {
        font-size: 18px;
        line-height: 1.35;
    }

    .lesson-card .info-row {
        font-size: 14px;
    }

    .lesson-card .room-badge {
        position: static;
        transform: none;
        margin-left: auto;
        border-radius: 8px;
        padding: 6px 12px;
        box-shadow: none;
    }

    .lesson-card.has-subgroups .room-badge {
        margin-left: 0;
        width: fit-content;
    }

    .lesson-card .subgroups-vertical {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
    }

    .lesson-card.single-subgroup-layout .subgroups-vertical {
        display: flex;
    }

    .bottom-toolbar-shell {
        left: 50%;
        right: auto;
        bottom: 22px;
        width: var(--desktop-rail-width);
        padding: 0;
        transform: translateX(-50%);
        background: transparent;
    }

    .bottom-toolbar {
        border-radius: 8px;
        padding: 10px;
        gap: 10px;
        background: rgba(33, 33, 33, 0.94);
        box-shadow: 0 18px 42px rgba(0, 0, 0, 0.32);
    }

    .bottom-toolbar-btn {
        min-height: 66px;
        border-radius: 8px;
        font-size: 15px;
        flex-direction: row;
        gap: 10px;
    }

    .bottom-toolbar-btn i {
        font-size: 19px;
    }

    .bottom-toolbar-btn.active {
        box-shadow:
            inset 0 0 0 1px rgba(96, 165, 250, 0.22),
            0 8px 18px rgba(59, 130, 246, 0.12);
    }

    .teacher-modal,
    .settings-modal {
        align-items: center;
        padding: 24px;
    }

    .teacher-modal-content {
        width: min(760px, calc(100vw - 48px));
        height: min(760px, calc(100vh - 48px));
        border-radius: 8px;
        padding: 24px;
    }

    .search-modal-content {
        width: min(860px, calc(100vw - 48px));
        height: min(760px, calc(100vh - 48px));
    }

    .settings-modal-content {
        width: min(520px, calc(100vw - 48px));
        max-height: calc(100vh - 48px);
        border-radius: 8px;
        padding: 24px;
    }

    .teacher-modal-close,
    .group-select-back {
        border-radius: 8px;
    }

    .search-switch {
        gap: 10px;
    }

    .search-quick-actions {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .search-quick-action {
        border-radius: 8px;
    }

    .teacher-item,
    .room-item,
    .group-item,
    .settings-item,
    .status-card,
    .search-hint,
    .search-mode-empty {
        border-radius: 8px;
    }

    .group-select-screen,
    .download-screen {
        align-items: center;
        justify-content: center;
        background: rgba(0, 0, 0, 0.55);
    }

    .group-select-screen.show,
    .download-screen.show {
        display: flex;
    }

    .group-select-content,
    .download-screen-content {
        width: min(560px, calc(100vw - 48px));
        height: auto;
        min-height: auto;
        max-height: calc(100vh - 48px);
        overflow-y: auto;
        padding: 24px;
        border: 1px solid var(--color-border);
        border-radius: 8px;
        background: var(--tg-theme-bg-color);
        box-shadow: var(--shadow-md);
    }

    .help-content,
    .update-modal-content {
        max-width: 440px;
        border-radius: 8px;
    }

    .update-toast,
    .action-toast {
        left: 50%;
        right: auto;
        width: min(520px, calc(100vw - 48px));
        transform: translateX(-50%);
        border-radius: 8px;
    }
}

@media (prefers-reduced-motion: reduce) {
    :root {
        --motion-fast: 80ms;
        --motion-base: 110ms;
        --motion-emphasis: 120ms;
        --motion-toast-out: 80ms;
        --motion-banner-out: 80ms;
        --motion-enter-x: 0px;
        --motion-exit-x: 0px;
        --motion-enter-y: 0px;
        --motion-sheet-y: 0px;
        --motion-toast-y: 0px;
        --motion-banner-y: 0px;
    }

    .skeleton-line,
    #scheduleContainer[data-startup-shell="1"] .skeleton-line {
        animation: none;
    }

    .is-entering,
    .is-exiting,
    .stagger-item,
    .stagger-item.current-glow,
    .motion-spin-once,
    #scheduleContainer.slide-in-left,
    #scheduleContainer.slide-in-right,
    .search-pane.slide-out-left,
    .search-pane.slide-out-right,
    .search-pane.slide-in-left,
    .search-pane.slide-in-right,
    .next-lesson-summary.motion-update,
    .next-lesson-summary.motion-update .next-lesson-summary-title,
    .next-lesson-summary.motion-update .next-lesson-summary-subject,
    .next-lesson-summary.motion-update .next-lesson-summary-empty,
    .next-lesson-summary.motion-update .next-lesson-summary-empty-icon,
    .next-lesson-summary.motion-update .next-lesson-summary-action,
    .next-lesson-summary.motion-update .next-lesson-summary-detail,
    .next-lesson-summary.motion-update .next-lesson-summary-detail.status {
        animation-duration: 80ms !important;
        animation-delay: 0ms !important;
    }

    .next-lesson-summary::after,
    .next-lesson-summary.motion-update::after {
        animation: none !important;
        opacity: 0 !important;
    }

    .stagger-item,
    .stagger-item.current-glow,
    .motion-spin-once {
        animation-name: motionEnter !important;
    }
}
