:root, body {
    /* Тёмная тема по умолчанию */
    color-scheme: only dark;
    --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;
}

:root, body {
    --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);
}

:root {
    --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 transparent;
    }

    35% {
        box-shadow: 0 0 0 4px color-mix(in srgb, var(--color-accent) 24%, transparent);
    }

    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-header, var(--color-surface));
    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-header, var(--color-bg));
    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: color-mix(in srgb, var(--color-accent) 14%, transparent);
    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: 20px;
    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-subtitle, 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: color-mix(in srgb, var(--color-accent) 14%, transparent);
    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: color-mix(in srgb, var(--color-accent) 12%, transparent);
    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: var(--color-surface);
    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 color-mix(in srgb, var(--color-accent) 28%, transparent);
    border-radius: 999px;
    background: color-mix(in srgb, var(--color-accent) 16%, transparent);
    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 color-mix(in srgb, var(--color-accent) 18%, transparent);
}

.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, transparent, var(--color-native-bottom, var(--color-bg)));
    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(4, 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 {
    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;
    overscroll-behavior-inline: contain;
}

.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: color-mix(in srgb, var(--color-accent) 16%, transparent);
    border-color: rgba(96, 165, 250, 0.34);
    color: var(--color-accent);
    box-shadow: none;
}

body[data-app-palette] .day-btn.active {
    border-color: color-mix(in srgb, var(--color-accent) 34%, transparent);
}

.day-btn.active .day-btn-label {
    color: var(--color-highlight, 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: 8.75px 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 transparent;
    }

    45% {
        box-shadow: 0 0 0 4px color-mix(in srgb, var(--color-accent) 16%, transparent);
    }

    100% {
        box-shadow: 0 0 0 0 transparent;
    }
}

.next-lesson-summary-title {
    font-size: 11px;
    color: var(--color-section-heading, 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 color-mix(in srgb, var(--color-accent) 22%, transparent);
}

.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: color-mix(in srgb, var(--color-accent) 12%, transparent);
}

.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: color-mix(in srgb, var(--color-accent) 12%, transparent);
    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 color-mix(in srgb, var(--color-accent) 18%, transparent);
    border-radius: 999px;
    background: color-mix(in srgb, var(--color-accent) 12%, transparent);
    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: 16px;
}

.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: var(--color-surface);
    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: color-mix(in srgb, var(--color-accent) 50%, transparent);
    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: color-mix(in srgb, var(--color-accent) 12%, transparent);
    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: var(--color-bg);
}

.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: color-mix(in srgb, var(--color-accent) 18%, transparent);
    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: 85vh;
    max-height: 85dvh;
    padding: 16px 20px calc(24px + var(--screen-bottom-inset));
    overflow-y: auto;
    overscroll-behavior-y: contain;
    touch-action: pan-y;
    -webkit-overflow-scrolling: touch;
    will-change: transform, opacity;
}

.settings-section {
    margin-bottom: 16px;
}

.settings-section:last-child {
    margin-bottom: 0;
}

.settings-section-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-section-heading, var(--color-muted));
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.settings-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 44px;
    padding: 10px var(--space-4);
    background: var(--tg-theme-secondary-bg-color);
    border-radius: 10px;
    margin-bottom: 0;
}

.settings-item + .settings-item {
    margin-top: 10px;
}

.settings-install-link {
    color: inherit;
    text-decoration: none;
}

button.settings-item {
    width: 100%;
    border: none;
    text-align: left;
    cursor: pointer;
}

.settings-language-select {
    max-width: 132px;
    min-height: 36px;
    padding: 6px 30px 6px 10px;
    border: 1px solid var(--color-border);
    border-radius: 10px;
    background: var(--color-surface);
    color: var(--tg-theme-text-color);
    font: inherit;
    font-size: 14px;
    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;
    --light-selection: #2563eb;
    --shadow-sm: 0 2px 10px rgba(15, 23, 42, 0.08);
    --shadow-md: 0 10px 28px rgba(15, 23, 42, 0.10);
    color-scheme: only light;
}

body.light-theme[data-app-palette] { --light-selection: var(--color-accent); }

:root:has(> body.light-theme) {
    color-scheme: only light;
}

.light-theme .toggle-slider {
    background-color: #d4d4d8;
}

body[data-app-palette="telegram"] .toggle-switch input:not(:checked) + .toggle-slider {
    background-color: color-mix(in srgb, var(--color-surface) 72%, var(--color-text) 28%);
}

.light-theme .lesson-card.past {
    opacity: 0.72;
}

.light-theme .sticky-header {
    transition: background var(--motion-fast) var(--ease-standard);
}

.light-theme .header {
    background: var(--color-header, var(--color-bg));
}

.light-theme .schedule-controls {
    margin-top: 10px;
}

.light-theme .bottom-toolbar-shell {
    --toolbar-background: var(--color-native-bottom, var(--color-bg));
    background: linear-gradient(180deg, transparent, color-mix(in srgb, var(--toolbar-background) 76%, transparent) 32%, var(--toolbar-background));
}

.light-theme .bottom-toolbar {
    background: color-mix(in srgb, var(--color-surface) 94%, transparent);
    border-color: var(--color-border);
    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: var(--color-surface);
    border: 1px solid var(--tg-theme-section-separator-color);
    color: var(--tg-theme-text-color);
}

body[data-app-palette="telegram"] .day-btn:not(.active),
body[data-app-palette="telegram"] #settingsIcon {
    background: color-mix(in srgb, var(--color-header) 91%, var(--color-text) 9%);
    border-color: var(--color-border);
}

body[data-app-palette="telegram"] .app-screen .settings-item {
    border: 1px solid var(--color-border);
}

body[data-app-palette="telegram"] :is(.lesson-card .pair-num, .lesson-card .info-row i, .status-card:not(.error, .success) i,
    .study-menu-item > i:first-child, .next-lesson-summary-empty-icon, .bb-filter-reset, .day-empty i) {
    color: var(--color-highlight);
}

.light-theme .bottom-toolbar-btn {
    color: var(--color-muted);
}

.light-theme .view-btn.active,
.light-theme .room-tab.active,
.light-theme .search-switch-btn.active {
    box-shadow: 0 4px 12px color-mix(in srgb, var(--color-accent) 22%, transparent);
}

.light-theme .bottom-toolbar-btn.active {
    background: color-mix(in srgb, var(--light-selection) 12%, transparent);
    color: var(--tg-theme-link-color);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--light-selection) 14%, transparent);
}

.light-theme .day-btn.active {
    box-shadow: none;
    background: color-mix(in srgb, var(--light-selection) 12%, transparent);
    border-color: color-mix(in srgb, var(--light-selection) 24%, transparent);
}

.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: var(--color-surface);
}

.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: var(--color-surface);
    border: 1px solid var(--tg-theme-section-separator-color);
}

.light-theme .search-modal-content {
    background: var(--color-surface);
}

.light-theme .group-search,
.light-theme .time-select {
    background: var(--color-bg);
    border-color: var(--tg-theme-section-separator-color);
    color: var(--tg-theme-text-color);
}

.light-theme .group-search::placeholder {
    color: var(--color-muted);
}

.light-theme .teacher-modal-close {
    background: var(--color-bg);
    color: var(--color-text);
    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: var(--color-surface);
    border: 1px solid var(--tg-theme-section-separator-color);
}

.light-theme .room-tab:not(.active),
.light-theme .search-switch-btn:not(.active) {
    background: var(--color-bg);
    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: color-mix(in srgb, var(--color-accent) 9%, var(--color-surface));
    border-color: var(--color-border);
}

.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: var(--color-border);
    background: var(--color-bg);
    color: var(--color-muted);
}

.light-theme .search-mode-empty-icon {
    background: color-mix(in srgb, var(--color-accent) 13%, var(--color-surface));
    color: var(--color-accent);
}

.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: color-mix(in srgb, var(--light-selection) 9%, var(--color-surface));
    color: var(--tg-theme-link-color);
}

.light-theme .offline-banner[data-variant="warning"] {
    background: #fef2f2;
    color: #b91c1c;
}

.light-theme .date-header,
.light-theme .next-lesson-summary-subject {
    color: var(--color-text);
}

.light-theme .next-lesson-summary-title {
    color: var(--color-section-heading, var(--color-muted));
}

.light-theme .next-lesson-summary-detail {
    background: var(--color-bg);
    border-color: var(--color-border);
    color: var(--color-muted);
}

.light-theme .next-lesson-summary-room {
    background: color-mix(in srgb, var(--color-accent) 10%, var(--color-surface));
    border-color: color-mix(in srgb, var(--color-accent) 45%, var(--color-border));
    color: var(--color-text);
    box-shadow:
        inset 0 0 0 1px color-mix(in srgb, var(--color-accent) 12%, transparent),
        0 6px 14px color-mix(in srgb, var(--color-accent) 12%, transparent);
}

.light-theme .next-lesson-summary-room i,
.light-theme .next-lesson-summary-room span {
    color: var(--color-accent);
}

.light-theme .next-lesson-summary-detail.status {
    background: color-mix(in srgb, var(--color-accent) 10%, var(--color-surface));
    border-color: var(--color-border);
    color: var(--color-text);
}

.light-theme .next-lesson-summary-empty {
    background: transparent;
}

.light-theme .next-lesson-summary-empty-icon {
    background: color-mix(in srgb, var(--light-selection) 10%, var(--color-surface));
    color: var(--tg-theme-link-color);
}

.light-theme .next-lesson-summary-empty-heading {
    color: var(--color-text);
}

.light-theme .next-lesson-summary-empty-text {
    color: var(--color-muted);
}

.light-theme .next-lesson-summary-action {
    border-color: color-mix(in srgb, var(--light-selection, var(--color-accent)) 18%, transparent);
    background: color-mix(in srgb, var(--light-selection, var(--color-accent)) 10%, transparent);
    color: var(--color-text);
    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 320ms var(--ease-decelerate) both;
}

#scheduleContainer.slide-in-right {
    animation: slideInRight 320ms var(--ease-decelerate) both;
}

@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 {
    --lesson-card-top-padding: 18px;
    background: var(--tg-theme-secondary-bg-color);
    border-radius: 14px;
    padding: var(--space-3) var(--space-4);
    padding-top: var(--lesson-card-top-padding);
    margin-bottom: 16px;
    margin-top: 10px;
    display: flex;
    align-items: center;
    column-gap: 14px;
    position: relative;
    opacity: 1;
    box-shadow: var(--shadow-sm);
}

.lesson-card.soon {
    box-shadow: 0 0 0 1px rgba(251, 191, 36, 0.6);
}

.lesson-card.past {
    opacity: 0.66;
}

.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;
    line-height: 1.4;
    color: var(--color-muted);
    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: 13px;
    color: color-mix(in srgb, var(--tg-theme-text-color) 72%, var(--tg-theme-bg-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.has-lesson-badges {
    flex-wrap: wrap;
    row-gap: 0;
}

.lesson-card .lesson-locations {
    display: flex;
    flex: 0 0 100%;
    flex-wrap: wrap;
    justify-content: center;
    align-items: flex-start;
    align-self: flex-start;
    gap: 4px 6px;
    /* Keep the badge on the top border and allow for long room names. */
    margin: calc(-10px - var(--lesson-card-top-padding)) 0 6px;
    z-index: 1;
}

.lesson-type-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 2px 4px;
    width: max-content;
    min-width: 0;
    max-width: 100%;
    min-height: 23px;
    padding: 3px 5px;
    border: 1px solid var(--color-border);
    border-radius: 7px;
    background: var(--color-surface);
    color: var(--tg-theme-link-color);
    font-size: 11px;
    font-weight: 600;
    line-height: 1.2;
    text-align: center;
}

.lesson-type-badge > span { min-width: 0; overflow-wrap: anywhere; }

.lesson-card .room-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    max-width: 100%;
    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;
    line-height: 1.25;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.room-badge-label { min-width: 0; overflow-wrap: anywhere; }
.lesson-card .room-badge i { flex-shrink: 0; }

/* Подгруппы */
.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-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-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;
}


