/* Общие стили */
:root {
    --main-bg: #fff;
    --accent-blue: #0033a0;
    --accent-blue-dark: #002266;
    --text-main: #111;
    --border-radius: 14px;
    --success-green: #22c55e;
    --warning-yellow: #f59e0b;
    --danger-red: #ef4444;
    --gray-light: #f3f4f6;
    --gray-medium: #e5e7eb;
    --gray-dark: #6b7280;
}

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

html {
    width: 100%;
    overflow-x: hidden;
    position: relative;
}

body {
    font-family: 'Roboto', 'Arial', sans-serif;
    line-height: 1.6;
    color: var(--text-main);
    background-color: var(--main-bg);
    min-height: 100vh;
    position: relative;
    width: 100%;
    overflow-x: hidden;
    touch-action: pan-y;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
}

/* Размытые шахматные фигуры в фоне */
.bg-chess {
    position: fixed;
    z-index: 0;
    opacity: 0.06;
    filter: blur(16px);
    pointer-events: none;
}

/* ===========================
   СТРАНИЦА АВТОРИЗАЦИИ
   =========================== */

.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
    z-index: 1;
    -webkit-overflow-scrolling: touch;
}

.login-box {
    background: white;
    border: 2px solid var(--accent-blue);
    border-radius: var(--border-radius);
    padding: 48px 40px;
    max-width: 450px;
    width: 100%;
    box-shadow: 0 10px 40px rgba(0, 51, 160, 0.1);
    box-sizing: border-box;
}

.logo-section {
    text-align: center;
    margin-bottom: 32px;
}

.chess-icon {
    font-size: 64px;
    color: var(--accent-blue);
    margin-bottom: 16px;
}

.logo-section h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--accent-blue);
    margin-bottom: 8px;
}

.club-name {
    font-size: 16px;
    color: var(--gray-dark);
}

.login-form {
    margin-top: 24px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-main);
    margin-bottom: 8px;
}

.form-group input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--gray-medium);
    border-radius: 10px;
    font-size: 16px;
    transition: border-color 0.2s;
    -webkit-appearance: none;
    appearance: none;
}

.form-group input:focus {
    outline: none;
    border-color: var(--accent-blue);
}

.error-message {
    color: var(--danger-red);
    font-size: 14px;
    margin-bottom: 16px;
    min-height: 20px;
}

.login-btn {
    width: 100%;
    padding: 16px;
    background: var(--accent-blue);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.login-btn:hover {
    background: var(--accent-blue-dark);
}


/* ===========================
   ОСНОВНОЙ ИНТЕРФЕЙС ДНЕВНИКА
   =========================== */

.diary-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 1;
    width: 100%;
    overflow-x: hidden;
}

/* Шапка */
.diary-header {
    background: var(--accent-blue);
    color: white;
    padding: 20px 0;
    box-shadow: 0 2px 8px rgba(0, 51, 160, 0.15);
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chess-piece {
    font-size: 32px;
}

.title {
    font-size: 24px;
    font-weight: 700;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-name {
    font-size: 16px;
    font-weight: 500;
}

.logout-btn {
    padding: 8px 20px;
    background: white;
    color: var(--accent-blue);
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.logout-btn:hover {
    background: var(--gray-light);
}

/* Навигация */
.diary-nav {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(250, 251, 252, 0.98));
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 10px 20px;
    position: sticky;
    top: 0;
    z-index: 100;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    gap: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border-radius: 0 0 16px 16px;
    border-bottom: none;
}

.nav-btn {
    flex: 1;
    padding: 12px 20px;
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(0, 51, 160, 0.1);
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    color: var(--gray-dark);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    -webkit-tap-highlight-color: transparent;
}

.nav-btn:hover {
    color: var(--accent-blue);
    background: rgba(0, 51, 160, 0.08);
    border-color: rgba(0, 51, 160, 0.2);
    transform: translateY(-1px);
}

.nav-btn.active {
    color: white;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-blue-dark));
    box-shadow: 0 4px 16px rgba(0, 51, 160, 0.35), 0 2px 8px rgba(0, 51, 160, 0.2);
    border-color: var(--accent-blue);
    transform: translateY(-2px);
}

