/* style.css — единые стили для всех страниц */

/* ===== 1. ПЕРЕМЕННЫЕ И ГЛОБАЛЬНЫЕ СТИЛИ ===== */
:root {
    --bg-page: #f3f3f3;
    --bg-header: #d9d9d9;
    --bg-sticky: #efefef;
    --bg-white: #ffffff;
    --text-dark: #001d18;
    --border-light: #e0e0e0;
    --accent: #2d5a4e;
    --accent-dark: #001d18;
}

* {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, 'Helvetica Neue', Arial, sans-serif;
    color: var(--text-dark);
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    background: var(--bg-page);
    overflow: hidden;
}

/* ===== 2. САЙДБАР ===== */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 260px;
    height: 100vh;
    background: var(--accent-dark);
    z-index: 100;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}

.user-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.user-name {
    font-size: 20px;
    font-weight: 600;
    color: white;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.logout-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    gap: 6px;
    width: fit-content;
}

.logout-btn img {
    display: block;
    width: 14px;
    height: 14px;
    opacity: 0.7;
}

.logout-text {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
    transition: color 0.2s;
}

.logout-btn:hover img {
    opacity: 1;
}

.logout-btn:hover .logout-text {
    color: rgba(255, 255, 255, 0.8);
}

.sidebar-nav {
    padding: 20px 0;
    flex: 1;
}

.sidebar-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.15);
    margin: 12px 20px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 12px 20px;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    transition: all 0.2s;
    font-size: 15px;
    line-height: 20px;
}

.nav-item img {
    width: 20px !important;
    height: 20px !important;
    object-fit: contain;
}

.nav-item:hover,
.nav-item.active {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    margin-top: auto;
}

.sidebar-footer-content {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.6);
    text-align: center;
    line-height: 1.5;
}

.sidebar-footer-content .footer-label {
    display: block;
    font-size: 10px;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 4px;
}

.sidebar-footer-content .footer-value {
    display: block;
    color: rgba(255, 255, 255, 0.5);
}

