body {
    background-color: #f5f7fa;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

.container-fluid {
    padding-left: 12px !important;
    padding-right: 12px !important;
}

/* Кастомный тултип для диаграммы Ганта */
#gantt-tooltip {
    position: fixed;
    background: rgba(30, 30, 30, 0.92);
    color: #fff;
    padding: 7px 11px;
    border-radius: 7px;
    font-size: 11.5px;
    line-height: 1.5;
    pointer-events: none;
    z-index: 9999;
    max-width: 500px;
    white-space: nowrap;
    display: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

#gantt-tooltip strong {
    font-size: 13px;
    display: block;
    margin-bottom: 2px;
}

/* Подсветка задачи при клике с диаграммы */
.task-highlight {
    background: #fff3cd !important;
    border-left: 3px solid #ffc107;
    padding-left: 7px;
    border-radius: 3px;
    transition: background 2s ease-out;
}

.stat-row {
    min-height: 240px;
}

.stat-col {
    display: flex;
    flex-direction: column;
}

.stat-value-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-value {
    font-size: 2.5rem;
    font-weight: bold;
    color: #0d6efd;
}

.stat-label {
    color: #6c757d;
    font-size: 0.9rem;
    padding-bottom: 4px;
}

.task-details {
    background-color: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    text-align: left;
}

.task-list {
    list-style: none;
    padding: 0;
    margin: 15px 0;
}

.task-list li {
    padding: 10px;
    border-bottom: 1px solid #dee2e6;
    transition: background-color 0.2s;
}

.task-list li:hover {
    background-color: #fff;
}

.task-list li:last-child {
    border-bottom: none;
}

.task-link {
    text-decoration: none;
    color: #0d6efd;
    font-weight: 500;
}

.task-link:hover {
    text-decoration: underline;
}

.task-date {
    color: #6c757d;
    font-size: 0.85rem;
    margin-left: 10px;
}

.task-no-deadline {
    font-style: italic;
    opacity: 0.6;
}

.details-loading {
    text-align: center;
    padding: 20px;
    color: #6c757d;
}

.expandable-row {
    display: none;
}

.expandable-row.show {
    display: table-row;
}

.chart-container {
    position: relative;
    height: 200px;
    width: 100%;
    padding: 20px;
}

.chart-container canvas {
    cursor: pointer;
}

.task-count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.8rem;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 36px;
    height: 36px;
    min-width: 36px;
    min-height: 36px;
    text-align: center;
    border: 2px solid;
    background: transparent;
    box-sizing: border-box;
    padding: 0;
    aspect-ratio: 1 / 1;
    margin: 0 auto;
}

.task-count-badge:hover {
    transform: scale(1.1);
}

.badge-completed {
    border-color: #198754;
    color: #198754;
}

.badge-completed.active,
.badge-completed:hover {
    background: #198754;
    color: white;
}

.badge-all {
    border-color: #6c757d;
    color: #6c757d;
}

.badge-all.active,
.badge-all:hover {
    background: #6c757d;
    color: white;
}

.badge-in-progress {
    border-color: #0d6efd;
    color: #0d6efd;
}

.badge-in-progress.active,
.badge-in-progress:hover {
    background: #0d6efd;
    color: white;
}

.badge-postponed {
    border-color: #ffc107;
    color: #ffc107;
}

.badge-postponed.active,
.badge-postponed:hover {
    background: #ffc107;
    color: #333;
}

.badge-overdue {
    border-color: #dc3545;
    color: #dc3545;
}

.badge-overdue.active,
.badge-overdue:hover {
    background: #dc3545;
    color: white;
}

.sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
}

.sortable:hover {
    background-color: #f8f9fa;
}

.sort-icon {
    display: inline-block;
    width: 0;
    height: 0;
    margin-left: 5px;
    vertical-align: middle;
    opacity: 0.3;
}

.sortable.sort-asc .sort-icon {
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-bottom: 6px solid #333;
    opacity: 1;
}

.sortable.sort-desc .sort-icon {
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 6px solid #333;
    opacity: 1;
}

.user-row {
    cursor: pointer;
}

.user-row:hover {
    background-color: #f8f9fa;
}

/* Таблица задач: компактные заголовки и центрирование */
.task-table {
    table-layout: fixed;
    width: 100%;
}

.task-table thead th {
    font-size: 0.78rem;
    white-space: nowrap;
    vertical-align: middle;
    padding: 8px 4px;
    width: 8%;
}

.task-table thead th:nth-child(1) {
    width: 3%;
}

.task-table thead th:nth-child(2) {
    width: 13%;
    text-align: left !important;
}

.task-table tbody td {
    vertical-align: middle;
    text-align: center;
    padding: 8px 4px;
}

.task-table tbody td:nth-child(2) {
    text-align: left;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    margin-right: 8px;
    vertical-align: middle;
    object-fit: cover;
}

.user-avatar-fallback {
    display: inline-block;
    margin-right: 5px;
}