.nav-btn.active:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 51, 160, 0.4), 0 4px 12px rgba(0, 51, 160, 0.25);
}

.nav-btn:active {
    transform: translateY(0);
}

/* Контент */
.diary-content {
    flex: 1;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 32px 20px;
    box-sizing: border-box;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===========================
   ПРОФИЛЬ
   =========================== */

.profile-card {
    background: white;
    border: 2px solid var(--accent-blue);
    border-radius: var(--border-radius);
    padding: 32px;
    box-shadow: 0 4px 16px rgba(0, 51, 160, 0.08);
    width: 100%;
    box-sizing: border-box;
}

.profile-header {
    display: flex;
    align-items: center;
    gap: 24px;
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 2px solid var(--gray-medium);
}

.profile-photo {
    flex-shrink: 0;
}

.photo-placeholder {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-blue-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    font-weight: 700;
    color: white;
    border: 4px solid white;
    box-shadow: 0 4px 16px rgba(0, 51, 160, 0.2);
    overflow: hidden;
    position: relative;
    cursor: pointer;
}

.profile-photo-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.avatar-upload-btn {
    display: none;
}

.profile-info h2 {
    font-size: 32px;
    font-weight: 700;
    color: var(--accent-blue);
    margin-bottom: 8px;
}

.profile-details {
    display: grid;
    gap: 16px;
}

.detail-row {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 16px;
    padding: 12px 0;
    border-bottom: 1px solid var(--gray-light);
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-label {
    font-weight: 600;
    color: var(--gray-dark);
}

.detail-value {
    color: var(--text-main);
    font-weight: 500;
}

.subject-teachers-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 6px;
}

.subject-teachers-list li {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    font-size: 14px;
}

.subject-name-pill {
    padding: 4px 10px;
    border-radius: 999px;
    background: #e0edff;
    color: var(--accent-blue);
    font-weight: 600;
    font-size: 13px;
}

.subject-teacher {
    color: var(--gray-dark);
    font-size: 13px;
}

/* ===========================
   РАСПИСАНИЕ
   =========================== */

.schedule-card {
    background: white;
    border: 2px solid var(--accent-blue);
    border-radius: var(--border-radius);
    padding: 32px;
    box-shadow: 0 4px 16px rgba(0, 51, 160, 0.08);
    width: 100%;
    box-sizing: border-box;
}

.schedule-card h2 {
    font-size: 28px;
    font-weight: 700;
    color: var(--accent-blue);
    margin-bottom: 24px;
}

.schedule-grid {
    display: grid;
    gap: 16px;
}

.schedule-item {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 20px;
    padding: 20px;
    background: var(--gray-light);
    border-left: 4px solid var(--accent-blue);
    border-radius: 10px;
    transition: all 0.2s;
}

.schedule-item:hover {
    background: white;
    box-shadow: 0 4px 12px rgba(0, 51, 160, 0.1);
    transform: translateX(4px);
}

.schedule-day {
    font-size: 18px;
    font-weight: 700;
    color: var(--accent-blue);
}

.schedule-details {
    display: grid;
    gap: 8px;
}

.schedule-time {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-main);
}

.schedule-subject {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 999px;
    background: #e0edff;
    color: var(--accent-blue);
    font-size: 13px;
    font-weight: 600;
    width: fit-content;
}

.no-schedule {
    text-align: center;
    padding: 48px;
    color: var(--gray-dark);
    font-size: 16px;
}

/* ===========================
   ДНЕВНИК ОЦЕНОК
   =========================== */