@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.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: color-mix(in srgb, var(--color-accent) 14%, transparent);
    color: var(--color-accent);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.light-theme .mode-banner {
    border-bottom-color: var(--tg-theme-section-separator-color);
}

.light-theme .mode-banner-action {
    background: color-mix(in srgb, var(--color-accent) 12%, transparent);
    border-color: color-mix(in srgb, var(--color-accent) 22%, transparent);
}

.light-theme .search-quick-action,
.light-theme .search-hint {
    background: var(--color-surface);
    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: var(--color-surface);
    border: 1px solid var(--tg-theme-section-separator-color);
    color: var(--tg-theme-text-color);
}

.light-theme .download-progress {
    background: var(--color-border);
}

.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: color-mix(in srgb, var(--light-selection, var(--color-accent)) 14%, transparent);
    color: #93c5fd;
}

body[data-app-palette] .offline-banner[data-variant="context"] {
    color: var(--tg-theme-link-color);
}

.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: var(--color-destructive, #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-auto-flow: column;
        grid-auto-columns: max(64px, calc((100% - 9 * 8px) / 10));
        gap: 8px;
        overflow-x: auto;
        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: 15.75px 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 {
        --lesson-card-top-padding: 20px;
        border-radius: 8px;
        padding: var(--lesson-card-top-padding) 22px 20px;
        margin: 0 0 16px;
        column-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 .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);
    }

    body[data-app-palette="telegram"] .bottom-toolbar {
        background: color-mix(in srgb, var(--color-surface) 94%, transparent);
    }

    body[data-app-palette] .bottom-toolbar-btn.active {
        box-shadow:
            inset 0 0 0 1px color-mix(in srgb, var(--color-accent) 22%, transparent),
            0 8px 18px color-mix(in srgb, var(--color-accent) 12%, transparent);
    }

    .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;
    }
}

/* ==================== Campus map ==================== */
body.campus-map-open {
    overflow: hidden;
    overscroll-behavior: none;
}

body.campus-map-open .container {
    visibility: hidden;
    pointer-events: none;
}

.campus-map-screen[hidden] {
    display: none;
}

.campus-map-screen {
    position: fixed;
    inset: 0;
    z-index: 20;
    overflow: hidden;
    background: var(--color-bg);
    color: var(--color-text);
}

.campus-map-canvas {
    position: absolute;
    inset: 0;
    background: var(--color-bg);
    touch-action: none;
}

.campus-map-screen .leaflet-container {
    width: 100%;
    height: 100%;
    background: transparent;
    font-family: inherit;
}

.campus-map-screen .leaflet-image-layer {
    border-radius: 18px;
    box-shadow: 0 22px 65px rgba(0, 0, 0, 0.3);
}

body:not(.light-theme) .campus-map-floor-image {
    filter: brightness(0.72) saturate(0.72) contrast(1.08);
}

.campus-map-screen .leaflet-bottom {
    bottom: calc(var(--bottom-toolbar-offset) + 6px);
}

.campus-map-screen .leaflet-top,
.campus-map-screen .leaflet-bottom {
    z-index: 400;
}

.campus-map-screen .leaflet-right {
    right: 8px;
}

.campus-map-screen .leaflet-control-zoom {
    overflow: hidden;
    border: 1px solid var(--color-border);
    border-radius: 14px;
    box-shadow: var(--shadow-md);
}

.campus-map-screen .leaflet-control-zoom a {
    width: 40px;
    height: 40px;
    line-height: 40px;
    border-color: var(--color-border);
    background: color-mix(in srgb, var(--color-surface) 94%, transparent);
    color: var(--color-text);
}

.campus-map-topbar {
    position: absolute;
    top: calc(env(safe-area-inset-top, 0px) + 12px);
    left: 12px;
    right: 12px;
    z-index: 500;
    min-height: 60px;
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) 44px;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border: 1px solid var(--color-border);
    border-radius: 18px;
    background: color-mix(in srgb, var(--color-surface) 90%, transparent);
    box-shadow: var(--shadow-md);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}

.campus-map-heading {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.campus-map-heading strong {
    overflow: hidden;
    color: var(--color-text);
    font-size: 15px;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.campus-map-heading span {
    overflow: hidden;
    color: var(--color-muted);
    font-size: 11px;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.campus-map-icon-btn {
    width: 44px;
    min-width: 44px;
    height: 44px;
    border: 1px solid var(--color-border);
    border-radius: 14px;
    background: color-mix(in srgb, var(--color-bg) 80%, transparent);
    color: var(--color-text);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform var(--motion-fast) var(--ease-standard), background var(--motion-fast) var(--ease-standard);
}

.campus-map-icon-btn:active {
    transform: scale(0.96);
}

.campus-map-route-toggle {
    border-color: color-mix(in srgb, var(--color-accent) 40%, var(--color-border));
    background: color-mix(in srgb, var(--color-accent) 16%, var(--color-surface));
    color: var(--color-accent);
}

.campus-map-status {
    position: absolute;
    top: calc(env(safe-area-inset-top, 0px) + 84px);
    left: 50%;
    z-index: 490;
    max-width: calc(100vw - 108px);
    padding: 8px 12px;
    border: 1px solid var(--color-border);
    border-radius: 12px;
    background: color-mix(in srgb, var(--color-surface) 92%, transparent);
    color: var(--color-text);
    box-shadow: var(--shadow-sm);
    font-size: 12px;
    font-weight: 650;
    line-height: 1.3;
    text-align: center;
    transform: translateX(-50%);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

.campus-map-status[data-kind="success"] {
    border-color: rgba(34, 197, 94, 0.45);
}

.campus-map-status[data-kind="error"] {
    border-color: rgba(239, 68, 68, 0.55);
    color: #fca5a5;
}

.light-theme .campus-map-status[data-kind="error"] {
    color: #b91c1c;
}

.campus-map-floor-switcher {
    position: absolute;
    top: calc(env(safe-area-inset-top, 0px) + 132px);
    right: 12px;
    z-index: 480;
    display: flex;
    flex-direction: column-reverse;
    gap: 6px;
    padding: 6px;
    border: 1px solid var(--color-border);
    border-radius: 16px;
    background: color-mix(in srgb, var(--color-surface) 90%, transparent);
    box-shadow: var(--shadow-md);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.campus-map-floor-btn {
    position: relative;
    width: 42px;
    height: 42px;
    border: none;
    border-radius: 12px;
    background: transparent;
    color: var(--color-muted);
    font: inherit;
    font-size: 14px;
    font-weight: 800;
    cursor: pointer;
}

.campus-map-floor-btn.has-route::after {
    content: '';
    position: absolute;
    top: 6px;
    right: 6px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #22c55e;
}

.campus-map-floor-btn.active {
    background: var(--color-accent);
    color: var(--color-accent-text);
    box-shadow: 0 8px 18px color-mix(in srgb, var(--color-accent) 28%, transparent);
}

.campus-map-route-panel {
    position: absolute;
    left: 10px;
    right: 10px;
    bottom: calc(var(--bottom-toolbar-offset) + 2px);
    z-index: 520;
    padding: 8px 16px 16px;
    border: 1px solid var(--color-border);
    border-radius: 22px;
    background: color-mix(in srgb, var(--color-surface) 96%, transparent);
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.42);
    opacity: 0;
    pointer-events: none;
    transform: translateY(calc(100% + var(--bottom-toolbar-offset) + 24px));
    transition: transform var(--motion-base) var(--ease-decelerate), opacity var(--motion-fast) var(--ease-standard);
    backdrop-filter: blur(22px);
    -webkit-backdrop-filter: blur(22px);
}

.campus-map-route-panel.is-open {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.campus-map-panel-handle {
    width: 42px;
    height: 4px;
    margin: 0 auto 10px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--color-muted) 55%, transparent);
}

.campus-map-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.campus-map-panel-header > div {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.campus-map-panel-header strong {
    font-size: 17px;
}

.campus-map-panel-header span {
    color: var(--color-muted);
    font-size: 12px;
}

.campus-map-quick-origins {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    overflow-x: auto;
    scrollbar-width: none;
}

.campus-map-quick-origins[hidden] {
    display: none;
}

.campus-map-quick-origins::-webkit-scrollbar {
    display: none;
}

.campus-map-origin-chip {
    flex: 0 0 auto;
    min-height: 38px;
    padding: 8px 11px;
    border: 1px solid color-mix(in srgb, var(--color-accent) 35%, var(--color-border));
    border-radius: 12px;
    background: color-mix(in srgb, var(--color-accent) 12%, transparent);
    color: var(--color-text);
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font: inherit;
    font-size: 12px;
    cursor: pointer;
}

.campus-map-origin-chip i {
    color: var(--color-accent);
}

.campus-map-route-fields {
    display: grid;
    grid-template-columns: 1fr;
    gap: 9px;
}

.campus-map-field {
    display: grid;
    grid-template-columns: 74px minmax(0, 1fr);
    align-items: center;
    gap: 8px;
}

.campus-map-field > span {
    color: var(--color-muted);
    font-size: 12px;
    font-weight: 650;
}

.campus-map-field > span i {
    width: 15px;
    color: var(--color-accent);
}

.campus-map-field input {
    width: 100%;
    min-width: 0;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid var(--color-border);
    border-radius: 12px;
    outline: none;
    background: color-mix(in srgb, var(--color-bg) 72%, transparent);
    color: var(--color-text);
    font: inherit;
    font-size: 14px;
}

.campus-map-field input:focus {
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-accent) 16%, transparent);
}

.campus-map-panel-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 48px;
    gap: 9px;
    margin-top: 12px;
}

.campus-map-primary-btn,
.campus-map-secondary-btn {
    min-height: 48px;
    border: none;
    border-radius: 14px;
    font: inherit;
    font-size: 14px;
    font-weight: 750;
    cursor: pointer;
}

.campus-map-primary-btn {
    background: var(--color-accent);
    color: var(--color-accent-text);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 10px 24px color-mix(in srgb, var(--color-accent) 28%, transparent);
}

.campus-map-secondary-btn {
    border: 1px solid var(--color-border);
    background: color-mix(in srgb, var(--color-bg) 72%, transparent);
    color: var(--color-text);
}

.campus-map-route-line {
    filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.5));
}

.campus-map-stair-marker {
    border-radius: 50%;
    background: var(--color-accent);
    color: var(--color-accent-text);
    display: grid;
    place-items: center;
    box-shadow: 0 5px 16px rgba(0, 0, 0, 0.36);
}

.campus-map-tooltip {
    border: 1px solid var(--color-border);
    border-radius: 9px;
    background: var(--color-surface);
    color: var(--color-text);
    box-shadow: var(--shadow-sm);
    font-weight: 700;
}

.campus-map-tooltip::before {
    border-top-color: var(--color-surface);
}

.map-room-link {
    border: none;
    font: inherit;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.map-room-link i {
    width: auto !important;
    color: currentColor !important;
    font-size: 9px !important;
    opacity: 0.8;
}

.map-room-link:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--color-accent) 38%, transparent);
    outline-offset: 2px;
}

.map-room-link:active {
    filter: brightness(0.92);
}

@media (min-width: 900px) {
    .campus-map-topbar {
        top: 24px;
        left: 24px;
        right: auto;
        width: 360px;
        border-radius: 10px;
    }

    .campus-map-status {
        top: 96px;
        max-width: min(540px, calc(100vw - 520px));
    }

    .campus-map-floor-switcher {
        top: 24px;
        right: 24px;
        flex-direction: row;
        border-radius: 10px;
    }

    .campus-map-floor-btn {
        border-radius: 7px;
    }

    .campus-map-route-panel {
        left: auto;
        right: 24px;
        bottom: 116px;
        width: 410px;
        border-radius: 12px;
    }

    .campus-map-screen .leaflet-bottom {
        bottom: 114px;
    }
}

