.student-calendar {
    max-width: 1200px;
    margin: 40px auto;
    font-family: inherit;
}

.student-calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.student-calendar-title {
    font-size: 32px;
    font-weight: 700;
}

.student-calendar-week {
    color: #6b7280;
    font-weight: 500;
}

.student-calendar-nav {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.student-calendar-nav a {
    display: inline-block;
    padding: 8px 14px;
    border-radius: 999px;
    background: #f3f4f6;
    color: #111827;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
}

.student-calendar-nav a:hover {
    background: #e5e7eb;
}

.student-calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 12px;
}

.student-calendar-day-card {
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    background: #fff;
    padding: 14px;
    min-height: 220px;
}

.student-calendar-day-title {
    font-weight: 700;
    margin-bottom: 12px;
    text-align: center;
}

.student-slot-free {
    background: #dcfce7;
    color: #166534;
    padding: 8px 10px;
    border-radius: 10px;
    margin-bottom: 8px;
    cursor: pointer;
    font-weight: 600;
}

.student-slot-lesson {
    background: #dbeafe;
    color: #1e40af;
    padding: 8px 10px;
    border-radius: 10px;
    margin-bottom: 8px;
    cursor: pointer;
    font-weight: 600;
}

.student-slot-later,
.student-slot-empty {
    background: #f3f4f6;
    color: #9ca3af;
    padding: 8px 10px;
    border-radius: 10px;
    margin-bottom: 8px;
    font-size: 12px;
    font-weight: 500;
}

.student-slot-time {
    font-size: 12px;
    opacity: 0.85;
    margin-top: 3px;
}

@media (max-width: 900px) {
    .student-calendar {
        overflow-x: auto;
    }

    .student-calendar-days {
        min-width: 1000px;
    }

    .student-calendar-title {
        font-size: 24px;
    }
}

.student-calendar-grid-view {
    display: grid;
    position: relative;
    grid-template-columns: 80px repeat(7, 1fr);
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    overflow: hidden;
    background: #fff;
}

.student-calendar-corner,
.student-calendar-grid-day-header {
    background: #f3f4f6;
    border-right: 1px solid #e5e7eb;
    border-bottom: 1px solid #e5e7eb;
    padding: 10px 8px;
    font-weight: 700;
    text-align: center;
}

.student-calendar-time-column {
    background: #f9fafb;
    border-right: 1px solid #e5e7eb;
}

.student-calendar-time-row {
    border-bottom: 1px solid #e5e7eb;
    padding: 8px;
    color: #6b7280;
    font-size: 13px;
    font-weight: 500;
}

.student-calendar-grid-day {
    position: relative;
    border-right: 1px solid #e5e7eb;
    background: #fff;
}

.student-calendar-hour-line {
    position: absolute;
    left: 0;
    right: 0;
    border-top: 1px solid #e5e7eb;
    pointer-events: none;
}

.student-slot-positioned {
    position: absolute;
    left: 6px;
    right: 6px;
    z-index: 2;
    overflow: hidden;
}

.student-slot-positioned.student-slot-free,
.student-slot-positioned.student-slot-lesson,
.student-slot-positioned.student-slot-later,
.student-slot-positioned.student-slot-empty {
    margin-bottom: 0;
    box-sizing: border-box;
}

@media (max-width: 900px) {
    .student-calendar {
        overflow-x: auto;
    }

    .student-calendar-grid-view {
        min-width: 1000px;
    }
}
.sp-teacher-block-form {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: end;
    background: #fff7ed;
    border: 1px solid #fed7aa;
    padding: 16px;
    border-radius: 14px;
    margin-bottom: 20px;
}

.sp-teacher-block-form label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 13px;
    font-weight: 600;
}

.sp-teacher-block-form input {
    padding: 8px 10px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
}

.sp-teacher-block-form button {
    padding: 9px 14px;
    border: 0;
    border-radius: 999px;
    background: #111827;
    color: #fff;
    font-weight: 700;
    cursor: pointer;
}
<?php if ($is_teacher && !empty($manual_blocks)): ?>
    <?php foreach ($manual_blocks as $manual_block): ?>
        <?php
        $block_start = strtotime($manual_block->start_time);
        $block_end = strtotime($manual_block->end_time);
        $top = $time_to_top($block_start);
        $height = $duration_to_height($block_start, $block_end);
        ?>
        <div class="student-slot-manual-block student-slot-positioned"
             style="top: <?php echo esc_attr($top); ?>px; height: <?php echo esc_attr($height); ?>px;">
            Блокировка
            <?php if (!empty($manual_block->reason)): ?>
                <div class="student-slot-time">
                    <?php echo esc_html($manual_block->reason); ?>
                </div>
            <?php endif; ?>
            <div class="student-slot-time">
                <?php echo esc_html(date_i18n('H:i', $block_start)); ?>
                –
                <?php echo esc_html(date_i18n('H:i', $block_end)); ?>
            </div>
        </div>
    <?php endforeach; ?>
<?php endif; ?>

.sp-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(17,24,39,.45);
    z-index: 999999;
    align-items: center;
    justify-content: center;
}

.sp-modal.open {
    display: flex;
}

.sp-modal-content {
    background: #fff;
    border-radius: 18px;
    padding: 24px;
    width: min(420px, 92vw);
    position: relative;
}

.sp-modal-content h3 {
    margin-top: 0;
    margin-bottom: 16px;
}

.sp-modal-content form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sp-modal-content label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 13px;
    font-weight: 600;
}

.sp-modal-content input {
    padding: 9px 10px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
}

.sp-modal-content button[type="submit"] {
    padding: 10px 14px;
    border: 0;
    border-radius: 999px;
    background: #111827;
    color: #fff;
    font-weight: 700;
    cursor: pointer;
}

.sp-modal-close {
    position: absolute;
    top: 12px;
    right: 14px;
    border: 0;
    background: transparent;
    font-size: 26px;
    cursor: pointer;
}

.student-slot-google-event {
    background: #ede9fe;
    color: #5b21b6;
    padding: 8px 10px;
    border-radius: 10px;
    font-weight: 700;
    border: 1px solid #c4b5fd;
    box-sizing: border-box;
    overflow: hidden;
}

.student-slot-google-event {
    background: #fef3c7 !important;
    color: #92400e !important;
    border: 1px solid #fbbf24 !important;
}

.student-calendar .student-slot-google-event {
    background: #fef3c7 !important;
    color: #92400e !important;
    border: 1px solid #fbbf24 !important;
    padding: 8px 10px !important;
    border-radius: 10px !important;
    font-weight: 700 !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
    z-index: 6 !important;
}

.student-slot-open-exception {
    background: #f3f4f6;
    color: #374151;
    border: 1px dashed #9ca3af;
    padding: 8px 10px;
    border-radius: 10px;
    font-weight: 700;
    cursor: pointer;
    box-sizing: border-box;
    overflow: hidden;
}

.student-dashboard-lesson {
    display: block;
    padding: 14px 18px;
    margin-bottom: 12px;

    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 18px;

    text-decoration: none !important;
    color: inherit;

    box-shadow: 0 2px 8px rgba(0,0,0,.04);

    transition: all .2s ease;
}

.student-dashboard-lesson:hover {
    background: #f8fafc;
    border-color: #93c5fd;

    transform: translateY(-2px);

    box-shadow: 0 6px 18px rgba(59,130,246,.15);
}