/* MINERVA Server - Main Styles v1.2 */
.reports-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.reports-date-range {
    display: flex;
    gap: 20px;
    margin-bottom: 24px;
    padding: 16px;
    background: var(--bg-card);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.date-input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.date-input-group label {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
}

.date-input-group input[type="date"] {
    padding: 8px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
}

.date-input-group input[type="date"]:focus {
    outline: none;
    border-color: var(--teal-400);
}

.reports-spoiler {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 16px;
    overflow: hidden;
}

.reports-spoiler-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    cursor: pointer;
    user-select: none;
    font-weight: 600;
    font-size: 16px;
    color: var(--text-primary);
    background: var(--bg-secondary);
    transition: background 0.2s;
}

.reports-spoiler-header:hover {
    background: rgba(79, 209, 197, 0.1);
}

.reports-spoiler-header .spoiler-arrow {
    font-size: 12px;
    color: var(--text-secondary);
    transition: transform 0.2s;
}

.reports-spoiler[open] .spoiler-arrow {
    transform: rotate(180deg);
}

.reports-spoiler-content {
    padding: 20px;
}

.reports-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.summary-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.summary-label {
    font-size: 13px;
    color: var(--text-secondary);
}

.summary-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--teal-400);
}

.summary-value.missed {
    color: var(--red-400);
}

.reports-actions {
    margin-top: 20px;
    display: flex;
    gap: 12px;
}

/* Detailed Report Modal */
.detailed-report-date-range {
    display: flex;
    gap: 20px;
    margin-bottom: 24px;
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: 8px;
}

.detailed-report-table-container {
    max-height: 600px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.detailed-report-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-card);
}

.detailed-report-table thead {
    position: sticky;
    top: 0;
    background: var(--bg-secondary);
    z-index: 10;
}

.detailed-report-table th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 13px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--border-color);
}

.detailed-report-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
    color: var(--text-primary);
}

.detailed-report-table tbody tr:hover {
    background: var(--bg-secondary);
}

.detailed-report-table tbody tr.status-received {
    background: rgba(16, 185, 129, 0.1);
}

.detailed-report-table tbody tr.status-missed {
    background: rgba(239, 68, 68, 0.1);
}

.status-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.status-badge.status-received {
    background: rgba(16, 185, 129, 0.2);
    color: var(--green-400);
}

.status-badge.status-missed {
    background: rgba(239, 68, 68, 0.2);
    color: var(--red-400);
}

.message-cell {
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.loading-cell,
.empty-cell,
.error-cell {
    text-align: center;
    padding: 40px !important;
    color: var(--text-secondary);
}

.error-cell {
    color: var(--red-400);
}

/* Modal Large */
.modal-large {
    max-width: 95vw !important;
    width: 95vw !important;
    max-height: 95vh !important;
    height: auto;
    margin: 2.5vh auto;
}

/* Print Header (скрыт на экране) */
.print-header {
    display: none;
}

/* Print Styles */
@media print {
    body {
        background: #fff !important;
    }
    
    .modal {
        position: static !important;
        display: block !important;
        background: #fff !important;
    }
    
    .modal-content {
        max-width: 100% !important;
        width: 100% !important;
        box-shadow: none !important;
        border: none !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    
    .modal-header,
    .modal-footer,
    .detailed-report-date-range {
        display: none !important;
    }
    
    .print-header {
        display: block !important;
        text-align: center;
        margin-bottom: 30px;
        padding-bottom: 20px;
        border-bottom: 3px solid #000;
        page-break-after: avoid;
    }
    
    .print-title {
        font-size: 36px;
        font-weight: bold;
        color: #0f766e;
        margin-bottom: 10px;
        letter-spacing: 2px;
    }
    
    .print-subtitle {
        font-size: 18px;
        color: #333;
        margin-bottom: 10px;
    }
    
    .print-date-range {
        font-size: 14px;
        color: #666;
    }
    
    .detailed-report-table-container {
        max-height: none !important;
        overflow: visible !important;
        border: none !important;
    }
    
    .detailed-report-table {
        width: 100%;
        border-collapse: collapse;
        font-size: 11px;
    }
    
    .detailed-report-table th {
        background: #f0f0f0 !important;
        color: #000 !important;
        border: 1px solid #000 !important;
        padding: 8px 6px !important;
        font-size: 10px;
    }
    
    .detailed-report-table td {
        border: 1px solid #000 !important;
        color: #000 !important;
        padding: 6px !important;
        font-size: 10px;
    }
    
    .detailed-report-table tbody tr.status-received {
        background: #f0f9f7 !important;
    }
    
    .detailed-report-table tbody tr.status-missed {
        background: #fef2f2 !important;
    }
    
    .status-badge {
        padding: 2px 6px !important;
        border-radius: 3px !important;
        font-size: 9px !important;
    }
    
    .status-badge.status-received {
        background: #d1fae5 !important;
        color: #065f46 !important;
    }
    
    .status-badge.status-missed {
        background: #fee2e2 !important;
        color: #991b1b !important;
    }
    
    .message-cell {
        max-width: 250px;
        word-wrap: break-word;
        white-space: normal !important;
    }
    
    @page {
        margin: 1.5cm;
        size: A4;
    }
}

:root {
    --bg-primary: #0d1b2a;
    --bg-secondary: #1b263b;
    --bg-surface: #0f172a;
    --bg-card: rgba(27, 38, 59, 0.95);
    
    --teal-200: #4fd1c5;
    --teal-400: #14b8a6;
    --teal-700: #0f766e;
    
    --green-400: #10b981;
    --red-400: #ef4444;
    --orange-400: #f59e0b;
    --purple-400: #8b5cf6;
    
    --grey-400: #9ca3af;
    --grey-500: #718096;
    --grey-600: #4a5568;
    --grey-700: #374151;
    
    --text-primary: #ffffff;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    
    --border-color: #374151;
    
    --header-height: 56px;
    --sidebar-width: 260px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Roboto', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.5;
}

/* === Sidebar === */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 199;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.sidebar-overlay.show {
    opacity: 1;
    visibility: visible;
}

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    z-index: 200;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
}

.sidebar.open {
    transform: translateX(0);
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--teal-200);
}

.sidebar-close {
    background: none;
    border: none;
    color: var(--grey-500);
    font-size: 28px;
    cursor: pointer;
    line-height: 1;
    padding: 0;
}

.sidebar-close:hover {
    color: var(--text-primary);
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 10px;
    margin-bottom: 6px;
    transition: all 0.2s;
}

.sidebar-link:hover {
    background: rgba(79, 209, 197, 0.1);
    color: var(--teal-200);
}

.sidebar-link.active {
    background: rgba(79, 209, 197, 0.15);
    color: var(--teal-200);
}

.sidebar-icon {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
}

.sidebar-version {
    font-size: 12px;
    color: var(--grey-600);
}

/* === Header === */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 100;
}

.burger-btn {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 36px;
    height: 36px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: 8px;
    transition: background 0.2s;
}

.burger-btn:hover {
    background: rgba(79, 209, 197, 0.1);
}

.burger-btn span {
    display: block;
    width: 100%;
    height: 2px;
    background: var(--teal-200);
    border-radius: 1px;
    transition: all 0.3s;
}

.header-center {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.logo-text {
    font-size: 22px;
    font-weight: 700;
    color: var(--teal-200);
    letter-spacing: 3px;
    cursor: pointer;
    transition: opacity 0.2s;
}

.logo-text:hover {
    opacity: 0.8;
}

.header-right {
    position: relative;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.user-menu:hover {
    border-color: var(--teal-400);
}

.user-icon-svg {
    width: 20px;
    height: 20px;
    color: var(--teal-200);
}

.dropdown-arrow {
    font-size: 10px;
    color: var(--grey-500);
    transition: transform 0.2s;
}

.user-menu.open .dropdown-arrow {
    transform: rotate(180deg);
}

.user-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 200px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s;
    z-index: 200;
}

.user-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-primary);
    cursor: pointer;
    transition: background 0.2s;
}

.dropdown-item:first-child {
    border-radius: 10px 10px 0 0;
}

.dropdown-item:last-child {
    border-radius: 0 0 10px 10px;
}

.dropdown-item:hover {
    background: rgba(79, 209, 197, 0.1);
}

.dropdown-item svg {
    color: var(--teal-200);
}

.dropdown-divider {
    height: 1px;
    background: var(--border-color);
    margin: 4px 0;
}

/* === Main Content === */
.main-content {
    margin-top: var(--header-height);
    min-height: calc(100vh - var(--header-height));
    padding: 20px;
}

.page {
    display: none;
    animation: fadeIn 0.3s ease;
}

.page.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.page-header {
    margin-bottom: 24px;
}

.page-header h2 {
    font-size: 26px;
    font-weight: 600;
    color: var(--teal-200);
    margin-bottom: 6px;
}

.page-description {
    color: var(--text-secondary);
    font-size: 14px;
}

/* === Objects Grid === */
.objects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
}

.object-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s;
}

.object-card:hover {
    border-color: var(--teal-400);
    transform: translateY(-4px);
    box-shadow: 0 10px 30px rgba(79, 209, 197, 0.1);
}

.object-card-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 14px;
}

.object-icon {
    width: 48px;
    height: 48px;
    background: rgba(79, 209, 197, 0.15);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

.object-info h3 {
    font-size: 17px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.object-code-badge {
    display: inline-block;
    padding: 2px 8px;
    background: var(--teal-700);
    border-radius: 4px;
    font-size: 11px;
    color: var(--teal-200);
    font-family: 'Consolas', monospace;
}

.object-card.kro-object-card {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.object-card.kro-object-card .object-card-clickable {
    cursor: pointer;
    flex: 1;
}

.object-card.kro-object-card .object-card-actions {
    border-top: 1px solid var(--border-color);
    padding-top: 12px;
    margin-top: 4px;
}

.object-card-schedule-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--teal-200);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.object-card-schedule-btn:hover {
    background: rgba(79, 209, 197, 0.1);
    border-color: var(--teal-400);
    color: var(--teal-200);
}

.object-card-schedule-btn svg {
    flex-shrink: 0;
}

.object-stats {
    display: flex;
    gap: 20px;
    padding-top: 14px;
    border-top: 1px solid var(--border-color);
}

.object-stat-value {
    font-size: 18px;
    font-weight: 600;
    color: var(--teal-200);
}

.object-stat-label {
    font-size: 11px;
    color: var(--text-muted);
}

/* === Coming Soon === */
.coming-soon {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    text-align: center;
}

.coming-soon-icon-svg {
    width: 80px;
    height: 80px;
    color: var(--grey-600);
    margin-bottom: 20px;
}

.coming-soon h3 {
    font-size: 22px;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.coming-soon p {
    color: var(--text-secondary);
}

/* === Timeline Header === */
.timeline-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
}

.back-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--teal-200);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.back-btn:hover {
    background: rgba(79, 209, 197, 0.1);
    border-color: var(--teal-400);
}

.back-btn svg {
    flex-shrink: 0;
}

.object-title-compact {
    min-width: 100px;
}

.object-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

/* === Day Timeline === */
.day-timeline-container {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 300px;
}

.day-timeline {
    flex: 1;
}

.timeline-hours {
    position: relative;
    height: 14px;
    font-size: 9px;
    color: var(--grey-500);
    margin-bottom: 2px;
    padding: 0 2px;
    user-select: none;
}

.timeline-hours span {
    white-space: nowrap;
}


.timeline-track {
    position: relative;
    height: 8px;
    background: #e8e8e8;
    border-radius: 2px;
    cursor: pointer;
    border: 1px solid #ccc;
    overflow: hidden;
}

.timeline-available {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.timeline-slot {
    position: absolute;
    height: 100%;
    background: #f5a623;
    cursor: pointer;
    pointer-events: auto;
}

.timeline-slot:hover {
    background: #e89a1d;
}

.timeline-thumb-day {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 2px;
    height: 24px;
    background: #d32f2f;
    cursor: grab;
    z-index: 3;
}

.timeline-thumb-day::before {
    content: '';
    position: absolute;
    top: -4px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 6px solid #d32f2f;
}

.timeline-thumb-day::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-bottom: 6px solid #d32f2f;
}

.timeline-thumb-day:hover {
    background: #b71c1c;
}

.timeline-thumb-day:hover::before {
    border-top-color: #b71c1c;
}

.timeline-thumb-day:hover::after {
    border-bottom-color: #b71c1c;
}

.timeline-thumb-day:active {
    cursor: grabbing;
}

.current-time-display {
    font-size: 11px;
    font-weight: 600;
    color: #d32f2f;
    font-family: 'Consolas', 'Monaco', monospace;
    min-width: 60px;
    text-align: center;
    background: rgba(0,0,0,0.05);
    padding: 2px 6px;
    border-radius: 3px;
}

/* Timeline Zoom Controls */
.timeline-zoom-controls {
    display: flex;
    gap: 4px;
    margin-left: 8px;
}

.zoom-btn {
    width: 24px;
    height: 24px;
    border: 1px solid var(--border-color);
    background: var(--bg-surface);
    color: var(--teal-200);
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.zoom-btn:hover {
    background: rgba(79, 209, 197, 0.2);
    border-color: var(--teal-400);
}

.zoom-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.zoom-level {
    font-size: 10px;
    color: var(--grey-500);
    min-width: 30px;
    text-align: center;
    align-self: center;
}

/* === Calendar === */
.calendar-container {
    position: relative;
}

.calendar-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.calendar-btn:hover {
    border-color: var(--teal-400);
}

.calendar-btn svg {
    width: 18px;
    height: 18px;
    color: var(--teal-200);
}

.calendar-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 280px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    padding: 16px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s;
    z-index: 300;
}

.calendar-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.calendar-header-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.calendar-header-nav button {
    background: none;
    border: none;
    color: var(--teal-200);
    font-size: 20px;
    cursor: pointer;
    padding: 4px 10px;
    border-radius: 6px;
    transition: background 0.2s;
}

.calendar-header-nav button:hover {
    background: rgba(79, 209, 197, 0.1);
}

.calendar-header-nav span {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    font-size: 11px;
    color: var(--grey-500);
    margin-bottom: 8px;
}

.calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.calendar-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    color: var(--text-secondary);
    border-radius: 8px;
    cursor: pointer;
    position: relative;
    transition: all 0.2s;
}

