/* =================================================================
   BASE & RESET STYLES
   ================================================================= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    min-height: 100vh;
    background: radial-gradient(ellipse at bottom, #1B2735 0%, #090A0F 100%);
    color: #f8f9fa; /* Changed to light color for dark theme */
    overflow: hidden; /* As per the example */
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 30px;
}

/* =================================================================
   STARRY BACKGROUND
   ================================================================= */
@keyframes animStar {
    from { transform: translateY(0px); }
    to { transform: translateY(-2000px); }
}

.stars {
    position: fixed;
    top: 0;
    left: 0;
    width: 1px;
    height: 1px;
    background: transparent;
    box-shadow: /* A smaller, manually generated set of stars */
        1539px 1361px #FFF, 1294px 751px #FFF, 1599px 1863px #FFF, 
        1534px 1238px #FFF, 1211px 470px #FFF, 1173px 1819px #FFF, 
        413px 1385px #FFF, 1029px 1013px #FFF, 1963px 1478px #FFF, 
        342px 1492px #FFF, 1334px 133px #FFF, 1629px 1236px #FFF, 
        1700px 316px #FFF, 1132px 1233px #FFF, 461px 1801px #FFF, 
        810px 1891px #FFF, 237px 1195px #FFF, 1109px 153px #FFF, 
        138px 1086px #FFF, 1632px 166px #FFF;
    animation: animStar 50s linear infinite;
}

.stars:after {
    content: " ";
    position: absolute;
    top: 2000px;
    width: 1px;
    height: 1px;
    background: transparent;
    box-shadow: /* Matching the above set */
        1539px 1361px #FFF, 1294px 751px #FFF, 1599px 1863px #FFF, 
        1534px 1238px #FFF, 1211px 470px #FFF, 1173px 1819px #FFF, 
        413px 1385px #FFF, 1029px 1013px #FFF, 1963px 1478px #FFF, 
        342px 1492px #FFF, 1334px 133px #FFF, 1629px 1236px #FFF, 
        1700px 316px #FFF, 1132px 1233px #FFF, 461px 1801px #FFF, 
        810px 1891px #FFF, 237px 1195px #FFF, 1109px 153px #FFF, 
        138px 1086px #FFF, 1632px 166px #FFF;
}

.stars2 {
    position: fixed;
    top: 0;
    left: 0;
    width: 2px;
    height: 2px;
    background: transparent;
    box-shadow: /* Medium stars */
        161px 662px #FFF, 1123px 1324px #FFF, 1233px 584px #FFF, 
        1109px 1999px #FFF, 345px 1089px #FFF, 1295px 1231px #FFF, 
        431px 126px #FFF, 1221px 1839px #FFF, 1244px 197px #FFF, 
        1156px 1303px #FFF;
    animation: animStar 100s linear infinite;
}

.stars2:after {
    content: " ";
    position: absolute;
    top: 2000px;
    width: 2px;
    height: 2px;
    background: transparent;
    box-shadow: /* Matching the above set */
        161px 662px #FFF, 1123px 1324px #FFF, 1233px 584px #FFF, 
        1109px 1999px #FFF, 345px 1089px #FFF, 1295px 1231px #FFF, 
        431px 126px #FFF, 1221px 1839px #FFF, 1244px 197px #FFF, 
        1156px 1303px #FFF;
}

.stars3 {
    position: fixed;
    top: 0;
    left: 0;
    width: 3px;
    height: 3px;
    background: transparent;
    box-shadow: /* Big stars */
        1016px 1604px #FFF, 135px 1354px #FFF, 856px 602px #FFF, 
        134px 180px #FFF, 1855px 1873px #FFF;
    animation: animStar 150s linear infinite;
}

.stars3:after {
    content: " ";
    position: absolute;
    top: 2000px;
    width: 3px;
    height: 3px;
    background: transparent;
    box-shadow: /* Matching the above set */
        1016px 1604px #FFF, 135px 1354px #FFF, 856px 602px #FFF, 
        134px 180px #FFF, 1855px 1873px #FFF;
}

/* Remove old background */
.animated-bg {
    display: none;
}

/* =================================================================
   HEADER (Dark Theme)
   ================================================================= */
