.avn-button-container {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    justify-content: center;
    gap: 6px;
    z-index: 99;
    width: auto;
    max-width: 280px;
}

.selection-container {
    position: fixed;
    top: 70px;
    right: 12px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
    z-index: 99;
    width: auto;
    max-width: 280px;
}

#avn-button {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 6px 12px;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    height: 35px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    width: auto;
    min-width: 200px;
}

#avn-button:hover {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-color) 100%);
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
}

#avn-button:active {
    transform: translateY(0);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

#avn-button i {
    font-size: 14px;
}

#select-all-button {
    background: linear-gradient(135deg, var(--secondary-color) 0%, #2c3e50 100%);
    color: white;
    padding: 6px 12px;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    width: auto;
    min-width: 120px;
}

#select-all-button:hover {
    background: linear-gradient(135deg, #2c3e50 0%, var(--secondary-color) 100%);
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
}

#select-all-button:active {
    transform: translateY(0);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

#select-all-button i {
    font-size: 14px;
}

#selected-issues-caption {
    font-size: 12px;
    color: var(--text-color);
    background: var(--card-bg);
    padding: 6px 10px;
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    text-align: right;
    width: auto;
    max-width: 280px;
    line-height: 1.4;
    cursor: pointer;
    max-height: 28px;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
}

#selected-issues-caption.expanded {
    max-height: 180px;
    overflow-y: auto;
}

#selected-issues-caption strong {
    color: var(--primary-color);
    font-weight: 600;
}

#selected-issues-caption .toggle-icon {
    margin-left: 6px;
    font-size: 11px;
    color: var(--text-light);
    transition: transform 0.3s ease;
}

#selected-issues-caption.expanded .toggle-icon {
    transform: rotate(180deg);
}

.avn-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--card-bg, #ffffff);
    border-radius: 2px;
    width: 100%;
    max-width: 720px;
    max-height: 90vh;
    overflow-y: auto;
    z-index: 1001;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.avn-modal-content {
    display: flex;
    flex-direction: column;
    gap: 5px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

.avn-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color, #e0e0e0);
    padding: 16px;
}

.avn-modal-header h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    color: var(--text-color, #1a1a1a);
    letter-spacing: 0.2px;
}