.campus-map-screen.map-survey .campus-map-canvas {
    background-image: radial-gradient(color-mix(in srgb, var(--color-border) 65%, transparent) .7px, transparent .7px);
    background-size: 24px 24px;
}

.map-survey .campus-map-survey-marker .campus-map-survey-label {
    position: absolute;
    left: 0;
    top: 0;
    transform: translate(-50%, -50%);
    display: grid;
    place-items: center;
    min-width: 18px;
    min-height: 18px;
    color: #eef2f1;
    font-size: var(--survey-font-size, 11px);
    font-weight: 550;
    font-variant-numeric: tabular-nums;
    line-height: 1;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
    border-radius: 4px;
    text-shadow: 0 1px 2px #1c2225;
}

.map-survey .campus-map-location-stair .campus-map-survey-label,
.map-survey .campus-map-location-toilet .campus-map-survey-label {
    width: var(--survey-poi-size, 21px);
    height: var(--survey-poi-size, 21px);
    min-width: 0;
    min-height: 0;
    color: #e3d2a2;
    background: #3f3c31;
    border: 1px solid #847857;
    border-radius: 5px;
    text-shadow: none;
}

.map-survey .campus-map-location-toilet .campus-map-survey-label {
    color: #b0dbd5;
    background: #264749;
    border-color: #5b8b88;
    font-size: clamp(6px, calc(var(--survey-poi-size, 21px) * .38), 8px);
    font-weight: 650;
}

.campus-map-survey-label svg,
.campus-map-survey-transition svg {
    width: 70%;
    height: 70%;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.6;
    stroke-linejoin: round;
    stroke-linecap: round;
}

.map-survey .campus-map-survey-marker.is-label-hidden {
    visibility: hidden;
    pointer-events: none;
}

.map-survey .campus-map-survey-marker:is(:hover, :focus-visible, .is-highlighted, .is-destination, .is-start) .campus-map-survey-label {
    color: #172d2b;
    background: #b0d5c9;
    outline: 2px solid #1c2225;
    text-shadow: none;
    min-width: 25px;
    min-height: 24px;
    font-size: 12px;
    font-weight: 700;
}

.map-survey .campus-map-survey-marker.is-destination .campus-map-survey-label {
    background: #e2cc98;
    color: #332e20;
}

.map-survey .campus-map-route-line { filter: none; }

.map-survey .campus-map-survey-transition {
    color: #e3d2a2;
    background: #3f3c31;
    border: 1px solid #c3b180;
    border-radius: 6px;
    box-shadow: 0 0 0 2px #1c2225;
}

.campus-map-survey-key {
    position: absolute;
    left: 20px;
    bottom: calc(var(--bottom-toolbar-offset) + 92px);
    z-index: 400;
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    color: #a5b1b5;
    font-size: 10px;
    line-height: 1.4;
    pointer-events: none;
}

.campus-map-survey-key[hidden] { display: none; }
.campus-map-survey-key span { display: flex; align-items: center; gap: 6px; }
.campus-map-survey-key i { width: 9px; height: 9px; border: 1px solid #879295; border-radius: 2px; background: #343b3e; }
.campus-map-survey-key .map-key-stair { background: #504a3a; border-color: #aa996a; }
.campus-map-survey-key .map-key-wc { background: #284d4e; border-color: #6caaa2; }
.campus-map-floor-btn.campus-map-fit-btn { display: grid; place-items: center; margin-left: 5px; }

@media (min-width: 900px) {
    .campus-map-survey-key { bottom: 128px; font-size: 11px; }
    .campus-map-screen.map-survey .leaflet-bottom { bottom: 194px; }
}

/* ==================== Campus map: semantic full view ==================== */
.campus-map-screen .leaflet-image-layer {
    border-radius: 26px;
    box-shadow: none;
    opacity: 0.42;
}

body:not(.light-theme) .campus-map-floor-image {
    filter: brightness(0.58) saturate(0.55) contrast(0.94);
    opacity: 0.46;
}

.light-theme .campus-map-floor-image {
    filter: grayscale(0.18) contrast(0.86);
    opacity: 0.58;
}

.campus-map-screen .campus-map-floor-redrawn,
body:not(.light-theme) .campus-map-floor-redrawn,
.light-theme .campus-map-floor-redrawn {
    filter: none;
    opacity: 1;
}

.campus-map-topbar {
    top: calc(env(safe-area-inset-top, 0px) + 10px);
    left: 10px;
    right: 10px;
    min-height: 56px;
    grid-template-columns: 40px minmax(0, 1fr) 40px;
    gap: 9px;
    padding: 7px;
    border-color: color-mix(in srgb, var(--color-border) 75%, transparent);
    border-radius: 20px;
    background: color-mix(in srgb, var(--color-surface) 88%, transparent);
    box-shadow: 0 10px 34px rgba(0, 0, 0, 0.2);
}

.campus-map-heading strong {
    font-size: 15px;
    letter-spacing: -0.01em;
}

.campus-map-heading span {
    font-size: 11px;
}

.campus-map-icon-btn {
    width: 40px;
    min-width: 40px;
    height: 40px;
    border-radius: 13px;
}

.campus-map-floor-switcher {
    top: calc(env(safe-area-inset-top, 0px) + 76px);
    right: auto;
    left: 50%;
    width: max-content;
    max-width: calc(100vw - 20px);
    min-height: 42px;
    flex-direction: row;
    align-items: center;
    gap: 3px;
    padding: 4px;
    border-color: color-mix(in srgb, var(--color-border) 75%, transparent);
    border-radius: 15px;
    background: color-mix(in srgb, var(--color-surface) 88%, transparent);
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.18);
    transform: translateX(-50%);
}

.campus-map-floor-label {
    padding: 0 7px 0 9px;
    color: var(--color-muted);
    font-size: 11px;
    font-weight: 700;
}

.campus-map-floor-btn {
    width: 38px;
    height: 34px;
    border-radius: 11px;
    font-size: 13px;
}

.campus-map-floor-btn.has-route::after {
    top: 4px;
    right: 4px;
    width: 5px;
    height: 5px;
}

.campus-map-status {
    top: calc(env(safe-area-inset-top, 0px) + 124px);
    max-width: calc(100vw - 30px);
    padding: 7px 11px;
    border-radius: 11px;
    font-size: 11px;
}

.campus-map-route-launcher {
    position: absolute;
    left: 10px;
    right: 10px;
    bottom: calc(var(--bottom-toolbar-offset) + 8px);
    z-index: 510;
    min-height: 62px;
    padding: 9px 12px;
    border: 1px solid color-mix(in srgb, var(--color-border) 78%, transparent);
    border-radius: 19px;
    background: color-mix(in srgb, var(--color-surface) 92%, transparent);
    color: var(--color-text);
    box-shadow: 0 14px 38px rgba(0, 0, 0, 0.28);
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr) 24px;
    align-items: center;
    gap: 10px;
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: opacity var(--motion-fast) var(--ease-standard), transform var(--motion-base) var(--ease-standard);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.campus-map-route-launcher:active {
    transform: scale(0.985);
}

.campus-map-route-launcher-icon {
    width: 40px;
    height: 40px;
    border-radius: 13px;
    background: var(--color-accent);
    color: var(--color-accent-text);
    display: grid;
    place-items: center;
    box-shadow: 0 7px 18px color-mix(in srgb, var(--color-accent) 28%, transparent);
}

.campus-map-route-launcher-copy {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.campus-map-route-launcher-copy strong,
.campus-map-route-launcher-copy small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.campus-map-route-launcher-copy strong {
    font-size: 14px;
    line-height: 1.15;
}

.campus-map-route-launcher-copy small {
    color: var(--color-muted);
    font-size: 11px;
    line-height: 1.25;
}

.campus-map-route-launcher-chevron {
    color: var(--color-muted);
    font-size: 12px;
    justify-self: center;
}

.campus-map-screen.panel-open .campus-map-route-launcher {
    opacity: 0;
    pointer-events: none;
    transform: translateY(16px);
}

.campus-map-route-panel {
    left: 10px;
    right: 10px;
    bottom: calc(var(--bottom-toolbar-offset) + 8px);
    padding: 7px 14px 14px;
    border-color: color-mix(in srgb, var(--color-border) 80%, transparent);
    border-radius: 22px;
    background: color-mix(in srgb, var(--color-surface) 96%, transparent);
    box-shadow: 0 20px 56px rgba(0, 0, 0, 0.38);
}

.campus-map-panel-handle {
    margin-bottom: 8px;
}

.campus-map-panel-header {
    margin-bottom: 10px;
}

.campus-map-panel-header strong {
    font-size: 16px;
}

.campus-map-panel-header span {
    font-size: 11px;
}

.campus-map-quick-origins {
    margin-bottom: 10px;
}

.campus-map-origin-chip {
    min-height: 34px;
    padding: 7px 10px;
    border-radius: 11px;
    font-size: 11px;
}

.campus-map-route-fields {
    gap: 8px;
}

.campus-map-field input {
    min-height: 42px;
    border-radius: 11px;
    font-size: 13px;
}

.campus-map-panel-actions {
    grid-template-columns: minmax(0, 1fr) 44px;
    margin-top: 10px;
}

.campus-map-primary-btn,
.campus-map-secondary-btn {
    min-height: 44px;
    border-radius: 12px;
    font-size: 13px;
}

.campus-map-screen .leaflet-bottom {
    bottom: calc(var(--bottom-toolbar-offset) + 80px);
}

.campus-map-screen.panel-open .leaflet-bottom {
    opacity: 0;
    pointer-events: none;
}

.campus-map-screen .leaflet-right {
    right: 4px;
}

.campus-map-screen .leaflet-control-zoom {
    border-radius: 13px;
}

.campus-map-screen .leaflet-control-zoom a {
    width: 36px;
    height: 36px;
    line-height: 36px;
}

.campus-map-corridor-segment {
    stroke: rgba(216, 228, 241, 0.68) !important;
    filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.16));
}

.light-theme .campus-map-corridor-segment {
    stroke: rgba(255, 255, 255, 0.94) !important;
    filter: drop-shadow(0 1px 2px rgba(37, 62, 88, 0.2));
}

.campus-map-location-marker {
    width: 1px !important;
    height: 1px !important;
    border: 0 !important;
    background: transparent !important;
    pointer-events: auto;
}

.campus-map-room-pin,
.campus-map-poi-pin {
    position: absolute;
    left: 0;
    top: 0;
    transform: translate(-50%, -50%);
    user-select: none;
}

.campus-map-room-pin {
    width: 22px;
    height: 22px;
    display: grid;
    place-items: center;
    cursor: pointer;
}

.campus-map-room-dot {
    width: 7px;
    height: 7px;
    border: 2px solid color-mix(in srgb, var(--color-surface) 92%, transparent);
    border-radius: 50%;
    background: color-mix(in srgb, var(--color-accent) 72%, #94a3b8);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.26);
    opacity: 0.76;
    transition: width var(--motion-fast) var(--ease-standard), height var(--motion-fast) var(--ease-standard), opacity var(--motion-fast) var(--ease-standard);
}

.campus-map-room-label {
    position: absolute;
    left: 17px;
    top: 50%;
    padding: 3px 6px;
    border: 1px solid color-mix(in srgb, var(--color-border) 74%, transparent);
    border-radius: 7px;
    background: color-mix(in srgb, var(--color-surface) 94%, transparent);
    color: var(--color-text);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.16);
    font-size: 10px;
    font-weight: 760;
    line-height: 1.15;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-50%) scale(0.9);
    transform-origin: left center;
    transition: opacity var(--motion-fast) var(--ease-standard), transform var(--motion-fast) var(--ease-standard);
}

.map-zoom-detail .campus-map-room-dot {
    width: 10px;
    height: 10px;
    opacity: 1;
}