/* ===== 3. ОСНОВНОЙ КОНТЕНТ ===== */
.main-content {
    margin-left: 260px;
    background: transparent;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

.main-content .container {
    width: 100%;
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* ===== 4. ШАПКА, ПАНЕЛИ, КНОПКИ НАВИГАЦИИ ===== */
.page-header,
.control-panel,
.nav-panel {
    background: transparent;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 24px;
    height: 60px;
    min-height: 60px;
    position: sticky;
    top: 0;
    z-index: 20;
}

.control-panel {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    padding: 0 24px;
    height: 56px;
    min-height: 56px;
    gap: 20px;
    flex-wrap: wrap;
}

.nav-panel {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 24px;
    height: 52px;
    min-height: 52px;
}

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

.nav-btn {
    background: transparent;
    border: none;
    padding: 8px 16px;
    border-radius: 30px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    height: 36px;
    pointer-events: auto !important;
    position: relative;
    z-index: 100;
}

.nav-btn:hover {
    background: rgba(0, 29, 24, 0.08);
    transform: translateY(-2px);
}

.month-title {
    font-size: 28px;
    font-weight: 600;
    text-align: center;
    line-height: 1;
}

/* ===== 5. КАСТОМНЫЕ СЕЛЕКТОРЫ ===== */
.custom-select,
.custom-select-employee {
    position: relative;
    width: 320px;
    z-index: 1000;
}

.custom-select-trigger,
.custom-select-employee .custom-select-trigger {
    padding: 6px 10px;
    border: 1px solid #ccc;
    border-radius: 8px;
    background: transparent;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s;
}

.custom-select-trigger:hover,
.custom-select-employee .custom-select-trigger:hover {
    border-color: #999;
}

.custom-arrow,
.custom-select-employee .custom-arrow {
    color: #888;
    transition: transform 0.2s;
}

.custom-select-dropdown,
.custom-select-employee .custom-select-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ccc;
    border-radius: 8px;
    margin-top: 4px;
    max-height: 300px;
    overflow-y: auto;
    display: none;
    z-index: 1001;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.custom-select-option,
.custom-select-employee .custom-select-option {
    padding: 8px 10px;
    cursor: pointer;
    border-bottom: 1px solid #eee;
    transition: background 0.2s;
}

.custom-select-option:last-child,
.custom-select-employee .custom-select-option:last-child {
    border-bottom: none;
}

.custom-select-option:hover,
.custom-select-employee .custom-select-option:hover {
    background: #e8f0fe !important;
}

.custom-select .custom-select-option-title,
.custom-select-trigger .custom-select-option-title {
    font-weight: 600 !important;
}

.custom-select-employee .custom-select-option-title {
    font-weight: normal;
}

.custom-select-option-title {
    color: #001d18;
}

.custom-select-option-address {
    font-size: 12px;
    color: #666;
    line-height: 1.4;
}

/* ===== 6. ПЛАВАЮЩИЙ ВЫПАДАЮЩИЙ СПИСОК ===== */
#floatingDropdown {
    position: fixed;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 999999 !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.dropdown-item {
    padding: 8px 12px;
    cursor: pointer;
    border-bottom: 1px solid #eee;
    font-size: 14px;
    transition: background 0.2s;
}

.dropdown-item:last-child {
    border-bottom: none;
}

.dropdown-item:hover {
    background: #e8f0fe !important;
}

/* ===== 7. КОНТЕЙНЕРЫ ТАБЛИЦ ===== */
#managementContent,
#monthContent,
#adminContent,
#personalContent,
#todayContent {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.table-wrapper {
    padding: 0 24px 0 24px;
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.table-container {
    overflow-x: auto;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
    max-height: calc(100vh - 200px);
    background: var(--bg-white);
    border: 1px solid #e0e0e0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* ===== 8. ОБЩИЕ СТИЛИ ТАБЛИЦ ===== */
.data-table,
.schedule-table,
.personal-table,
.employees-table,
.today-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.data-table th,
.data-table td,
.schedule-table th,
.schedule-table td,
.personal-table th,
.personal-table td,
.employees-table th,
.employees-table td,
.today-table th,
.today-table td {
    border: 1px solid var(--border-light);
    padding: 6px 8px;
    text-align: center;
    vertical-align: middle;
}

.data-table th,
.schedule-table th,
.personal-table th,
.employees-table th,
.today-table th {
    background: var(--bg-header);
    font-weight: 600;
    border: 1px solid #b7b7b7;
    font-size: 15px;
    position: sticky;
    top: 0;
    z-index: 10;
}

.schedule-table th,
.personal-table th,
.employees-table th,
.data-table th,
.today-table th {
    border-bottom: 1px solid #b3b3b3 !important;
}

.schedule-table td,
.personal-table td,
.employees-table td,
.data-table td,
.today-table td {
    border: 1px solid #e0e0e0 !important;
}

/* ===== 9. СТРАНИЦА МЕСЯЦА (month) ===== */
#monthContent {
    display: flex;
    flex-direction: column;
    height: 100%;
}

#monthContent .table-wrapper {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

#monthContent .table-container {
    overflow: auto;
    flex: 1;
}

.month-footer {
    flex-shrink: 0;
    padding: 0 24px;
    background: transparent;
    border-top: 1px solid var(--border-light);
}

.month-footer .add-employee-under-table {
    margin: 0;
    padding: 0;
}

.add-employee-under-btn {
    background: none !important;
    border: none !important;
    color: var(--accent-dark);
    padding: 8px 0;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.add-employee-under-btn:hover {
    color: var(--accent);
    text-decoration: underline;
}

.schedule-table td.data-cell {
    background-color: #ffcdd2 !important;
}

.schedule-table td.data-cell.has-work {
    background-color: #ffffff !important;
}

.schedule-table td.value-v {
    background-color: #ffcdd2 !important;
}

.schedule-table td.value-r {
    background-color: #6d9eeb !important;
    font-weight: 600 !important;
}

.schedule-table td.value-r1,
.schedule-table td.value-r2 {
    background-color: #c9daf8 !important;
    font-weight: 600 !important;
}

.schedule-table td.value-r.has-work,
.schedule-table td.value-r1.has-work,
.schedule-table td.value-r2.has-work {
    background-color: inherit !important;
}

.schedule-table td.value-r.has-work {
    background-color: #6d9eeb !important;
}

.schedule-table td.value-r1.has-work,
.schedule-table td.value-r2.has-work {
    background-color: #c9daf8 !important;
}

.month-content .schedule-table td:hover {
    outline: 2px solid #001d18;
    outline-offset: -1px;
    position: relative;
    z-index: 5;
}

.month-content .schedule-table th.today,
.month-content .schedule-table td.today {
    border-left: 3px solid #358553 !important;
    border-right: 3px solid #358553 !important;
    background-color: rgba(174, 255, 205, 0.2) !important;
}

.month-content .schedule-table th.today {
    background-color: #35855465 !important;
    border-top: 3px solid #358553 !important;
}

.month-content .schedule-table td.today.value-r,
.month-content .schedule-table td.today.value-r1,
.month-content .schedule-table td.today.value-r2 {
    background-color: #358554be !important;
}

/* Легенда для страницы месяца */
.schedule-legend {
    margin: 20px 24px;
    padding: 16px 20px;
    background: transparent;
}

.schedule-legend .legend-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-dark);
}