.avn-modal-close {
    font-size: 24px;
    font-weight: 500;
    color: var(--text-light, #666);
    cursor: pointer;
    transition: color 0.2s ease, transform 0.2s ease;
    padding: 8px;
}

.avn-modal-close:hover {
    color: var(--primary-color, #007bff);
    transform: scale(1.15);
}

.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    transition: opacity 0.3s ease;
}

.modal-window {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 20px;
    border-radius: 12px;
    width: 90%;
    max-width: 400px;
    z-index: 1001;
}

.modal-window textarea {
    width: 100%;
    height: 100px;
    margin-top: 10px;
    padding: 8px;
    border-radius: 6px;
    resize: none;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color, #e0e0e0);
}

.modal-title {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
    color: var(--text-color, #1a1a1a);
    letter-spacing: 0.3px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.modal-close {
    font-size: 28px;
    color: var(--text-light, #666);
    cursor: pointer;
    transition: color 0.2s ease, transform 0.2s ease, background-color 0.2s ease;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 25px; /* Фиксированный размер для стабильности */
    width: 25px; /* Фиксированный размер для стабильности */
    line-height: 1; /* Устраняем влияние шрифта */
    text-align: center; /* Дополнительное центрирование текста */
    box-sizing: border-box; /* Учитываем padding и border в размерах */
    font-family: Arial, sans-serif; /* Надёжный шрифт для символа */
}

.modal-close:hover {
    color: white;
    background-color: var(--work-stopped-color, #007bff);
    transform: scale(1.2);
}

/* Стили для табов */
.avn-tabs {
    margin-top: 10px;
}

.avn-tab-header {
    display: flex;
    border-bottom: 2px solid var(--border-color, #ccc);
}

.avn-tab {
    padding: 10px 20px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    color: var(--text-light, #555);
    transition: color 0.2s ease, border-color 0.2s ease;
}

.avn-tab:hover {
    color: var(--primary-color, #007bff);
}

.avn-tab.active {
    color: var(--text-color, #000);
    border-bottom: 2px solid var(--primary-color, #007bff);
}

.avn-tab-content {
    padding: 20px 0;
}

.avn-tab-pane {
    display: none;
}

.avn-tab-pane.active {
    display: block;
}

.collapsible-section .collapsible-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}

.collapsible-section .toggle-collapse-btn {
    background: none;
    border: none;
    font-size: 16px;
    color: var(--text-light, #666);
    cursor: pointer;
    padding: 8px;
}

.collapsible-section .toggle-collapse-btn:hover {
    color: var(--primary-color, #007bff);
}

.collapsible-section .toggle-icon {
    transition: transform 0.3s ease;
}

.collapsible-section .collapsible-content {
    max-height: 400px; /* Specific height for collapsible section */
    overflow-y: auto;
    transition: max-height 0.3s ease;
    scrollbar-width: thin;
    scrollbar-color: var(--text-light) var(--card-bg);
}

.collapsible-section .collapsible-content.collapsed {
    max-height: 0;
    overflow: hidden;
}

.analysis-button {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 8px;
    height: 35px;
    background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
    color: #ffffff;
    border-radius: 4px;
    text-decoration: none;
    font-size: 15px;
    font-weight: 600;
    transition: background 0.3s ease, transform 0.2s ease;
    width: 100%;
    box-sizing: border-box;
    gap: 8px;
}

.analysis-button:hover {
    background-color: var(--primary-dark);
    transform: scale(0.98);
}

.analysis-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1000;
}

.analysis-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #fff;
    padding: 5px;
    border-radius: 8px;
    max-height: 100vh;
    overflow-y: auto;
    z-index: 1001;
    width: 95%;
    max-width: 900px;
}

.work-type-analysis-card,
.complex-analysis-card,
.building-analysis-card,
.contractor-analysis-card,
.subordinate-analysis-card {
    background: var(--card-bg);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 10px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    cursor: pointer;
    transition: transform 0.2s;
}

.work-type-analysis-card:hover,
.complex-analysis-card:hover,
.building-analysis-card:hover,
.contractor-analysis-card:hover,
.subordinate-analysis-card:hover {
    transform: translateY(-0.5px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.analysis-modal h3 {
    margin: 16px 0 8px;
    font-size: 15px;
    color: var(--text-color);
}

.analysis-error {
    color: #e74c3c;
    padding: 15px;
    text-align: center;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1100; /* Increased from 1000 to ensure it appears above AVN cards */
    overflow-y: auto;
}

.modal-content {
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    width: 90%;
    max-width: 400px; /* Default for mobile */
    max-height: 90vh;
    overflow-y: auto;
    overflow-x: hidden; /* Prevent horizontal scrollbar */
    box-sizing: border-box; /* Ensure padding is included in width */
    word-wrap: break-word; /* Ensure long text wraps */
    overflow-wrap: break-word; /* Modern equivalent for text wrapping */
}

.modal-content h3 {
    margin-top: 0;
    color: #333;
}

@media (min-width: 768px) {
    .modal-content {
        max-width: 800px; /* Increased width for better visibility on PC */
        padding: 30px; /* Slightly more padding for comfort */
    }
}

.modal-buttons {
    display: flex;
    justify-content: flex-end;
    margin-top: 20px;
    gap: 10px;
}

.modal-cancel-btn, .modal-confirm-btn {
    padding: 8px 16px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
}

.modal-cancel-btn {
    background-color: #f0f0f0;
    color: #333;
}

.modal-confirm-btn {
    background-color: #4CAF50;
    color: white;
}

.modal-confirm-btn:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
}

.modal-date-input {
    width: 100%;
    padding: 8px;
    margin-top: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.subordinate-analysis-card {
    background: white;
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 15px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: transform 0.2s;
}

.subordinate-analysis-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.loader {
    position: relative;
    width: 100px;
    height: 100px;
    margin: 20px auto;
}

.circle {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 0px;
    height: 0px;
    border-radius: 100%;
    opacity: 0;
    animation: pulse_4923 4s infinite linear;
    border: 0.5px solid #f3f3f3;
    box-shadow: 0px 0px 5px #eef0e5;
}

.circle:nth-child(1) {
    animation-delay: .2s;
}

.circle:nth-child(2) {
    animation-delay: .4s;
}

.circle:nth-child(3) {
    animation-delay: .8s;
}

.circle:nth-child(4) {
    animation-delay: 1s;
}

@keyframes pulse_4923 {
    0% {
        opacity: 0.0;
        width: 0px;
        height: 0px;
        transform: translate(-50%, -50%) scale(1);
    }

    10% {
        opacity: 0.5;
        transform: translate(-50%, -50%) scale(2);
    }

    100% {
        opacity: 0.0;
        width: 100px;
        height: 100px;
        transform: translate(-50%, -50%) scale(1);
    }
}