* {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    margin: 0;
    padding: 20px;
    background: #f5f5f5;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

header {
    margin-bottom: 30px;
}

h1 {
    margin: 0;
    color: #333;
    font-size: 28px;
}

h2 {
    color: #333;
    margin-top: 0;
}

.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 2px solid #eee;
}

.tab {
    padding: 12px 24px;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.3s;
    background: none;
    border: none;
    font-size: 16px;
    color: #666;
}

.tab:hover {
    background: #f8f9fa;
    color: #333;
}

.tab.active {
    border-bottom-color: #667eea;
    color: #667eea;
    font-weight: 500;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.controls {
    margin-bottom: 20px;
}

#managerSelect {
    padding: 10px 15px;
    font-size: 16px;
    margin-bottom: 20px;
    width: 100%;
    max-width: 400px;
    border: 1px solid #ddd;
    border-radius: 5px;
    background: white;
}

#managerSelect:focus {
    outline: none;
    border-color: #667eea;
}

.month-navigation {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin-bottom: 20px;
}

.month-navigation button {
    padding: 8px 16px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s;
}

.month-navigation button:hover {
    background: #5568d3;
}

.month-navigation button:active {
    background: #4456b8;
}

#currentMonth {
    font-size: 18px;
    font-weight: 500;
    min-width: 200px;
    text-align: center;
    color: #333;
}

.calendar {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    margin-bottom: 20px;
    background: #ddd;
    border: 1px solid #ddd;
}

.calendar-header {
    padding: 12px;
    text-align: center;
    font-weight: 600;
    background: #f8f9fa;
    color: #666;
    font-size: 14px;
}

.calendar-day {
    padding: 15px 5px;
    border: none;
    text-align: center;
    min-height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    background: white;
    font-size: 14px;
    position: relative;
}

.calendar-day:hover {
    background: #f0f0f0;
    transform: scale(1.05);
    z-index: 1;
}

.calendar-day.other-month {
    color: #ccc;
    background: #fafafa;
}

.calendar-day.working {
    background: #90EE90;
    font-weight: 500;
    color: #2d5016;
}

.calendar-day.working:hover {
    background: #7dd87d;
}

.calendar-day.off {
    background: #ffcccc;
    color: #8b0000;
}

.calendar-day.off:hover {
    background: #ffaaaa;
}

.calendar-day.weekend {
    background: #f0f0f0;
    color: #999;
}

.calendar-day.weekend.working {
    background: #90EE90;
    color: #2d5016;
}

.calendar-day.weekend.off {
    background: #ffcccc;
    color: #8b0000;
}

.calendar-day.today {
    border: 2px solid #007bff;
    font-weight: bold;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.2);
}

.calendar-day.today.working {
    background: #7dd87d;
    border-color: #007bff;
}

.calendar-day.today.off {
    background: #ffaaaa;
    border-color: #007bff;
}

.calendar-day.has-custom-time {
    position: relative;
}

.calendar-day.has-custom-time::after {
    content: '⏰';
    position: absolute;
    top: 2px;
    right: 2px;
    font-size: 10px;
    opacity: 0.7;
}

.legend {
    margin-top: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 5px;
}

.legend p {
    margin: 8px 0;
    font-size: 14px;
}

.legend-working {
    display: inline-block;
    width: 20px;
    height: 20px;
    background: #90EE90;
    border: 1px solid #ddd;
    margin-right: 8px;
    vertical-align: middle;
    border-radius: 3px;
}

.legend-off {
    display: inline-block;
    width: 20px;
    height: 20px;
    background: #ffcccc;
    border: 1px solid #ddd;
    margin-right: 8px;
    vertical-align: middle;
    border-radius: 3px;
}

.legend-today {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #007bff;
    margin-right: 8px;
    vertical-align: middle;
    background: white;
}

.legend-custom-time {
    display: inline-block;
    width: 20px;
    height: 20px;
    background: #90EE90;
    border: 2px solid #007bff;
    margin-right: 8px;
    vertical-align: middle;
    border-radius: 3px;
    position: relative;
}

.legend-custom-time::after {
    content: '⏰';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 10px;
}

.settings-item {
    margin-bottom: 30px;
    padding: 20px;
    border: 1px solid #ddd;
    border-radius: 5px;
    background: #fafafa;
}

.settings-item h3 {
    margin-top: 0;
    color: #333;
    font-size: 18px;
}

.settings-item label {
    display: block;
    margin: 15px 0;
    font-weight: 500;
    color: #555;
}

.settings-item input[type="time"] {
    padding: 8px 12px;
    width: 150px;
    margin-left: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 16px;
}

.settings-item input[type="time"]:focus {
    outline: none;
    border-color: #667eea;
}

.settings-item button {
    padding: 10px 20px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    margin-top: 10px;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.3s;
}

.settings-item button:hover {
    background: #5568d3;
}

.settings-item button:active {
    background: #4456b8;
}

/* Стили для вкладки сводки */
.overview-calendar {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    margin-bottom: 20px;
    background: #ddd;
    border: 1px solid #ddd;
}

.overview-day {
    background: white;
    border: none;
    min-height: 120px;
    padding: 8px;
    display: flex;
    flex-direction: column;
    transition: all 0.2s;
    cursor: pointer;
}

.overview-day:hover {
    background: #f8f9fa;
    transform: scale(1.02);
    z-index: 1;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.overview-day.other-month {
    background: #fafafa;
    opacity: 0.6;
}

.overview-day.weekend {
    background: #f0f0f0;
}

.overview-day.today {
    border: 2px solid #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.2);
}

.overview-day-header {
    font-weight: bold;
    font-size: 16px;
    margin-bottom: 5px;
    color: #333;
}

.overview-workers-list {
    flex: 1;
    font-size: 11px;
    overflow-y: auto;
}

.overview-worker {
    background: #90EE90;
    padding: 3px 6px;
    margin: 2px 0;
    border-radius: 3px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.worker-name {
    font-weight: 500;
    color: #2d5016;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.worker-time {
    font-size: 10px;
    color: #555;
    margin-left: 5px;
    white-space: nowrap;
}

.no-workers {
    color: #999;
    font-style: italic;
    text-align: center;
    padding: 10px 0;
    font-size: 12px;
}

/* Модальное окно деталей дня */
.day-details-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.day-details-content {
    background: white;
    padding: 30px;
    border-radius: 10px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 10px 25px rgba(0,0,0,0.3);
}

.day-details-content h2 {
    margin-top: 0;
    color: #333;
    border-bottom: 2px solid #667eea;
    padding-bottom: 10px;
}

.day-details-section {
    margin: 20px 0;
}

.day-details-section h3 {
    color: #555;
    font-size: 16px;
    margin-bottom: 10px;
}

.managers-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.managers-list li {
    padding: 8px 12px;
    margin: 5px 0;
    background: #f8f9fa;
    border-radius: 5px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.time-info {
    color: #667eea;
    font-size: 14px;
    font-weight: 500;
}

.close-btn {
    width: 100%;
    padding: 12px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    margin-top: 20px;
}

.close-btn:hover {
    background: #5568d3;
}

/* Кнопка выхода */
.logout-btn {
    padding: 8px 16px;
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    margin-left: auto;
}

.logout-btn:hover {
    background: #c0392b;
}

/* Группировка по офисам */
.office-group {
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.office-name {
    margin: 0 0 10px 0;
    color: #667eea;
    font-size: 16px;
    font-weight: 600;
}

.office-group .managers-list {
    margin-top: 10px;
}