.schedule-legend .legend-items {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
}

.schedule-legend .legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}

.legend-badge {
    display: inline-block;
    width: 32px;
    height: 24px;
    text-align: center;
    line-height: 24px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 12px;
}

.legend-r {
    background-color: #6d9eeb;
    color: white;
}

.legend-r1, .legend-r2 {
    background-color: #c9daf8;
    color: #001d18;
}

.legend-v {
    background-color: #ffcdd2;
    color: #999;
}

/* ===== 10. СТРАНИЦА АДМИНИСТРАТОРА (admin) ===== */
.admin-content .schedule-table td:nth-child(2) {
    text-align: left !important;
    width: auto;
}

.admin-data-cell.value-number {
    background-color: white !important;
    color: #001d18;
}

.admin-data-cell.value-zero {
    background-color: #ffcdd2 !important;
}

.stats-info {
    font-size: 14px;
    font-weight: 500;
}

.stats-success {
    color: #28a745;
}

.stats-warning {
    color: #dc3545;
}

/* ===== 11. СТРАНИЦА СОТРУДНИКОВ (personal) ===== */
.personal-table td:first-child {
    text-align: left !important;
    min-width: 80px;
    width: auto;
}

.personal-table tbody tr:hover td {
    background-color: #e8f0fe !important;
}

.personal-table .column-hover {
    background-color: #e8f0fe !important;
}

.personal-table td:hover {
    outline: 1px solid #6d9eeb;
    outline-offset: -1px;
    position: relative;
    z-index: 5;
}

.personal-table .value-v {
    color: #999999;
    background-color: #f5f5f5;
}

.pvz-legend {
    margin-top: 20px;
    padding: 16px 20px;
    background: transparent !important;
    box-shadow: none !important;
    border: none !important;
}

.legend-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-dark);
}

.legend-items {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 14px;
    line-height: 1.4;
}

.legend-number {
    font-weight: 600;
    min-width: 40px;
    color: inherit !important;
}

.legend-address {
    color: inherit !important;
    font-size: 13px;
}

/* ===== 12. СТРАНИЦА УПРАВЛЕНИЯ СОТРУДНИКАМИ (management) ===== */
.management-add-btn {
    background: transparent;
    border: 1px solid transparent;
    color: var(--accent-dark);
    padding: 0 24px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    height: 36px;
}