.calendar-day:hover {
    background: rgba(79, 209, 197, 0.1);
    color: var(--text-primary);
}

.calendar-day.other-month {
    color: var(--grey-700);
}

.calendar-day.today {
    border: 1px solid var(--teal-400);
}

.calendar-day.selected {
    background: var(--teal-700);
    color: var(--text-primary);
}

.calendar-day.has-recordings::after {
    content: '';
    position: absolute;
    bottom: 4px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 4px;
    background: var(--teal-200);
    border-radius: 50%;
}

/* === Object View Content === */
.object-view-content {
    display: flex;
    gap: 16px;
    height: calc(100vh - var(--header-height) - 140px);
    min-height: 0; /* Важно для корректной работы flex */
}

/* === Comments Panel === */
.comments-panel {
    width: 50%;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.comments-header {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
}

.comments-info {
    background: rgba(20, 184, 166, 0.15);
    border: 1px solid var(--teal-400);
    border-radius: 8px;
    padding: 10px 14px;
    margin-bottom: 12px;
}

.comments-info p {
    color: var(--teal-200);
    font-size: 13px;
}

.comments-filters {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.filter-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-btn.green {
    background: var(--green-400);
    color: white;
}

.filter-btn.red {
    background: var(--red-400);
    color: white;
}

.filter-btn.default {
    background: var(--grey-700);
    color: white;
}

.filter-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.filter-btn.active {
    box-shadow: 0 0 0 2px var(--teal-200);
}

.comments-list {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
}

.comment-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 14px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    padding-left: 18px;
}

.comment-card:hover {
    background: rgba(79, 209, 197, 0.05);
    border-color: var(--teal-400);
}

.comment-card.active {
    background: rgba(79, 209, 197, 0.1);
    border-color: var(--teal-200);
}

.comment-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    border-radius: 10px 0 0 10px;
    background: var(--grey-500);
}

.comment-card.compliance::before {
    background: var(--green-400);
}

.comment-card.violation::before {
    background: var(--red-400);
}

.comment-card.observation::before {
    background: var(--orange-400);
}

.comment-time {
    font-size: 11px;
    color: var(--grey-500);
    font-family: 'Consolas', monospace;
    margin-bottom: 6px;
}

.comment-speaker .role {
    color: var(--teal-200);
    font-weight: 500;
    font-size: 13px;
}

.comment-text {
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.5;
}

.comment-type-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 500;
    margin-top: 8px;
}

.comment-type-badge.compliance {
    background: rgba(16, 185, 129, 0.2);
    color: var(--green-400);
}

.comment-type-badge.violation {
    background: rgba(239, 68, 68, 0.2);
    color: var(--red-400);
}

.comment-type-badge.observation {
    background: rgba(245, 158, 11, 0.2);
    color: var(--orange-400);
}

/* === Video Panel === */
.video-panel {
    width: 50%;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 0; /* Важно для корректной работы flex */
    overflow: hidden;
}

.video-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 0; /* Важно для правильного flex shrink */
    overflow: hidden;
}

.video-wrapper {
    flex: 1;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    min-height: 0; /* Позволяет видео масштабироваться вниз */
    min-width: 0; /* Предотвращает overflow */
    display: flex;
    align-items: center;
    justify-content: center;
}

.video-wrapper video {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.video-label {
    position: absolute;
    top: 8px;
    left: 8px;
    background: rgba(0, 0, 0, 0.7);
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 11px;
    color: var(--teal-200);
    font-weight: 500;
}

.video-no-data {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--bg-surface);
    color: var(--grey-500);
}

.video-no-data.show {
    display: flex;
}

.video-no-data svg {
    margin-bottom: 10px;
    opacity: 0.5;
}

.video-no-data p {
    font-size: 13px;
}

.fullscreen-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.6);
    border: none;
    border-radius: 4px;
    padding: 6px;
    cursor: pointer;
    color: white;
    opacity: 0;
    transition: opacity 0.2s, background 0.2s;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
}

.video-wrapper:hover .fullscreen-btn {
    opacity: 1;
}

.fullscreen-btn:hover {
    background: rgba(79, 209, 197, 0.8);
}

.video-wrapper:fullscreen {
    background: #000;
}

.video-wrapper:fullscreen video {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.video-wrapper:fullscreen .fullscreen-btn {
    opacity: 1;
    top: 16px;
    right: 16px;
}

.video-wrapper:fullscreen .video-label {
    top: 16px;
    left: 16px;
    font-size: 14px;
}

/* === Video Controls === */
.video-controls {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 14px;
}

.controls-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.current-time {
    color: var(--teal-200);
    font-size: 16px;
    font-family: 'Consolas', monospace;
    font-weight: 600;
    min-width: 80px;
}

.controls-buttons {
    display: flex;
    align-items: center;
    gap: 6px;
}

.control-btn {
    background: transparent;
    border: none;
    color: var(--teal-200);
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.control-btn:hover {
    background: rgba(79, 209, 197, 0.2);
}

.control-btn.play-btn {
    background: var(--teal-700);
    width: 48px;
    height: 48px;
}

.control-btn.play-btn:hover {
    background: var(--teal-400);
}

.speed-btns {
    display: flex;
    gap: 4px;
}

.speed-btn {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 5px 10px;
    color: var(--teal-200);
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s;
}

.speed-btn:hover,
.speed-btn.active {
    background: var(--teal-700);
    border-color: var(--teal-400);
}

/* === Video Timeline === */
.timeline-container {
    margin-bottom: 12px;
}

.timeline {
    width: 100%;
    height: 8px;
    background: var(--grey-700);
    border-radius: 4px;
    cursor: pointer;
    position: relative;
}

.timeline-progress {
    height: 100%;
    background: var(--teal-400);
    border-radius: 4px;
    width: 0%;
    position: relative;
    transition: width 0.1s;
}

.timeline-thumb {
    position: absolute;
    right: -7px;
    top: 50%;
    transform: translateY(-50%);
    width: 14px;
    height: 14px;
    background: var(--teal-200);
    border-radius: 50%;
    border: 2px solid var(--bg-primary);
}

.timeline-markers {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
}

.timeline-marker {
    position: absolute;
    width: 5px;
    height: 5px;
    background: var(--teal-200);
    border-radius: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}

.timeline-times {
    display: flex;
    justify-content: space-between;
    margin-top: 6px;
    font-size: 11px;
    color: var(--grey-500);
    font-family: 'Consolas', monospace;
}

.audio-selector {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.audio-selector label {
    color: var(--grey-500);
    font-size: 12px;
}

.audio-selector select {
    flex: 1;
    padding: 7px 10px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 12px;
}

/* === Video Options === */
.video-options {
    display: flex;
    gap: 20px;
    align-items: center;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
    flex-wrap: wrap;
}

.video-options .audio-selector {
    padding-top: 0;
    border-top: none;
}

/* === Detection Overlay === */
.detection-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
}

.detection-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
}

.toggle-label {
    color: var(--grey-400);
    font-size: 12px;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 22px;
    transition: 0.3s;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 2px;
    bottom: 2px;
    background-color: var(--grey-500);
    border-radius: 50%;
    transition: 0.3s;
}

.toggle-switch input:checked + .toggle-slider {
    background-color: var(--teal-700);
    border-color: var(--teal-400);
}

.toggle-switch input:checked + .toggle-slider:before {
    background-color: var(--teal-300);
    transform: translateX(18px);
}

/* Detection box styles */
.detection-box {
    position: absolute;
    border: 2px solid;
    border-radius: 4px;
    pointer-events: none;
}

.detection-label {
    position: absolute;
    top: -20px;
    left: 0;
    padding: 2px 6px;
    font-size: 10px;
    font-weight: bold;
    color: #fff;
    border-radius: 3px;
    white-space: nowrap;
}

/* === Modal === */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    width: 100%;
    max-width: 400px;
    animation: slideUp 0.3s ease;
}

/* Modal Large должен переопределять базовые стили */
.modal-content.modal-large {
    max-width: 95vw !important;
    width: 95vw !important;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 20px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    font-size: 17px;
    color: var(--text-primary);
}

.modal-close {
    background: none;
    border: none;
    color: var(--grey-500);
    font-size: 24px;
    cursor: pointer;
    padding: 4px;
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 20px;
    max-height: calc(95vh - 140px);
    overflow-y: auto;
}

.modal-large .modal-body {
    max-height: calc(95vh - 140px);
    overflow-y: auto;
}

/* Schedule Editor */
.schedule-section {
    margin-bottom: 24px;
}

.schedule-section:last-child {
    margin-bottom: 0;
}

.schedule-section-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--teal-200);
    margin-bottom: 12px;
}

.schedule-times-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 10px;
}

.schedule-time-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.schedule-time-row input[type="time"] {
    flex: 1;
    max-width: 120px;
    padding: 8px 10px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
}

.schedule-minutes-row {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.schedule-minutes-row .form-group {
    flex: 1;
    min-width: 120px;
}

.schedule-add-position-row {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 16px;
}

.schedule-add-position-row .form-select {
    min-width: 200px;
    padding: 8px 12px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
}

.schedule-by-position-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.schedule-position-block {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 14px;
}

.schedule-position-block-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.schedule-position-block-header strong {
    color: var(--text-primary);
    font-size: 14px;
}

.schedule-position-block-body .form-group {
    margin-bottom: 12px;
}

.schedule-shift-section {
    border-top: 1px solid var(--border-color);
    padding-top: 20px;
}

.schedule-days-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}

.schedule-days-label {
    font-size: 13px;
    color: var(--text-secondary);
    margin-right: 4px;
}

.schedule-day-cb {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-primary);
    cursor: pointer;
}

.schedule-day-cb input {
    width: auto;
    margin: 0;
}

.schedule-shift-block .schedule-days-row {
    margin-bottom: 10px;
}

.btn-small {
    padding: 6px 12px;
    font-size: 12px;
}

.schedule-time-row .btn-icon.btn-danger,
.schedule-position-block .btn-icon.btn-danger {
    color: var(--red-400);
    border-color: rgba(239, 68, 68, 0.4);
}

.schedule-time-row .btn-icon.btn-danger:hover,
.schedule-position-block .btn-icon.btn-danger:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: var(--red-400);
    color: var(--red-400);
}