.header {
    background: rgba(27, 39, 53, 0.8);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-left h1, .office-name {
    color: #FFF;
}

.office-info {
    display: flex;
    gap: 15px;
    font-size: 14px;
    margin-top: 5px;
}

.office-city {
    color: #6c757d;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-name {
    font-weight: 500;
    color: #495057;
}

/* =================================================================
   BUTTONS
   ================================================================= */
.btn-primary, .settings-btn, .week-btn.active {
    display: inline-block;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    border: none;
    font-family: 'Inter', sans-serif;
    background: #0d6efd;
    color: white;
    box-shadow: 0 4px 15px rgba(13, 110, 253, 0.2);
}

.btn-primary:hover, .settings-btn:hover, .week-btn.active:hover {
    background: #0a58ca;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(13, 110, 253, 0.3), 0 0 0 4px #ffc107;
}

.btn-secondary, .logout-btn {
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    background: #e9ecef;
    color: #495057;
    border: 1px solid #dee2e6;
}

.btn-secondary:hover, .logout-btn:hover {
    background: #dee2e6;
    border-color: #ced4da;
    box-shadow: 0 0 0 4px #ffc107;
}

.btn-danger {
    padding: 8px 16px;
    background: #f8d7da;
    color: #842029;
    border: 1px solid #f5c2c7;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-danger:hover {
    background: #dc3545;
    color: white;
    border-color: #dc3545;
}

/* =================================================================
   TIME NAVIGATION
   ================================================================= */
.time-navigation {
    margin: 30px 0;
}

.month-selector {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin-bottom: 20px;
}

.nav-btn, .week-btn {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: rgba(27, 39, 53, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 18px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #f8f9fa;
}

.nav-btn:hover, .week-btn:hover {
    background: #0d6efd;
    color: white;
    border-color: #0d6efd;
    transform: scale(1.1);
}

.current-period {
    text-align: center;
}

.current-period h2 {
    font-size: 32px;
    color: #FFF; /* Changed to white */
}

.current-period .current-week {
    font-size: 16px;
    color: #6c757d;
}

.week-selector {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 30px; /* Added bottom margin */
}

.week-btn {
    padding: 10px 15px;
    min-width: 120px;
    text-align: center;
    font-size: 14px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    line-height: 1.4;
    border-radius: 8px; /* Restoring the border radius */
}

.week-btn small {
    display: block;
}

.week-btn:hover {
    border-color: #ffc107;
    color: #ffc107;
    background-color: #fff; /* Добавляем белый фон для яркости */
}

.week-btn.is-current-week {
    position: relative;
    border-color: #0d6efd;
}

.week-btn.is-current-week::after {
    content: '★';
    position: absolute;
    top: 5px;
    right: 8px;
    font-size: 14px;
    color: #ffc107;
    text-shadow: 0 0 5px rgba(0,0,0,0.3);
}

/* =================================================================
   STATISTICS PANEL
   ================================================================= */
.stats-panel {
    display: flex;
    justify-content: center;
    align-items: stretch;
    gap: 15px;
    margin: 23px 0;
    padding: 0 15px;
    flex-wrap: wrap;
}

.stat-card {
    background: rgba(27, 39, 53, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 18px;
    text-align: center;
    transition: all 0.3s ease;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.2);
    flex: 1;
    min-width: 150px;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
    border-color: rgba(255, 255, 255, 0.2);
}

.stat-card-main {
    background: linear-gradient(135deg, rgba(255, 193, 7, 0.2) 0%, rgba(255, 152, 0, 0.2) 100%);
    border-color: #ffc107;
    flex: 1.5;
}

.stat-card-main .stat-label {
    font-size: 24px;
    font-weight: 800;
    color: #ffc107;
    text-shadow: 0 0 15px rgba(255, 193, 7, 0.5);
}

.stat-card-main .stat-value {
    font-size: 36px;
    font-weight: 900;
}

.stat-card-medium {
    background: rgba(13, 110, 253, 0.1);
    border-color: rgba(13, 110, 253, 0.3);
}

.stat-card-medium .stat-label {
    color: #0d6efd;
    font-size: 14px;
    font-weight: 600;
}

.stat-card-result {
    background: linear-gradient(135deg, rgba(40, 167, 69, 0.2) 0%, rgba(25, 135, 84, 0.2) 100%);
    border-color: #28a745;
}

.stat-card-result .stat-label {
    color: #28a745;
    font-size: 18px;
    font-weight: 700;
    text-shadow: 0 0 12px rgba(40, 167, 69, 0.3);
}

.stat-label {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.75px;
}

.stat-value {
    font-size: 27px;
    font-weight: 800;
    color: #ffffff;
    margin: 8px 0;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.stat-value.negative {
    color: #dc3545;
    text-shadow: 0 0 12px rgba(220, 53, 69, 0.5);
}

.stat-description {
    font-size: 9px;
    color: #adb5bd;
    margin-top: 8px;
    font-weight: 400;
}

/* Responsive для статистики */
@media (max-width: 992px) {
    .stats-panel {
        flex-direction: column;
    }
    
    .stat-card {
        flex: 1;
        min-width: auto;
    }
}

/* =================================================================
   CUSTOM SELECT (ATTENDANCE)
   ================================================================= */
.custom-select-wrapper {
    position: relative;
    width: calc(100% - 4px);
    margin: 0 auto;
}

.custom-select-wrapper.open {
    z-index: 50; /* Поднимаем открытый селект наверх */
}

.custom-select-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: rgba(27, 39, 53, 0.8); /* Match header background */
    border: 1px solid rgba(255, 255, 255, 0.1); /* Match header border */
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.custom-select-wrapper.open .custom-select-trigger {
    border-color: #ffc107;
    box-shadow: 0 0 0 3px rgba(255, 193, 7, 0.2);
}

.custom-options {
    position: absolute;
    top: 105%;
    left: 0;
    right: 0;
    background: rgba(27, 39, 53, 0.95); /* Darker background for options */
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    z-index: 20;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s ease;
}

.custom-select-wrapper.open .custom-options {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.custom-option {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.custom-option:hover {
    background-color: rgba(13, 110, 253, 0.3); /* Blueish hover */
}

.custom-option .diagram-value {
    margin-right: 10px;
}

.diagram-value {
    width: 40px;
    height: 20px;
    display: flex;
    align-items: center;
}

.diagram-bar-wrapper {
    width: 100%;
    height: 12px;
    background-color: #e9ecef;
    border-radius: 6px;
    overflow: hidden;
}

.diagram-bar {
    height: 100%;
    border-radius: 6px;
    background: linear-gradient(90deg, #ffc107, #ffecb3);
}

.diagram-bar.zero {
    background-color: #dc3545;
    color: white;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    line-height: 1;
}

/* =================================================================
   TABLES
   ================================================================= */
.table-container {
    background: rgba(27, 39, 53, 0.7);
    border-radius: 12px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    position: relative; /* Добавляем для z-index контекста */
}

/* Позволяем выпадающему списку выходить за пределы таблицы */
.table-container:has(.custom-select-wrapper.open) {
    overflow: visible;
}

.employees-table {
    width: 100%;
    border-collapse: collapse;
}

.employees-table thead th {
    background: rgba(13, 110, 253, 0.5);
    color: white;
    padding: 18px 15px;
    font-size: 14px;
    text-align: center;
    position: sticky;
    top: 0;
    z-index: 10;
    border-right: 1px solid rgba(255, 255, 255, 0.2);
}

.employees-table thead th:last-child {
    border-right: none;
}

.employees-table tbody td {
    padding: 15px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    border-right: 1px solid rgba(255, 255, 255, 0.1);
}

.employees-table tbody td:last-child {
    border-right: none;
}

.employees-table th.current-day {
    background-color: #0d6efd; /* Keep header blue */
}

.employees-table th.current-day .day-name,
.employees-table th.current-day .day-date {
    color: #ffc107; /* Golden text for header */
}

.employees-table td.current-day {
    background-color: rgba(50, 65, 83, 0.8); /* Slightly lighter background for cells */
}

.attendance-cell {
    min-width: 120px;
}

.penalty-cell .penalty-input {
    width: 100%;
    padding: 8px;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    text-align: center;
    font-size: 14px;
    -moz-appearance: textfield; /* Firefox */
}

.penalty-cell .penalty-input::placeholder {
    color: #ced4da;
}

.penalty-cell .penalty-input:focus {
    outline: none;
    border-color: #ffc107;
    box-shadow: 0 0 0 3px rgba(255, 193, 7, 0.2);
}

.penalty-cell .penalty-input::-webkit-outer-spin-button,
.penalty-cell .penalty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Penalties Table Specifics */
.penalties-table .total-penalty-week {
    font-weight: 600;
    color: #dc3545;
}

/* Salary Table Specifics */
.salary-table .salary-cell .salary-input {
    width: 100%;
    padding: 8px;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    text-align: center;
    font-size: 14px;
    -moz-appearance: textfield;
}

.salary-table .salary-cell .salary-input:focus {
    outline: none;
    border-color: #ffc107;
    box-shadow: 0 0 0 3px rgba(255, 193, 7, 0.2);
}

.salary-table .total-salary-week {
    font-weight: 600;
    color: #198754;
}

.total-earnings .strikethrough {
    text-decoration: line-through;
    color: #6c757d;
    font-size: 14px;
}

.total-earnings .bonus-salary {
    font-size: 16px;
    font-weight: 700;
    color: #FFF; /* Was green, changed to white */
    position: relative;
    display: inline-block;
    margin: 5px 0;
}

.bonus-badge {
    position: absolute;
    top: -10px;
    right: -15px;
    background-color: #ffc107;
    color: #212529;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
}

.total-earnings .gross-amount {
    color: #FFF;
    font-size: 18px;
    font-weight: 500;
}

.total-earnings .penalty-amount {
    color: #dc3545;
    font-size: 14px;
    font-weight: 500;
}

.total-earnings .final-amount {
    color: #198754;
    font-size: 20px;
    font-weight: 700;
    margin-top: 5px;
}

/* User Management Styles */
#users-tab .section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

#users-tab h3 {
    font-size: 22px;
    color: #f8f9fa;
    margin: 20px 0;
}

.user-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.user-card {
    background: rgba(27, 39, 53, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 20px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.user-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(13, 110, 253, 0.3);
    border-color: rgba(13, 110, 253, 0.5);
}

.user-card-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 15px;
}

.user-card-header h4 {
    font-size: 18px;
    color: #FFF;
    margin: 0;
}

.user-card-header span {
    font-size: 14px;
    color: #adb5bd;
}

.user-card-actions {
    display: flex;
    gap: 10px;
}

.section-divider {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin: 30px 0;
}

.salary-managers-list .user-card {
    margin-bottom: 20px;
}

.office-assignment {
    margin-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 15px;
}

.office-assignment h5 {
    font-size: 16px;
    color: #e9ecef;
    margin-bottom: 10px;
}

.office-checkbox-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 150px;
    overflow-y: auto;
}

.office-checkbox {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 14px;
}

.office-checkbox input {
    margin-right: 10px;
}

.input-with-button {
    display: flex;
    gap: 10px;
}

.input-with-button input {
    flex-grow: 1;
}

.currency-symbol {
    font-weight: 500;
    color: #6c757d;
}

.summary-row td {
    font-weight: 600;
    padding: 18px 15px;
    background-color: #f8f9fa;
    border-top: 2px solid #dee2e6;
}

.total-penalties {
    font-size: 16px;
    color: #dc3545;
}

.sticky-col {
    position: sticky;
    left: 0;
    background: rgba(35, 51, 69, 0.9);
    z-index: 5;
}

.employees-table thead .sticky-col {
    z-index: 15;
    background: #0d6efd;
}

.employee-name {
    text-align: left;
    font-weight: 600;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.05);
}

.salary-info {
    font-size: 12px;
    color: #6c757d;
    font-weight: 400;
    margin-top: 4px;
    display: block;
}

.total-col {
    background: rgba(35, 51, 69, 0.9); /* Match sticky-col background */
    font-weight: 700;
}

.net {
    font-size: 18px;
    font-weight: 700;
}

/* =================================================================
   MODAL
   ================================================================= */
.modal {
    display: none; /* Hidden by default */
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.7);
    justify-content: center; /* Center horizontally */
    align-items: center; /* Center vertically */
}

.modal.active {
    display: flex; /* Shown when active */
}

.modal-content {
    background: rgba(27, 39, 53, 0.95);
    padding: 30px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    width: 90%;
    max-width: 500px; /* Limit max width for smaller modals */
    animation: modal-fade-in 0.3s ease-out;
}

.modal-content.large-modal {
    max-width: 900px;
}

.modal-content.wide-modal {
    max-width: 1000px;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    background: #0d6efd;
    color: white;
}

.modal-header h2 {
    font-size: 22px;
}

.close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 28px;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.close-btn:hover {
    transform: rotate(90deg);
}

.modal-body {
    padding: 30px;
    overflow-y: auto;
    max-height: calc(85vh - 100px); /* Ограничиваем высоту модального окна */
}

/* Красивая прокрутка для модального окна */
.modal-body::-webkit-scrollbar {
    width: 10px;
}

.modal-body::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 5px;
}

.modal-body::-webkit-scrollbar-thumb {
    background: rgba(13, 110, 253, 0.5);
    border-radius: 5px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
    background: rgba(13, 110, 253, 0.8);
}

/* =================================================================
   TABS & FORMS
   ================================================================= */
.settings-tabs {
    display: flex;
    border-bottom: 1px solid #dee2e6;
    margin-bottom: 25px;
}

.tab-btn {
    padding: 12px 25px;
    border: none;
    background: none;
    font-size: 15px;
    font-weight: 600;
    color: #6c757d;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
}

.tab-btn:hover {
    color: #0d6efd;
}

.tab-btn.active {
    color: #0d6efd;
    border-bottom-color: #0d6efd;
}

.tab-content { display: none; }
.tab-content.active { display: block; }

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.section-header h3 {
    font-size: 20px;
}

.form-card {
    background: rgba(27, 39, 53, 0.7);
    padding: 25px;
    border-radius: 12px;
    margin-bottom: 25px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.form-group label {
    font-size: 13px;
    font-weight: 600;
    color: #495057;
    margin-bottom: 8px;
    display: block;
}

.form-group input, .form-group select {
    width: 100%;
    padding: 12px;
    border: 1px solid #ced4da;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s ease;
}

.form-group input:focus, .form-group select:focus {
    outline: none;
    border-color: #0d6efd;
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.15);
}

.form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* =================================================================
   LISTS & CARDS
   ================================================================= */
.office-selector-page {
    padding: 30px 0;
}

.office-selector-page h2 {
    text-align: center;
    font-size: 28px;
    margin-bottom: 30px;
    color: #FFF; /* Changed to white */
}

.office-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px;
}

