:root {
    --primary-blue: #3b82f6;
    --bg-color: #ffffff;
    --card-bg: #f0f9ff;
    --text-main: #111827;
    --text-secondary: #9ca3af;
    --tag-bg: #dbeafe;
    --tag-text: #2563eb;
    --border-color: #e5e7eb;
    --hover-bg: #f3f4f6;
}

[data-theme="dark"] {
    --bg-color: #0f172a;
    --card-bg: #1e293b;
    --text-main: #f1f5f9;
    --text-secondary: #94a3b8;
    --tag-bg: #1e3a5f;
    --tag-text: #60a5fa;
    --border-color: #334155;
    --hover-bg: #1e293b;
}
[data-theme="dark"] body { background-color: var(--bg-color); color: var(--text-main); }
[data-theme="dark"] .date-selector { background: #1e293b; border-color: #334155; color: #f1f5f9; }
[data-theme="dark"] .date-selector svg { color: #94a3b8; }
[data-theme="dark"] .date-picker-popup { background: #1e293b; border-color: #334155; box-shadow: 0 24px 60px rgba(0,0,0,0.5); }
[data-theme="dark"] .dp-title-row { background: #0f172a; color: #f1f5f9; }
[data-theme="dark"] .dp-nav-btn { color: #64748b; }
[data-theme="dark"] .dp-nav-btn:hover:not(:disabled) { background: #0f172a; color: #94a3b8; }
[data-theme="dark"] .dp-day { color: #f1f5f9; }
[data-theme="dark"] .dp-day:hover:not(:disabled) { background: #1e3a5f; color: #60a5fa; }
[data-theme="dark"] .dp-day.today { color: #60a5fa; }
[data-theme="dark"] .dp-day.selected.today { color: #fff; }
[data-theme="dark"] .dp-day:disabled { color: #334155; }
[data-theme="dark"] .dp-day-header { color: #475569; }
[data-theme="dark"] .burger-dropdown { background: rgba(30, 41, 59, 0.75); border-color: #334155; box-shadow: 0 10px 25px rgba(0,0,0,0.4); }
[data-theme="dark"] .support-widget { background-color: rgba(30, 41, 59, 0.75); box-shadow: 0 4px 20px rgba(0,0,0,0.3); }
[data-theme="dark"] .cookie-banner { background-color: rgba(30, 41, 59, 0.75); color: var(--text-main); box-shadow: 0 4px 20px rgba(0,0,0,0.3); }

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: background-color 0.35s var(--ease-spring, cubic-bezier(0.22, 1, 0.36, 1)),
                color 0.35s var(--ease-spring, cubic-bezier(0.22, 1, 0.36, 1));
}

.app-container {
    max-width: none; margin: 0; width: 100%; padding: 0 24px;
    display: flex; flex-direction: column; height: 100vh; overflow-y: auto; overflow-x: hidden;
}

.main-header { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; }

.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.logo-area { display: flex; align-items: center; flex-shrink: 0; }
.logo-area img { width: 110px; height: auto; display: block; }
.page-title { font-size: 24px; font-weight: 500; position: absolute; left: 50%; transform: translateX(-50%); letter-spacing: -0.01em; }
.header-controls { display: flex; align-items: center; gap: 16px; }

.schedule-switch-btn {
    text-decoration: none; color: var(--primary-blue); background-color: var(--card-bg);
    padding: 10px 20px; border-radius: 12px; font-weight: 500; font-size: 14px;
    transition: all 0.25s var(--ease-spring, cubic-bezier(0.22, 1, 0.36, 1)); border: 1px solid transparent; cursor: pointer; display: inline-block;
}
.schedule-switch-btn:hover { background-color: var(--hover-bg); border-color: var(--border-color); transform: translateY(-1px); }
.schedule-switch-btn:active { transform: translateY(0) scale(0.97); transition: transform 0.1s ease-out; }

/* Burger Menu Styles */
.burger-menu-container { position: relative; }
.burger-btn { background: none; border: none; cursor: pointer; color: var(--text-main); padding: 8px; border-radius: 8px; transition: background 0.2s var(--ease-spring, cubic-bezier(0.22, 1, 0.36, 1)), transform 0.1s ease-out; display: flex; align-items: center; justify-content: center; }
.burger-btn:hover { background-color: var(--hover-bg); }
.burger-btn:active { transform: scale(0.92); }
.burger-dropdown {
    position: absolute; right: 0; top: calc(100% + 8px); transform-origin: top right;
    background: rgba(255, 255, 255, 0.75); backdrop-filter: blur(0px) saturate(180%);
    border-radius: 16px; box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    border: 1px solid var(--border-color); padding: 8px; width: 260px; z-index: 1000;
    display: flex; flex-direction: column; gap: 4px;
    opacity: 0; visibility: hidden; pointer-events: none;
    transform: translateY(-8px) scale(0.96);
    transition: opacity 0.22s var(--ease-spring, cubic-bezier(0.22, 1, 0.36, 1)),
                transform 0.22s var(--ease-spring, cubic-bezier(0.22, 1, 0.36, 1)),
                background-color 0.3s var(--ease-spring, cubic-bezier(0.22, 1, 0.36, 1)),
                backdrop-filter 0.22s var(--ease-spring, cubic-bezier(0.22, 1, 0.36, 1)),
                border-color 0.3s var(--ease-spring, cubic-bezier(0.22, 1, 0.36, 1)),
                visibility 0s linear 0.22s;
}
.burger-dropdown.active {
    opacity: 1; visibility: visible; pointer-events: auto;
    backdrop-filter: blur(20px) saturate(180%);
    transform: translateY(0) scale(1);
    transition: opacity 0.22s var(--ease-spring, cubic-bezier(0.22, 1, 0.36, 1)),
                transform 0.22s var(--ease-spring, cubic-bezier(0.22, 1, 0.36, 1)),
                background-color 0.3s var(--ease-spring, cubic-bezier(0.22, 1, 0.36, 1)),
                backdrop-filter 0.22s var(--ease-spring, cubic-bezier(0.22, 1, 0.36, 1)),
                border-color 0.3s var(--ease-spring, cubic-bezier(0.22, 1, 0.36, 1)),
                visibility 0s linear 0s;
}
.dropdown-item { background: none; border: none; padding: 12px 16px; text-align: left; border-radius: 12px; font-size: 14px; font-weight: 500; color: var(--text-main); cursor: pointer; transition: all 0.2s var(--ease-spring, cubic-bezier(0.22, 1, 0.36, 1)); display: flex; align-items: center; gap: 12px; font-family: 'Inter', sans-serif; }
.dropdown-item:hover { background-color: var(--hover-bg); color: var(--primary-blue); }
.dropdown-item:active { transform: scale(0.98); }
.dropdown-item svg { color: var(--text-secondary); transition: color 0.2s; }
.dropdown-item:hover svg { color: var(--primary-blue); }

.mobile-only { display: none; }
@media (max-width: 768px) {
    .mobile-only { display: block; }
    .desktop-only { display: none !important; }

    /* Group chip in the phone header — same white, softly bordered shape as
       the day tabs right under it, so it reads as part of the same set. */
    .header-group.mobile-only {
        display: inline-flex; align-items: center; gap: 8px; justify-self: center;
        margin: 0; padding: 8px 16px; max-width: 100%; overflow: hidden; white-space: nowrap;
        background: #ffffff; border: 1px solid var(--border-color); border-radius: 999px;
        box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
        font-size: 15px; line-height: 1.2;
    }
    /* Slate rather than near-black: a label, quieter than the lesson titles. */
    .header-group-name { font-weight: 600; color: #334155; letter-spacing: -0.01em; }
    .header-group-sub { font-size: 12px; font-weight: 500; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; }
    [data-theme="dark"] .header-group-name { color: #e2e8f0; }
    [data-theme="dark"] .header-group.mobile-only { background: var(--card-bg); }
}

.date-selector {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    padding: 10px 18px;
    background: #ffffff;
    border: 1px solid #d7e0ec;
    border-radius: 14px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    font-family: inherit;
    font-size: 16px;
    font-weight: 500;
    color: #0f172a;
    cursor: pointer;
    transition: border-color 0.25s var(--ease-spring, cubic-bezier(0.22, 1, 0.36, 1)),
                box-shadow 0.25s var(--ease-spring, cubic-bezier(0.22, 1, 0.36, 1)),
                transform 0.25s var(--ease-spring, cubic-bezier(0.22, 1, 0.36, 1)),
                background-color 0.3s var(--ease-spring, cubic-bezier(0.22, 1, 0.36, 1));
}
.date-selector:hover {
    border-color: #c3cfdd;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
    transform: translateY(-1px);
}
.date-selector:active { transform: translateY(0) scale(0.98); transition: transform 0.1s ease-out; }
.date-selector:focus-visible {
    outline: none;
    border-color: #8bb5ff;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15);
}
.date-selector svg { color: #334155; flex-shrink: 0; }

.schedule-grid-wrap { flex: 1; display: flex; flex-direction: column; min-height: 0; padding-bottom: 24px; box-sizing: border-box; }
.schedule-grid { flex: 1; min-height: 0; display: flex; flex-wrap: nowrap; overflow-anchor: none; overflow-x: auto; scrollbar-width: none; cursor: grab; user-select: none; }
.schedule-grid::-webkit-scrollbar { display: none; }
.day-column { border-right: 2px solid var(--border-color); padding: 20px; display: flex; flex-direction: column; gap: 16px; flex: 0 0 20%; min-width: 300px; }
.day-column:last-child { border-right: none; }
.day-header { margin-bottom: 12px; }
.day-badge { background-color: var(--primary-blue); color: white; font-size: 12px; padding: 4px 12px; border-radius: 12px; display: table; width: fit-content; margin-bottom: 8px; }
.day-badge.hidden { visibility: hidden; }
.day-title { font-size: 18px; font-weight: 600; margin-bottom: 4px; letter-spacing: -0.01em; }
.day-time { font-size: 13px; line-height: 16px; min-height: 16px; color: var(--text-secondary); }

.class-card { background-color: var(--card-bg); border-radius: 16px; padding: 16px; border: 1px solid transparent; transition: all 0.25s var(--ease-spring, cubic-bezier(0.22, 1, 0.36, 1)); }
.class-card:hover { border-color: var(--tag-bg); box-shadow: 0 4px 12px rgba(59,130,246,0.1); }
.card-time { color: var(--tag-text); font-size: 14px; margin-bottom: 8px; }
.card-subject { font-weight: 600; font-size: 15px; margin-bottom: 12px; line-height: 1.4; letter-spacing: -0.005em; transition: color 0.3s var(--ease-spring, cubic-bezier(0.22, 1, 0.36, 1)); }
.card-meta { display: flex; gap: 8px; flex-wrap: wrap; }
.tag-room, .tag-type { background-color: var(--tag-bg); color: var(--tag-text); font-size: 11px; padding: 4px 8px; border-radius: 6px; font-weight: 500; letter-spacing: 0.01em; transition: background-color 0.3s var(--ease-spring, cubic-bezier(0.22, 1, 0.36, 1)), color 0.3s var(--ease-spring, cubic-bezier(0.22, 1, 0.36, 1)); }
.tag-subgroup { background-color: #fef3c7; color: #d97706; font-size: 11px; padding: 4px 8px; border-radius: 6px; font-weight: 500; letter-spacing: 0.01em; }

.support-widget { position: fixed; bottom: 80px; right: 30px; background-color: rgba(255, 255, 255, 0.75); backdrop-filter: blur(20px) saturate(180%); padding: 12px 20px; border-radius: 16px; box-shadow: 0 4px 20px rgba(0,0,0,0.08); display: flex; align-items: center; gap: 12px; cursor: pointer; transition: transform 0.25s var(--ease-spring, cubic-bezier(0.22, 1, 0.36, 1)), background-color 0.3s var(--ease-spring, cubic-bezier(0.22, 1, 0.36, 1)); }
.support-widget:hover { transform: translateY(-2px); }
.support-widget:active { transform: translateY(0) scale(0.98); transition: transform 0.1s ease-out; }
.support-icon { display: flex; align-items: center; justify-content: center; padding: 6px 0; }
.support-icon img { width: 72px; height: auto; display: block; }
.support-text { display: flex; flex-direction: column; }
.support-title { font-size: 12px; color: var(--text-secondary); }
.support-subtitle { font-size: 14px; font-weight: 500; color: var(--text-main); }
.close-support { background: none; border: none; cursor: pointer; color: var(--text-secondary); display: flex; align-items: center; padding: 4px; margin-left: 4px; border-radius: 6px; flex-shrink: 0; transition: color 0.2s var(--ease-spring, cubic-bezier(0.22, 1, 0.36, 1)), background-color 0.2s var(--ease-spring, cubic-bezier(0.22, 1, 0.36, 1)), transform 0.1s ease-out; }
.close-support:hover { color: var(--text-main); background-color: var(--hover-bg); }
.close-support:active, .close-cookie:active { transform: scale(0.85); }

.cookie-banner { position: fixed; bottom: 20px; right: 30px; background-color: rgba(255, 255, 255, 0.75); backdrop-filter: blur(20px) saturate(180%); padding: 12px 20px; border-radius: 12px; box-shadow: 0 4px 20px rgba(0,0,0,0.08); display: flex; align-items: center; gap: 12px; font-size: 14px; color: var(--text-main); z-index: 100; transition: background-color 0.3s var(--ease-spring, cubic-bezier(0.22, 1, 0.36, 1)); }
.cookie-banner a { color: var(--primary-blue); text-decoration: none; border-bottom: 1px solid var(--primary-blue); }
.close-cookie { background: none; border: none; cursor: pointer; color: var(--text-secondary); display: flex; align-items: center; transition: color 0.2s var(--ease-spring, cubic-bezier(0.22, 1, 0.36, 1)), transform 0.1s ease-out; }
.close-cookie:hover { color: var(--text-main); }

/* min-height matches a lesson card (time + subject + tags), so a rest day lines up with its neighbours */
.rest-day { position: relative; overflow: hidden; text-align: left; padding: 16px 20px; background-color: var(--card-bg); border-radius: 16px; border: 1px solid transparent; color: var(--primary-blue); display: flex; flex-direction: row; align-items: center; justify-content: flex-start; gap: 16px; height: auto; min-height: 113px; width: 100%; }
.rest-day-sparkle { position: absolute; color: var(--primary-blue); opacity: 0.3; pointer-events: none; }
.rest-day-sparkle-left { top: 12px; left: 14px; }
.rest-day-sparkle-right { top: 14px; right: 16px; }
.rest-day-icon { display: flex; align-items: center; justify-content: center; width: 60px; height: 60px; flex-shrink: 0; }
.rest-day-text { display: flex; flex-direction: column; gap: 4px; }
.rest-day-title { font-weight: 600; font-size: 16px; line-height: 1.3; letter-spacing: -0.005em; }
.rest-day-subtitle { font-size: 14px; font-weight: 400; color: var(--text-secondary); }
.rest-day-confetti { width: 60px; height: 60px; max-width: 60px; object-fit: contain; display: block; }
.schedule-stale { margin: 0 0 10px; padding: 8px 14px; border-radius: 10px; background: rgba(245, 158, 11, 0.12); color: #92400e; font-size: 14px; }
[data-theme="dark"] .schedule-stale { background: rgba(245, 158, 11, 0.16); color: #fcd34d; }
.schedule-loading { display: flex; align-items: center; justify-content: center; flex: 1; color: var(--text-secondary); font-size: 16px; gap: 12px; }
.loading-spinner { width: 24px; height: 24px; border: 3px solid var(--border-color); border-top-color: var(--primary-blue); border-radius: 50%; animation: spin 0.8s linear infinite; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 1400px) {
    .schedule-grid { padding-bottom: 10px; }
}

@media (max-width: 768px) {
    body { background-color: #f3f8ff; overflow-y: auto; }
    .app-container { padding: 0 16px; overflow-y: visible; height: auto; }
    .main-header { padding: 16px 0; display: grid; grid-template-columns: minmax(max-content, 1fr) minmax(0, max-content) minmax(max-content, 1fr); align-items: center; column-gap: 10px; }
    .logo-area { justify-self: start; }
    .logo-area img { width: 70px; }
    .page-title { font-size: 16px; position: static; left: auto; transform: none; width: 100%; text-align: center; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .header-controls { display: flex; justify-self: end; margin-left: 0; }
    .burger-btn { padding: 6px; }
    .toolbar { display: none; }
    .schedule-grid { display: flex; flex-direction: column; gap: 16px; border-top: none; overflow-x: hidden; overflow-y: visible; padding-bottom: 100px; flex-wrap: nowrap; }
    .day-column { background-color: #ffffff; border-radius: 24px; padding: 20px; border: none; box-shadow: 0 2px 8px rgba(0,0,0,0.02); flex: none; width: 100%; min-width: 0; }
    .day-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0; flex-wrap: wrap; }
    .day-title { font-size: 20px; font-weight: 700; order: 1; margin-bottom: 0; }
    .day-badge { order: 2; margin-bottom: 0; margin-left: auto; background-color: #0066FF; font-size: 13px; padding: 6px 12px; border-radius: 8px; }
    .day-time { display: none; }
    .class-card { background-color: #F0F7FF; border-radius: 16px; padding: 16px; margin-bottom: -2px; border: none; }
    .class-card:last-child { margin-bottom: 0; }
    .card-time { color: #2563eb; font-weight: 600; font-size: 15px; margin-bottom: 4px; }
    .card-subject { font-size: 16px; font-weight: 700; margin-bottom: 12px; color: #111827; }
    .tag-room, .tag-type { background-color: var(--tag-bg); color: var(--tag-text); font-size: 12px; padding: 6px 10px; border-radius: 6px; }
    .support-widget { bottom: 70px; right: 20px; padding: 10px 16px; }
    .support-text { display: none; }
    .rest-day.mobile, .day-column .rest-day { background-color: #F0F7FF; padding: 20px; min-height: auto; height: auto; flex-direction: row; justify-content: flex-start; align-items: center; text-align: left; color: var(--primary-blue); margin-top: 0; gap: 14px; }
    /* Each rest-day card takes the look of the lesson cards around it: white in the day view, tinted in the list view. */
    .rest-day.mobile { background-color: #ffffff; box-shadow: 0 1px 3px rgba(0,0,0,0.05); }
    [data-theme="dark"] .rest-day.mobile { background-color: #1e293b; box-shadow: 0 1px 3px rgba(0,0,0,0.25); }
    [data-theme="dark"] .day-column .rest-day { background-color: #334155; }
    .rest-day.mobile .rest-day-title, .day-column .rest-day .rest-day-title { font-size: 17px; font-weight: 700; letter-spacing: -0.005em; }
    .rest-day.mobile .rest-day-subtitle, .day-column .rest-day .rest-day-subtitle { font-size: 14px; }
    .rest-day.mobile .rest-day-icon, .day-column .rest-day .rest-day-icon { width: 60px; height: 60px; }
    .rest-day.mobile .rest-day-confetti, .day-column .rest-day .rest-day-confetti { width: 60px; height: 60px; max-width: 60px; }

    /* Date picker becomes a bottom sheet on mobile, with a dimming scrim behind it */
    .dp-scrim {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 999;
        background: rgba(15, 23, 42, 0.4);
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transition: opacity 0.3s var(--ease-spring, cubic-bezier(0.22, 1, 0.36, 1)), visibility 0s linear 0.3s;
    }
    .dp-scrim.active {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        transition: opacity 0.3s var(--ease-spring, cubic-bezier(0.22, 1, 0.36, 1)), visibility 0s linear 0s;
    }
    .date-picker-popup {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        top: auto;
        width: auto;
        max-width: none;
        border-radius: 24px 24px 0 0;
        padding: 20px 20px calc(24px + env(safe-area-inset-bottom));
        box-shadow: 0 -20px 60px rgba(15, 23, 42, 0.25);
        transform: translateY(100%);
    }
    .date-picker-popup.active {
        transform: translateY(0);
    }
}

.date-selector-wrapper { position: relative; display: inline-flex; }
.dp-scrim { display: none; }
.date-picker-popup {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    transform-origin: top left;
    width: 304px;
    padding: 18px 18px 20px;
    background: #ffffff;
    border: 1px solid #dfe7f2;
    border-radius: 22px;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.14);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-8px) scale(0.96);
    transition: opacity 0.25s var(--ease-spring, cubic-bezier(0.22, 1, 0.36, 1)),
                transform 0.25s var(--ease-spring, cubic-bezier(0.22, 1, 0.36, 1)),
                background-color 0.3s var(--ease-spring, cubic-bezier(0.22, 1, 0.36, 1)),
                border-color 0.3s var(--ease-spring, cubic-bezier(0.22, 1, 0.36, 1)),
                visibility 0s linear 0.25s;
}
.date-picker-popup.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0) scale(1);
    transition: opacity 0.25s var(--ease-spring, cubic-bezier(0.22, 1, 0.36, 1)),
                transform 0.25s var(--ease-spring, cubic-bezier(0.22, 1, 0.36, 1)),
                background-color 0.3s var(--ease-spring, cubic-bezier(0.22, 1, 0.36, 1)),
                border-color 0.3s var(--ease-spring, cubic-bezier(0.22, 1, 0.36, 1)),
                visibility 0s linear 0s;
}
.dp-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
}
.dp-title-row {
    min-height: 36px;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 16px;
    background: #f2f5fb;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    color: #0f172a;
}
.dp-nav-btn {
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    background: transparent;
    border-radius: 999px;
    color: #94a3b8;
    font-family: inherit;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s var(--ease-spring, cubic-bezier(0.22, 1, 0.36, 1)),
                color 0.2s var(--ease-spring, cubic-bezier(0.22, 1, 0.36, 1)),
                opacity 0.2s var(--ease-spring, cubic-bezier(0.22, 1, 0.36, 1)),
                transform 0.1s ease-out;
}
.dp-nav-btn:hover:not(:disabled) {
    background: #f8fafc;
    color: #475569;
}
.dp-nav-btn:active:not(:disabled) { transform: scale(0.9); }
.dp-nav-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15);
}
.dp-nav-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}
.dp-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 10px 0;
    text-align: center;
}
.dp-day-header {
    font-size: 14px;
    color: #94a3b8;
    font-weight: 500;
    line-height: 1.2;
}
.dp-empty-cell {
    width: 36px;
    height: 36px;
    margin: 0 auto;
}
.dp-day {
    width: 36px;
    height: 36px;
    margin: 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    border-radius: 999px;
    color: #0f172a;
    font-family: inherit;
    font-size: 15px;
    font-weight: 500;
    line-height: 1;
    cursor: pointer;
    transition: background-color 0.2s var(--ease-spring, cubic-bezier(0.22, 1, 0.36, 1)),
                color 0.2s var(--ease-spring, cubic-bezier(0.22, 1, 0.36, 1)),
                box-shadow 0.2s var(--ease-spring, cubic-bezier(0.22, 1, 0.36, 1)),
                transform 0.15s ease-out;
}
.dp-day:hover:not(:disabled) {
    background: #edf4ff;
    color: #0057ff;
}
.dp-day:active:not(:disabled) { transform: scale(0.88); }
.dp-day:focus-visible {
    outline: none;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15);
}
.dp-day:disabled {
    color: #cbd5e1;
    cursor: not-allowed;
}
.dp-day.selected {
    background: #0057ff;
    color: #ffffff;
    box-shadow: 0 12px 22px rgba(0, 87, 255, 0.24);
}
.dp-day.today {
    color: #0057ff;
    font-weight: 700;
}
.dp-day.selected.today { color: #ffffff; }

/* Theme toggle switch */
.theme-toggle {
    display: flex; align-items: center; gap: 8px;
    background: none; border: none; cursor: pointer;
    padding: 6px 10px; border-radius: 10px;
    color: var(--text-secondary);
    transition: background 0.2s var(--ease-spring, cubic-bezier(0.22, 1, 0.36, 1)),
                color 0.2s var(--ease-spring, cubic-bezier(0.22, 1, 0.36, 1)),
                transform 0.1s ease-out;
}
.theme-toggle:hover { background-color: var(--hover-bg); color: var(--text-main); }
.theme-toggle:active { transform: scale(0.96); }
.toggle-track {
    width: 38px; height: 22px; border-radius: 999px;
    background: #d1d5db; position: relative; flex-shrink: 0;
    transition: background 0.3s var(--ease-spring, cubic-bezier(0.22, 1, 0.36, 1));
}
[data-theme="dark"] .toggle-track { background: var(--primary-blue); }
.toggle-thumb {
    position: absolute; top: 3px; left: 3px;
    width: 16px; height: 16px; border-radius: 50%;
    background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,0.2);
    transition: transform 0.3s var(--ease-spring, cubic-bezier(0.22, 1, 0.36, 1));
}
[data-theme="dark"] .toggle-thumb { transform: translateX(16px); }
.theme-dropdown-item { justify-content: space-between !important; cursor: pointer; }
.theme-dropdown-left { display: flex; align-items: center; gap: 12px; }

/* Reduced motion: people who turn motion down in their OS get instant state
   changes instead of slides, springs and the endlessly floating circles. */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Live update: a cancelled pair fades and shrinks a touch, then its place
   closes so the pairs below glide up; a new pair opens its place, then fades
   in. The wrapper's height and the card's fade are separate animations, so
   nothing jumps. The negative margin also closes the container's flex gap
   the pair leaves behind. Reduced motion collapses all of this to instant
   (see the rule above). Timing must fit LESSON_MOTION_MS in SchedulePage. */
.day-column { --stack-gap: 16px; }
.day-schedule { --stack-gap: 12px; }
.lesson-motion { display: grid; grid-template-rows: 1fr; }
.lesson-motion-inner { min-height: 0; overflow: hidden; }
.lesson-motion.is-leaving { animation: lessonCollapse 0.3s cubic-bezier(0.22, 1, 0.36, 1) 0.18s both; }
.lesson-motion.is-leaving .lesson-motion-inner { animation: lessonFadeOut 0.2s ease-out both; }
.lesson-motion.is-entering { animation: lessonExpand 0.3s cubic-bezier(0.22, 1, 0.36, 1) both; }
.lesson-motion.is-entering .lesson-motion-inner { animation: lessonFadeIn 0.25s ease-out 0.15s both; }
@keyframes lessonCollapse {
    from { grid-template-rows: 1fr; margin-bottom: 0; }
    to { grid-template-rows: 0fr; margin-bottom: calc(-1 * var(--stack-gap, 16px)); }
}
@keyframes lessonExpand {
    from { grid-template-rows: 0fr; margin-bottom: calc(-1 * var(--stack-gap, 16px)); }
    to { grid-template-rows: 1fr; margin-bottom: 0; }
}
@keyframes lessonFadeOut { to { opacity: 0; transform: scale(0.96); } }
@keyframes lessonFadeIn { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: none; } }