.grades-card {
    background: white;
    border: 2px solid var(--accent-blue);
    border-radius: var(--border-radius);
    padding: 32px;
    box-shadow: 0 4px 16px rgba(0, 51, 160, 0.08);
    width: 100%;
    box-sizing: border-box;
}

.grades-card h2 {
    font-size: 28px;
    font-weight: 700;
    color: var(--accent-blue);
    margin-bottom: 24px;
}

/* Фильтр по предметам */
.subject-filter {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    margin-bottom: 20px;
}

.subject-filter-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-dark);
}

.subject-filter-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.subject-pill {
    padding: 6px 14px;
    border-radius: 999px;
    border: 1px solid rgba(0, 51, 160, 0.15);
    background: #f3f4ff;
    color: var(--accent-blue);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.subject-pill:hover {
    background: #e0edff;
    border-color: rgba(0, 51, 160, 0.3);
}

.subject-pill.active {
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-blue-dark));
    color: #fff;
    border-color: transparent;
    box-shadow: 0 3px 12px rgba(0, 51, 160, 0.35);
}

.stats-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

.stat-item {
    padding: 20px;
    background: var(--gray-light);
    border-radius: 10px;
    text-align: center;
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--accent-blue);
    display: block;
    margin-bottom: 8px;
}

.stat-label {
    font-size: 14px;
    color: var(--gray-dark);
    font-weight: 500;
}

.lessons-list {
    display: grid;
    gap: 16px;
}

.lesson-item {
    padding: 24px;
    background: white;
    border: 2px solid var(--gray-medium);
    border-radius: 10px;
    transition: all 0.2s;
}

.lesson-item:hover {
    border-color: var(--accent-blue);
    box-shadow: 0 4px 12px rgba(0, 51, 160, 0.1);
}

.lesson-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--gray-light);
}

.lesson-date {
    font-size: 18px;
    font-weight: 700;
    color: var(--accent-blue);
}

.lesson-time {
    font-size: 14px;
    color: var(--gray-dark);
}

.lesson-grades {
    display: flex;
    gap: 12px;
}

.grade-badge {
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 6px;
}

.grade-badge.grade-5 {
    background: #dcfce7;
    color: var(--success-green);
}

.grade-badge.grade-4 {
    background: #dbeafe;
    color: #3b82f6;
}

.grade-badge.grade-3 {
    background: #fef3c7;
    color: var(--warning-yellow);
}

.lesson-body {
    display: grid;
    gap: 12px;
}

.attendance-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
}

.attendance-badge.present {
    background: #dcfce7;
    color: var(--success-green);
}

.attendance-badge.present::before {
    content: "✓";
}

.attendance-badge.absent {
    background: #fee2e2;
    color: var(--danger-red);
}

.attendance-badge.absent::before {
    content: "✗";
}

.attendance-badge.late {
    background: #fef3c7;
    color: var(--warning-yellow);
}

.attendance-badge.late::before {
    content: "⚠";
}

.lesson-comment {
    padding: 12px;
    background: var(--gray-light);
    border-radius: 8px;
    font-size: 14px;
    color: var(--text-main);
    line-height: 1.6;
}

.lesson-comment::before {
    content: "💬 ";
}

.lesson-homework {
    padding: 12px;
    background: #eff6ff;
    border-left: 3px solid var(--accent-blue);
    border-radius: 4px;
    font-size: 14px;
    color: var(--text-main);
}

.lesson-homework::before {
    content: "📝 Домашнее задание: ";
    font-weight: 600;
    color: var(--accent-blue);
}

.no-lessons {
    text-align: center;
    padding: 48px;
    color: var(--gray-dark);
    font-size: 16px;
}

/* ===========================
   АДАПТИВНОСТЬ
   =========================== */