.map-zoom-detail .campus-map-room-label,
.campus-map-location-marker.is-highlighted .campus-map-room-label,
.campus-map-location-marker.is-start .campus-map-room-label,
.campus-map-location-marker.is-destination .campus-map-room-label {
    opacity: 1;
    transform: translateY(-50%) scale(1);
}

.campus-map-location-marker.is-route-point .campus-map-room-dot {
    background: var(--color-accent);
    opacity: 1;
}

.campus-map-location-marker.is-start .campus-map-room-dot {
    width: 15px;
    height: 15px;
    border-width: 4px;
    background: #22c55e;
}

.campus-map-location-marker.is-destination .campus-map-room-dot,
.campus-map-location-marker.is-highlighted .campus-map-room-dot {
    width: 15px;
    height: 15px;
    border-width: 4px;
    background: #f97316;
}

.campus-map-poi-pin {
    min-width: 30px;
    min-height: 30px;
    padding: 0 8px;
    border: 2px solid color-mix(in srgb, var(--color-surface) 90%, transparent);
    border-radius: 11px;
    background: var(--color-accent);
    color: var(--color-accent-text);
    box-shadow: 0 5px 14px rgba(0, 0, 0, 0.25);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    font-size: 10px;
    font-weight: 800;
    white-space: nowrap;
    cursor: pointer;
}

.campus-map-location-toilet .campus-map-poi-pin {
    background: #0f766e;
    color: #fff;
}

.campus-map-poi-pin span {
    display: none;
}

.map-zoom-detail .campus-map-poi-pin span,
.campus-map-location-marker.is-highlighted .campus-map-poi-pin span {
    display: inline;
}

.campus-map-route-line {
    stroke-linecap: round;
    stroke-linejoin: round;
    filter: drop-shadow(0 3px 5px rgba(0, 0, 0, 0.42));
}

.campus-map-tooltip {
    padding: 5px 7px;
    border-radius: 8px;
    font-size: 11px;
}

@media (min-width: 900px) {
    .campus-map-topbar {
        top: 20px;
        left: 20px;
        right: auto;
        width: 350px;
        border-radius: 18px;
    }

    .campus-map-floor-switcher {
        top: 20px;
        right: 20px;
        left: auto;
        transform: none;
    }

    .campus-map-status {
        top: 86px;
        max-width: 420px;
    }

    .campus-map-route-launcher {
        left: auto;
        right: 20px;
        bottom: 112px;
        width: 390px;
    }

    .campus-map-route-panel {
        left: auto;
        right: 20px;
        bottom: 112px;
        width: 390px;
        border-radius: 20px;
    }

    .campus-map-screen .leaflet-bottom {
        bottom: 110px;
    }
}

@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;
    }
}