.management-add-btn:hover {
    border: 1px solid var(--accent-dark);
    transform: translateY(-2px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.status-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    min-height: 36px;
    font-size: 14px;
    font-weight: 500;
    padding: 4px 8px;
    box-sizing: border-box;
}

.status-working {
    background: #d4edda;
    color: #155724;
}

.status-replacement {
    background: #fff3cd;
    color: #856404;
}

.status-fired {
    background: #f8d7da;
    color: #721c24;
}

.check-mark {
    color: #27ae60;
    font-size: 16px;
    font-weight: bold;
}

.cross-mark {
    color: #e74c3c;
    font-size: 16px;
    font-weight: bold;
}

.employees-table {
    table-layout: auto !important;
    width: 100%;
}

.employees-table th:nth-child(1),
.employees-table td:nth-child(1) {
    width: 25px !important;
    min-width: 25px !important;
    text-align: center !important;
}

.employees-table th:nth-child(2),
.employees-table td:nth-child(2) {
    min-width: 40px !important;
    white-space: nowrap !important;
}

.employees-table th:nth-child(3),
.employees-table td:nth-child(3),
.employees-table th:nth-child(4),
.employees-table td:nth-child(4),
.employees-table th:nth-child(5),
.employees-table td:nth-child(5) {
    min-width: 60px !important;
    white-space: nowrap !important;
}

.employees-table th:nth-child(6),
.employees-table td:nth-child(6),
.employees-table th:nth-child(7),
.employees-table td:nth-child(7),
.employees-table th:nth-child(8),
.employees-table td:nth-child(8) {
    min-width: 60px !important;
    white-space: nowrap !important;
}

.employees-table th:nth-child(9),
.employees-table td:nth-child(9) {
    min-width: 100px !important;
    white-space: normal;
    word-break: break-word;
}

.employees-table th:nth-child(10),
.employees-table td:nth-child(10),
.employees-table th:nth-child(11),
.employees-table td:nth-child(11) {
    min-width: 50px !important;
}

.employees-table td:nth-child(12) {
    min-width: 100px !important;
    white-space: normal;
    word-break: break-word;
    font-weight: normal !important;
    font-style: italic !important;
    font-size: 12px !important;
    background: white !important;
}

.employees-table td:nth-child(1) {
    background: white !important;
}

.employees-table td:nth-child(3),
.employees-table td:nth-child(4),
.employees-table td:nth-child(5),
.employees-table td:nth-child(13) {
    text-align: left;
}

.employees-table td:nth-child(2) {
    padding: 0 !important;
}

.remove-employee-btn {
    background: none;
    border: none;
    color: #dc3545;
    cursor: pointer;
    font-size: 12px;
    padding: 0;
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.remove-employee-btn:hover {
    background: rgba(220, 53, 69, 0.1);
    transform: scale(1.1);
}

/* ===== 13. СТРАНИЦА СЕГОДНЯ (today) ===== */
.today-date {
    font-size: 16px;
    font-weight: 500;
    color: var(--accent-dark);
    padding: 6px 16px;
}

.today-table {
    table-layout: auto !important;
    width: auto !important;
}

.today-table th:nth-child(1),
.today-table td:nth-child(1) {
    width: 40px !important;
    white-space: nowrap !important;
}

.today-table th:nth-child(2),
.today-table td:nth-child(2) {
    width: 150px !important;
    white-space: nowrap !important;
}

.today-table td:nth-child(2) {
    text-align: left !important;
    white-space: nowrap !important;
}

.today-table td:nth-child(3) {
    width: 120px !important;
    white-space: nowrap !important;
}

.today-table th:nth-child(4),
.today-table td:nth-child(4) {
    width: 90px !important;
    white-space: nowrap !important;
}

.today-table th:nth-child(5),
.today-table td:nth-child(5) {
    width: auto !important;
    min-width: 150px !important;
    white-space: nowrap !important;
}

.today-table td {
    font-weight: normal !important;
    background: white !important;
}

#todayContent .table-container {
    width: fit-content !important;
    height: fit-content !important;
}

#todayContent .table-wrapper {
    display: block !important;
    padding: 0 24px 24px 24px;
}