@media (max-width: 768px) {
    .login-container {
        padding: 15px;
    }

    .login-box {
        padding: 32px 24px;
        max-width: 100%;
    }

    .chess-icon {
        font-size: 56px;
    }

    .logo-section h1 {
        font-size: 24px;
    }

    .club-name {
        font-size: 15px;
    }

    .form-group {
        margin-bottom: 18px;
    }

    .form-group input {
        padding: 13px 15px;
        font-size: 16px;
        min-height: 48px;
        -webkit-appearance: none;
    }

    .login-btn {
        padding: 15px;
        font-size: 17px;
        min-height: 48px;
    }


    /* Шапка дневника */
    .diary-header {
        padding: 15px 0;
    }

    .header-content {
        padding: 0 15px;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }

    .logo {
        gap: 8px;
    }

    .chess-piece {
        font-size: 28px;
    }

    .title {
        font-size: 20px;
    }

    .user-info {
        gap: 12px;
        flex-wrap: wrap;
    }

    .user-name {
        font-size: 14px;
    }

    .logout-btn {
        padding: 7px 16px;
        font-size: 13px;
        white-space: nowrap;
    }

    /* Навигация */
    .diary-nav {
        padding: 8px 15px;
        gap: 8px;
        overflow-x: hidden;
        border-radius: 0 0 12px 12px;
    }

    .nav-btn {
        flex: 1;
        min-width: 0;
        padding: 11px 14px;
        font-size: 14px;
        white-space: nowrap;
        border-radius: 10px;
    }

    .nav-btn.active {
        box-shadow: 0 3px 10px rgba(0, 51, 160, 0.3);
        transform: translateY(-1px);
    }

    .nav-btn.active:hover {
        transform: translateY(-1px);
    }

    /* Контент */
    .diary-content {
        padding: 20px 15px;
    }

    /* Профиль */
    .profile-card {
        padding: 24px 20px;
    }

    .profile-header {
        flex-direction: column;
        text-align: center;
        gap: 20px;
        padding-bottom: 20px;
    }

    .photo-placeholder {
        width: 100px;
        height: 100px;
        font-size: 42px;
    }

    .profile-info h2 {
        font-size: 26px;
    }

    .profile-level {
        font-size: 13px;
        padding: 5px 14px;
    }

    .profile-details {
        gap: 14px;
    }

    .detail-row {
        grid-template-columns: 1fr;
        gap: 6px;
        padding: 14px 0;
    }

    .detail-label {
        font-size: 14px;
        margin-bottom: 4px;
    }

    .detail-value {
        font-size: 15px;
    }

    /* Расписание */
    .schedule-card {
        padding: 24px 20px;
    }

    .schedule-card h2 {
        font-size: 24px;
        margin-bottom: 20px;
    }

    .schedule-item {
        grid-template-columns: 1fr;
        gap: 12px;
        padding: 18px;
    }

    .schedule-day {
        font-size: 16px;
        margin-bottom: 8px;
    }

    .schedule-time {
        font-size: 18px;
    }

    .schedule-location,
    .schedule-teacher {
        font-size: 13px;
    }

    /* Дневник оценок */
    .grades-card {
        padding: 24px 20px;
    }

    .grades-card h2 {
        font-size: 24px;
        margin-bottom: 20px;
    }

    .stats-summary {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
        margin-bottom: 24px;
    }

    .stat-item {
        padding: 16px;
    }

    .stat-value {
        font-size: 28px;
    }

    .stat-label {
        font-size: 13px;
    }

    .lesson-item {
        padding: 18px;
    }

    .lesson-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        margin-bottom: 14px;
        padding-bottom: 12px;
    }

    .lesson-date {
        font-size: 16px;
    }

    .lesson-time {
        font-size: 13px;
    }

    .lesson-grades {
        flex-wrap: wrap;
        gap: 8px;
        width: 100%;
    }

    .grade-badge {
        padding: 5px 12px;
        font-size: 13px;
    }

    .lesson-body {
        gap: 10px;
    }

    .attendance-badge {
        font-size: 12px;
        padding: 5px 10px;
    }

    .lesson-comment {
        font-size: 13px;
        padding: 10px;
        line-height: 1.5;
    }

    .lesson-homework {
        font-size: 13px;
        padding: 10px;
    }
}