.form-hint {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

.form-group {
    margin-bottom: 14px;
}

.form-group label {
    display: block;
    color: var(--text-secondary);
    font-size: 13px;
    margin-bottom: 6px;
}

.form-group input {
    width: 100%;
    padding: 11px 13px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
}

.form-group input:focus {
    outline: none;
    border-color: var(--teal-400);
}

.form-error {
    color: var(--red-400);
    font-size: 12px;
    margin-top: 6px;
    display: none;
}

.form-error.show {
    display: block;
}

/* Special Zone Preview */
.special-zone-preview {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
    margin: 16px 0;
}

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

.preview-section {
    margin-bottom: 12px;
}

.preview-section:last-child {
    margin-bottom: 0;
}

.preview-section-title {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.preview-section-value {
    font-size: 14px;
    color: var(--text-primary);
    font-weight: 500;
}

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

.preview-list li {
    padding: 8px 12px;
    background: var(--bg-primary);
    border-radius: 6px;
    margin-bottom: 6px;
    font-size: 13px;
    color: var(--text-secondary);
}

.preview-list li:last-child {
    margin-bottom: 0;
}

.preview-list li strong {
    color: var(--text-primary);
}

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

.btn-primary {
    padding: 10px 20px;
    background: var(--teal-700);
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

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

.btn-secondary {
    padding: 10px 20px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: var(--grey-700);
}

.btn-special {
    padding: 10px 20px;
    background: linear-gradient(135deg, #9f7aea 0%, #805ad5 100%);
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-special:hover {
    background: linear-gradient(135deg, #b794f4 0%, #9f7aea 100%);
    transform: translateY(-1px);
}

.btn-special svg {
    width: 16px;
    height: 16px;
}

/* === Loading & Empty States === */
.loading-state,
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    color: var(--grey-500);
}

.loading-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--grey-700);
    border-top-color: var(--teal-400);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 14px;
}

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

/* === Scrollbar === */
::-webkit-scrollbar {
    width: 7px;
    height: 7px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--grey-700);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--grey-600);
}

/* === Responsive === */
@media (max-width: 1200px) {
    .object-view-content {
        flex-direction: column;
        height: auto;
    }
    
    .comments-panel,
    .video-panel {
        width: 100%;
    }
    
    .video-panel {
        min-height: 450px;
    }
}

@media (max-width: 768px) {
    .main-content {
        padding: 14px;
    }
    
    .page-header {
        padding: 16px 0;
    }
    
    .page-header h2 {
        font-size: 22px;
    }
    
    .page-description {
        font-size: 13px;
    }
    
    .objects-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .object-card {
        padding: 16px;
    }
    
    .timeline-header {
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .day-timeline-container {
        order: 10;
        width: 100%;
        min-width: auto;
    }
    
    .header-center {
        position: static;
        transform: none;
    }
    
    .header {
        padding: 0 12px;
    }
    
    .logo-text {
        font-size: 18px;
        letter-spacing: 2px;
    }
    
    .user-menu {
        padding: 6px 10px;
    }
    
    .user-menu span {
        display: none;
    }
    
    .sidebar {
        width: 280px;
    }
    
    .section-header-with-info {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .section-header-with-info h3 {
        font-size: 18px;
    }
}

/* === Faces Page === */

.faces-filters {
    display: flex;
    gap: 10px;
    margin-bottom: 24px;
}

.face-filter-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.face-filter-btn:hover {
    background: var(--bg-secondary);
    border-color: var(--teal-400);
}

.face-filter-btn.active {
    background: linear-gradient(135deg, var(--teal-700), var(--teal-400));
    border-color: var(--teal-400);
    color: var(--text-primary);
}

.face-filter-btn .badge {
    background: rgba(255, 255, 255, 0.15);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.face-filter-btn.active .badge {
    background: rgba(255, 255, 255, 0.25);
}

.faces-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 20px;
}

.face-card {
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.2s ease;
}

.face-card:hover {
    transform: translateY(-4px);
    border-color: var(--teal-400);
    box-shadow: 0 8px 24px rgba(79, 209, 197, 0.15);
}

.face-card.unknown {
    border-color: var(--orange-400);
}

.face-card.known {
    border-color: var(--green-400);
}

.face-image-container {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    overflow: hidden;
    cursor: pointer;
}

.face-image-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.face-card:hover .face-image-container img {
    transform: scale(1.05);
}

.face-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.face-card:hover .face-overlay {
    opacity: 1;
}

.face-overlay span {
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    padding: 8px 16px;
    background: var(--teal-400);
    border-radius: 6px;
}

.face-card .face-info {
    padding: 12px;
}

.face-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.face-name.guest {
    color: var(--orange-400);
}

.face-stats {
    display: flex;
    gap: 12px;
    font-size: 12px;
    color: var(--text-muted);
}

.face-edit-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: all 0.2s ease;
}

.face-card:hover .face-edit-btn {
    opacity: 1;
}

.face-edit-btn:hover {
    background: var(--teal-400);
    border-color: var(--teal-400);
}

/* Face Edit Modal */
.modal-small {
    max-width: 400px;
}

.face-preview {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

.face-preview img {
    width: 150px;
    height: 150px;
    object-fit: cover;
    border-radius: 50%;
    border: 3px solid var(--teal-400);
}

#faceEditModal .face-info {
    margin-top: 16px;
    padding: 12px;
    background: var(--bg-surface);
    border-radius: 8px;
    font-size: 13px;
    color: var(--text-secondary);
}

#faceEditModal .face-info p {
    margin-bottom: 6px;
}

#faceEditModal .face-info p:last-child {
    margin-bottom: 0;
}

#faceEditModal .face-info strong {
    color: var(--text-primary);
}

/* Responsive Faces Grid */
@media (max-width: 768px) {
    .faces-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 12px;
    }
    
    .faces-filters {
        flex-wrap: wrap;
    }
    
    .face-filter-btn {
        flex: 1;
        justify-content: center;
    }
}

/* === Telegram Photos Spoiler === */
.telegram-photos {
    margin-top: 8px;
    padding: 8px;
    background: rgba(79, 209, 197, 0.1);
    border-radius: 4px;
    border: 1px solid rgba(79, 209, 197, 0.3);
}

.telegram-photos summary {
    cursor: pointer;
    font-size: 12px;
    color: var(--teal-200);
    font-weight: 500;
    padding: 4px 0;
    user-select: none;
}

.telegram-photos summary:hover {
    color: var(--teal-400);
}

.telegram-photos summary::-webkit-details-marker {
    display: none;
}

.telegram-photos summary::before {
    content: '▶ ';
    display: inline-block;
    margin-right: 4px;
    transition: transform 0.2s;
}

.telegram-photos[open] summary::before {
    transform: rotate(90deg);
}

.telegram-photos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 8px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(79, 209, 197, 0.2);
}

.telegram-photo {
    width: 100%;
    height: auto;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.telegram-photo:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(79, 209, 197, 0.3);
}

/* === Telegram Message Author === */
.comment-author {
    font-size: 12px;
    color: var(--teal-200);
    margin-bottom: 4px;
    font-weight: 500;
}

.telegram-message {
    border-left: 3px solid var(--teal-400);
    background: rgba(79, 209, 197, 0.05);
}

.telegram-message .comment-type-badge.telegram {
    background: var(--teal-700);
    color: var(--teal-200);
}

/* === Spoiler Container === */
.spoiler-container {
    margin-top: 8px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    overflow: hidden;
}

.spoiler-header {
    padding: 8px 12px;
    background: var(--bg-secondary);
    cursor: pointer;
    font-size: 12px;
    color: var(--teal-200);
    user-select: none;
    transition: background 0.2s;
}

.spoiler-header:hover {
    background: var(--bg-card);
}

.spoiler-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.spoiler-content.show {
    max-height: 2000px;
    padding: 8px;
}

.telegram-photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 8px;
}

.telegram-photo-thumbnail {
    position: relative;
    overflow: hidden;
    border-radius: 4px;
    cursor: pointer;
}

.telegram-photo-thumbnail img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.2s;
}

.telegram-photo-thumbnail:hover img {
    transform: scale(1.1);
}

/* === Excel Reports (КРО) Styles === */

/* Upload Page */
.upload-content {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

.upload-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 32px;
    text-align: center;
}

.upload-card h3 {
    margin: 0 0 8px 0;
    color: var(--text-primary);
}

.upload-card > p {
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.upload-area {
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    padding: 48px 24px;
    background: var(--bg-secondary);
    transition: all 0.3s;
    cursor: pointer;
}

.upload-area:hover {
    border-color: var(--teal-400);
    background: rgba(45, 212, 191, 0.05);
}

.upload-area.drag-over {
    border-color: var(--teal-400);
    background: rgba(45, 212, 191, 0.1);
}

.upload-icon {
    color: var(--teal-400);
    margin-bottom: 16px;
}

.upload-area p {
    margin: 8px 0;
    color: var(--text-primary);
}

.upload-area a {
    color: var(--teal-400);
    text-decoration: underline;
    cursor: pointer;
}

.upload-hint {
    font-size: 14px;
    color: var(--text-secondary);
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--bg-secondary);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-fill {
    height: 100%;
    background: var(--teal-400);
    transition: width 0.3s;
    width: 0%;
}

.success-message {
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.3);
    border-radius: 8px;
    padding: 16px;
    color: var(--text-primary);
}

.success-message h4 {
    color: rgb(34, 197, 94);
    margin: 0 0 8px 0;
}

.error-message {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 8px;
    padding: 16px;
    color: var(--text-primary);
}

.error-message h4 {
    color: rgb(239, 68, 68);
    margin: 0 0 8px 0;
}

/* Service Standards Dashboard */
.service-standards-header {
    margin-bottom: 24px;
}

.service-standards-header h2 {
    margin: 0;
    color: var(--text-primary);
}

/* ===== Modern Dashboard Styles ===== */

.dashboard-container {
    display: flex;
    flex-direction: column;
    gap: 24px;
    max-width: 1400px;
    margin: 0 auto;
}

.data-source-info {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 14px 18px;
    background: rgba(20, 184, 166, 0.08);
    border: 1px solid rgba(20, 184, 166, 0.2);
    border-radius: 8px;
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 20px;
}

.data-source-info .info-icon {
    margin-right: 0;
    margin-top: 2px;
    flex-shrink: 0;
}

/* Dashboard Controls Header */
.dashboard-controls {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    padding: 20px 24px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1;
    min-width: 240px;
    max-width: 400px;
}

.control-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 6px;
    line-height: 1.4;
    flex-wrap: wrap;
}

.control-label .info-icon {
    margin-left: 0;
    flex-shrink: 0;
}

.control-select {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 400;
    cursor: pointer;
    transition: all 0.2s ease;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%234fd1c5' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 12px;
    padding-right: 40px;
}

.control-select:focus {
    outline: none;
    border-color: var(--teal-400);
    box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.15);
    background-color: var(--bg-surface);
}

.control-select:hover {
    border-color: var(--teal-400);
    background-color: var(--bg-surface);
}

.control-select:active {
    border-color: var(--teal-200);
}

/* Top Metrics Section */
.dashboard-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.metric-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
    position: relative;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
}

.metric-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(20, 184, 166, 0.15);
}

.metric-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--teal-400), var(--teal-200));
}

.metric-label {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.metric-value {
    font-size: 56px;
    font-weight: 700;
    line-height: 1.1;
    margin-bottom: 8px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    word-break: break-word;
}

.metric-value .rating-main {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 8px;
}

.metric-value > span:first-child,
.metric-value .rating-main > span:first-child {
    line-height: 1;
}

.metric-value .period-label-small {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 400;
    white-space: nowrap;
    margin-top: 2px;
}

@media (max-width: 768px) {
    .metric-value {
        align-items: flex-start;
    }
    
    .metric-value {
        font-size: 42px;
    }
    
    .rating-main {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .comparison-badge {
        font-size: 11px;
        padding: 3px 6px;
    }
}

.metric-comparison {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    margin-top: 12px;
}

.metric-comparison-label {
    color: var(--text-secondary);
    font-size: 12px;
}

.metric-subtitle {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 8px;
}

/* Shifts Section */
.dashboard-shifts {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 24px;
}

.shifts-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 16px;
}

.shifts-header h3 {
    margin: 0;
    color: var(--text-primary);
    font-size: 20px;
    font-weight: 600;
}

.shifts-selector {
    padding: 10px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
    min-width: 200px;
    cursor: pointer;
    transition: border-color 0.2s;
}

.shifts-selector:focus {
    outline: none;
    border-color: var(--teal-400);
}

.shifts-chart-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-top: 24px;
}

@media (max-width: 768px) {
    .shifts-chart-container {
        grid-template-columns: 1fr;
    }
    
    .dashboard-metrics {
        grid-template-columns: 1fr;
    }
    
    .positions-grid {
        grid-template-columns: 1fr;
    }
    
    .errors-comparison-grid {
        grid-template-columns: 1fr;
    }
    
    .errors-comparison-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .leaders-grid {
        grid-template-columns: 1fr;
    }
    
    .leader-card {
        padding: 16px;
    }
    
    .leader-place {
        font-size: 28px;
    }
    
    .leader-name {
        font-size: 15px;
    }
    
    .leader-rating-value {
        font-size: 18px;
    }
    
    .dashboard-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
        padding: 16px;
    }
    
    .control-group {
        flex-direction: column;
        align-items: stretch;
        min-width: 100%;
        max-width: 100%;
        gap: 8px;
    }
    
    .control-label {
        width: 100%;
        font-size: 13px;
    }
    
    .control-select {
        width: 100%;
        min-width: 100%;
        padding: 10px 14px;
        padding-right: 40px;
    }
    
    .dashboard-container {
        gap: 16px;
    }
    
    .service-standards-header h2 {
        font-size: 20px;
    }
    
    .positions-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .position-card {
        padding: 16px;
    }
    
    .metric-card {
        padding: 16px;
    }
    
    .info-modal-overlay {
        padding: 0;
    }
    
    .info-modal {
        max-height: 100vh;
        border-radius: 0;
    }
    
    .leaders-section {
        margin-bottom: 24px;
    }
    
    .leaders-section h3 {
        font-size: 18px;
        margin-bottom: 16px;
    }
    
    .errors-comparison-section {
        margin-top: 24px;
    }
    
    .error-block {
        padding: 16px;
        min-height: auto;
    }
    
    .error-block-header h4 {
        font-size: 15px;
    }
    
    .error-count-badge {
        min-width: 24px;
        height: 24px;
        font-size: 12px;
        padding: 0 6px;
    }
}