.today-table .employee-phone a,
.today-table .telegram-link {
    text-decoration: none;
}

.today-table .employee-phone a:hover,
.today-table .telegram-link:hover {
    text-decoration: underline !important;
    opacity: 0.8;
}

/* ===== 14. СТРАНИЦА ИСТОРИИ (history) ===== */
.history-tabs {
    display: flex;
    gap: 0;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 25;
}

.history-tab {
    background: transparent;
    border-width: 1px 1px 0 1px;
    border-style: solid;
    border-color: var(--accent-dark);
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    color: #666;
    transition: all 0.2s;
    position: relative;
    margin-bottom: -1px;
    border-radius: 12px 12px 0 0;
}

.history-tab:hover {
    color: var(--accent-dark);
}

.history-tab.active {
    background: var(--accent-dark);
    color: #ffffff;
}

#historyContent .table-wrapper {
    padding-top: 0;
}

#historyContent .table-container {
    border-top: none;
}

.history-table {
    table-layout: fixed !important;
    width: 100%;
}

/* Стили для таблицы истории изменений графика (6 колонок) */
.history-table.schedule-table th:nth-child(1),
.history-table.schedule-table td:nth-child(1) {
    width: 150px !important;
    white-space: nowrap;
    text-align: center !important;
    position: static !important;
}

.history-table.schedule-table th:nth-child(2),
.history-table.schedule-table td:nth-child(2) {
    width: 150px !important;
    white-space: nowrap;
    text-align: center !important;
}

.history-table.schedule-table th:nth-child(3),
.history-table.schedule-table td:nth-child(3) {
    width: 60px !important;
    white-space: nowrap;
    text-align: center !important;
}

.history-table.schedule-table th:nth-child(4),
.history-table.schedule-table td:nth-child(4) {
    width: 150px !important;
    white-space: nowrap;
    text-align: center !important;
}

.history-table.schedule-table th:nth-child(5),
.history-table.schedule-table td:nth-child(5) {
    width: 150px !important;
    white-space: nowrap;
    text-align: center !important;
}

.history-table.schedule-table th:nth-child(6),
.history-table.schedule-table td:nth-child(6) {
    width: auto;
    text-align: left !important;
    white-space: normal;
    word-break: break-word;
}

/* Стили для таблицы активных сессий (5 колонок) */
.history-table.sessions-table th:nth-child(1),
.history-table.sessions-table td:nth-child(1) {
    width: 150px !important;
    min-width: 150px !important;
    text-align: center !important;
    position: static !important;
}

.history-table.sessions-table th:nth-child(2),
.history-table.sessions-table td:nth-child(2) {
    width: 120px !important;
    min-width: 120px !important;
    text-align: center !important;
}

.history-table.sessions-table th:nth-child(3),
.history-table.sessions-table td:nth-child(3) {
    width: 120px !important;
    min-width: 120px !important;
    text-align: center !important;
}

.history-table.sessions-table th:nth-child(4),
.history-table.sessions-table td:nth-child(4) {
    width: 150px !important;
    min-width: 150px !important;
    text-align: center !important;
}

.history-table.sessions-table th:nth-child(5),
.history-table.sessions-table td:nth-child(5) {
    width: 100px !important;
    min-width: 100px !important;
    text-align: center !important;
}