@media (max-width: 480px) {
    .login-container {
        padding: 10px;
    }

    .login-box {
        padding: 28px 20px;
    }

    .chess-icon {
        font-size: 48px;
        margin-bottom: 12px;
    }

    .logo-section {
        margin-bottom: 24px;
    }

    .logo-section h1 {
        font-size: 22px;
    }

    .club-name {
        font-size: 14px;
    }

    .form-group {
        margin-bottom: 16px;
    }

    .form-group label {
        font-size: 13px;
    }

    .form-group input {
        padding: 12px 14px;
        font-size: 16px;
    }

    .login-btn {
        padding: 14px;
        font-size: 16px;
    }


    /* Шапка */
    .diary-header {
        padding: 12px 0;
    }

    .header-content {
        padding: 0 12px;
        flex-wrap: wrap;
    }

    .chess-piece {
        font-size: 24px;
    }

    .title {
        font-size: 18px;
    }

    .user-info {
        gap: 8px;
        width: 100%;
        justify-content: space-between;
    }

    .user-name {
        font-size: 13px;
        flex: 1;
    }

    .logout-btn {
        padding: 6px 14px;
        font-size: 12px;
    }

     /* Навигация */
     .diary-nav {
         padding: 7px 12px;
         gap: 6px;
         border-radius: 0 0 10px 10px;
     }

     .nav-btn {
         padding: 10px 10px;
         font-size: 13px;
         border-radius: 9px;
     }

     .nav-btn.active {
         box-shadow: 0 2px 8px rgba(0, 51, 160, 0.25);
         transform: translateY(-1px);
     }

     .nav-btn.active:hover {
         transform: translateY(-1px);
     }

    /* Контент */
    .diary-content {
        padding: 16px 12px;
    }

    /* Профиль */
    .profile-card,
    .schedule-card,
    .grades-card {
        padding: 20px 16px;
    }

    .profile-header {
        gap: 16px;
        padding-bottom: 16px;
    }

    .photo-placeholder {
        width: 90px;
        height: 90px;
        font-size: 38px;
    }

    .profile-info h2 {
        font-size: 22px;
        margin-bottom: 6px;
    }

    .profile-level {
        font-size: 12px;
        padding: 4px 12px;
    }

    .detail-row {
        padding: 12px 0;
    }

    .detail-label {
        font-size: 13px;
    }

    .detail-value {
        font-size: 14px;
    }

    /* Расписание */
    .schedule-card h2 {
        font-size: 22px;
        margin-bottom: 18px;
    }

    .schedule-item {
        padding: 16px;
    }

    .schedule-day {
        font-size: 15px;
    }

    .schedule-time {
        font-size: 17px;
    }

    /* Дневник */
    .grades-card h2 {
        font-size: 22px;
        margin-bottom: 18px;
    }

    .stats-summary {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .stat-item {
        padding: 14px;
    }

    .stat-value {
        font-size: 26px;
    }

    .stat-label {
        font-size: 12px;
    }

    .lesson-item {
        padding: 16px;
    }

    .lesson-date {
        font-size: 15px;
    }

    .grade-badge {
        padding: 4px 10px;
        font-size: 12px;
    }

    .lesson-comment {
        font-size: 12px;
        padding: 8px;
    }

    .lesson-homework {
        font-size: 12px;
        padding: 8px;
    }
}

@media (max-width: 360px) {
    .login-box {
        padding: 24px 16px;
    }

    .chess-icon {
        font-size: 42px;
    }

    .logo-section h1 {
        font-size: 20px;
    }

     .diary-nav {
         padding: 6px 10px;
         gap: 5px;
         border-radius: 0 0 8px 8px;
     }

     .nav-btn {
         padding: 9px 8px;
         font-size: 12px;
         border-radius: 8px;
     }

     .nav-btn.active {
         box-shadow: 0 2px 6px rgba(0, 51, 160, 0.2);
         transform: translateY(-1px);
     }

    .profile-card,
    .schedule-card,
    .grades-card {
        padding: 18px 14px;
    }

    .photo-placeholder {
        width: 80px;
        height: 80px;
        font-size: 34px;
    }

    .profile-info h2 {
        font-size: 20px;
    }
}

/* Кнопки для админки */
.btn-primary {
    background: var(--accent-blue);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    font-family: inherit;
}

.btn-primary:hover {
    background: var(--accent-blue-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 51, 160, 0.3);
}

.btn-primary:active {
    transform: translateY(0);
}

/* Модальные окна */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow-y: auto;
}