.office-card {
    background-color: white;
    background-size: cover;
    background-position: center right;
    border-radius: 12px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.05);
    text-decoration: none;
    color: #212529;
    transition: all 0.3s ease;
    border: 1px solid #e9ecef;
    position: relative;
    overflow: hidden;
    height: 150px;
    display: flex;
    align-items: center;
}

.office-card-overlay {
    position: relative;
    padding: 25px;
    height: 100%;
    width: 100%;
    background: linear-gradient(to right, white 50%, rgba(255, 255, 255, 0) 85%);
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.office-card:before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, #0d6efd, #0dcaf0);
    transition: all 0.3s ease;
}

.office-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    border-color: #0d6efd;
}

.office-card:hover:before {
    background: linear-gradient(90deg, #ffc107, #ffca2c);
}

.office-card h3 {
    font-size: 22px;
    margin-bottom: 8px;
    color: #1a202c;
}

.office-card p {
    font-size: 14px;
    color: #6c757d;
    margin-bottom: 15px;
}

.employee-count {
    display: inline-block;
    padding: 6px 12px;
    background: #e9ecef;
    color: #495057;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.offices-list, .employees-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.office-item, .employee-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: rgba(27, 39, 53, 0.7);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

.office-item:hover, .employee-item:hover {
    border-color: #0d6efd;
    box-shadow: 0 4px 15px rgba(13, 110, 253, 0.1);
}

/* Режим просмотра без кнопок */
.employee-item.view-only {
    justify-content: flex-start;
}

.employee-item.view-only:hover {
    border-color: rgba(255, 255, 255, 0.2);
}

.office-item-actions, .employee-item-actions {
    display: flex;
    gap: 8px;
}

.btn-sm {
    padding: 5px 10px;
    font-size: 12px;
}

.office-item-info h4, .employee-item-info strong {
    font-size: 16px;
    margin-bottom: 5px;
}

.office-group h4 {
    font-size: 18px;
    color: #0d6efd;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #dee2e6;
}

/* =================================================================
   RESPONSIVE DESIGN
   ================================================================= */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 15px;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .sticky-col {
        min-width: 150px;
    }
}

.image-gallery {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    padding: 10px;
    max-height: 400px; /* Ограничиваем высоту галереи */
    overflow-y: auto; /* Добавляем прокрутку если много изображений */
}

/* Красивая прокрутка для галереи */
.image-gallery::-webkit-scrollbar {
    width: 8px;
}

.image-gallery::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.image-gallery::-webkit-scrollbar-thumb {
    background: rgba(13, 110, 253, 0.5);
    border-radius: 4px;
}

.image-gallery::-webkit-scrollbar-thumb:hover {
    background: rgba(13, 110, 253, 0.8);
}

.image-gallery img {
    width: 100%;
    height: 150px; /* Фиксированная высота миниатюр */
    object-fit: cover; /* Обрезаем изображение чтобы заполнить область */
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.image-gallery img:hover {
    border-color: #ffc107;
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(255, 193, 7, 0.4);
}

.thumbnail {
    width: 100%;
    padding-top: 100%; /* Aspect ratio 1:1 */
    background-size: cover;
    background-position: center;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.thumbnail:hover {
    border-color: #ffc107;
    transform: scale(1.05);
}

/* =================================================================
   COMMENT SYSTEM
   ================================================================= */

/* Контейнер для ячейки с комментарием */
.cell-with-comment {
    position: relative;
}

/* Кнопка добавления комментария */
.add-comment-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(13, 110, 253, 0.8);
    border: none;
    color: white;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10;
    line-height: 1;
}

.add-comment-btn:hover {
    background: rgba(13, 110, 253, 1);
    transform: scale(1.1);
}

/* Контейнер для кнопок действий */
.action-buttons {
    position: absolute;
    top: 5px;
    right: 5px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    z-index: 10;
}

/* Иконка комментария для админа (когда есть комментарии) */
.view-comments-btn {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(255, 193, 7, 0.8);
    border: none;
    color: white;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    position: relative;
}

.view-comments-btn:hover {
    background: rgba(255, 193, 7, 1);
    transform: scale(1.1);
}

/* Кнопка просмотра зарплат от менеджера */
.view-salary-btn {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ffc107, #ffecb3);
    border: none;
    color: #000000;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.view-salary-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(255, 193, 7, 0.4);
}

/* Модальное окно комментария */
.comment-modal {
    position: fixed;
    background: rgba(27, 39, 53, 0.98);
    border: 2px solid rgba(13, 110, 253, 0.5);
    border-radius: 12px;
    padding: 15px;
    width: 320px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    z-index: 9999;
    display: none;
    --arrow-right: 12px;
}

.comment-modal.active {
    display: block;
}

/* Стрелочка указывающая на кнопку */
.comment-modal::before {
    content: '';
    position: absolute;
    top: -10px;
    right: var(--arrow-right, 12px);
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-bottom: 10px solid rgba(13, 110, 253, 0.5);
}

.comment-modal::after {
    content: '';
    position: absolute;
    top: -8px;
    right: calc(var(--arrow-right, 12px) + 1px);
    width: 0;
    height: 0;
    border-left: 9px solid transparent;
    border-right: 9px solid transparent;
    border-bottom: 9px solid rgba(27, 39, 53, 0.98);
}

.comment-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.comment-modal-header h4 {
    font-size: 14px;
    color: #f8f9fa;
    margin: 0;
}

.close-comment-btn {
    background: none;
    border: none;
    color: #adb5bd;
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.3s ease;
}

.close-comment-btn:hover {
    color: #dc3545;
}

.comment-modal-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.comment-input {
    width: 100%;
    min-height: 80px;
    padding: 10px;
    background: rgba(9, 10, 15, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: #f8f9fa;
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    resize: vertical;
    transition: border-color 0.3s ease;
}

.comment-input:focus {
    outline: none;
    border-color: rgba(13, 110, 253, 0.5);
}

.comment-input::placeholder {
    color: #6c757d;
}

.comment-submit-btn {
    padding: 8px 16px;
    background: #0d6efd;
    border: none;
    border-radius: 6px;
    color: white;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.comment-submit-btn:hover {
    background: #0b5ed7;
    transform: translateY(-1px);
}

.comment-submit-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Список комментариев */
.comments-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 300px;
    overflow-y: auto;
    padding-right: 5px;
}

.comments-list::-webkit-scrollbar {
    width: 6px;
}

.comments-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
}

.comments-list::-webkit-scrollbar-thumb {
    background: rgba(13, 110, 253, 0.4);
    border-radius: 3px;
}

.comment-item {
    background: rgba(9, 10, 15, 0.4);
    border-radius: 8px;
    padding: 10px;
    border-left: 3px solid #0d6efd;
}

.comment-author {
    font-size: 11px;
    color: #0d6efd;
    font-weight: 600;
    margin-bottom: 5px;
}

.comment-text {
    font-size: 13px;
    color: #dee2e6;
    line-height: 1.4;
    word-wrap: break-word;
}

.comment-time {
    font-size: 10px;
    color: #6c757d;
    margin-top: 5px;
}

.no-comments {
    text-align: center;
    color: #6c757d;
    font-size: 12px;
    padding: 20px;
}

/* Информация о зарплате */
.salary-info {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.salary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: rgba(9, 10, 15, 0.4);
    border-radius: 6px;
}

.salary-row.bonus-row {
    background: rgba(255, 193, 7, 0.15);
    border: 1px solid rgba(255, 193, 7, 0.3);
}

.salary-label {
    font-size: 13px;
    color: #adb5bd;
    font-weight: 500;
}

.salary-value {
    font-size: 16px;
    color: #f8f9fa;
    font-weight: 700;
}

.bonus-row .salary-value {
    color: #ffc107;
}

/* Позиционирование модального окна под кнопкой */
.comment-modal-positioned {
    top: 100%;
    margin-top: 10px;
}

/* Badge с количеством комментариев */
.comments-count-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #dc3545;
    color: white;
    border-radius: 50%;
    width: 16px;
    height: 16px;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

/* =================================================================
   ADMIN PANEL - COEFFICIENT DISPLAY WITH PROGRESS BAR
   ================================================================= */

/* Прогресс-бар для коэффициента */
.coefficient-progress-bar {
    position: relative;
    width: 70px;
    height: 26px;
    background-color: rgba(233, 236, 239, 0.3);
    border-radius: 8px;
    overflow: hidden;
    margin: 0 auto 5px auto;
}

.coefficient-bar-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: linear-gradient(90deg, #ffc107, #ffecb3);
    border-radius: 8px;
    transition: width 0.3s ease;
}

.coefficient-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 14px;
    font-weight: 700;
    color: #000000;
    z-index: 2;
    text-shadow: 0 0 3px rgba(255, 255, 255, 0.5);
}

/* Крестик для нулевого коэффициента */
.coefficient-zero {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #E6A8A8, #F4D3D3);
    color: #8B4C4C;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: bold;
    margin: 0 auto 5px auto;
}

/* Штраф за день - маленький тонкий текст */
.day-penalty-small {
    font-size: 9px;
    color: #dc3545;
    font-weight: 300;
    margin-top: 3px;
    line-height: 1.2;
}

/* Штраф под итоговой суммой */
.penalty-note {
    font-size: 11px;
    font-weight: 300;
    color: #6c757d;
    margin-top: 4px;
    font-style: italic;
}

/* =================================================================
   ANIMATIONS
   ================================================================= */
@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.comment-modal.active {
    animation: fadeIn 0.2s ease;
}