.revoke-session-btn {
    background: #ffffff;
    color: rgb(255, 0, 0);
    border: none;
    padding: 4px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

.revoke-session-btn:hover {
    font-weight: bold !important;
}

.history-table.schedule-table td:nth-child(1),
.history-table.schedule-table td:nth-child(6),
.history-table.sessions-table td:nth-child(1),
.history-table.sessions-table td:nth-child(5) {
    background: #ffffff;
    font-weight: normal !important;
    box-shadow: none !important;
}


/* ===== 15. ФИКСАЦИЯ ПЕРВОГО И ПОСЛЕДНЕГО СТОЛБЦА ===== */
.data-table th:first-child,
.schedule-table th:first-child,
.personal-table th:first-child {
    position: sticky;
    left: 0;
    z-index: 20;
    background: var(--bg-header);
}

.data-table td:first-child,
.schedule-table td:first-child,
.personal-table td:first-child {
    position: sticky;
    left: 0;
    z-index: 15;
    background: var(--bg-sticky);
}

.data-table td:first-child,
.schedule-table td:first-child,
.personal-table td:first-child {
    border-right: 1px solid #b3b3b3 !important;
    box-shadow: inset -1px 0 0 0 #b3b3b3 !important;
}

.data-table th:first-child,
.schedule-table th:first-child,
.personal-table th:first-child {
    border-right: 1px solid #b3b3b3 !important;
    box-shadow: inset -1px 0 0 0 #b3b3b3 !important;
}

.admin-content .schedule-table td:first-child,
.admin-content .schedule-table th:first-child {
    width: 40px !important;
    min-width: 40px !important;
    max-width: 40px !important;
    text-align: center !important;
}

.month-content .schedule-table td:first-child,
.month-content .schedule-table th:first-child,
.admin-content .schedule-table td:nth-child(2),
.admin-content .schedule-table th:nth-child(2),
.personal-table td:first-child,
.personal-table th:first-child,
.employees-table td:first-child,
.employees-table th:first-child {
    border-left: 1px solid #b3b3b3 !important;
}

.data-table td:last-child,
.schedule-table td:last-child,
.personal-table td:last-child {
    position: sticky;
    right: 0;
    z-index: 15;
    background: var(--bg-sticky);
    width: 55px;
    min-width: 55px;
    max-width: 55px;
    font-weight: bold;
    border-right: 1px solid #b3b3b3 !important;
    box-shadow: inset 1px 0 0 0 #b3b3b3 !important;
}

.data-table th:last-child,
.schedule-table th:last-child,
.personal-table th:last-child,
.employees-table th:last-child {
    position: sticky;
    right: 0;
    z-index: 20;
    background: var(--bg-header);
    width: 55px;
    min-width: 55px;
    max-width: 55px;
    border-right: 1px solid #b3b3b3 !important;
    box-shadow: inset 1px 0 0 0 #b3b3b3 !important;
}

.today-table td:first-child,
.today-table th:first-child,
.today-table td:last-child,
.today-table th:last-child,
.admin-content .schedule-table td:first-child,
.admin-content .schedule-table th:first-child {
    border-right: 1px solid #e0e0e0 !important;
    box-shadow: none !important;
}

.admin-content .schedule-table td:nth-child(2),
.admin-content .schedule-table th:nth-child(2) {
    border-right: 1px solid #b3b3b3 !important;
    box-shadow: inset -1px 0 0 0 #b3b3b3 !important;
}

.month-content .schedule-table td:first-child,
.month-content .schedule-table th:first-child,
.month-content .schedule-table td:last-child,
.month-content .schedule-table th:last-child,
.admin-content .schedule-table td:nth-child(2),
.admin-content .schedule-table th:nth-child(2),
.admin-content .schedule-table td:last-child,
.admin-content .schedule-table th:last-child,
.personal-table td:first-child,
.personal-table th:first-child,
.personal-table td:last-child,
.personal-table th:last-child {
    white-space: nowrap !important;
}

/* Левая тень для последнего столбца (и для заголовков, и для ячеек) */
.admin-content .schedule-table td:last-child,
.admin-content .schedule-table th:last-child,
.month-content .schedule-table td:last-child,
.month-content .schedule-table th:last-child,
.personal-table td:last-child,
.personal-table th:last-child {
    border-left: 1px solid #b3b3b3 !important;
    box-shadow: -1px 0 0 0 #b3b3b3 !important;
}

/* Убираем правую границу, если есть */
.admin-content .schedule-table td:last-child,
.admin-content .schedule-table th:last-child,
.month-content .schedule-table td:last-child,
.month-content .schedule-table th:last-child,
.personal-table td:last-child,
.personal-table th:last-child {
    border-right: none !important;
}

/* ===== ФИКСЫ ДЛЯ ТАБЛИЦЫ СОТРУДНИКОВ ===== */

/* Заголовки таблицы сотрудников — единый цвет */
.employees-table th {
    background: var(--bg-header) !important;
    color: var(--text-dark) !important;
    font-weight: 600 !important;
}

/* Все ячейки таблицы — белый фон */
.employees-table td {
    background: white !important;
}

/* Первый и последний столбцы — тоже белый фон */
.employees-table td:first-child,
.employees-table td:last-child {
    background: white !important;
}

/* Выделение строки при наведении */
.employees-table tbody tr:hover td {
    background-color: #e8f0fe !important;
}

.employees-table tbody tr:hover td:first-child,
.employees-table tbody tr:hover td:last-child {
    background-color: #e8f0fe !important;
}

/* Фиксация первого столбца */
.employees-table th:first-child,
.employees-table td:first-child {
    position: sticky !important;
    left: 0 !important;
    z-index: 15 !important;
    background: white !important;
    box-shadow: inset -1px 0 0 0 #b3b3b3 !important;
}

/* Фиксация последнего столбца */
.employees-table th:last-child,
.employees-table td:last-child {
    position: sticky !important;
    right: 0 !important;
    z-index: 15 !important;
    background: white !important;
    box-shadow: inset 1px 0 0 0 #b3b3b3 !important;
}

/* Заголовки фиксированных столбцов — выше остальных */
.employees-table th:first-child,
.employees-table th:last-child {
    background: var(--bg-header) !important;
    z-index: 20 !important;
}

.employees-table th:last-child,
.employees-table td:last-child {
    box-shadow: none !important;
}

/* Тень для последнего столбца в сводном графике и месяце */
.admin-content .schedule-table td:last-child,
.admin-content .schedule-table th:last-child,
.month-content .schedule-table td:last-child,
.month-content .schedule-table th:last-child {
    box-shadow: inset 1px 0 0 0 #b3b3b3 !important;
}

/* ===== 16. ЗАГРУЗКА, ОШИБКИ, ПУСТЫЕ СОСТОЯНИЯ ===== */
.loading-container,
.management-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px;
}