@media (max-width: 480px) {
    .dashboard-container {
        gap: 12px;
    }
    
    .dashboard-controls {
        padding: 12px 16px;
        gap: 12px;
    }
    
    .control-group {
        min-width: 100%;
    }
    
    .metric-card {
        padding: 14px;
    }
    
    .metric-value {
        font-size: 36px;
    }
    
    .position-card {
        padding: 14px;
    }
    
    .leader-card {
        padding: 14px;
    }
    
    .error-block {
        padding: 14px;
    }
    
    .info-modal-header {
        padding: 14px 18px;
    }
    
    .info-modal-content {
        padding: 18px;
        font-size: 12px;
    }
    
    .info-modal-title {
        font-size: 15px;
    }
    
    .positions-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .leaders-grid {
        gap: 12px;
    }
    
    .errors-comparison-grid {
        gap: 12px;
    }
    
    .rating-main {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .comparison-badge {
        font-size: 11px;
        padding: 3px 6px;
    }
}

.shifts-bars {
    display: flex;
    align-items: flex-end;
    gap: 16px;
    height: 200px;
    padding: 20px 0;
}

.shift-bar {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: transform 0.2s;
}

.shift-bar:hover {
    transform: translateY(-4px);
}

.shift-bar-fill {
    width: 100%;
    background: linear-gradient(180deg, var(--teal-400), var(--teal-200));
    border-radius: 8px 8px 0 0;
    min-height: 20px;
    transition: all 0.2s;
    position: relative;
    box-shadow: 0 2px 8px rgba(20, 184, 166, 0.3);
}

.shift-bar:hover .shift-bar-fill {
    opacity: 0.9;
    box-shadow: 0 4px 12px rgba(20, 184, 166, 0.5);
}

.shift-bar-label {
    font-size: 12px;
    color: var(--text-secondary);
    text-align: center;
    font-weight: 500;
}

.shift-bar-value {
    font-size: 16px;
    color: var(--teal-400);
    font-weight: 600;
    margin-top: 4px;
}

.shifts-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.shift-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    transition: background 0.2s;
}

.shift-item:hover {
    background: rgba(20, 184, 166, 0.05);
}

.shift-item-name {
    font-weight: 500;
    color: var(--text-primary);
}

.shift-item-rating {
    font-size: 24px;
    font-weight: 600;
    color: var(--teal-400);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Positions Grid */
.dashboard-positions {
    margin-bottom: 24px;
}

.positions-header {
    margin-bottom: 20px;
}

.positions-header h3 {
    margin: 0;
    color: var(--text-primary);
    font-size: 20px;
    font-weight: 600;
}

.positions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    align-items: stretch;
}

.position-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
    cursor: pointer;
    position: relative;
    min-height: 140px;
    display: flex;
    flex-direction: column;
}

.position-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(20, 184, 166, 0.1);
    border-color: var(--teal-400);
}

.position-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
    gap: 16px;
    flex: 1;
}

@media (max-width: 768px) {
    .position-card-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .position-rating-large {
        align-items: flex-start;
        text-align: left;
    }
    
    .position-rating-large .rating-main {
        justify-content: flex-start;
    }
}

.position-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
    line-height: 1.4;
    word-break: keep-all;
    overflow-wrap: break-word;
    white-space: normal;
    min-width: 0;
}

.position-rating-large {
    font-size: 32px;
    font-weight: 700;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    flex-shrink: 0;
    text-align: right;
    line-height: 1.1;
    min-width: fit-content;
}

.position-rating-large > span:first-child {
    line-height: 1;
}

.position-rating-large .rating-main {
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.position-rating-large .period-label-small {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 400;
    white-space: nowrap;
    margin-top: 2px;
}

.position-comparison {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
    font-size: 12px;
    color: var(--text-secondary);
}

.position-details-btn {
    margin-top: auto;
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    min-height: 44px;
}

.position-details-btn:hover {
    background: rgba(20, 184, 166, 0.1);
    border-color: var(--teal-400);
    color: var(--teal-400);
}

.failed-badge {
    background: #ef4444;
    color: white;
    font-size: 11px;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.metric-placeholder {
    padding: 40px 20px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.6;
}

/* Errors Comparison Section */
.errors-comparison-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 24px;
    display: block;
    visibility: visible;
}

.errors-comparison-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

.errors-comparison-header h3 {
    margin: 0;
    color: var(--text-primary);
    font-size: 20px;
    font-weight: 600;
}

.previous-period-label {
    font-size: 13px;
    color: var(--text-secondary);
    padding: 6px 12px;
    background: var(--bg-secondary);
    border-radius: 6px;
}

/* Leaders Section */
.leaders-section {
    margin-bottom: 32px;
}

.leaders-section h3 {
    margin: 0 0 20px 0;
    color: var(--text-primary);
    font-size: 20px;
    font-weight: 600;
}

.leaders-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
}

.leader-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    transition: all 0.2s;
}

.leader-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.leader-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 12px;
}

.leader-place {
    font-size: 32px;
    line-height: 1;
    flex-shrink: 0;
}

.leader-info {
    flex: 1;
    min-width: 0;
}

.leader-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
    word-break: break-word;
}

.leader-rating {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.leader-rating-value {
    font-size: 20px;
    font-weight: 700;
}

.leader-comparison {
    font-size: 13px;
    color: var(--text-secondary);
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
    margin-top: 12px;
}

.errors-comparison-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.error-block {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    min-height: 200px;
}

.error-block.recurring-errors {
    border-left: 4px solid #ef4444;
}

.error-block.fixed-errors {
    border-left: 4px solid #22c55e;
}

.error-block-header {
    margin-bottom: 12px;
}

.error-block-header h4 {
    margin: 0;
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.error-count {
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.error-toggle-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    width: 100%;
    justify-content: center;
    margin-top: 8px;
}

.error-toggle-btn:hover {
    background: rgba(20, 184, 166, 0.1);
    border-color: var(--teal-400);
}

.error-toggle-btn:active {
    transform: scale(0.98);
}

.error-count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
    padding: 0 8px;
    border-radius: 14px;
    font-size: 13px;
    font-weight: 700;
    color: white;
    margin-left: 4px;
}

.error-count-red {
    background: #ef4444;
}

.error-count-green {
    background: #22c55e;
}

.error-toggle-text {
    font-weight: 500;
}

.error-toggle-arrow {
    font-size: 12px;
    transition: transform 0.2s;
}

.error-status-badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    flex-shrink: 0;
    min-width: fit-content;
}

.error-status-red {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.error-status-green {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.error-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 400px;
    overflow-y: auto;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
    flex: 1;
}

.error-list::-webkit-scrollbar {
    width: 6px;
}

.error-list::-webkit-scrollbar-track {
    background: var(--bg-card);
    border-radius: 3px;
}

.error-list::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.error-list::-webkit-scrollbar-thumb:hover {
    background: var(--teal-400);
}

.error-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-card);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.error-item-content {
    flex: 1;
    min-width: 0;
}

.error-position {
    font-weight: 600;
    color: var(--teal-400);
    font-size: 13px;
    margin-bottom: 6px;
    line-height: 1.4;
}

.error-description {
    color: var(--text-primary);
    font-size: 13px;
    line-height: 1.5;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.comparison-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    margin-left: 8px;
}

.period-label-small {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 400;
    margin-left: 8px;
    white-space: nowrap;
    align-self: flex-end;
    line-height: 1.5;
}

.metric-value {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 8px;
}

.position-rating-large {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 8px;
}

/* Info Tooltips */
.info-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: rgba(20, 184, 166, 0.2);
    color: var(--teal-400);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    margin-left: 8px;
    position: relative;
    transition: all 0.2s;
    user-select: none;
}

.info-icon:hover {
    background: rgba(20, 184, 166, 0.3);
    transform: scale(1.1);
}

.info-icon:active {
    transform: scale(0.95);
}

/* Info Modal Styles */
.info-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.info-modal-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

.info-modal {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    max-width: 600px;
    width: 100%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.info-modal-overlay.show .info-modal {
    transform: scale(1);
}

.info-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
}

.info-modal-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.info-modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s;
}

.info-modal-close:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.info-modal-content {
    padding: 24px;
    overflow-y: auto;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-primary);
}

.info-modal-content strong {
    color: var(--teal-400);
    display: block;
    margin-bottom: 12px;
    font-size: 16px;
}

.info-modal-content br {
    margin-bottom: 8px;
}

/* Адаптивность для модального окна */
@media (max-width: 768px) {
    .info-modal-overlay {
        padding: 10px;
        align-items: flex-end;
    }
    
    .info-modal {
        max-width: 100%;
        max-height: 90vh;
        border-radius: 16px 16px 0 0;
        transform: translateY(100%);
    }
    
    .info-modal-overlay.show .info-modal {
        transform: translateY(0);
    }
    
    .info-modal-header {
        padding: 16px 20px;
    }
    
    .info-modal-title {
        font-size: 16px;
    }
    
    .info-modal-content {
        padding: 20px;
        font-size: 13px;
    }
    
    .info-modal-content strong {
        font-size: 15px;
    }
}

/* Старые стили tooltip удалены - теперь используются модальные окна */

.info-section {
    margin-top: 16px;
    padding: 12px 16px;
    background: rgba(20, 184, 166, 0.05);
    border-left: 3px solid var(--teal-400);
    border-radius: 6px;
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.metric-label-with-info {
    display: flex;
    align-items: center;
    gap: 4px;
}

.section-header-with-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Position Details Modal */
.position-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.position-modal.active {
    display: flex;
}

.position-modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    padding: 24px;
    position: relative;
}

.position-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    border: none;
    background: var(--bg-secondary);
    border-radius: 8px;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.position-modal-close:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.position-modal-header {
    margin-bottom: 24px;
    padding-right: 40px;
}

.position-modal-header h3 {
    margin: 0 0 8px 0;
    color: var(--text-primary);
    font-size: 24px;
}

.position-modal-rating {
    font-size: 48px;
    font-weight: 700;
    margin: 16px 0;
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 8px;
    line-height: 1.2;
    word-break: break-word;
}

.position-modal-rating > span:first-child {
    line-height: 1;
}

.failed-params-section {
    margin-top: 24px;
}

.failed-params-section h4 {
    margin: 0 0 16px 0;
    color: var(--text-primary);
    font-size: 18px;
}

.failed-params-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.failed-params-list li {
    display: flex;
    align-items: flex-start;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border-left: 3px solid #ef4444;
    border-radius: 6px;
    color: var(--text-primary);
    gap: 12px;
    word-wrap: break-word;
    overflow-wrap: break-word;
    line-height: 1.5;
    min-height: 44px;
}

.failed-params-list li span:first-child {
    flex-shrink: 0;
    margin-right: 0;
}

.failed-params-list li span:last-child {
    flex: 1;
    min-width: 0;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.download-report-section {
    margin-top: 24px;
    padding: 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    text-align: center;
}

.download-report-btn {
    display: inline-flex;
    align-items: center;
    padding: 12px 24px;
    background: var(--teal-400);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.download-report-btn:hover {
    background: var(--teal-700);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(20, 184, 166, 0.3);
}

.download-report-btn:active {
    transform: translateY(0);
}

.no-errors {
    padding: 16px;
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.3);
    border-radius: 8px;
    color: #22c55e;
    font-weight: 500;
    text-align: center;
}

/* Comments Section */
.dashboard-comments {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
}

.comments-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.comments-header h3 {
    margin: 0;
    color: var(--text-primary);
    font-size: 20px;
    font-weight: 600;
}

.comments-toggle {
    padding: 8px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.comments-toggle:hover {
    background: rgba(20, 184, 166, 0.1);
    border-color: var(--teal-400);
}

.comments-list {
    display: none;
    flex-direction: column;
    gap: 16px;
    margin-top: 20px;
}

.comments-list.active {
    display: flex;
}

.comment-item {
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: 8px;
    border-left: 3px solid var(--teal-400);
}

.comment-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.comment-item-author {
    font-weight: 600;
    color: var(--teal-400);
}

.comment-item-type {
    font-size: 12px;
    color: var(--text-secondary);
    padding: 4px 8px;
    background: var(--bg-card);
    border-radius: 4px;
}

.comment-item-text {
    color: var(--text-primary);
    line-height: 1.6;
    margin: 0;
}

/* Legacy styles for backward compatibility */
.rating-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 20px;
}

.rating-card h3 {
    margin: 0 0 16px 0;
    color: var(--text-primary);
    font-size: 18px;
}

.rating-value {
    font-size: 48px;
    font-weight: bold;
    color: var(--teal-400);
    text-align: center;
    margin: 16px 0;
}

.position-spoiler,
.comments-spoiler {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 12px;
    overflow: hidden;
}

.position-spoiler-header,
.comments-spoiler-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s;
}

.position-spoiler-header:hover,
.comments-spoiler-header:hover {
    background: rgba(45, 212, 191, 0.05);
}

.position-spoiler-header span:first-child,
.comments-spoiler-header span:first-child {
    font-weight: 500;
    color: var(--text-primary);
}

.position-rating {
    color: var(--teal-400);
    font-weight: 600;
    margin: 0 16px;
}

.spoiler-arrow {
    color: var(--text-secondary);
    transition: transform 0.3s;
}

details[open] .spoiler-arrow {
    transform: rotate(180deg);
}

.position-spoiler-content,
.comments-spoiler-content {
    padding: 16px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-card);
}

.position-spoiler-content h4 {
    margin: 0 0 12px 0;
    color: var(--text-primary);
    font-size: 16px;
}

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

/* Legacy styles removed - using new standardized styles above */

.no-errors {
    color: rgb(34, 197, 94);
    font-weight: 500;
    margin: 0;
    padding: 8px 0;
}

.comment-item {
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

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

.comment-item strong {
    color: var(--teal-400);
    display: block;
    margin-bottom: 4px;
}

.comment-item p {
    margin: 0;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* === KRO (Контрольно-Ревизионный Отдел) === */

.kro-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
    margin-top: 20px;
}

.kro-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 32px 24px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.kro-card:hover {
    border-color: var(--teal-400);
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(79, 209, 197, 0.15);
}

.kro-card-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    background: rgba(79, 209, 197, 0.15);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--teal-400);
}