/* Заголовок уведомлений */
.notification-header {
    padding: 20px;
    background: linear-gradient(135deg, #4a90e2 0%, #357abd 100%);
    color: white;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(74, 144, 226, 0.3);
}

/* Автокомплит */
.autocomplete-wrapper {
    position: relative;
}

.autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 250px;
    overflow-y: auto;
    background: white;
    border: 1px solid #dee2e6;
    border-top: none;
    border-radius: 0 0 4px 4px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    z-index: 1000;
    display: none;
}

.autocomplete-dropdown.show {
    display: block;
}

.autocomplete-item {
    padding: 10px 15px;
    cursor: pointer;
    transition: background 0.2s;
    border-bottom: 1px solid #f8f9fa;
}

.autocomplete-item:hover {
    background-color: #f8f9fa;
}

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

/* Chips для выбранных элементов */
.chips-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 40px;
}

.chip {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    background: linear-gradient(135deg, #4a90e2 0%, #357abd 100%);
    color: white;
    border-radius: 20px;
    font-size: 14px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.chip-remove {
    margin-left: 8px;
    cursor: pointer;
    font-weight: bold;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.chip-remove:hover {
    opacity: 1;
}

/* Inline валидация */
.field-error {
    color: #dc3545;
    font-size: 13px;
    margin-top: 4px;
    display: none;
}

.field-error.visible {
    display: block;
}

.form-control.is-invalid,
.form-select.is-invalid {
    border-color: #dc3545;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.15);
}

.hours-grid.is-invalid .hour-tile:not(.selected) {
    border-color: #dc3545;
}

.chips-container.is-invalid {
    border: 1px solid #dc3545;
    border-radius: 6px;
    padding: 6px;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.15);
}

/* Плитки времени */
.hours-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 10px;
    margin-bottom: 10px;
}

.hour-tile {
    padding: 12px;
    text-align: center;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 500;
    background: white;
    user-select: none;
}

.hour-tile:hover {
    border-color: #4a90e2;
    background: #f8f9fa;
    transform: translateY(-2px);
}

.hour-tile.selected {
    background: linear-gradient(135deg, #4a90e2 0%, #357abd 100%);
    color: white;
    border-color: #4a90e2;
    box-shadow: 0 4px 8px rgba(74, 144, 226, 0.3);
}

/* Бейдж: перенесено */
.badge-rescheduled {
    border-color: #6f42c1;
    color: #6f42c1;
}

.badge-rescheduled.active,
.badge-rescheduled:hover {
    background: #6f42c1;
    color: white;
}

/* Бейдж: поставлено */
.badge-created {
    border-color: #0dcaf0;
    color: #0dcaf0;
}

.badge-created.active,
.badge-created:hover {
    background: #0dcaf0;
    color: white;
}

/* Бейдж: ожидает выполнения */
.badge-pending {
    border-color: #17a2b8;
    color: #17a2b8;
}

.badge-pending.active,
.badge-pending:hover {
    background: #17a2b8;
    color: white;
}

/* Бейдж: ожидает контроля */
.badge-pending-control {
    border-color: #fd7e14;
    color: #fd7e14;
}

.badge-pending-control.active,
.badge-pending-control:hover {
    background: #fd7e14;
    color: white;
}

.badge-rescheduled.rescheduled-loading {
    cursor: default;
    border-color: #ced4da;
    color: #6c757d;
}

.badge-rescheduled.rescheduled-loading:hover {
    background: transparent;
    transform: none;
    color: #6c757d;
}

/* Диаграмма Ганта */
.gantt-wrapper {
    overflow-x: auto;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 12px 12px 8px;
    margin-bottom: 16px;
}

.gantt-chart {
    position: relative;
    min-width: 500px;
}

.gantt-header {
    position: relative;
    height: 20px;
    border-bottom: 1px solid #dee2e6;
    margin-bottom: 6px;
}

.gantt-date-label {
    position: absolute;
    transform: translateX(-50%);
    font-size: 10px;
    color: #6c757d;
    white-space: nowrap;
    top: 2px;
}

.gantt-body {
    position: relative;
}

.gantt-grid-line {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 1px;
    background: rgba(0, 0, 0, 0.4);
    pointer-events: none;
    z-index: 0;
}

.gantt-row {
    position: relative;
    height: 26px;
    margin: 3px 0;
    background: #f8f9fa;
    border-radius: 4px;
}

.gantt-bar {
    position: absolute;
    top: 0;
    height: 100%;
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
    min-width: 3px;
    cursor: pointer;
    transition: filter 0.15s;
    z-index: 1;
}

.gantt-bar:hover {
    filter: brightness(1.1);
}

.gantt-bar-no-deadline {
    background: linear-gradient(135deg, #28a745 0%, #20c997 70%, rgba(32,201,151,0.4) 100%);
    border-right: 2px dashed rgba(255,255,255,0.7);
}

.gantt-bar-text {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    left: 6px;
    right: 4px;
    font-size: 11px;
    color: white;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    pointer-events: none;
}

/* Карточки групп */
.group-card {
    border: 2px solid #4a90e2;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    background: white;
    box-shadow: 0 2px 8px rgba(74, 144, 226, 0.15);
    transition: all 0.3s;
}

.group-card:hover {
    box-shadow: 0 4px 16px rgba(74, 144, 226, 0.25);
    transform: translateY(-2px);
}