.loading-spinner,
.management-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(0, 0, 0, 0.1);
    border-top-color: var(--accent-dark);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.empty-state,
.management-empty,
.management-error {
    text-align: center;
    padding: 60px;
}

.management-error h3 {
    color: #dc3545;
}

.management-retry-btn {
    background: rgba(0, 0, 0, 0.1);
    border: none;
    padding: 8px 20px;
    border-radius: 20px;
    cursor: pointer;
    margin-top: 15px;
}

/* ===== 17. МОДАЛЬНЫЕ ОКНА ===== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    border-radius: 12px;
    width: 500px;
    max-width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.modal-small {
    width: 350px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 10px;
    border-bottom: 1px solid var(--border-light);
    background: var(--accent-dark);
    border-radius: 12px 12px 0 0;
}

.modal-header h3 {
    margin: 0;
    font-size: 16px;
    color: white;
}

.modal-close {
    font-size: 24px;
    cursor: pointer;
    color: white;
}

.modal-close:hover {
    opacity: 0.8;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-light);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.modal-footer .btn {
    padding: 6px 12px;
    font-size: 13px;
}

/* ===== 18. ФОРМЫ ===== */
.form-row {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
}

.form-group {
    flex: 1;
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-size: 13px;
    font-weight: 500;
    color: #333;
}