.kro-card h3 {
    color: var(--text-primary);
    font-size: 20px;
    font-weight: 600;
    margin: 0 0 12px;
}

.kro-card p {
    color: var(--text-secondary);
    font-size: 14px;
    margin: 0;
    line-height: 1.5;
}

/* KRO Editor */
.kro-editor-content {
    padding: 0;
}

.kro-toolbar {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.kro-toolbar-add-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.kro-toolbar .btn-primary,
.kro-toolbar .btn-secondary {
    display: flex;
    align-items: center;
    gap: 8px;
}

.kro-toolbar .btn-secondary.active {
    background: var(--teal-700);
    border-color: var(--teal-400);
    color: var(--teal-200);
}

.kro-toolbar .btn-secondary svg {
    transition: transform 0.2s ease;
}

/* KRO Sections */
.kro-section {
    margin-bottom: 32px;
}

.kro-section-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--teal-200);
    margin: 0 0 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--teal-700);
}

/* KRO Hierarchical List — компактный табличный вид */
.kro-hierarchical-list {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    background: var(--bg-card);
}

.kro-list-header {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 16px;
    padding: 10px 16px;
    background: var(--bg-secondary);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
}

.kro-list-col-name { flex: 1; min-width: 0; }
.kro-list-col-activity { flex-shrink: 0; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

.kro-zone-group {
    border-bottom: 1px solid var(--border-color);
}
.kro-zone-group:last-child { border-bottom: none; }

.kro-zone-group > summary {
    list-style: none;
    cursor: pointer;
}
.kro-zone-group > summary::-webkit-details-marker { display: none; }

.kro-zone-row,
.kro-check-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 16px;
    align-items: center;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border-color);
    min-height: 44px;
    transition: background 0.15s;
}

.kro-zone-row {
    background: var(--bg-card);
}
.kro-zone-row:hover { background: rgba(79, 209, 197, 0.06); }

.kro-zone-row .kro-list-col-name {
    display: flex;
    align-items: center;
    gap: 10px;
}

.kro-row-expand {
    width: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-size: 10px;
    transition: transform 0.2s;
}
.kro-row-expand::before { content: '▶'; }
.kro-zone-group[open] .kro-row-expand { transform: rotate(90deg); }

.kro-row-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--teal-400);
    flex-shrink: 0;
}

.kro-row-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}
.kro-check-row .kro-row-name { font-weight: 400; }

.kro-zone-row .kro-list-col-name .kro-tag { margin-left: 4px; }
.kro-check-row .kro-list-col-name .kro-tag { margin-left: 6px; }

.kro-checks-rows {
    background: rgba(0, 0, 0, 0.08);
}

.kro-check-row {
    padding-left: 44px;
    border-bottom: 1px solid var(--border-color);
    background: transparent;
}
.kro-check-row:last-child { border-bottom: none; }
.kro-check-row:hover { background: rgba(79, 209, 197, 0.04); }

.kro-check-row .kro-list-col-name {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Drag handle для перестановки проверок */
.kro-check-drag-handle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    cursor: grab;
    color: var(--text-secondary);
    border-radius: 4px;
    flex-shrink: 0;
    transition: color 0.15s, background 0.15s;
}
.kro-check-drag-handle:hover {
    color: var(--teal-400);
    background: rgba(79, 209, 197, 0.1);
}
.kro-check-drag-handle:active {
    cursor: grabbing;
}
.kro-check-row.kro-check-dragging {
    opacity: 0.6;
    background: rgba(79, 209, 197, 0.1);
}
.kro-check-row.kro-check-drag-over {
    border-top: 2px solid var(--teal-400);
    background: rgba(79, 209, 197, 0.08);
}

.kro-activity-check {
    color: #22c55e;
    font-size: 14px;
    font-weight: 600;
    flex-shrink: 0;
}