/* Таблицы для админки */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    background: white;
    border-radius: 8px;
    overflow: hidden;
}

table th,
table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--gray-medium);
}

table th {
    background: var(--gray-light);
    font-weight: 500;
    color: var(--text-main);
}

table tr:last-child td {
    border-bottom: none;
}

table tr:hover {
    background: var(--gray-light);
}

/* Адаптивность для модальных окон */
@media (max-width: 768px) {
    .modal,
    .custom-modal {
        padding: 10px;
    }
    
    .custom-modal > div {
        padding: 20px !important;
        max-width: 100% !important;
        margin: 0 !important;
    }
    
    .btn-primary {
        width: 100%;
        padding: 14px;
        font-size: 14px;
    }
    
    table {
        font-size: 14px;
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    table th,
    table td {
        padding: 8px;
        white-space: nowrap;
    }
    
    /* Мобильные стили для карточек занятий */
    .lesson-item {
        padding: 16px !important;
        margin-bottom: 12px !important;
    }
    
    .lesson-item > div {
        flex-direction: column !important;
        gap: 12px !important;
    }
    
    .lesson-item h3 {
        font-size: 16px !important;
        margin-bottom: 8px !important;
    }
    
    .lesson-item button {
        width: 100% !important;
        margin-top: 10px !important;
    }
    
    /* Мобильные стили для форм в модальных окнах */
    .custom-modal input,
    .custom-modal select,
    .custom-modal textarea {
        font-size: 16px !important; /* Предотвращает зум на iOS */
        padding: 12px !important;
    }
    
    /* Мобильные стили для grid в модальных окнах */
    .custom-modal [style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
    }
    
    /* Мобильные стили для расписания */
    .schedule-row {
        padding: 12px !important;
    }
    
    .schedule-row button {
        position: static !important;
        width: 100% !important;
        margin-top: 10px !important;
    }
    
    /* Мобильные стили для списка студентов в модальных окнах */
    #attendanceStudentsList > div,
    #gradesStudentsList > div {
        flex-direction: column !important;
        gap: 10px !important;
        padding: 12px !important;
    }
    
    #attendanceStudentsList select {
        width: 100% !important;
        min-width: auto !important;
    }
    
    /* Мобильные стили для заголовков модальных окон */
    .custom-modal h2 {
        font-size: 18px !important;
    }
    
    /* Мобильные стили для кнопок в шапке */
    .header-content {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }
    
    .user-info {
        width: 100%;
        justify-content: space-between;
    }
    
    /* Мобильные стили для навигации */
    .diary-nav {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }
    
    .diary-nav::-webkit-scrollbar {
        display: none;
    }
    
    .nav-btn {
        white-space: nowrap;
        flex-shrink: 0;
    }
    
    /* Мобильные стили для карточек статистики */
    .stats-grid {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }
    
    /* Мобильные стили для списков */
    #studentsList > div,
    #trialLessonsList > div,
    #adminTrialLessons > div,
    #expensesList > div,
    #employeesList > div {
        flex-direction: column !important;
        gap: 12px !important;
    }
    
    #studentsList button,
    #trialLessonsList button,
    #adminTrialLessons button,
    #expensesList button,
    #employeesList button {
        width: 100% !important;
    }
}