.form-control {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-light);
    border-radius: 6px;
    font-size: 14px;
    box-sizing: border-box;
}

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

.checkbox-group {
    display: flex;
    align-items: center;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    margin: 0;
    font-size: 14px;
    font-weight: 500;
}

.checkbox-group input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* ===== 19. КНОПКИ ===== */
.btn {
    padding: 8px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--accent-dark);
    color: white;
}

.btn-primary:hover {
    background: var(--accent);
}

.btn-secondary {
    background: #e9ecef;
    border: 1px solid #ced4da;
}

.btn-secondary:hover {
    background: #dee2e6;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:hover {
    background: #c82333;
}

/* ===== 20. УВЕДОМЛЕНИЯ ===== */
.notification-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 3000;
}

.notification-top {
    padding: 12px 20px;
    border-radius: 8px;
    color: white;
    font-size: 14px;
    margin-bottom: 10px;
    animation: slideIn 0.3s ease;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.notification-success {
    background: #28a745;
}

.notification-error {
    background: #dc3545;
}

.notification-info {
    background: #17a2b8;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ===== 21. КАСТОМНОЕ ОКНО ПОДТВЕРЖДЕНИЯ ===== */
.custom-confirm-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.custom-confirm {
    background: white;
    border-radius: 12px;
    padding: 24px 32px;
    min-width: 320px;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.custom-confirm-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 12px;
    color: #001d18;
}

.custom-confirm-message {
    font-size: 14px;
    color: #666;
    margin-bottom: 24px;
    line-height: 1.5;
}

.custom-confirm-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.custom-confirm-btn {
    padding: 8px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.custom-confirm-btn-cancel {
    background: #e9ecef;
    color: #333;
}

.custom-confirm-btn-cancel:hover {
    background: #dee2e6;
}

.custom-confirm-btn-confirm {
    background: #dc3545;
    color: white;
}

.custom-confirm-btn-confirm:hover {
    background: #c82333;
}

/* ===== 22. ОБЩИЕ СТИЛИ ДЛЯ ЗАГОЛОВКОВ ДНЕЙ ===== */
.schedule-table th.day-header,
.data-table th.day-header,
.personal-table th.day-header {
    font-size: 15px;
    font-weight: 600;
}

.schedule-table th.day-header small,
.data-table th.day-header small,
.personal-table th.day-header small {
    font-size: 11px;
    color: #666;
    font-weight: normal;
}

/* ===== 23. ДОБАВЛЕНИЕ СОТРУДНИКА В ГРАФИК ===== */
.add-employee-row td {
    border-left: none !important;
    border-right: none !important;
}

.add-employee-cell {
    padding: 2px !important;
    background: #f9f9f9;
}

#addEmployeeBtn {
    cursor: pointer;
    color: #7e7e7e;
}

#addEmployeeBtn:hover {
    text-decoration: underline;
}

#employeeSearchContainer {
    margin: 0 !important;
    padding: 0 !important;
    position: relative;
    width: 100%;
}

#employeeSearchInput {
    padding: 4px 6px !important;
    margin: 0 !important;
    height: 28px !important;
    font-size: 13px !important;
    width: 100% !important;
    border: 1px solid var(--border-light);
    border-radius: 4px;
    box-sizing: border-box;
}

/* Левая внутренняя тень для последнего столбца */
.month-content .schedule-table td:last-child,
.month-content .schedule-table th:last-child,
.admin-content .schedule-table td:last-child,
.admin-content .schedule-table th:last-child,
.personal-table td:last-child,
.personal-table th:last-child {
    box-shadow: inset 2px 0 0 0 #b3b3b3 !important;
}