.kro-row-btn {
    width: 28px;
    height: 28px;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: all 0.15s;
}
.kro-row-btn:hover { opacity: 1; }
/* Редактировать — синий */
.kro-row-btn-edit { color: #63b3ed; border-color: rgba(99, 179, 237, 0.4); }
.kro-row-btn-edit:hover, .kro-row-btn-edit.active {
    background: rgba(99, 179, 237, 0.2); border-color: #63b3ed; color: #63b3ed;
}
/* Настройки — фиолетовый */
.kro-row-btn-settings { color: #9f7aea; border-color: rgba(159, 122, 234, 0.4); }
.kro-row-btn-settings:hover {
    background: rgba(159, 122, 234, 0.2); border-color: #9f7aea; color: #9f7aea;
}
/* Добавить ответственного — зелёный */
.kro-row-btn-add-responsible { color: #4ade80; border-color: rgba(74, 222, 128, 0.4); }
.kro-row-btn-add-responsible:hover {
    background: rgba(74, 222, 128, 0.2); border-color: #4ade80; color: #4ade80;
}
/* Добавить проверку (плюс) — бирюзовый, основной акцент */
.kro-row-btn-add-check { color: var(--teal-400); border-color: rgba(79, 209, 197, 0.5); }
.kro-row-btn-add-check:hover {
    background: rgba(79, 209, 197, 0.2); border-color: var(--teal-400); color: var(--teal-300);
}
/* Копировать — голубой */
.kro-row-btn-copy { color: #38bdf8; border-color: rgba(56, 189, 248, 0.4); }
.kro-row-btn-copy:hover {
    background: rgba(56, 189, 248, 0.2); border-color: #38bdf8; color: #38bdf8;
}
/* Удалить — красный */
.kro-row-btn-danger { color: #f87171; border-color: rgba(248, 113, 113, 0.4); }
.kro-row-btn-danger:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: var(--red-400);
    color: var(--red-400);
}
.kro-row-btn.hidden { display: none !important; }

/* KRO Zone Cards — иерархический layout по референсу */
.kro-zones-table {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.kro-zone-card {
    background: var(--bg-card);
    border: none;
    border-top: 1px solid rgba(79, 209, 197, 0.35);
    border-left: 4px solid var(--teal-400);
    border-radius: 8px;
    margin: 0 0 0 0;
    padding: 20px;
    transition: all 0.2s ease;
}

.kro-section:first-child .kro-zones-table > .kro-zone-card:first-child {
    border-top: none;
}

.kro-zone-card:hover {
    background: rgba(27, 38, 59, 0.6);
}

.kro-zone-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 14px;
    gap: 16px;
}

.kro-zone-name {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
}

.kro-zone-header-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    flex-wrap: wrap;
}

.kro-zone-status-tags,
.kro-check-tags {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    flex-wrap: wrap;
}

/* KRO Tags */
.kro-tag {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.kro-tag-time {
    background: rgba(79, 209, 197, 0.2);
    color: var(--teal-300);
    border: 1px solid rgba(79, 209, 197, 0.3);
}

.kro-tag-shift {
    background: rgba(99, 179, 237, 0.2);
    color: #63b3ed;
    border: 1px solid rgba(99, 179, 237, 0.3);
}

.kro-tag-rental {
    background: rgba(237, 137, 54, 0.2);
    color: var(--orange-400);
    border: 1px solid rgba(237, 137, 54, 0.3);
}

.kro-tag-inactive {
    background: rgba(245, 101, 101, 0.2);
    color: #f56565;
    border: 1px solid rgba(245, 101, 101, 0.3);
}

.kro-tag-special {
    background: rgba(159, 122, 234, 0.2);
    color: #9f7aea;
    border: 1px solid rgba(159, 122, 234, 0.3);
}

.kro-tag-field {
    background: rgba(56, 189, 248, 0.2);
    color: #38bdf8;
    border: 1px solid rgba(56, 189, 248, 0.3);
}

.kro-tag-required {
    background: rgba(236, 72, 153, 0.2);
    color: #ec4899;
    border: 1px solid rgba(236, 72, 153, 0.3);
}

.kro-inactive {
    opacity: 0.65;
}

.kro-zone-card.kro-inactive {
    border-left-color: #f56565;
}

.kro-zone-card.kro-inactive .kro-zone-name {
    text-decoration: line-through;
    text-decoration-color: #f5656580;
}

.kro-zone-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.btn-icon {
    width: 32px;
    height: 32px;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.btn-icon:hover {
    background: var(--teal-700);
    border-color: var(--teal-400);
    color: var(--teal-200);
}

.btn-icon.btn-danger:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: var(--red-400);
    color: var(--red-400);
}

.btn-icon-sm {
    width: 22px;
    height: 22px;
    border: none;
    background: transparent;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: bold;
    transition: all 0.2s ease;
}

.btn-icon-sm.btn-danger:hover {
    background: rgba(239, 68, 68, 0.2);
    color: var(--red-400);
}

/* KRO Zone Content */
.kro-zone-responsibles,
.kro-zone-checks {
    margin-bottom: 12px;
}

.kro-zone-checks:last-child {
    margin-bottom: 0;
}

.kro-label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.kro-label-inline {
    display: inline;
    margin-bottom: 0;
    margin-right: 8px;
}

.kro-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: var(--teal-700);
    color: var(--teal-200);
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    margin-right: 6px;
    margin-bottom: 4px;
}

/* Зелёные бейджи для ответственных (по референсу) */
.kro-badge-responsible {
    background: rgba(34, 197, 94, 0.2);
    color: #4ade80;
    border: 1px solid rgba(34, 197, 94, 0.35);
}

.kro-badge-responsible .kro-badge-remove:hover {
    background: rgba(34, 197, 94, 0.3);
}

.kro-responsibles-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 10px;
    align-items: center;
    margin-top: 6px;
}

.kro-badge-remove {
    background: transparent;
    border: none;
    color: var(--teal-200);
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    line-height: 1;
    padding: 0;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
    opacity: 0.7;
}

.kro-badge-remove:hover {
    background: rgba(255, 255, 255, 0.2);
    opacity: 1;
    transform: scale(1.1);
}

.kro-empty {
    color: var(--text-muted);
    font-size: 13px;
    font-style: italic;
}

/* KRO Checks Spoiler */
.kro-checks-spoiler {
    margin-top: 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.02);
    overflow: hidden;
    transition: all 0.2s ease;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

.kro-checks-spoiler:hover {
    border-color: var(--teal-400);
}

.kro-checks-spoiler[open] {
    border-color: var(--teal-400);
    background: var(--bg-card);
}

.kro-checks-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
    padding: 12px 16px;
    transition: all 0.2s ease;
    background: var(--bg-secondary);
    list-style: none;
}

.kro-checks-spoiler[open] .kro-checks-summary {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
}

.kro-checks-summary:hover {
    background: rgba(79, 209, 197, 0.1);
}

.kro-checks-spoiler[open] .kro-checks-summary:hover {
    background: rgba(79, 209, 197, 0.15);
}

.kro-checks-summary::-webkit-details-marker {
    display: none;
}

.kro-checks-summary-content {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.kro-spoiler-arrow {
    color: var(--teal-400);
    font-size: 11px;
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.kro-checks-spoiler[open] .kro-spoiler-arrow {
    transform: rotate(180deg);
}

.kro-checks-count {
    font-weight: 600;
    color: var(--teal-300);
    font-size: 12px;
    padding: 3px 10px;
    background: rgba(79, 209, 197, 0.18);
    border: 1px solid rgba(79, 209, 197, 0.3);
    border-radius: 12px;
}

/* Вложенный блок проверок — иерархия */
.kro-checks-content {
    padding: 12px 16px 12px 20px;
    background: rgba(0, 0, 0, 0.12);
    border-left: 3px solid rgba(79, 209, 197, 0.35);
    margin-left: 4px;
}

/* Предотвращаем закрытие спойлера при клике внутри */
.kro-checks-content * {
    pointer-events: auto;
}

.kro-checks-content label,
.kro-checks-content input,
.kro-checks-content button {
    pointer-events: auto;
}

/* KRO Checks List */
.kro-checks-list {
    list-style: none;
    padding: 0;
    margin: 12px 0 0;
}

.kro-check-item {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 14px;
    background: var(--bg-secondary);
    border-radius: 6px;
    margin-bottom: 8px;
    border-left: 3px solid var(--teal-400);
    transition: all 0.2s ease;
}

.kro-check-item:hover {
    background: rgba(79, 209, 197, 0.08);
    border-left-color: var(--teal-300);
}

.kro-check-item.kro-inactive {
    border-left-color: #f56565;
}

.kro-check-item:last-child {
    margin-bottom: 0;
}

/* Text Field Items (for special zones) */
.kro-text-field-item {
    border-left-color: #9f7aea !important;
}

.kro-text-field-item:hover {
    background: rgba(159, 122, 234, 0.08) !important;
    border-left-color: #b794f4 !important;
}

.kro-text-fields-summary {
    background: linear-gradient(90deg, rgba(159, 122, 234, 0.1) 0%, transparent 100%) !important;
}

.kro-text-fields-list {
    border-left: 2px solid rgba(159, 122, 234, 0.3);
    padding-left: 12px;
    margin-left: 8px;
}

.kro-text-fields-list-container {
    max-height: 300px;
    overflow-y: auto;
    padding: 8px;
    background: var(--bg-primary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.kro-formulas-list-container {
    max-height: 300px;
    overflow-y: auto;
    padding: 8px;
    background: var(--bg-primary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.kro-formula-item {
    transition: all 0.2s ease;
}

.kro-formula-item:hover {
    background: rgba(56, 189, 248, 0.08) !important;
    border-left-color: #60a5fa !important;
}

.formula-condition-item {
    transition: all 0.2s ease;
}

.formula-condition-item:hover {
    background: rgba(159, 122, 234, 0.05) !important;
    border-color: rgba(159, 122, 234, 0.3) !important;
}

.kro-check-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.kro-check-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.kro-check-title-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.kro-check-tags {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.kro-check-name {
    font-size: 14px;
    color: var(--text-primary);
    font-weight: 500;
    word-wrap: break-word;
    flex: 1;
    min-width: 0;
}

.kro-check-status-icons {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.kro-check-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

/* KRO Check Buttons */
.kro-btn-settings,
.kro-btn-delete {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-secondary);
}

.kro-btn-settings:hover {
    background: var(--teal-700);
    border-color: var(--teal-400);
    color: var(--teal-200);
}

.kro-btn-delete {
    color: var(--text-muted);
}

.kro-btn-delete:hover {
    background: rgba(245, 101, 101, 0.2);
    border-color: #f56565;
    color: #f56565;
}

/* KRO Edit Mode */
.kro-edit-only {
    transition: all 0.2s ease;
}

.kro-edit-only.hidden {
    display: none !important;
}

.btn-icon.btn-active {
    background: var(--teal-600);
    border-color: var(--teal-400);
    color: var(--teal-200);
}

.kro-zone-card.kro-editing {
    border-color: var(--teal-400);
    box-shadow: 0 0 0 2px rgba(79, 209, 197, 0.2);
}

/* Form hints */
.form-hint {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 6px;
    font-style: italic;
}

/* Zone copy select */
#zoneCopyFromSelect {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

#zoneCopyFromSelect:hover {
    border-color: var(--teal-400);
}

#zoneCopyFromSelect:focus {
    outline: none;
    border-color: var(--teal-400);
    box-shadow: 0 0 0 2px rgba(79, 209, 197, 0.2);
}

#zoneCopyFromSelect option {
    background: var(--bg-card);
    color: var(--text-primary);
    padding: 8px;
}

.kro-check-desc {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.4;
    word-wrap: break-word;
}


.kro-check-options-modal {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 8px;
}

.kro-check-options-modal .kro-checkbox-label {
    margin: 0;
}

/* KRO Checkboxes */
/* KRO Custom Checkbox */
.kro-checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
    font-size: 14px;
    color: var(--text-primary);
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    transition: all 0.2s ease;
}

.kro-checkbox-label:hover {
    border-color: var(--teal-400);
    background: rgba(79, 209, 197, 0.05);
}

.kro-checkbox-label input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-card);
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.kro-checkbox-label input[type="checkbox"]:hover {
    border-color: var(--teal-400);
}

.kro-checkbox-label input[type="checkbox"]:checked {
    background: var(--teal-400);
    border-color: var(--teal-400);
}

.kro-checkbox-label input[type="checkbox"]:checked::after {
    content: '';
    display: block;
    width: 5px;
    height: 10px;
    border: solid var(--bg-primary);
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    margin-top: -2px;
    margin-left: 1px;
}

.kro-checkbox-label-small {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
    transition: color 0.2s ease;
    padding: 6px 10px;
    border-radius: 4px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
}

.kro-checkbox-label-small:hover {
    color: var(--text-primary);
    border-color: var(--teal-400);
}

.kro-checkbox-small {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid var(--border-color);
    border-radius: 3px;
    background: var(--bg-card);
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.kro-checkbox-small:hover {
    border-color: var(--teal-400);
}

.kro-checkbox-small:checked {
    background: var(--teal-400);
    border-color: var(--teal-400);
}

.kro-checkbox-small:checked::after {
    content: '';
    display: block;
    width: 4px;
    height: 8px;
    border: solid var(--bg-primary);
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    margin-top: -2px;
    margin-left: 1px;
}

/* Positions Modal */
.modal-medium {
    max-width: 500px;
}

.positions-add-form {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.positions-add-form input {
    flex: 1;
    padding: 10px 14px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
}

.positions-add-form input:focus {
    outline: none;
    border-color: var(--teal-400);
}

.positions-list {
    max-height: 300px;
    overflow-y: auto;
}

.position-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border-radius: 8px;
    margin-bottom: 8px;
    border: 1px solid var(--border-color);
}

.position-item:last-child {
    margin-bottom: 0;
}

.position-name {
    font-size: 14px;
    color: var(--text-primary);
    font-weight: 500;
}

/* Form Select */
.form-select {
    width: 100%;
    padding: 11px 13px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
}

.form-select:focus {
    outline: none;
    border-color: var(--teal-400);
}

/* Form Textarea */
.form-group textarea {
    width: 100%;
    padding: 11px 13px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    min-height: 80px;
}

.form-group textarea:focus {
    outline: none;
    border-color: var(--teal-400);
}

/* Filter Modal */
.filter-section {
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.filter-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.filter-section-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 12px;
}

.filter-checkboxes {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 300px;
    overflow-y: auto;
    padding-right: 8px;
}

.filter-checkboxes::-webkit-scrollbar {
    width: 6px;
}

.filter-checkboxes::-webkit-scrollbar-track {
    background: var(--bg-card);
    border-radius: 3px;
}

.filter-checkboxes::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.filter-checkboxes::-webkit-scrollbar-thumb:hover {
    background: var(--teal-400);
}

/* === KRO Events Timeline === */
.kro-events-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.kro-events-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 24px;
    padding: 16px;
    background: var(--bg-card);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    align-items: flex-end;
}

.kro-events-filters .date-input-group input[type="datetime-local"] {
    padding: 8px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
}

.kro-events-filters .date-input-group input[type="datetime-local"]:focus {
    outline: none;
    border-color: var(--teal-400);
}

.kro-events-filters .filter-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.kro-events-filters .filter-group label {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
}

.kro-events-filters .filter-group select {
    padding: 8px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
    min-width: 140px;
}

.kro-events-filters .filter-group select:focus {
    outline: none;
    border-color: var(--teal-400);
}

/* Event Timeline Container */
.events-timeline-container {
    background: var(--bg-card);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    padding: 24px;
    min-height: 400px;
}

.events-timeline {
    position: relative;
    padding-left: 40px;
}

/* Vertical Timeline Line */
.events-timeline::before {
    content: '';
    position: absolute;
    left: 16px;
    top: 0;
    bottom: 0;
    width: 3px;
    background: linear-gradient(to bottom, var(--teal-400), var(--teal-700));
    border-radius: 3px;
}

/* Timeline Event Item */
.timeline-event {
    position: relative;
    margin-bottom: 24px;
    padding-left: 24px;
}

.timeline-event:last-child {
    margin-bottom: 0;
}

/* Event Node (circle on the line) */
.timeline-event::before {
    content: '';
    position: absolute;
    left: -32px;
    top: 6px;
    width: 14px;
    height: 14px;
    background: var(--bg-card);
    border: 3px solid var(--teal-400);
    border-radius: 50%;
    z-index: 1;
}

.timeline-event.photo::before {
    border-color: var(--purple-400);
}

.timeline-event.text::before {
    border-color: var(--orange-400);
}

/* Event Card */
.timeline-event-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 16px;
    transition: all 0.2s;
}

.timeline-event-card:hover {
    border-color: var(--teal-400);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

/* Event Header */
.timeline-event-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
    gap: 12px;
}

.timeline-event-meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.timeline-event-position {
    font-size: 15px;
    font-weight: 600;
    color: var(--teal-200);
}

.timeline-event-zone {
    font-size: 13px;
    color: var(--text-secondary);
}

.timeline-event-time {
    font-size: 12px;
    color: var(--grey-500);
    font-family: 'Consolas', monospace;
    white-space: nowrap;
}

/* Event Body */
.timeline-event-body {
    margin-top: 12px;
}

.timeline-event-comment {
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 12px;
}

/* Photo Preview */
.timeline-event-photos {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.timeline-photo-thumb {
    position: relative;
    width: 120px;
    height: 90px;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid var(--border-color);
    transition: all 0.2s;
}

.timeline-photo-thumb:hover {
    border-color: var(--teal-400);
    transform: scale(1.02);
}

.timeline-photo-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.timeline-photo-thumb .photo-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
}

.timeline-photo-thumb:hover .photo-overlay {
    opacity: 1;
}

.timeline-photo-thumb .photo-overlay svg {
    width: 32px;
    height: 32px;
    color: white;
}

/* Event Type Badge */
.timeline-event-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.timeline-event-badge.photo {
    background: rgba(139, 92, 246, 0.2);
    color: var(--purple-400);
}

.timeline-event-badge.text {
    background: rgba(245, 158, 11, 0.2);
    color: var(--orange-400);
}

/* Photo Lightbox */
.modal-lightbox {
    max-width: 90vw;
    max-height: 90vh;
    background: rgba(0, 0, 0, 0.95);
    border: none;
    padding: 0;
    display: flex;
    flex-direction: column;
}

.lightbox-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    font-size: 32px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 10;
    transition: background 0.2s;
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.lightbox-image-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow: hidden;
}

.lightbox-image-container img {
    max-width: 100%;
    max-height: calc(90vh - 100px);
    object-fit: contain;
    border-radius: 8px;
}

.lightbox-info {
    padding: 16px 24px;
    background: rgba(0, 0, 0, 0.5);
    color: var(--text-secondary);
    font-size: 14px;
}

.lightbox-info strong {
    color: var(--text-primary);
}

/* Empty Events State */
.events-empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.events-empty-state svg {
    width: 80px;
    height: 80px;
    color: var(--grey-600);
    margin-bottom: 20px;
}

.events-empty-state h3 {
    color: var(--text-primary);
    margin: 0 0 8px;
}

.events-empty-state p {
    margin: 0;
    font-size: 14px;
}

/* Date Separator */
.timeline-date-separator {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 32px 0 24px -40px;
    padding-left: 40px;
}

.timeline-date-separator::before {
    content: '';
    position: absolute;
    left: 10px;
    width: 15px;
    height: 15px;
    background: var(--teal-700);
    border: 3px solid var(--teal-200);
    border-radius: 50%;
}

.timeline-date-separator span {
    background: var(--bg-card);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    color: var(--teal-200);
    border: 1px solid var(--teal-700);
}

/* KRO Responsive */
@media (max-width: 768px) {
    .kro-cards-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .kro-card {
        padding: 24px 20px;
    }
    
    .kro-card-icon {
        width: 64px;
        height: 64px;
    }
    
    .kro-card-icon svg {
        width: 32px;
        height: 32px;
    }
    
    .kro-toolbar {
        flex-direction: column;
    }
    
    .kro-toolbar button {
        width: 100%;
        justify-content: center;
    }
    
    .kro-zone-header {
        flex-direction: column;
        gap: 12px;
    }
    
    .kro-zone-actions {
        align-self: flex-end;
    }
    
    .positions-add-form {
        flex-direction: column;
    }
    
    .kro-events-filters {
        flex-direction: column;
        gap: 12px;
    }
    
    .kro-events-filters .filter-group select {
        width: 100%;
    }
    
    .timeline-event-header {
        flex-direction: column;
    }
    
    .timeline-photo-thumb {
        width: 100px;
        height: 75px;
    }
}

/* === Аттестация сотрудников === */

.certification-positions-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

.certification-position-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    transition: all 0.2s ease;
}