.next-lesson-map-action { margin-top: 12px; }
.next-lesson-map-action[hidden] { display: none; }
/* Gradebook is a full page; its colors follow the schedule theme. */
.gradebook-launch { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; white-space: nowrap; text-decoration: none; }
.gradebook-body {
    min-height: 100dvh;
    --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-border: var(--tg-theme-section-separator-color);
    --color-accent: var(--tg-theme-button-color);
    --color-accent-text: var(--tg-theme-button-text-color);
}
.gradebook-page { width: min(760px, 100%); margin: 0 auto; padding: max(20px, env(safe-area-inset-top, 0px)) 24px max(40px, env(safe-area-inset-bottom, 0px)); }
.gradebook-nav { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 32px; }
.gradebook-back { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; margin-left: -10px; padding: 8px 10px; border-radius: 10px; color: var(--color-text); text-decoration: none; font-size: 14px; }
.gradebook-back:hover { background: var(--color-surface); }
.gradebook-eyebrow { color: var(--color-muted); font-size: 10px; letter-spacing: 1.5px; font-weight: 600; }
.gradebook-heading { margin-bottom: 28px; }
.gradebook-heading h1 { font-size: clamp(30px, 5vw, 38px); letter-spacing: -1px; line-height: 1.15; font-weight: 700; }
.gradebook-intro { color: var(--color-muted); margin-top: 10px; font-size: 14px; line-height: 1.5; }
.gradebook-form { padding: 20px; border: 1px solid var(--color-border); border-radius: var(--radius-lg); background: var(--color-surface); }
.gradebook-form > label, .gradebook-filters label { display: block; font-size: 12px; font-weight: 600; line-height: 1.5; }
.gradebook-input-row { display: flex; gap: 10px; margin-top: 10px; }
.gradebook-page input, .gradebook-page select { min-width: 0; width: 100%; min-height: 46px; border: 1px solid var(--color-border); border-radius: var(--radius-md); padding: 11px 12px; background: var(--color-bg); color: var(--color-text); font: inherit; font-size: 16px; line-height: 1.4; }
.gradebook-page input::placeholder { color: var(--color-muted); opacity: 1; }
.gradebook-page :focus-visible { outline: 2px solid var(--tg-theme-link-color); outline-offset: 3px; }
.gradebook-primary { flex-shrink: 0; min-width: 104px; min-height: 46px; border: 0; border-radius: var(--radius-md); padding: 10px 16px; color: var(--color-accent-text); background: var(--color-accent); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.gradebook-primary:disabled { opacity: .65; cursor: wait; }
.gradebook-status { font-size: 13px; line-height: 1.6; color: var(--color-muted); padding: 16px 2px 24px; }
.gradebook-status[data-error="true"] { color: var(--color-destructive, #ffb6c0); }
.gradebook-filters { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 20px; }
.gradebook-filters input, .gradebook-filters select { margin-top: 8px; }
.gradebook-summary { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.gradebook-summary span { padding: 8px 12px; background: var(--color-surface); border-radius: 10px; font-size: 12px; line-height: 1.5; }
.gradebook-subjects { list-style: none; border: 1px solid var(--color-border); border-radius: var(--radius-lg); overflow: hidden; }
.gradebook-subject { display: flex; gap: 20px; align-items: center; justify-content: space-between; padding: 18px 20px; }
.gradebook-subject + .gradebook-subject { border-top: 1px solid var(--color-border); }
.gradebook-subject-name { min-width: 0; font-size: 14px; line-height: 1.55; overflow-wrap: anywhere; }
.gradebook-grade { flex-shrink: 0; max-width: 48%; padding: 6px 10px; border-radius: 8px; font-size: 12px; line-height: 1.5; font-weight: 600; text-align: center; background: var(--color-surface); overflow-wrap: anywhere; }
.gradebook-grade[data-tone="good"] { background: #183c2d; color: #a0eac1; }
.gradebook-grade[data-tone="fair"] { background: #403318; color: #f7d98c; }
.gradebook-grade[data-tone="bad"] { background: #461f28; color: #ffb6c0; }
.light-theme .gradebook-grade[data-tone="good"] { background: #e2f3e9; color: #17613b; }
.light-theme .gradebook-grade[data-tone="fair"] { background: #fff1cf; color: #755000; }
.light-theme .gradebook-grade[data-tone="bad"] { background: #fce6e9; color: #a2263b; }
.light-theme .gradebook-status[data-error="true"] { color: var(--color-destructive, #a2263b); }
@media (max-width: 540px) {
    .gradebook-page { padding-left: 16px; padding-right: 16px; }
    .gradebook-nav { margin-bottom: 20px; }
    .gradebook-form { padding: 16px; }
    .gradebook-filters { grid-template-columns: 1fr; gap: 14px; }
    .gradebook-subject { flex-direction: column; align-items: flex-start; padding: 16px; gap: 10px; }
    .gradebook-grade { max-width: 100%; text-align: left; }
    .gradebook-primary { min-width: 96px; padding-inline: 12px; }
}
/* Mobile navigation and search. The map and lesson contents keep their existing layout. */
.schedule-view-row { display:flex; align-items:center; justify-content:space-between; gap:8px; margin-bottom:8px; }
.schedule-view-row > * { pointer-events:auto; box-shadow:var(--shadow-sm); }
.schedule-view-switch { margin-right:auto; display:flex; gap:2px; padding:2px; border:1px solid var(--color-border); border-radius:11px; background:var(--color-surface); }
.schedule-view-switch button, .today-btn { min-height:32px; border:0; border-radius:8px; padding:6px 11px; background:transparent; color:var(--color-text); font:inherit; font-size:12px; cursor:pointer; }
.schedule-view-switch button.active { background:var(--color-accent); color:var(--color-accent-text); }
.today-btn { min-height:38px; color:var(--tg-theme-link-color); border:1px solid var(--color-border); background:var(--color-surface); }
body.modal-open .schedule-view-row, body.campus-map-open .schedule-view-row { display:none; }
.schedule-content, .schedule-content.list-view { padding-bottom:calc(var(--page-bottom-offset) + 48px); }
.today-btn[hidden], .install-suggestion[hidden], .my-day-stats[hidden] { display:none; }
.bottom-toolbar a { text-decoration:none; }
.bottom-toolbar-btn { min-width:0; }
.bottom-toolbar-btn span { font-size:11px; }
.schedule-freshness { margin:0; font-size:10px; line-height:1.4; color:var(--color-subtitle, var(--color-muted)); }
.my-day-main { display:flow-root; }
.my-day-lesson { display:flow-root; }
.my-day-lesson, .my-day-location { min-width:0; }
.my-day-lesson .next-lesson-summary-subject { font-size:16px; line-height:1.3; overflow-wrap:anywhere; }
.my-day-time { margin-top:5px; color:var(--color-muted); font-size:12px; }
.my-day-location { float:right; max-width:42%; margin-left:12px; text-align:right; }
.my-day-room { display:inline-flex; align-items:center; justify-content:center; gap:7px; max-width:100%; padding:6px 9px; border:0; border-radius:8px; background:var(--color-accent); color:var(--color-accent-text); font:inherit; font-size:14px; font-weight:700; cursor:pointer; }
.my-day-room span { overflow-wrap:anywhere; }
.my-day-room i { font-size:12px; }
.my-day-room i[hidden] { display:none; }
.my-day-room:disabled { background:var(--color-bg); color:var(--color-text); cursor:default; }
.my-day-countdown { margin-top:6px; color:var(--color-muted); font-size:11px; line-height:1.4; overflow-wrap:anywhere; }
.my-day-stats { margin:10px 0 0; padding-top:8px; border-top:1px solid var(--color-border); font-size:11px; line-height:1.4; color:var(--color-muted); }
.day-btn { min-height:44px; }
.day-btn-label { font-size:11px; }
.header-actions .icon-btn-sm { width:44px; height:44px; }
.lesson-card .time-range { white-space:nowrap; }
#searchModal .search-mode-switch { display:grid; grid-template-columns:1.45fr 1fr 1fr; gap:5px; overflow:visible; flex-shrink:0; }
#searchModal .search-mode-btn { min-width:0; width:100%; padding:8px 3px; min-height:44px; font-size:12px; justify-content:center; gap:0; }
#searchModal .search-mode-btn i { display:none; }
.search-free-shortcut { flex-shrink:0; text-align:left; align-self:flex-start; min-height:44px; padding:8px 0; margin:-8px 0 6px; background:none; border:0; color:var(--tg-theme-link-color); font:inherit; font-size:13px; cursor:pointer; }
.search-result { display:flex; gap:6px; background:var(--color-surface); border:1px solid var(--color-border); border-radius:12px; margin-bottom:8px; }
.search-result-open { flex:1; min-width:0; min-height:60px; padding:12px; color:var(--color-text); border:0; background:none; text-align:left; font:inherit; cursor:pointer; }
.search-result-open strong { display:block; font-size:15px; overflow-wrap:anywhere; }
.search-result-open span { display:block; font-size:12px; line-height:1.4; margin-top:4px; color:var(--color-muted); }
.search-pin { flex:0 0 44px; min-height:44px; align-self:center; background:none; border:0; color:var(--tg-theme-link-color); font-size:26px; cursor:pointer; }
.search-library-title { font-size:13px; color:var(--color-muted); margin:12px 0 8px; }
.search-clear-recent { min-height:44px; padding:8px; border:0; background:none; color:var(--tg-theme-link-color); cursor:pointer; }
.free-room-range { display:flex; gap:12px; margin:12px 0; }
.free-room-range label { flex:1; min-width:0; font-size:13px; color:var(--color-muted); }
.free-room-range input, #freeRoomDate { width:100%; min-width:0; min-height:44px; font:inherit; font-size:16px; border:1px solid var(--color-border); border-radius:9px; padding:8px; background:var(--color-surface); color:var(--color-text); }
.free-room-range input { display:block; margin-top:5px; }
#freeRoomDate { margin:6px 0 12px; }
#freeRoomTime { font-size:16px; }
#roomFreeTab { padding-bottom:16px; }
.group-filters { display:grid; grid-template-columns:1.3fr 1fr; gap:10px; margin-bottom:12px; flex-shrink:0; }
.group-filters label { min-width:0; color:var(--color-muted); font-size:12px; }
.group-filters select { display:block; width:100%; min-width:0; min-height:44px; margin-top:5px; border:1px solid var(--color-border); border-radius:10px; background:var(--color-surface); color:var(--color-text); padding:8px; font-size:14px; }
.install-suggestion { position:relative; display:flex; flex-wrap:wrap; align-items:center; gap:8px; padding:12px 44px 12px 12px; margin:0 0 12px; border:1px solid var(--color-border); border-radius:12px; background:var(--color-surface); font-size:13px; }
.install-suggestion strong { font-size:14px; }
.install-suggestion p { line-height:1.4; margin:4px 0; }
.install-suggestion a { display:inline-flex; align-items:center; min-height:44px; color:var(--tg-theme-link-color); }
.install-suggestion button { position:absolute; top:0; right:0; width:44px; height:44px; border:0; background:none; color:var(--color-text); font-size:24px; cursor:pointer; }
.gradebook-number-help { margin-top:12px; line-height:1.6; color:var(--color-muted); font-size:13px; }
.gradebook-body { padding-bottom:120px; }
@media (max-width:360px) {
    .search-modal-content { padding-left:12px; padding-right:12px; }
    .schedule-view-switch button { padding-inline:14px; }
    .bottom-toolbar-btn span { font-size:10px; }
}

/* A fixed mobile header cannot be pushed out by the bottom of the document. */
.compact-header, #stickyHeaderSpacer { display:none; }
.schedule-context-row[hidden] { display:none; }
@media (max-width:899px) {
    #stickyHeaderSpacer { display:block; }
    .container > .schedule-content:not(.list-view) { translate:var(--schedule-header-translate,none); }
    .container > .schedule-content.list-view {
        overflow: clip;
        translate: 0 calc(-1 * var(--week-header-offset, 0px));
    }
    .container > .schedule-content.list-view .day-section .date-header {
        position: sticky;
        top: calc(var(--sticky-header-height) + var(--week-header-offset, 0px));
        z-index: 2;
    }
    .is-week-view .compact-header-date { visibility:hidden; }
    .sticky-header { position:fixed; top:0; left:0; right:0; transform:translate3d(0,calc(-1 * var(--header-collapse-distance,0px) * var(--sticky-header-visual-progress)),0); }
    .sticky-header > .header { opacity:1; transform:none; }
    .sticky-header .context-title,
    .sticky-header #settingsIcon {
        position: relative;
        z-index: 3;
        transform:
            translate3d(0, calc((var(--header-collapse-distance, 0px) + var(--header-item-shift, 0px)) * var(--sticky-header-visual-progress)), 0)
            scale(calc(1 + (var(--header-item-scale, 1) - 1) * var(--sticky-header-visual-progress)));
    }
    .sticky-header .context-title { white-space:nowrap; overflow:hidden; text-overflow:ellipsis; max-width:calc(100% - 120px * var(--sticky-header-visual-progress)); transform-origin:left top; }
    .sticky-header #settingsIcon { transform-origin:right top; }
    .sticky-header .context-subtitle, .sticky-header .schedule-freshness, .sticky-header .schedule-controls, .sticky-header .schedule-context-row { opacity:clamp(0,calc(1 - var(--sticky-header-visual-progress) / .85),1); transform:translate3d(0,calc(-4px * var(--sticky-header-visual-progress)),0); transition:none; }
    .is-week-view .sticky-header .schedule-controls { opacity:1; transform:none; }
    .is-week-view .sticky-header .context-title { max-width:100%; }
    .is-week-view .sticky-header :is(.context-subtitle, .schedule-freshness, .schedule-context-row) {
        opacity:clamp(0, calc(1 - var(--sticky-header-visual-progress) / .45), 1);
    }
    .is-week-view .sticky-header :is(.context-subtitle, .schedule-freshness) {
        transform:translate3d(0, calc(var(--header-collapse-distance, 0px) * var(--sticky-header-visual-progress)), 0);
    }
    .compact-header { position:absolute; z-index:2; top:var(--header-collapse-distance,0px); left:0; right:0; height:56px; padding:6px 62px 6px 12px; display:flex; align-items:center; gap:10px; border-bottom:1px solid var(--color-border); opacity:clamp(0,calc((var(--sticky-header-visual-progress) - .85) / .15),1); pointer-events:none; }
    .compact-header-title { visibility:hidden; flex:1; min-width:0; white-space:nowrap; overflow:hidden; font-size:16px; }
    .compact-header-date { flex-shrink:0; white-space:nowrap; font-size:12px; color:var(--color-muted); }
    .is-week-view .compact-header { display:none; }
}
#scheduleContainer.slide-in-up { animation:scheduleExpand 320ms var(--ease-decelerate) both; }
#scheduleContainer.slide-in-down { animation:scheduleFocus 320ms var(--ease-decelerate) both; }
@keyframes scheduleExpand { from { opacity:0; transform:translate3d(0, 18px, 0) scale(.985); } to { opacity:1; transform:translate3d(0, 0, 0) scale(1); } }
@keyframes scheduleFocus { from { opacity:0; transform:translate3d(0, -14px, 0) scale(.985); } to { opacity:1; transform:translate3d(0, 0, 0) scale(1); } }
.day-btn, .schedule-view-switch button, .today-btn, .search-mode-btn, .my-day-room {
    transition:background 180ms var(--ease-standard), color 180ms var(--ease-standard), border-color 180ms var(--ease-standard), transform 160ms var(--ease-decelerate);
}
.day-btn:active, .schedule-view-switch button:active, .today-btn:active, .search-mode-btn:active, .my-day-room:active { transform:scale(.95); }
.gradebook-page { animation:pageArrive 320ms var(--ease-decelerate) both; }
@keyframes pageArrive { from { opacity:0; transform:translate3d(0, 12px, 0); } to { opacity:1; transform:none; } }
/* Native same-origin page transitions keep the navigation bar in place. */
@view-transition { navigation:auto; }
.bottom-toolbar { view-transition-name:main-navigation; }
::view-transition-old(root) { animation:pageDepart 160ms var(--ease-accelerate) both; }
::view-transition-new(root) { animation:pageArrive 320ms var(--ease-decelerate) both; }
::view-transition-group(main-navigation) { animation-duration:280ms; animation-timing-function:var(--ease-decelerate); }
@keyframes pageDepart { to { opacity:0; transform:translate3d(0, -8px, 0); } }
@media (prefers-reduced-motion:reduce) {
    #scheduleContainer.slide-in-up, #scheduleContainer.slide-in-down, .gradebook-page { animation:none; }
    .day-btn, .schedule-view-switch button, .today-btn, .search-mode-btn, .my-day-room { transition:none; }
    .day-btn:active, .schedule-view-switch button:active, .today-btn:active, .search-mode-btn:active, .my-day-room:active { transform:none; }
    ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation:none; }
}

/* One composited outgoing page, clipped between the header and navigation. */
.schedule-motion-snapshot { position:fixed; z-index:9; overflow:hidden; pointer-events:none; contain:layout paint; background:var(--color-bg); }
.schedule-motion-snapshot *, .schedule-motion-snapshot *::before, .schedule-motion-snapshot *::after { animation:none !important; transition:none !important; }
#scheduleContainer .lesson-card { animation:none; }
.schedule-view-switch button:active, .today-btn:active, .day-btn:active, .search-mode-btn:active, .my-day-room:active { transform:scale(.98); }
.gradebook-page { animation:none; }
::view-transition-old(root) { animation:softPageOut 380ms cubic-bezier(.32,0,.16,1) both; }
::view-transition-new(root) { animation:softPageIn 460ms cubic-bezier(.32,0,.16,1) both; }
@keyframes softPageOut { to { opacity:0; transform:translate3d(0,-6px,0); } }
@keyframes softPageIn { from { opacity:0; transform:translate3d(0,10px,0); } to { opacity:1; transform:none; } }
html.is-switching-schedule-view .bottom-toolbar-shell { view-transition-name:main-navigation; }
html.is-switching-schedule-view .bottom-toolbar { view-transition-name:none; }
html.is-switching-schedule-view .sticky-header { view-transition-name:schedule-header; }
html.is-switching-schedule-view::view-transition { pointer-events:none; }
html.is-switching-schedule-view::view-transition-group(root),
html.is-switching-schedule-view::view-transition-group(main-navigation),
html.is-switching-schedule-view::view-transition-group(schedule-header),
html.is-switching-schedule-view::view-transition-new(main-navigation),
html.is-switching-schedule-view::view-transition-new(schedule-header) { animation:none; mix-blend-mode:normal; }
html.is-switching-schedule-view::view-transition-old(root) {
    animation:scheduleViewFadeOut 160ms var(--ease-standard) both;
    mix-blend-mode:normal;
    z-index:1;
}
html.is-switching-schedule-view::view-transition-new(root) {
    animation:scheduleViewArrive 260ms var(--ease-decelerate) both;
    mix-blend-mode:normal;
}
html.is-switching-schedule-view::view-transition-old(main-navigation),
html.is-switching-schedule-view::view-transition-old(schedule-header) { display:none; }
@keyframes scheduleViewFadeOut { from { opacity:1; } to { opacity:0; } }
@keyframes scheduleViewArrive {
    from { opacity:.65; transform:translateY(10px); }
    to { opacity:1; transform:translateY(0); }
}
@media (prefers-reduced-motion:reduce) {
    .schedule-motion-snapshot { display:none; }
    ::view-transition-old(root), ::view-transition-new(root) { animation:none; }
    .schedule-view-switch button:active, .today-btn:active, .day-btn:active, .search-mode-btn:active, .my-day-room:active { transform:none; }
}

.container { overflow-x:clip; }
@media (prefers-reduced-motion:reduce) {
    .sticky-header > .header, .compact-header { transition:none; transform:none; }
}

/* In-flow surfaces have borders; only overlays and floating controls cast shadows. */
.next-lesson-summary, .light-theme .next-lesson-summary,
.lesson-card, .light-theme .lesson-card,
.search-result, .group-item, .teacher-item, .room-item, .view-btn,
.app-screen .settings-item, .app-screen .search-switch-btn {
    box-shadow:none;
}
.next-lesson-summary { background:var(--color-surface); border:1px solid var(--color-border); }
.my-day-time { white-space:nowrap; font-variant-numeric:tabular-nums; }
.my-day-lesson .next-lesson-summary-subject { width:100%; max-width:none; display:block; overflow:visible; text-overflow:clip; -webkit-line-clamp:unset; }
.lesson-card { border:1px solid var(--color-border); }
.lesson-card.current, .light-theme .lesson-card.current {
    background: var(--color-surface);
    border-color: var(--color-accent);
    box-shadow: none;
}
.lesson-card.soon, .light-theme .lesson-card.soon { border-color:#b8943a; box-shadow:none; }

/* Search and settings are navigation screens, not bottom sheets. */
.app-screen { background:var(--color-bg); align-items:stretch; padding:0; backdrop-filter:none; }
html:has(#searchModal.show, body.campus-map-open, #studyScreen.show, #bbCoursesScreen.show, #gradebookPage) { overscroll-behavior-x:none; }
.app-screen > .search-modal-content, .app-screen > .settings-modal-content {
    width:100%; max-width:680px; height:100%; max-height:none; min-height:0;
    margin:0 auto; padding:max(12px, env(safe-area-inset-top)) 20px max(24px, env(safe-area-inset-bottom));
    border:0; border-radius:0; background:var(--color-bg); box-shadow:none;
}
.app-screen > .search-modal-content { display:flex; flex-direction:column; overflow:hidden; }
.app-screen .teacher-modal-header { position:relative; display:flex; justify-content:flex-start; align-items:center; gap:12px; min-height:48px; flex-shrink:0; margin:0 0 20px; padding:0; border:0; }
.app-screen .teacher-modal-header h3 { font-size:23px; font-weight:700; }
.app-screen .teacher-modal-header h3 > i { display:none; }
.app-screen .screen-back { order:-1; flex:0 0 44px; width:44px; height:44px; margin-left:-10px; border:0; border-radius:10px; background:none; color:var(--color-text); }
.app-screen .screen-back i { font-size:18px; }
#searchModal .search-mode-switch { grid-template-columns:minmax(0,1.3fr) repeat(3,minmax(0,1fr)); gap:4px; padding:0 0 12px; margin-bottom:16px; border-bottom:1px solid var(--color-border); }
#searchModal .search-mode-btn { display:flex; flex-direction:column; gap:7px; padding:10px 2px; min-height:70px; font-size:10px; border:0; background:transparent; color:var(--color-muted); border-radius:10px; }
#searchModal .search-mode-btn i { display:block; font-size:19px; width:auto; color:inherit; }
#searchModal .search-mode-btn.active { background:var(--color-surface); color:var(--tg-theme-link-color); }
.app-screen .group-search { box-shadow:none; border:1px solid var(--color-border); background:var(--color-surface); }
.app-screen .search-hint { padding:0; margin:0 0 18px; line-height:1.6; background:none; border:0; border-radius:0; }
.app-screen .unified-search-row { margin-bottom:18px; }
#roomFreeTab { padding:4px 0 24px; }
#roomFreeTab .time-select-label { display:block; margin:0 0 8px; line-height:1.5; }
#roomFreeTab .time-select-group { margin:18px 0; }
#roomFreeTab .free-room-range { gap:16px; margin:18px 0 22px; }
#freeRoomDate { margin:0; }
#freeRoomList { margin-top:24px; }
#findFreeRoomsBtn { min-height:48px; box-shadow:none; }
.app-screen .settings-section { margin-bottom:28px; }
.app-screen .settings-section-title { margin:0 0 10px; }
.app-screen .settings-item { min-height:54px; padding:12px; font-size:14px; }
.app-screen .settings-item .settings-chevron { width:16px; font-size:12px; color:var(--color-muted); text-align:center; }
.settings-install-link[hidden] { display:none; }
body.app-screen-open .bottom-toolbar-shell { z-index:1100; }
.bottom-toolbar-shell { transition:transform 240ms cubic-bezier(.2,.8,.2,1), opacity 180ms ease; }
body.keyboard-open .bottom-toolbar-shell { transform:translate3d(0,110%,0); opacity:0; pointer-events:none; }
body.keyboard-open .bottom-toolbar { pointer-events:none; }
.app-screen > .search-modal-content, .app-screen > .settings-modal-content { padding-bottom:var(--page-bottom-offset); }
body.keyboard-open .app-screen > .search-modal-content { padding-bottom:16px; }
@media (max-width:360px) {
    .app-screen > .search-modal-content, .app-screen > .settings-modal-content { padding-left:16px; padding-right:16px; }
}

.app-screen .language-control { display:flex; align-items:center; gap:8px; min-width:0; }
.language-flag { display:inline-block; flex:0 0 22px; width:22px; height:16px; border-radius:2px; border:1px solid #8884; background-size:100% 100%; }
.language-flag[data-language="ru"] { background-image:linear-gradient(#fff 0 33.333%, #1645a3 33.333% 66.666%, #d52b1e 66.666%); }
.language-flag[data-language="fr"] { background-image:linear-gradient(90deg, #002654 0 33.333%, #fff 33.333% 66.666%, #ed2939 66.666%); }
.language-flag[data-language="en"] { background-color:#012169; background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 60 40'%3E%3Cpath d='M0 0L60 40M60 0L0 40' stroke='white' stroke-width='8'/%3E%3Cpath d='M0 0L60 40M60 0L0 40' stroke='%23c8102e' stroke-width='3'/%3E%3Cpath d='M30 0V40M0 20H60' stroke='white' stroke-width='12'/%3E%3Cpath d='M30 0V40M0 20H60' stroke='%23c8102e' stroke-width='7'/%3E%3C/svg%3E"); }
#findFreeRoomsBtn { display:flex; width:100%; align-items:center; justify-content:center; gap:8px; background:var(--color-accent); color:var(--color-accent-text); border:0; }
.app-screen .settings-modal-content > .teacher-modal-header { position:sticky; top:-12px; z-index:2; padding-block:8px; background:var(--color-bg); }

/* Native iOS date/time fields must be allowed to shrink inside their columns. */
.free-room-range { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr); }
.free-room-range label { display:block; overflow:hidden; }
#roomFreeTab input, #roomFreeTab select { display:block; box-sizing:border-box; width:100%; max-width:100%; min-width:0; min-height:46px; -webkit-appearance:none; appearance:none; border:1px solid var(--color-border); border-radius:10px; background:var(--color-surface); color:var(--color-text); padding:10px 12px; }
#roomFreeTab input::-webkit-date-and-time-value { min-width:0; text-align:left; }
#roomFreeTab input::-webkit-datetime-edit { padding:0; min-width:0; }
#roomFreeTab select { padding-right:30px; background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='m1 1 5 5 5-5' fill='none' stroke='%238b8b8b' stroke-width='2'/%3E%3C/svg%3E"); background-position:right 12px center; background-repeat:no-repeat; }
#freeRoomList .search-result { margin-bottom:10px; }
.app-screen .language-control { flex:0 1 190px; gap:8px; }
.app-screen .settings-language-select { flex:1; width:100%; min-width:0; max-width:none; min-height:44px; padding:8px 6px; }
.app-screen .settings-item-label { min-width:0; }
.app-screen .settings-item-label > span { overflow-wrap:anywhere; }
.app-screen #telegramAppearanceSetting[hidden], #manualAppearance[hidden] { display:none; }
#telegramAppearanceSetting:not([hidden]) + #manualAppearance { margin-top:8px; }
#manualAppearance .settings-item, #telegramAppearanceSetting { cursor:pointer; }
#manualAppearance .toggle-switch, #telegramAppearanceSetting .toggle-switch { flex-shrink:0; }
.toggle-switch:has(input:focus-visible) .toggle-slider { outline:2px solid var(--color-accent); outline-offset:2px; }
.settings-palettes {
    min-width: 0;
    margin: 14px 0 0;
    padding: 0;
    border: 0;
}
.settings-palettes legend {
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 650;
}
.settings-palette-options {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}
.settings-palette-option {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 48px;
    padding: 8px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    color: var(--color-text);
    font-size: 13px;
    overflow-wrap: anywhere;
    cursor: pointer;
}
.settings-palette-option input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    opacity: 0;
    cursor: pointer;
}
.settings-palette-option:has(:checked) {
    border-color: var(--color-accent);
    font-weight: 650;
}
.settings-palette-option:has(:focus-visible) { outline:2px solid var(--color-accent); outline-offset:2px; }
.settings-palette-preview {
    flex: 0 0 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--preview-accent, var(--color-accent));
}
@media (min-width:500px) {
    .settings-palette-options { grid-template-columns:repeat(3, minmax(0, 1fr)); }
}
@media (max-width:360px) { .app-screen .language-control { flex-basis:160px; } }
@media (prefers-reduced-motion:reduce) { .bottom-toolbar-shell { transition:none; } }

.app-screen button, .app-screen select, .bottom-toolbar-btn { font-family:inherit; }

/* Installation is a separate, dismissible screen with two equally reachable actions. */
.install-promo { position:fixed; inset:0; width:100%; max-width:none; height:100%; height:100dvh; max-height:none; margin:0; padding:max(24px,env(safe-area-inset-top)) 24px max(24px,env(safe-area-inset-bottom)); border:0; box-sizing:border-box; background:var(--color-bg); color:var(--color-text); overflow-y:auto; }
.install-promo[hidden] { display:none; }
.install-promo::backdrop { background:var(--color-bg); }
.install-promo-content { width:100%; max-width:420px; min-height:100%; margin:auto; display:flex; flex-direction:column; justify-content:center; align-items:stretch; }
.install-promo-icon { width:64px; height:64px; border-radius:20px; display:grid; place-items:center; background:var(--color-accent); color:var(--color-accent-text); font-size:30px; margin-bottom:28px; }
.install-promo-eyebrow { font-size:11px; letter-spacing:.12em; color:var(--color-muted); margin-bottom:12px; }
.install-promo h2 { font-size:clamp(25px,7vw,32px); line-height:1.15; letter-spacing:-.025em; margin-bottom:16px; }
.install-promo p:not(.install-promo-eyebrow) { font-size:15px; line-height:1.5; color:var(--color-muted); }
.install-promo-benefits { list-style:none; display:grid; gap:22px; margin:32px 0; }
.install-promo-benefits li { display:flex; align-items:center; gap:16px; }
.install-promo-benefits i, .install-promo-benefits svg { width:24px; height:24px; flex-shrink:0; text-align:center; color:var(--color-accent); font-size:20px; }
.install-promo-benefits strong, .install-promo-benefits span { display:block; font-size:14px; line-height:1.5; }
.install-promo-benefits span { color:var(--color-muted); font-size:13px; }
.install-promo-actions { display:grid; gap:10px; }
.install-promo-actions a, .install-promo-actions button { display:flex; align-items:center; justify-content:center; min-height:50px; padding:12px; border-radius:12px; border:0; font:inherit; font-weight:600; text-decoration:none; cursor:pointer; }
.install-promo-actions a { background:var(--color-accent); color:var(--color-accent-text); }
.install-promo-actions button { background:var(--color-surface); color:var(--color-text); }
@media(max-height:650px) { .install-promo-icon { width:48px; height:48px; font-size:24px; margin-bottom:16px; } .install-promo-benefits { margin:22px 0; gap:16px; } }

/* Study navigation and the shared Blackboard course catalog. */
.bb-screen-content { overflow-y:auto; overscroll-behavior:contain; }
.bb-screen-intro { margin:0 0 24px; color:var(--color-muted); font-size:14px; line-height:1.55; }
.bb-courses-context { margin:0 0 24px; padding:14px 16px; border-left:3px solid var(--color-accent); border-radius:0 12px 12px 0; background:var(--color-surface); font-size:13px; line-height:1.6; white-space:pre-line; overflow-wrap:anywhere; }
.bb-courses-context::before { content:'По паре в расписании'; display:block; margin-bottom:6px; color:var(--color-muted); font-size:11px; }
.bb-courses-context[hidden], .bb-filter-reset[hidden] { display:none; }
.bb-screen-content:has(.bb-courses-context:not([hidden])) > .bb-screen-intro { display:none; }
.bb-filter-heading { display:flex; align-items:center; justify-content:space-between; gap:8px; margin-bottom:10px; }
.bb-filter-heading h4 { font-size:14px; font-weight:600; }
.bb-filter-reset { min-height:44px; padding:8px 0 8px 12px; border:0; background:none; color:var(--color-accent); font:inherit; font-size:12px; cursor:pointer; }
.study-menu { display:grid; gap:12px; }
.study-menu-item { display:flex; align-items:center; gap:16px; width:100%; min-height:84px; padding:18px 16px; border:1px solid var(--color-border); border-radius:14px; background:var(--color-surface); color:var(--color-text); font:inherit; text-align:left; text-decoration:none; cursor:pointer; }
.study-menu-item > i:first-child { flex:0 0 24px; color:var(--color-accent); font-size:22px; text-align:center; }
.study-menu-item > i:last-child { margin-left:auto; color:var(--color-muted); font-size:12px; }
.study-menu-item span { min-width:0; }
.study-menu-item strong, .study-menu-item small { display:block; }
.study-menu-item strong { font-size:16px; margin-bottom:6px; }
.study-menu-item small { color:var(--color-muted); font-size:12px; line-height:1.5; }
.bb-year-row { display:grid; grid-template-columns:1fr auto; align-items:center; gap:8px 16px; margin-bottom:24px; }
.bb-year-row label, .bb-filter > label { font-size:13px; font-weight:600; }
.bb-year-row select { min-width:150px; min-height:44px; padding:8px 12px; border:1px solid var(--color-border); border-radius:10px; background:var(--color-surface); color:var(--color-text); font:inherit; font-size:13px; }
.bb-year-row p { grid-column:1/-1; color:var(--color-muted); font-size:12px; line-height:1.5; }
.bb-filter { position:relative; margin:0 0 20px; }
.bb-filter > label { display:block; margin-bottom:9px; }
.bb-combobox { display:flex; align-items:stretch; border:1px solid var(--color-border); border-radius:10px; background:var(--color-surface); }
.bb-combobox:focus-within { border-color:var(--color-accent); outline:2px solid color-mix(in srgb,var(--color-accent) 25%,transparent); }
.bb-combobox input { width:100%; min-width:0; min-height:48px; padding:12px; border:0; border-radius:10px; background:none; color:var(--color-text); font:inherit; font-size:16px; outline:none; }
.bb-combobox input::placeholder { color:var(--color-muted); opacity:1; }
.bb-combobox button { flex:0 0 42px; border:0; border-radius:0 10px 10px 0; background:none; color:var(--color-muted); cursor:pointer; }
.bb-combobox button i { transform:rotate(90deg); font-size:12px; }
.bb-combobox input:disabled, .bb-combobox button:disabled { opacity:.55; }
.bb-filter-options { max-height:280px; overflow-y:auto; overscroll-behavior:contain; border:1px solid var(--color-border); border-radius:10px; margin-top:6px; padding:6px; background:var(--color-surface); }
.bb-filter-options[hidden] { display:none; }
.bb-options-heading { padding:12px 10px 6px; font-size:11px; color:var(--color-section-heading, var(--color-muted)); }
.bb-filter-option { display:block; width:100%; min-height:44px; padding:10px; border:0; border-radius:7px; color:var(--color-text); background:none; text-align:left; font:inherit; font-size:14px; line-height:1.45; cursor:pointer; }
.bb-filter-option:hover, .bb-filter-option:focus-visible, .bb-filter-option[aria-selected="true"] { background:var(--color-bg); outline:none; }
.bb-options-empty { padding:12px 10px; color:var(--color-muted); font-size:13px; line-height:1.5; }
.bb-courses-status { color:var(--color-muted); font-size:13px; line-height:1.55; margin:24px 0 14px; }
.bb-courses-status[data-error="true"] { color:var(--color-destructive, #ef9a9a); }
.light-theme .bb-courses-status[data-error="true"] { color:var(--color-destructive, #b42318); }
#bbCoursesScreen[aria-busy="true"] .bb-courses-status { display:flex; align-items:center; gap:10px; }
#bbCoursesScreen[aria-busy="true"] .bb-courses-status::before { content:''; flex:0 0 16px; height:16px; border:2px solid var(--color-border); border-top-color:var(--color-accent); border-radius:50%; animation:bbLoading 750ms linear infinite; }
@keyframes bbLoading { to { transform:rotate(360deg); } }
@media(prefers-reduced-motion:reduce) { #bbCoursesScreen[aria-busy="true"] .bb-courses-status::before { animation:none; } }
.bb-courses-results { display:grid; gap:12px; }
.bb-course-card { padding:18px; border:1px solid var(--color-border); border-radius:14px; background:var(--color-surface); }
.bb-course-card h4 { font-size:16px; line-height:1.45; overflow-wrap:anywhere; }
.bb-course-teacher { margin-top:8px; color:var(--color-muted); font-size:13px; line-height:1.5; }
.bb-course-name { margin-top:10px; color:var(--color-muted); font-size:12px; line-height:1.5; overflow-wrap:anywhere; }
.bb-course-actions { display:flex; flex-wrap:wrap; gap:10px; margin-top:20px; }
.bb-course-actions a, .bb-course-actions button, .bb-retry { display:flex; align-items:center; justify-content:center; min-height:44px; padding:10px 14px; border-radius:9px; font:inherit; font-size:13px; font-weight:600; text-decoration:none; cursor:pointer; }
.bb-course-open { flex:1 1 120px; border:1px solid var(--color-accent); background:var(--color-accent); color:var(--color-accent-text); }
.bb-course-share, .bb-retry { border:1px solid var(--color-border); background:var(--color-bg); color:var(--color-text); }
.bb-share-copy { display:block; width:100%; min-height:120px; margin-top:14px; padding:12px; border:1px solid var(--color-border); border-radius:9px; background:var(--color-bg); color:var(--color-text); font:inherit; font-size:16px; line-height:1.5; resize:vertical; }
.bb-share-copy-label { display:block; margin-top:14px; color:var(--color-muted); font-size:12px; }
.bb-retry[hidden] { display:none; }
.bb-courses-updated { margin-top:20px; color:var(--color-muted); font-size:11px; line-height:1.5; }
@media(max-width:360px) { .bb-course-card { padding:14px; } .bb-year-row { gap:8px; } .study-menu-item { gap:12px; } }

/* Readable times in both views; abbreviated metadata is exclusive to the week. */
.lesson-card .pair-num { font-size:20px; }
.lesson-card .time-range { font-size:13px; color:var(--color-text); font-variant-numeric:tabular-nums; }
.lesson-card .lesson-detail-compact { display:none; }
.schedule-content.list-view .lesson-detail-full { display:none; }
.schedule-content.list-view .lesson-detail-compact { display:inline; text-decoration:none; }
.schedule-content.list-view .lesson-card:not(.window-card) { --lesson-card-top-padding:18px; padding:var(--lesson-card-top-padding) 12px 12px; column-gap:10px; }
.schedule-content.list-view .lesson-card .card-header { gap:10px; }
.schedule-content.list-view .lesson-card .subgroups-vertical { margin-top:8px; padding-top:8px; gap:8px; }
.schedule-content.list-view .lesson-card .subgroup-card { padding:9px 10px; }
.lesson-card.lunch-card { padding:9px 12px; margin:4px 0 16px; min-height:36px; gap:12px; border:0; border-radius:0; background:transparent; box-shadow:none; }
.lesson-card.lunch-card .lunch-label { color:var(--color-muted); font-size:13px; }
.lesson-card.lunch-card .time-range { margin:0; color:var(--color-muted); }
.next-lesson-summary-action[aria-busy="true"] { cursor:progress; }
.date-header[hidden] { display:none !important; }

/* Keep a single scrolling result area and preserve space when the keyboard opens. */
#searchModal .teacher-modal-header { margin-bottom:10px; }
#searchModal .search-mode-switch { padding-bottom:8px; margin-bottom:12px; }
#searchModal .search-mode-btn { min-height:54px; padding:7px 5px; gap:4px; font-size:11px; }
#searchModal [data-search-target="teacher"] { font-size:clamp(10px, 2.85vw, 11px); }
#searchModal .search-mode-btn i { font-size:17px; }
#searchModal .unified-search-row { flex-shrink:0; margin-bottom:10px; }
#searchModal .search-mode-stage { container:search-stage / size; }
#searchModal .search-hint { flex-shrink:0; margin-bottom:10px; line-height:1.45; }
#searchModal .modal-list-scroll { padding:2px 2px 12px; overscroll-behavior:contain; touch-action:pan-y; }
#searchModal .teacher-list, #searchModal .room-list { flex:none; max-height:none; overflow:visible; }
#searchModal .search-result-open { min-height:52px; padding:10px 12px; }
#searchModal .search-pin { flex-basis:44px; font-size:22px; color:var(--color-muted); }
#searchModal .search-pin[aria-pressed="true"] { color:var(--tg-theme-link-color); }
#searchModal.search-has-query .search-pane > .search-hint { display:none; }
#roomFreeTab .time-select-group { margin:12px 0; }
#roomFreeTab .free-room-range { margin:12px 0 16px; }
#freeRoomList { margin-top:16px; }
@container search-stage (min-height: 420px) {
    #roomFreeTab { display:flex; flex-direction:column; overflow:hidden; }
    #roomFreeTab .free-room-form { flex-shrink:0; }
    #searchModal #freeRoomList { flex:1 1 0; min-height:0; overflow-y:auto; overscroll-behavior:contain; }
}
body.keyboard-open #searchModal > .search-modal-content {
    margin-top:var(--search-viewport-top, 0px);
    height:var(--search-viewport-height, 100%);
}
body.keyboard-open #searchModal .teacher-modal-header { min-height:44px; margin-bottom:4px; }
body.keyboard-open #searchModal .search-mode-switch { margin-bottom:8px; padding-bottom:6px; }
body.keyboard-open #searchModal .search-mode-btn { min-height:44px; padding-block:6px; }
body.keyboard-open #searchModal .search-hint { display:none; }

/* Start, pair number and finish share a narrow, predictable column. */
.lesson-card .time-block { display:flex; flex-direction:column; align-items:center; justify-content:center; gap:8px; min-width:54px; }
.lesson-card .time-block .time-range { margin:0; font-size:13px; line-height:1.15; white-space:nowrap; }
.lesson-card .pair-num { font-size:28px; line-height:1.1; }
.lesson-card .lesson-progress { position:relative; overflow:hidden; min-height:72px; background:var(--color-border); }
.lesson-progress::after { content:''; position:absolute; inset:0 0 auto; height:var(--lesson-progress,0%); background:var(--color-accent); border-radius:inherit; transition:height 1s linear; }
.lesson-progress.is-complete::after { background:var(--color-muted); }
.lesson-card.lunch-card { min-height:52px; padding:12px 14px; gap:0 12px; flex-wrap:nowrap; background:var(--color-surface); border:1px solid var(--color-border); border-radius:12px; justify-content:space-between; }
.lunch-card > .lesson-locations { position:absolute; inset:-10px 14px auto; margin:0; }
.lesson-card.lunch-card .lunch-label { font-size:14px; font-weight:600; color:var(--color-text); }
.lesson-card.compact-subgroups .card-content { overflow-wrap:anywhere; }
.lesson-card.compact-subgroups .card-content .subgroups-vertical { margin:0; padding:0; border:0; gap:0; }
.lesson-card.compact-subgroups .subgroup-common + .subgroups-vertical { margin-top:8px; }
.lesson-card.compact-subgroups .subgroup-card { padding:8px 0; border:0; border-top:1px solid var(--color-border); border-radius:0; background:none; }
.lesson-card.compact-subgroups .subgroup-card:first-child { border-top:0; padding-top:0; }
.lesson-card.compact-subgroups .subgroup-card:last-child { padding-bottom:0; }
.compact-subgroups .subgroup-common .info-row { margin-top:3px; }
.compact-subgroups .subgroup-header { flex-wrap:wrap; justify-content:space-between; gap:4px; margin-bottom:5px; }
.subgroup-badges { display:flex; align-items:center; gap:4px; min-width:0; margin-inline-start:auto; }
.subgroup-badges .lesson-type-badge { min-height:21px; padding:2px 4px; }
.compact-subgroups .subgroup-header .room-badge { padding:2px 6px; gap:4px; border-radius:5px; font-weight:600; box-shadow:none; }
.compact-subgroups { --subgroup-label-color: var(--tg-theme-link-color); }
.compact-subgroups [data-subgroup="2"] { --subgroup-label-color: var(--color-subgroup-secondary, var(--tg-theme-link-color)); }
.compact-subgroups .subgroup-label { color:var(--subgroup-label-color); font-size:12px; font-weight:650; }
.single-subgroup .single-subgroup-label {
    position: absolute;
    top: 3px;
    right: 5px;
    padding: 1px 4px;
    border: 1px solid color-mix(in srgb, var(--subgroup-label-color) 65%, var(--color-border));
    border-radius: 5px;
    background: var(--color-surface);
    color: var(--subgroup-label-color);
    font-size: 10px;
    font-weight: 700;
    line-height: 13px;
    white-space: nowrap;
}
.lesson-card.single-subgroup .lesson-locations {
    /* Reserve the same space on each side to keep the room and type centered. */
    column-gap: 4px;
    padding-inline: 62px;
    margin-bottom: 7px;
}
.lesson-card.single-subgroup:not(.has-lesson-badges) { padding-top: 24px; }
@media (max-width: 400px) {
    .lesson-card.single-subgroup .lesson-locations .room-badge { padding-inline: 8px; gap: 4px; }
}
@media (min-width:900px) {
    .lesson-card.single-subgroup .subgroups-vertical { display:flex; }
}
.compact-subgroups .info-row { line-height:1.4; }

/* Each row extends the day rail to the next time marker. */
.lesson-card.timeline-card,
.schedule-content.list-view .lesson-card.timeline-card {
    --timeline-gap: 8px;
    --timeline-marker: 16px;
    display: grid;
    grid-template-columns: 44px 8px minmax(0, 1fr);
    align-items: stretch;
    gap: 8px;
    margin: 0 0 var(--timeline-gap);
    padding: 0;
    background: none;
    border: 0;
    border-radius: 0;
}
.lesson-card.timeline-card:last-child { margin-bottom: 0; }
.schedule-content > #scheduleContainer:has(> .timeline-card),
.schedule-content.day-preview > div:has(> .timeline-card) {
    padding-inline: 8px 12px;
}
.schedule-content.list-view .day-section > .timeline-card { margin-inline-start: -4px; }
.lesson-card.timeline-card.past { opacity: 1; }
.timeline-card .timeline-body {
    min-width: 0;
    min-height: 60px;
    padding: 10px 11px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 11px;
}
.timeline-card.current .timeline-body { border-color: var(--color-accent); }
.timeline-card.soon .timeline-body { border-color: #b8943a; }
.timeline-card.past .timeline-body, .timeline-card.past .time-block { opacity: .8; }
.lesson-card.timeline-card .time-block {
    align-self: start;
    align-items: flex-end;
    justify-content: flex-start;
    gap: 2px;
    min-width: 0;
    padding-top: 8px;
}
.lesson-card.timeline-card .time-block .lesson-start { font-size: 14px; font-weight: 700; color: var(--color-text); }
.lesson-card.timeline-card .time-block .lesson-end { font-size: 11px; color: var(--color-muted); }
.lesson-card.timeline-card .pair-num { color: var(--color-subtitle, var(--color-muted)); font-size: 13px; font-weight: 650; }
.lesson-card.timeline-card .pair-num:empty { display: none; }
.lesson-card.timeline-card .divider {
    position: relative;
    justify-self: center;
    width: 2px;
    min-height: 0;
    margin-bottom: calc(-1 * var(--timeline-gap));
    border-radius: 0;
    overflow: visible;
    background: var(--color-border);
}
.lesson-card.timeline-card:not(.timeline-card + .timeline-card) .divider {
    margin-top: var(--timeline-marker);
    --timeline-dot-top: 0px;
}
.lesson-card.timeline-card:not(:has(+ .timeline-card)) .divider {
    align-self: start;
    height: var(--timeline-marker);
    margin-bottom: 0;
}
.lesson-card.timeline-card:not(.timeline-card + .timeline-card):not(:has(+ .timeline-card)) .divider { height: 0; }
.timeline-card .divider::before {
    content: '';
    position: absolute;
    z-index: 1;
    inset: var(--timeline-dot-top, var(--timeline-marker)) auto auto 50%;
    transform: translate(-50%, -50%);
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--color-accent);
}
.timeline-card:is(.past, .window-card) .divider::before { background: var(--color-muted); }
.timeline-card .lesson-progress::after { height: 0; }
.timeline-card.current .lesson-progress::after {
    inset: var(--timeline-dot-top, var(--timeline-marker)) 0 0;
    height: auto;
    clip-path: inset(0 0 calc(100% - var(--lesson-progress, 0%)) 0);
    transition-property: clip-path;
}
.timeline-card.current:not(:has(+ .timeline-card)) .lesson-progress {
    align-self: stretch;
    height: auto;
}
.lesson-card.timeline-card .lesson-subject { margin: 0; font-size: 14px; overflow-wrap: anywhere; }
.timeline-meta, .timeline-description {
    display: flex;
    min-width: 0;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 8px;
    color: var(--color-muted);
    font-size: 12px;
}
.timeline-meta { justify-content: space-between; margin-top: 5px; }
.timeline-description { flex: 1 1 118px; }
.timeline-description:empty { display: none; }
.timeline-description .lesson-detail-full,
.timeline-description .lesson-detail-compact { overflow-wrap: anywhere; }
.timeline-card .lesson-type-badge {
    min-height: 0;
    padding: 0;
    border: 0;
    background: none;
    font-size: 12px;
}
.lesson-card.timeline-card .room-badge {
    padding: 4px 7px;
    background: color-mix(in srgb, var(--color-accent) 14%, var(--color-surface));
    color: var(--tg-theme-link-color);
    box-shadow: none;
}
.timeline-groups { margin-top: 5px; color: var(--color-muted); font-size: 12px; overflow-wrap: anywhere; }
.timeline-subgroups:not(:first-child) { margin-top: 8px; }
.timeline-subgroup + .timeline-subgroup { border-top: 1px solid var(--color-border); padding-top: 7px; margin-top: 7px; }
.timeline-subgroup > .lesson-subject { margin-top: 4px; }
.timeline-card.window-card .timeline-body { min-height: 0; background: transparent; border-style: dashed; align-self: start; }
.timeline-card.lunch-card .timeline-body { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.timeline-card.lunch-card .timeline-body .lunch-label { color: var(--color-muted); }
.timeline-card-setting { cursor: pointer; }
.timeline-card-setting .toggle-switch { flex-shrink: 0; }
@media (min-width:900px) {
    .lesson-card.timeline-card, .schedule-content.list-view .lesson-card.timeline-card { grid-template-columns: 58px 10px minmax(0, 1fr); }
    .schedule-content > #scheduleContainer:has(> .timeline-card),
    .schedule-content.day-preview > div:has(> .timeline-card) { padding-inline: 0; }
    .schedule-content.list-view .day-section > .timeline-card { margin-inline-start: 0; }
}

.week-days-nav .day-btn { flex: 0 0 auto; }
.week-days-nav .day-btn[aria-current="date"]:not(.active) .day-btn-label { color: var(--tg-theme-link-color); }
.week-days-nav .day-btn:focus-visible { outline: 2px solid var(--color-accent); outline-offset: -2px; }

#searchModal .search-container { position:relative; }
#searchModal .group-search { padding-right:52px; }
.search-clear { position:absolute; right:4px; top:50%; transform:translateY(-50%); width:44px; height:44px; border:0; border-radius:10px; background:none; color:var(--color-muted); cursor:pointer; font-size:16px; }
.search-clear[hidden], .free-room-range[hidden], #bbCoursesFilters[hidden], #bbCoursesSelection[hidden], #gradebookForm[hidden], #gradebookIdentity[hidden] { display:none; }
#searchModal .search-mode-btn { transition:background 180ms ease,color 180ms ease,min-height 180ms ease,padding 180ms ease,gap 180ms ease; }
#searchModal .search-mode-btn i { max-height:20px; opacity:1; overflow:hidden; transition:max-height 180ms ease,opacity 140ms ease,transform 180ms ease; }
body.keyboard-open #searchModal .search-mode-btn { gap:0; }
body.keyboard-open #searchModal .search-mode-btn i { max-height:0; opacity:0; transform:translateY(-5px) scale(.85); }

.bb-selection, .gradebook-identity { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:12px; margin-bottom:18px; border:1px solid var(--color-border); border-radius:12px; background:var(--color-surface); }
.bb-selection > span, .gradebook-identity > span { min-width:0; font-size:13px; line-height:1.5; overflow-wrap:anywhere; }
.bb-selection > button { flex-shrink:0; }
.gradebook-identity { flex-wrap:wrap; }
.gradebook-identity > div { display:flex; gap:8px; flex-wrap:wrap; }
.gradebook-identity button, .gradebook-attention { min-height:44px; border:1px solid var(--color-border); border-radius:9px; padding:8px 10px; background:var(--color-bg); color:var(--color-text); font:inherit; font-size:13px; cursor:pointer; }
.gradebook-summary .gradebook-attention { background:var(--color-surface); }
.gradebook-summary .gradebook-attention[aria-pressed="true"] { border-color:var(--color-accent); color:var(--color-accent); }
@media(prefers-reduced-motion:reduce) { .lesson-progress::after, #searchModal .search-mode-btn, #searchModal .search-mode-btn i { transition:none; } }

.study-menu-item:focus-visible, .bb-course-actions a:focus-visible, .bb-course-actions button:focus-visible { outline:2px solid var(--color-accent); outline-offset:3px; }
.schedule-calendar-btn { display:grid; place-items:center; width:38px; min-height:38px; padding:0; border:1px solid var(--color-border); border-radius:11px; background:var(--color-surface); color:var(--color-text); font-size:16px; cursor:pointer; }
.schedule-calendar-btn:focus-visible, .schedule-calendar button:focus-visible { outline:2px solid var(--color-accent); outline-offset:3px; }
.schedule-content.list-view #scheduleContainer { overflow-anchor:none; }

body.calendar-open { overflow:hidden; }
.schedule-calendar { box-sizing:border-box; width:min(360px,calc(100% - 24px)); max-height:calc(100dvh - 32px); overflow:auto; padding:16px; margin:auto; border:1px solid var(--color-border); border-radius:16px; background:var(--color-surface); color:var(--color-text); box-shadow:var(--shadow-lg); }
.schedule-calendar::backdrop { background:rgba(0,0,0,.55); }
.calendar-heading, .calendar-month { display:flex; align-items:center; justify-content:space-between; gap:8px; }
.calendar-heading h2 { font-size:18px; margin:0; }
.schedule-calendar button { border:0; border-radius:9px; background:none; color:inherit; font:inherit; cursor:pointer; }
.calendar-heading button, .calendar-month button { min-width:40px; min-height:40px; font-size:26px; }
.calendar-month { margin:8px 0; }
.calendar-month strong { font-size:14px; text-align:center; text-transform:capitalize; }
.calendar-weekdays, .calendar-days { display:grid; grid-template-columns:repeat(7,minmax(0,1fr)); gap:3px; }
.calendar-weekdays { margin-bottom:6px; text-align:center; color:var(--color-muted); font-size:12px; }
.schedule-calendar .calendar-date { min-height:36px; aspect-ratio:1; padding:0; font-variant-numeric:tabular-nums; font-size:14px; }
.schedule-calendar .calendar-date[aria-current="date"] { box-shadow:inset 0 0 0 1px var(--color-accent); }
.schedule-calendar .calendar-date[aria-pressed="true"] { background:var(--color-accent); color:var(--color-accent-text); }
.schedule-calendar button:disabled { opacity:.3; cursor:default; }
.schedule-calendar .calendar-today { width:100%; min-height:40px; margin-top:12px; border:1px solid var(--color-border); color:var(--tg-theme-link-color); }
