/* --- Общие стили --- */
html, body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    height: 100%;
    margin: 0;
    padding: 0;
}
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: #f8f9fa;
    color: #212529;
    box-sizing: border-box;
}
.container {
    max-width: 1200px;
    margin: auto;
    padding: 20px;
}
nav.navbar {
    margin-bottom: 20px;
}

/* --- Стили для страниц входа/регистрации --- */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    min-height: 100vh;
}
.form-block {
    background: #fff;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 400px;
    border: 1px solid #dee2e6; /* <-- ВОТ КРАСИВАЯ РАМКА */
}
.form-block h2 {
    text-align: center;
    margin-top: 0;
    margin-bottom: 25px;
}
.form-block label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}
.form-block input[type="text"],
.form-block input[type="email"],
.form-block input[type="password"] {
    display: block;
    width: 100%;
    padding: 10px;
    margin-bottom: 15px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
}
.form-block button {
    width: 100%;
    padding: 12px;
    color: white;
    border: none;
    cursor: pointer;
    border-radius: 5px;
    font-size: 1em;
}
.form-links {
    text-align: center;
    margin-top: 20px;
    border-top: 1px solid #eee;
    padding-top: 15px;
}
/* Стили для ссылок, чтобы они были по центру и с отступом */
.form-links a {
    display: block;
    margin-bottom: 5px;
}

/* --- Табель --- */
table.calendar {
    table-layout: fixed;
}
table.calendar td {
    word-wrap: break-word;
}
.day-details {
    font-size: 0.8em;
    margin-top: 5px;
}
.day-details div {
    margin-bottom: 2px;
}
.day-earnings {
    font-weight: bold;
    color: #2e7d32;
}
.holiday-name {
    font-size: 0.8em;
}
.day-contract-info {
    font-size: 0.75em;
    color: #6c757d;
    margin-top: 8px;
    padding-top: 4px;
    border-top: 1px solid #e9ecef;
}
.weekend {
    background-color: #afa8a8; 
}
.mobile-day-label {
    font-weight: bold;
    margin-right: 10px;
}

/* --- Элемент-триггер для кнопки "Наверх" --- */
#scroll-trigger {
    position: absolute;
    top: 0;
    left: 0;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

/* --- Ссылка "Наверх" --- */
#scrollTopLink {
    display: none;
    position: fixed;
    bottom: 20px;
    right: 30px;
    z-index: 1001;
    opacity: 0.7;
    font-size: 36px;
    padding: 0;
    width: 50px;
    height: 50px;
    text-align: center;
    line-height: 50px;
}
#scrollTopLink:hover {
    opacity: 1;
}

/* --- АДАПТИВНОСТЬ ДЛЯ МОБИЛЬНЫХ УСТРОЙСТВ --- */
@media (max-width: 767px) {
    /* Общий класс для заголовков страниц */
    .page-header {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 10px;
    }

    /* Навигация календаря */
    .calendar-nav {
        flex-direction: column !important;
        align-items: center; 
        gap: 15px; 
    }
    .calendar-nav h2 {
        order: -1; 
    }
    .calendar-nav-buttons {
        display: flex;
        flex-direction: column;
        width: 100%;
        gap: 5px;
    }
    .calendar-nav-buttons .btn {
        width: 100%;
        margin: 0 !important;
    }

    /* Адаптивность для календаря */
    .table-responsive .calendar thead { display: none; }
    .table-responsive .calendar, .table-responsive .calendar tbody, .table-responsive .calendar tr, .table-responsive .calendar td { display: block; width: 100%; }
    .table-responsive .calendar tr { margin-bottom: 15px; }
    .table-responsive .calendar td { height: auto; min-height: 100px; text-align: left; }
    
    /* Адаптивность для таблицы админа */
    .admin-table thead { display: none; }
    .admin-table, .admin-table tbody, .admin-table tr, .admin-table td { display: block; width: 100%; }
    .admin-table tr { margin-bottom: 15px; border: 1px solid #ddd; border-radius: 5px; }
    .admin-table td { display: flex; justify-content: space-between; align-items: center; padding: .5rem 1rem; text-align: right; border: none; border-bottom: 1px solid #eee; }
    .admin-table td:last-child { border-bottom: none; flex-wrap: wrap; justify-content: flex-end; }
    .admin-table td::before { content: attr(data-label); font-weight: bold; text-align: left; }
    
    .dashboard-header { flex-direction: column; align-items: flex-start !important; gap: 15px; }
    .dashboard-header h1 { font-size: 2rem; }
    .dashboard-header .btn { width: 100%; }
}

/* ИСПРАВЛЕНИЕ: Разрешаем перенос текста для плашек внутри календаря */
.calendar .badge {
    white-space: normal;
    text-align: left;
}