.certification-position-card:hover {
    border-color: var(--teal-500);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.position-card-header {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
}

.position-icon {
    font-size: 32px;
    line-height: 1;
}

.position-info {
    flex: 1;
}

.position-info h3 {
    margin: 0 0 8px 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.position-desc {
    margin: 0 0 8px 0;
    font-size: 14px;
    color: var(--text-secondary);
}

.position-status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.position-status-badge.success {
    background: rgba(34, 197, 94, 0.2);
    color: #22c55e;
}

.position-status-badge.pending {
    background: rgba(245, 158, 11, 0.2);
    color: #f59e0b;
}

.position-file-info {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    color: var(--text-secondary);
    font-style: italic;
}

.position-card-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.btn-small {
    padding: 6px 12px !important;
    font-size: 12px !important;
}

.btn-accent {
    background: linear-gradient(135deg, #8b5cf6 0%, #6366f1 100%);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.btn-accent:hover {
    background: linear-gradient(135deg, #7c3aed 0%, #4f46e5 100%);
    transform: translateY(-1px);
}

/* Модальные окна аттестации */
.responsibilities-content {
    max-height: 60vh;
    overflow-y: auto;
    padding: 10px;
}

.resp-file-info {
    padding: 10px 14px;
    background: var(--bg-secondary);
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 13px;
    color: var(--text-secondary);
}

.resp-sections {
    padding: 0 10px;
}

.resp-section-title {
    margin: 20px 0 12px 0;
    color: var(--teal-300);
    font-weight: 600;
}

.resp-paragraph {
    margin: 0 0 12px 0;
    line-height: 1.7;
    color: var(--text-primary);
}

.resp-raw-text pre {
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-primary);
}

/* Предпросмотр теста */
.test-preview-content {
    max-height: 60vh;
    overflow-y: auto;
    padding: 10px;
}

.test-info {
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: 8px;
    margin-bottom: 20px;
}

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

.test-info p:last-child {
    margin-bottom: 0;
}

.test-questions {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.test-question {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 16px;
}

.question-number {
    font-size: 12px;
    font-weight: 600;
    color: var(--teal-400);
    text-transform: uppercase;
    margin-bottom: 8px;
}

.question-text {
    font-size: 15px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 14px;
    line-height: 1.5;
}

.question-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.question-option {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    background: var(--bg-secondary);
    border-radius: 6px;
    border: 1px solid transparent;
    transition: all 0.2s ease;
}

.question-option.correct {
    background: rgba(34, 197, 94, 0.15);
    border-color: rgba(34, 197, 94, 0.4);
}

.option-letter {
    font-weight: 600;
    color: var(--text-secondary);
    min-width: 20px;
}

.option-text {
    flex: 1;
    color: var(--text-primary);
    line-height: 1.4;
}

.correct-badge {
    color: #22c55e;
    font-weight: bold;
    font-size: 16px;
}

.question-explanation {
    margin-top: 12px;
    padding: 10px;
    background: rgba(79, 209, 197, 0.1);
    border-radius: 6px;
    font-size: 13px;
    color: var(--text-secondary);
}

.loading-hint {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 8px;
}

/* Responsive */
@media (max-width: 768px) {
    .certification-positions-grid {
        padding: 12px;
    }
    
    .position-card-header {
        flex-direction: column;
        gap: 12px;
    }
    
    .position-card-actions {
        flex-direction: column;
    }
    
    .position-card-actions button {
        width: 100%;
        justify-content: center;
    }
}

/* === Employees Page === */

.employees-view-toggle {
    display: flex;
    gap: 4px;
    margin-left: auto;
    background: var(--bg-secondary);
    padding: 4px;
    border-radius: 8px;
}

.view-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s;
}

.view-btn:hover {
    color: var(--text-primary);
    background: var(--bg-card);
}

.view-btn.active {
    background: var(--teal-500);
    color: white;
}

.employees-stats-compact {
    display: flex;
    gap: 24px;
    padding: 12px 20px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
}

.stat-mini {
    display: flex;
    align-items: center;
    gap: 6px;
}

.stat-mini-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--teal-400);
}

.stat-mini-label {
    font-size: 13px;
    color: var(--text-secondary);
}

.employees-container {
    padding: 20px;
}

.employees-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}

.employees-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.employee-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    gap: 14px;
}

.employee-card:hover {
    border-color: var(--teal-500);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Вид списком */
.employees-list .employee-card {
    border-radius: 8px;
    padding: 12px 16px;
}

.employees-list .employee-card:hover {
    transform: none;
}

.employees-list .employee-avatar {
    width: 44px;
    height: 44px;
}

.employees-list .employee-name {
    font-size: 15px;
}

.employees-list .employee-work-info {
    flex-direction: row;
    gap: 16px;
}

.employee-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
}

.employee-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.employee-avatar-placeholder {
    font-size: 24px;
    color: var(--text-secondary);
}

.employee-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.employee-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.employee-name-empty {
    color: var(--text-secondary);
    font-style: italic;
    font-weight: 400;
}

.employee-work-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-top: 4px;
}

.employee-position {
    font-size: 14px;
    color: var(--teal-400);
    font-weight: 500;
}

.employee-object {
    font-size: 13px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 4px;
}

.employee-object svg {
    width: 12px;
    height: 12px;
    opacity: 0.7;
}

.employee-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 500;
    margin-top: 6px;
    width: fit-content;
}

.employee-status-badge.filled {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
}

.employee-status-badge.not-filled {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
}

/* Employee Profile Modal */
.employee-profile {
    display: flex;
    gap: 24px;
}

.employee-profile-avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
}

.employee-profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.employee-profile-avatar-placeholder {
    font-size: 48px;
    color: var(--text-secondary);
}

.employee-profile-info {
    flex: 1;
}

.employee-profile-name {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.employee-profile-username {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.employee-profile-section {
    margin-bottom: 16px;
}

.employee-profile-section h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--teal-400);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.employee-profile-row {
    display: flex;
    gap: 16px;
    margin-bottom: 8px;
}

.employee-profile-field {
    flex: 1;
}

.employee-profile-label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 2px;
}

.employee-profile-value {
    font-size: 14px;
    color: var(--text-primary);
}

.employee-profile-value.empty {
    color: var(--text-secondary);
    font-style: italic;
}

@media (max-width: 768px) {
    .employees-stats-compact {
        flex-wrap: wrap;
        gap: 12px 20px;
    }
    
    .employees-grid {
        grid-template-columns: 1fr;
    }
    
    .employee-profile {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    
    .employee-profile-row {
        flex-direction: column;
        gap: 8px;
    }
    
    .employees-view-toggle {
        position: absolute;
        right: 16px;
        top: 50%;
        transform: translateY(-50%);
    }
    
    #page-employees .page-header {
        position: relative;
    }
}

/* ===========================================
   PHOTO GALLERY - Desktop version of mobile app
   Inspired by WhatsApp/Telegram gallery style
   =========================================== */

.photo-gallery-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: var(--bg-primary);
}

/* Compact Filters */
.gallery-filters {
    padding: 16px 20px;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
}

.gallery-filters .filter-row {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.date-range-picker {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-secondary);
    border-radius: 8px;
    padding: 4px 12px;
}

.date-range-picker input[type="date"] {
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 13px;
    padding: 6px 0;
}

.date-range-picker input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(1);
    opacity: 0.6;
}

.date-separator {
    color: var(--grey-500);
}

.filter-select {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 13px;
    min-width: 140px;
}

.filter-select:focus {
    border-color: var(--teal-400);
    outline: none;
}

.gallery-stats {
    display: flex;
    gap: 16px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--grey-400);
    font-size: 13px;
}

.stat-item svg {
    color: var(--grey-500);
}

/* Albums Container */
.albums-container {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
}

/* Date Separator - WhatsApp style */
.gallery-date-separator {
    display: flex;
    justify-content: center;
    padding: 24px 0 16px;
}

.gallery-date-separator span {
    background: var(--bg-secondary);
    color: var(--grey-400);
    font-size: 13px;
    font-weight: 500;
    padding: 6px 16px;
    border-radius: 16px;
}

/* Album Section */
.photo-album {
    margin-bottom: 24px;
}

.album-header {
    margin-bottom: 12px;
}

.album-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.album-subtitle {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--grey-500);
    font-size: 13px;
}

.album-pending-badge {
    display: flex;
    align-items: center;
    gap: 4px;
    color: var(--yellow-400);
    font-size: 12px;
}

/* Photo Grid - 3 columns like mobile */
.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 4px;
}

@media (min-width: 1200px) {
    .photo-grid {
        grid-template-columns: repeat(6, 1fr);
    }
}

@media (min-width: 900px) and (max-width: 1199px) {
    .photo-grid {
        grid-template-columns: repeat(5, 1fr);
    }
}

@media (min-width: 600px) and (max-width: 899px) {
    .photo-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Photo Thumbnail */
.photo-thumb {
    position: relative;
    aspect-ratio: 1;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    background: var(--bg-secondary);
}

.photo-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.2s;
}

.photo-thumb:hover img {
    transform: scale(1.05);
}

/* Photo Overlay with gradient */
.photo-thumb-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.7) 0%, transparent 50%);
    pointer-events: none;
}

/* Photo Info at bottom */
.photo-thumb-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 6px 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.photo-thumb-time {
    color: white;
    font-size: 11px;
    font-weight: 500;
}

.photo-thumb-check {
    color: rgba(255,255,255,0.8);
    font-size: 10px;
    max-width: 60%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Delivery Status Icon */
.photo-status-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

.photo-status-icon svg {
    width: 14px;
    height: 14px;
}

.photo-status-icon.delivered svg {
    color: var(--green-400);
}

.photo-status-icon.pending svg {
    color: var(--yellow-400);
}

.photo-status-icon.failed svg {
    color: var(--red-400);
}

/* Empty State */
.gallery-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 64px 32px;
    text-align: center;
}

.gallery-empty-state svg {
    width: 64px;
    height: 64px;
    color: var(--grey-600);
    margin-bottom: 16px;
}

.gallery-empty-state h3 {
    color: var(--grey-400);
    font-size: 16px;
    margin-bottom: 8px;
}

.gallery-empty-state p {
    color: var(--grey-600);
    font-size: 13px;
}

/* ==================
   PHOTO LIGHTBOX
   Full-screen viewer
   ================== */

.photo-lightbox {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
}

.photo-lightbox.active {
    display: flex;
}

.lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.95);
    cursor: pointer;
}

.lightbox-content {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 10;
    background: rgba(255,255,255,0.1);
    border: none;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
}

.lightbox-close:hover {
    background: rgba(255,255,255,0.2);
}

.lightbox-close svg {
    color: white;
}

/* Navigation Arrows */
.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    background: rgba(255,255,255,0.1);
    border: none;
    border-radius: 50%;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
}

.lightbox-nav:hover {
    background: rgba(255,255,255,0.2);
}

.lightbox-nav svg {
    color: white;
}

.lightbox-prev {
    left: 20px;
}

.lightbox-next {
    right: 340px; /* Account for info panel */
}

/* Image Container */
.lightbox-image-container {
    position: relative;
    max-width: calc(100% - 360px);
    max-height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-image-container img {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 4px;
}

.lightbox-counter {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.6);
    color: white;
    padding: 6px 16px;
    border-radius: 16px;
    font-size: 14px;
}

/* Info Panel (right side) */
.lightbox-info {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 320px;
    background: var(--bg-surface);
    border-left: 1px solid var(--border-color);
    padding: 24px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.lightbox-info-header {
    margin-bottom: 16px;
}

.lightbox-info-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.lightbox-report-type {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    background: var(--teal-500);
    color: white;
}

.lightbox-report-type.before-rental {
    background: var(--blue-500);
}

.lightbox-report-type.after-rental {
    background: var(--purple-500);
}

.lightbox-report-type.no-changes {
    background: var(--grey-500);
}

.lightbox-check {
    color: var(--grey-400);
    font-size: 14px;
    margin-bottom: 24px;
}

.lightbox-meta {
    flex: 1;
}

.meta-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
}

.meta-label {
    color: var(--grey-500);
    font-size: 13px;
}

.meta-value {
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 500;
}

.lightbox-actions {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
}

.btn-action {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px;
    border-radius: 8px;
    border: none;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-reject {
    background: var(--red-500);
    color: white;
}

.btn-reject:hover {
    background: var(--red-600);
}

/* Text Event Card */
.text-event-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-left: 3px solid var(--orange-400);
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 8px;
}

.text-event-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.text-event-zone {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.text-event-time {
    font-size: 12px;
    color: var(--grey-500);
}

.text-event-comment {
    color: var(--grey-300);
    font-size: 13px;
    line-height: 1.4;
}

.text-event-meta {
    display: flex;
    gap: 16px;
    margin-top: 8px;
    font-size: 12px;
    color: var(--grey-500);
}

/* Report Type Badge Colors */
.report-type-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
}

.report-type-badge.standard {
    background: rgba(20, 184, 166, 0.2);
    color: var(--teal-400);
}

.report-type-badge.before-rental {
    background: rgba(59, 130, 246, 0.2);
    color: var(--blue-400);
}

.report-type-badge.after-rental {
    background: rgba(139, 92, 246, 0.2);
    color: var(--purple-400);
}

.report-type-badge.no-changes {
    background: rgba(156, 163, 175, 0.2);
    color: var(--grey-400);
}

.report-type-badge.cannot-report {
    background: rgba(239, 68, 68, 0.2);
    color: var(--red-400);
}

/* Header actions */
.header-actions {
    display: flex;
    gap: 8px;
    margin-left: auto;
}

.btn-icon {
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-icon:hover {
    background: var(--bg-secondary);
    border-color: var(--teal-400);
}

.btn-icon svg {
    color: var(--grey-400);
}

.btn-icon:hover svg {
    color: var(--teal-400);
}

/* Mobile responsive */
@media (max-width: 768px) {
    .lightbox-info {
        position: fixed;
        left: 0;
        right: 0;
        top: auto;
        bottom: 0;
        width: 100%;
        height: auto;
        max-height: 50vh;
        border-left: none;
        border-top: 1px solid var(--border-color);
        border-radius: 16px 16px 0 0;
    }
    
    .lightbox-next {
        right: 20px;
    }
    
    .lightbox-image-container {
        max-width: 100%;
    }
    
    .gallery-filters .filter-row {
        flex-direction: column;
        align-items: stretch;
    }
    
    .date-range-picker {
        width: 100%;
        justify-content: center;
    }
    
    .filter-select {
        width: 100%;
    }
}

/* === Analytics Config Form === */
.analytics-config-form {
    max-width: 640px;
    padding: 0 0 24px;
}

.analytics-section {
    margin-bottom: 24px;
    padding: 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.analytics-section h3 {
    margin: 0 0 16px;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.analytics-section h4 {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
}

.analytics-config-form .form-group {
    margin-bottom: 16px;
}

.analytics-config-form .form-group:last-child {
    margin-bottom: 0;
}

.analytics-config-form .form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
    color: var(--text-secondary);
}

.analytics-config-form .form-group input[type="number"] {
    width: 100%;
    max-width: 160px;
    padding: 8px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 14px;
}

.analytics-config-form .form-group input:focus {
    outline: none;
    border-color: var(--teal-400);
}

.analytics-config-form .form-row {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
}

.analytics-config-form .form-row .form-group {
    flex: 1;
    min-width: 140px;
}

.analytics-config-form .form-actions .btn-primary {
    padding: 10px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
}

/* Analytics Settings Modal — всплывающее окно по центру экрана */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 20px;
    box-sizing: border-box;
}

.modal-overlay.show {
    display: flex;
}

/* Внутренний блок модалки не должен наследовать .modal { display: none } */
.modal-overlay.show .modal {
    display: block;
    margin: auto;
    flex-shrink: 0;
}

.modal-overlay .modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    max-width: 560px;
    width: 100%;
    max-height: 90vh;
    overflow: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    box-sizing: border-box;
}

.modal-overlay .modal .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}

.modal-overlay .modal .modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.modal-overlay .modal .modal-close {
    background: none;
    border: none;
    color: var(--grey-500);
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
    padding: 0;
}

.modal-overlay .modal .modal-close:hover {
    color: var(--text-primary);
}

.modal-overlay .modal .modal-body {
    padding: 20px;
}

.analytics-dashboard {
    padding: 20px 0;
    max-width: 100%;
}

/* Вкладки аналитики: Стандарты / Дисциплина */
.analytics-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 20px;
    padding: 4px;
    background: var(--bg-secondary);
    border-radius: 10px;
    border: 1px solid var(--border-color);
    width: fit-content;
}

.analytics-tab {
    padding: 10px 20px;
    border: none;
    background: transparent;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.analytics-tab:hover {
    color: var(--text-primary);
    background: var(--bg-card);
}

.analytics-tab.active {
    background: var(--teal-600);
    color: white;
    box-shadow: 0 2px 8px rgba(20, 184, 166, 0.3);
}

.analytics-tab-panel {
    display: none;
    margin-top: 8px;
}

.analytics-tab-panel.active {
    display: block;
}

.analytics-panel-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.analytics-panel-card .analytics-section-title:first-of-type {
    margin-top: 0;
}

.analytics-report-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.analytics-date-label {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
}

.analytics-date-input {
    padding: 8px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 14px;
}

.analytics-date-input:focus {
    outline: none;
    border-color: var(--teal-400);
}

.analytics-date-sep {
    color: var(--text-secondary);
    font-weight: 500;
}

.analytics-presets {
    display: flex;
    gap: 6px;
    align-items: center;
}

.analytics-preset-btn {
    padding: 6px 14px;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.analytics-preset-btn:hover {
    border-color: var(--teal-400);
    color: var(--text-primary);
    background: rgba(20, 184, 166, 0.08);
}

.analytics-detailization-wrap {
    margin-top: 20px;
}

.analytics-detailization-btn {
    padding: 10px 18px;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    border-radius: 8px;
    color: var(--teal-400);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.analytics-detailization-btn:hover {
    background: rgba(20, 184, 166, 0.1);
    border-color: var(--teal-400);
}

.analytics-detailization-content {
    margin-top: 14px;
}

.analytics-report-summary {
    margin-bottom: 20px;
}

.analytics-report-meta {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

/* Спойлер аналитики */
.analytics-spoiler-wrap {
    margin-top: 12px;
    background: rgba(239, 68, 68, 0.08);
    border-radius: 8px;
    border-left: 4px solid #ef4444;
    overflow: hidden;
}

.analytics-spoiler-wrap.analytics-summary-violations {
    padding: 0;
}

.analytics-spoiler-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 12px 16px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-primary);
    text-align: left;
}

.analytics-spoiler-btn:hover {
    background: rgba(0, 0, 0, 0.04);
}

.analytics-spoiler-title {
    font-weight: 600;
}

.analytics-spoiler-icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    margin-left: 8px;
    position: relative;
    color: var(--text-secondary);
}

.analytics-spoiler-icon::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    margin-left: -5px;
    margin-top: -3px;
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 6px solid currentColor;
}

.analytics-spoiler-wrap.open .analytics-spoiler-icon::before {
    margin-top: -9px;
    border-top: none;
    border-bottom: 6px solid currentColor;
}

.analytics-spoiler-content {
    display: none;
    padding: 0 16px 14px 16px;
    font-size: 14px;
}

.analytics-spoiler-wrap.open .analytics-spoiler-content {
    display: block;
}

/* Иерархический список: время → зона → позиции */
.analytics-violations-hierarchy {
    margin: 0;
    padding-left: 20px;
    list-style: none;
    color: var(--text-secondary);
}

.analytics-violations-hierarchy > li {
    margin-bottom: 10px;
}

.analytics-vh-slot-label {
    font-weight: 600;
    color: var(--text-primary);
}

.analytics-vh-zones {
    margin: 6px 0 0 0;
    padding-left: 18px;
    list-style: none;
}

.analytics-vh-zone {
    margin-bottom: 6px;
}

.analytics-vh-zone-label {
    font-weight: 500;
    color: var(--text-primary);
}

.analytics-vh-checks {
    margin: 4px 0 0 0;
    padding-left: 18px;
    list-style: disc;
    font-size: 13px;
}

.analytics-vh-checks li {
    margin-bottom: 2px;
}

.analytics-summary-violations strong {
    color: var(--text-primary);
}

.analytics-violations-by-slot {
    margin: 8px 0 0 0;
    padding-left: 20px;
    color: var(--text-secondary);
}

.analytics-violations-by-slot li {
    margin-bottom: 4px;
}

.analytics-violations-block {
    margin-top: 12px;
    padding: 0;
    background: rgba(239, 68, 68, 0.06);
    border-radius: 8px;
    border-left: 3px solid #ef4444;
    font-size: 13px;
    overflow: hidden;
}

.analytics-violations-block .analytics-spoiler-btn {
    padding: 10px 14px;
    font-size: 13px;
}

.analytics-violations-block .analytics-spoiler-content {
    padding: 0 14px 12px 14px;
    font-size: 13px;
}

.analytics-violations-block strong {
    color: var(--text-primary);
}

.analytics-report-no-zones,
.analytics-report-error {
    color: var(--text-secondary);
    font-size: 14px;
}

.analytics-report-error {
    color: #ef4444;
}

.analytics-section-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 28px 0 14px 0;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--teal-400);
    display: block;
}

.analytics-charts-row {
    display: flex;
    gap: 24px;
    margin-bottom: 28px;
    flex-wrap: wrap;
}

.analytics-chart-wrap {
    flex: 1;
    min-width: 280px;
    max-width: 480px;
    height: 220px;
    background: var(--bg-card);
    border-radius: 12px;
    padding: 16px;
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.analytics-employees-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 8px;
}

.analytics-employee-card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 20px;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
    transition: transform 0.2s, box-shadow 0.2s;
}

.analytics-employee-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
}

.analytics-employee-card.percent-100 {
    border-left: 4px solid var(--teal-400);
    background: linear-gradient(135deg, var(--bg-card) 0%, rgba(20, 184, 166, 0.06) 100%);
}

.analytics-employee-card.percent-50 {
    border-left: 4px solid #f59e0b;
    background: linear-gradient(135deg, var(--bg-card) 0%, rgba(245, 158, 11, 0.06) 100%);
}

.analytics-employee-card.percent-low {
    border-left: 4px solid #ef4444;
    background: linear-gradient(135deg, var(--bg-card) 0%, rgba(239, 68, 68, 0.05) 100%);
}

.analytics-employee-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
}

.analytics-employee-ring {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: conic-gradient(var(--teal-400) calc(var(--pct, 0) * 1%), var(--bg-secondary) 0);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.analytics-employee-card.percent-50 .analytics-employee-ring {
    background: conic-gradient(#f59e0b calc(var(--pct, 0) * 1%), var(--bg-secondary) 0);
}

.analytics-employee-card.percent-low .analytics-employee-ring {
    background: conic-gradient(#ef4444 calc(var(--pct, 0) * 1%), var(--bg-secondary) 0);
}

.analytics-employee-ring {
    position: relative;
}

.analytics-employee-ring::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--bg-card);
}

.analytics-employee-pct {
    position: relative;
    z-index: 1;
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.analytics-employee-info {
    flex: 1;
    min-width: 0;
}

.analytics-employee-name {
    margin: 0 0 4px 0;
    font-size: 17px;
    font-weight: 600;
    color: var(--text-primary);
}

.analytics-employee-zones-caption {
    margin: 0;
    font-size: 12px;
    color: var(--text-secondary);
}

.analytics-employee-zones {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.analytics-emp-zone {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 12px;
    background: var(--bg-secondary);
    border-radius: 8px;
    font-size: 13px;
}

.analytics-emp-zone-name {
    color: var(--text-primary);
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.analytics-emp-zone-pct {
    font-weight: 600;
    flex-shrink: 0;
}

.analytics-emp-zone-pct.pct-ok {
    color: var(--teal-400);
}

.analytics-emp-zone-pct.pct-mid {
    color: #f59e0b;
}

.analytics-emp-zone-pct.pct-low {
    color: #ef4444;
}

.analytics-emp-zone-count {
    font-size: 12px;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.analytics-discipline-block {
    margin-bottom: 24px;
}

.analytics-discipline-empty {
    color: var(--text-secondary);
    font-size: 14px;
    margin: 0;
    padding: 12px 0;
}

.analytics-discipline-intro {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.analytics-discipline-table-wrap {
    overflow-x: auto;
    background: var(--bg-card);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    padding: 0;
}

.analytics-discipline-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.analytics-discipline-table th,
.analytics-discipline-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.analytics-discipline-table th {
    color: var(--text-secondary);
    font-weight: 600;
    background: var(--bg-secondary);
}

.analytics-discipline-table tbody tr:last-child td {
    border-bottom: none;
}

.analytics-discipline-table tbody tr.discipline-ok {
    background: rgba(20, 184, 166, 0.06);
}

.analytics-discipline-table tbody tr.discipline-mid {
    background: rgba(245, 158, 11, 0.06);
}

.analytics-discipline-table tbody tr.discipline-low {
    background: rgba(239, 68, 68, 0.06);
}

/* Общий процент дисциплины (макс. балл = 100%) */
.analytics-discipline-overall {
    display: flex;
    align-items: center;
    gap: 24px;
    margin-bottom: 24px;
    padding: 20px 24px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
}

.analytics-discipline-overall-ring {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: conic-gradient(var(--teal-400) calc(var(--pct, 0) * 1%), var(--bg-card) 0);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    position: relative;
}

.analytics-discipline-overall-ring::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--bg-secondary);
}

.analytics-discipline-overall-pct {
    position: relative;
    z-index: 1;
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
}

.analytics-discipline-overall-info {
    flex: 1;
}

.analytics-discipline-overall-title {
    margin: 0 0 4px 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.analytics-discipline-overall-desc {
    margin: 0;
    font-size: 13px;
    color: var(--text-secondary);
}

/* Детализация факторов по сотруднику */
.analytics-discipline-detail-btn {
    padding: 4px 10px;
    font-size: 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.analytics-discipline-detail-btn:hover {
    border-color: var(--teal-400);
    color: var(--teal-400);
}

.analytics-discipline-factors {
    list-style: none;
    margin: 0;
    padding: 12px 16px;
    background: var(--bg-primary);
    border-radius: 8px;
    border-left: 3px solid var(--teal-400);
    font-size: 13px;
}

.analytics-discipline-factors li {
    padding: 6px 0;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

.analytics-discipline-factors li:last-child {
    border-bottom: none;
}

.analytics-discipline-factors-empty {
    color: var(--text-secondary);
    font-style: italic;
}

.analytics-report-zones {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.analytics-zone-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
}

.analytics-zone-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 12px;
}

.analytics-zone-name {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.analytics-zone-stats {
    display: flex;
    gap: 16px;
    align-items: center;
}

.analytics-zone-stats .analytics-stat {
    font-size: 14px;
    color: var(--text-secondary);
}

.analytics-zone-stats .analytics-stat.percent-100 {
    color: var(--teal-400);
    font-weight: 600;
}

.analytics-zone-stats .analytics-stat.percent-50 {
    color: #f59e0b;
    font-weight: 600;
}

.analytics-zone-stats .analytics-stat.percent-low {
    color: #ef4444;
    font-weight: 600;
}

.analytics-zone-responsibles {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 0 0 12px 0;
}

.analytics-checks-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    margin-bottom: 12px;
}

.analytics-checks-table th,
.analytics-checks-table td {
    padding: 8px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.analytics-checks-table th {
    color: var(--text-secondary);
    font-weight: 500;
}

.analytics-by-employee {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 0;
}

.analytics-by-employee ul {
    margin: 8px 0 0 0;
    padding-left: 20px;
}

.analytics-report-empty {
    padding: 24px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
}

.analytics-zone-overrides-list {
    margin-bottom: 8px;
}

.analytics-zone-override-row select.analytics-zone-select {
    padding: 8px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 14px;
}

.analytics-zone-override-row .analytics-zone-value-input {
    padding: 8px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 14px;
}

.analytics-config-form .btn-small {
    padding: 6px 14px;
    font-size: 13px;
}
