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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
    background: #f5f7fa;
    min-height: 100vh;
    color: #1a1a1a;
    line-height: 1.6;
}

.container {
    display: -webkit-box;
    display: -webkit-flex;
    display: -ms-flexbox;
    display: flex;
    -webkit-justify-content: center;
    -ms-flex-pack: center;
    justify-content: center;
    -webkit-align-items: center;
    -ms-flex-align: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

/* Страница выбора роли */
.role-selection-card {
    background: #ffffff;
    border-radius: 12px;
    padding: 48px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
    max-width: 1000px;
    width: 100%;
    animation: fadeIn 0.4s ease-in;
    border: 1px solid #e5e7eb;
}

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

.logo-section {
    text-align: center;
    margin-bottom: 48px;
}

.logo-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    background: #f3f4f6;
    border-radius: 12px;
    margin-bottom: 24px;
    color: #4b5563;
}

.main-title {
    font-size: 28px;
    color: #111827;
    margin-bottom: 12px;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.subtitle {
    font-size: 15px;
    color: #6b7280;
    font-weight: 400;
}

.divider {
    width: 48px;
    height: 3px;
    background: #e5e7eb;
    margin: 24px auto 0;
    border-radius: 2px;
}

.role-form {
    width: 100%;
}

.role-buttons {
    /* Fallback для старых браузеров */
    display: -webkit-box;
    display: -webkit-flex;
    display: -ms-flexbox;
    display: flex;
    -webkit-flex-wrap: wrap;
    -ms-flex-wrap: wrap;
    flex-wrap: wrap;
    margin-bottom: 32px;
    /* gap с fallback для старых браузеров */
    margin: -8px;
    margin-bottom: 32px;
}

.role-buttons > * {
    margin: 8px;
}

/* Современные браузеры с поддержкой gap */
@supports (gap: 16px) {
    .role-buttons {
        gap: 16px;
        margin: 0;
        margin-bottom: 32px;
    }
    
    .role-buttons > * {
        margin: 0;
    }
}

/* CSS Grid для современных браузеров */
@supports (display: grid) {
    .role-buttons {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
        gap: 16px;
        margin: 0;
        margin-bottom: 32px;
    }
    
    .role-buttons > * {
        margin: 0;
    }
}

.role-btn {
    background: #ffffff;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    padding: 24px;
    cursor: pointer;
    -webkit-transition: all 0.2s ease;
    -moz-transition: all 0.2s ease;
    -o-transition: all 0.2s ease;
    transition: all 0.2s ease;
    text-align: left;
    color: #374151;
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 16px;
    min-height: 100px;
}

.role-btn:hover {
    border-color: #d1d5db;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    -webkit-transform: translateY(-2px);
    -ms-transform: translateY(-2px);
    transform: translateY(-2px);
}

.role-btn.active {
    background: #f9fafb;
    border-color: #2563eb;
    border-width: 2px;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.15);
}

.role-btn.active .role-icon-wrapper {
    background: #2563eb;
    color: #ffffff;
}

.role-btn.active .role-name {
    color: #111827;
    font-weight: 600;
}

.role-btn.active .role-check {
    opacity: 1;
    transform: scale(1);
}

.role-icon-wrapper {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    background: #f3f4f6;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6b7280;
    -webkit-transition: all 0.2s ease;
    -moz-transition: all 0.2s ease;
    -o-transition: all 0.2s ease;
    transition: all 0.2s ease;
}

.role-icon {
    width: 24px;
    height: 24px;
    stroke-width: 2;
}

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

.role-name {
    font-weight: 500;
    font-size: 16px;
    color: #111827;
    margin-bottom: 4px;
    line-height: 1.4;
}

.role-description {
    font-size: 13px;
    color: #6b7280;
    line-height: 1.4;
}

.role-check {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    background: #2563eb;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    opacity: 0;
    transform: scale(0.8);
    -webkit-transition: all 0.2s ease;
    -moz-transition: all 0.2s ease;
    -o-transition: all 0.2s ease;
    transition: all 0.2s ease;
}

.role-check svg {
    width: 14px;
    height: 14px;
}

.submit-btn {
    width: 100%;
    padding: 14px 24px;
    background: #2563eb;
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    -webkit-transition: all 0.2s ease;
    -moz-transition: all 0.2s ease;
    -o-transition: all 0.2s ease;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    letter-spacing: 0.01em;
}

.submit-btn:hover {
    background: #1d4ed8;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
    transform: translateY(-1px);
}

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

.submit-btn svg {
    width: 18px;
    height: 18px;
    transition: transform 0.2s ease;
}

.submit-btn:hover svg {
    transform: translateX(2px);
}

/* Страница входа */
.login-card {
    background: white;
    border-radius: 20px;
    padding: 50px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 450px;
    width: 100%;
    animation: fadeIn 0.5s ease-in;
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-title {
    font-size: 2em;
    color: #667eea;
    margin-bottom: 15px;
    font-weight: 700;
}

.login-subtitle {
    font-size: 1.1em;
    color: #666;
}

.role-badge {
    display: inline-block;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 5px 15px;
    border-radius: 20px;
    font-weight: 600;
}

.error-message {
    background: #fee;
    color: #c33;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 20px;
    text-align: center;
    border: 2px solid #fcc;
}

.login-form {
    width: 100%;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #333;
    font-weight: 600;
    font-size: 1em;
}

.form-group input {
    width: 100%;
    padding: 15px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 1em;
    transition: all 0.3s ease;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.login-btn {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1.2em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 15px;
}

.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.4);
}

.back-link {
    display: block;
    text-align: center;
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s ease;
}

.back-link:hover {
    color: #764ba2;
}

/* Личный кабинет */
.main-header {
    background: white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-logo h2 {
    color: #667eea;
    font-size: 1.8em;
    font-weight: 700;
}

.main-nav {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.nav-link {
    padding: 10px 20px;
    color: #333;
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.3s ease;
    font-weight: 600;
    font-size: 0.95em;
}

.nav-link:hover {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    transform: translateY(-2px);
}

.nav-link.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.logout-link {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
}

.logout-link:hover {
    background: linear-gradient(135deg, #f5576c 0%, #f093fb 100%);
}

.main-content {
    padding: 40px 20px;
    min-height: calc(100vh - 100px);
}

.dashboard-container {
    max-width: 100%;
    margin: 0 auto;
    width: 100%;
}

.welcome-card {
    background: white;
    border-radius: 20px;
    padding: 60px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    animation: fadeIn 0.5s ease-in;
}

.welcome-title {
    font-size: 2.5em;
    color: #667eea;
    margin-bottom: 30px;
    text-align: center;
    font-weight: 700;
}

.welcome-message {
    text-align: center;
    font-size: 1.3em;
    line-height: 1.8;
    color: #555;
}

.welcome-message p {
    margin-bottom: 15px;
}

.good-day {
    font-size: 1.2em;
    color: #667eea;
    font-weight: 600;
    margin-top: 20px;
}

/* Адаптивность */
@media (max-width: 1024px) {
    .role-selection-card {
        padding: 40px 32px;
    }
    
    .role-buttons {
        /* Fallback для старых браузеров */
        flex-direction: column;
    }
    
    /* CSS Grid для современных браузеров */
    @supports (display: grid) {
        .role-buttons {
            grid-template-columns: repeat(2, 1fr);
        }
    }
}

@media (max-width: 768px) {
    .container {
        padding: 16px;
    }
    
    .role-selection-card {
        padding: 32px 24px;
        border-radius: 10px;
    }
    
    .logo-icon {
        width: 56px;
        height: 56px;
        margin-bottom: 20px;
    }
    
    .main-title {
        font-size: 24px;
    }
    
    .subtitle {
        font-size: 14px;
    }
    
    .role-buttons {
        /* Fallback уже применен через flexbox */
        flex-direction: column;
    }
    
    /* CSS Grid для современных браузеров */
    @supports (display: grid) {
        .role-buttons {
            grid-template-columns: 1fr;
        }
    }
    
    .role-btn {
        padding: 20px;
        min-height: auto;
    }
    
    .role-icon-wrapper {
        width: 44px;
        height: 44px;
    }
    
    .role-icon {
        width: 22px;
        height: 22px;
    }
    
    .role-name {
        font-size: 15px;
    }
    
    .role-description {
        font-size: 12px;
    }
    
    .submit-btn {
        padding: 13px 20px;
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 12px;
    }
    
    .role-selection-card {
        padding: 24px 20px;
    }
    
    .logo-section {
        margin-bottom: 32px;
    }
    
    .logo-icon {
        width: 48px;
        height: 48px;
        margin-bottom: 16px;
    }
    
    .main-title {
        font-size: 22px;
    }
    
    .subtitle {
        font-size: 13px;
    }
    
    .role-buttons {
        gap: 10px;
    }
    
    .role-btn {
        padding: 18px;
        gap: 12px;
    }
    
    .role-icon-wrapper {
        width: 40px;
        height: 40px;
    }
    
    .role-icon {
        width: 20px;
        height: 20px;
    }
}

@media (max-width: 360px) {
    .role-selection-card {
        padding: 20px 16px;
    }
    
    .main-title {
        font-size: 20px;
    }
}

/* Адаптивность для других страниц */
@media (max-width: 768px) {
    .login-card {
        padding: 32px 24px;
    }
    
    .header-container {
        flex-direction: column;
        gap: 16px;
        padding: 16px 20px;
    }
    
    .main-nav {
        justify-content: center;
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .nav-link {
        padding: 8px 16px;
        font-size: 14px;
    }
    
    .welcome-card {
        padding: 32px 20px;
    }
    
    .welcome-title {
        font-size: 22px;
    }
    
    .welcome-message {
        font-size: 15px;
    }
}

/* Таблица в стиле Excel */
.table-section {
    width: 100%;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    padding: 20px;
    overflow-x: auto;
}

.table-header {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e5e7eb;
}

.table-header-content {
    display: flex;
    justify-content: flex-start;
    align-items: flex-start;
    flex-direction: column;
    gap: 16px;
}

.table-title {
    font-size: 24px;
    font-weight: 600;
    color: #111827;
    align-self: flex-start;
}

.table-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-self: flex-start;
    align-items: center;
}

.action-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: #ffffff;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    cursor: pointer;
    -webkit-transition: all 0.2s ease;
    -moz-transition: all 0.2s ease;
    -o-transition: all 0.2s ease;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.action-btn:hover {
    background: #f9fafb;
    border-color: #2563eb;
    color: #2563eb;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.15);
}

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

.action-btn svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.action-btn span {
    line-height: 1;
}

/* Ссылка в виде кнопки — такой же вид, как у .action-btn */
a.action-btn {
    text-decoration: none;
    color: inherit;
    font-weight: 500;
    box-sizing: border-box;
}

.table-wrapper {
    width: 100%;
    overflow-x: auto;
    overflow-y: auto;
    max-height: calc(100vh - 200px);
    -webkit-overflow-scrolling: touch;
    transition: opacity 0.2s ease;
}

.excel-table {
    width: 100%;
    border-collapse: collapse;
    border-spacing: 0;
    font-size: 13px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
    background: #ffffff;
    min-width: 2200px;
}

.excel-table thead {
    background: #f8f9fa;
    position: sticky;
    top: 0;
    z-index: 10;
}

/* Убеждаемся, что заголовки закреплены при прокрутке */
.excel-table thead tr {
    position: sticky;
    top: 0;
    z-index: 10;
}

.excel-table thead th {
    position: sticky;
    top: 0;
    z-index: 11;
}

.excel-table th {
    background: #f1f3f5;
    border: 1px solid #dee2e6;
    padding: 10px 8px;
    text-align: center;
    font-weight: 600;
    color: #212529;
    font-size: 12px;
    white-space: nowrap;
    width: auto;
    min-width: 80px;
    height: 35px;
    vertical-align: middle;
    position: relative;
    user-select: none;
}

.excel-table th .resizer {
    position: absolute;
    top: 0;
    right: 0;
    width: 5px;
    height: 100%;
    cursor: col-resize;
    user-select: none;
    background: transparent;
    z-index: 1;
}

.excel-table th .resizer:hover {
    background: #2563eb;
}

.excel-table th.resizing {
    user-select: none;
}

.excel-table td {
    border: 1px solid #dee2e6;
    padding: 8px;
    text-align: left;
    background: #ffffff;
    color: #212529;
    width: auto;
    min-width: 80px;
    height: 30px;
    vertical-align: middle;
    position: relative;
}

.excel-table td.editable {
    cursor: text;
}

.excel-table td.editable:focus {
    outline: 2px solid #2563eb;
    outline-offset: -2px;
    background: #dbeafe !important;
}

.excel-table td.editable:hover {
    background: #f3f4f6 !important;
}

.excel-table td:not(.editable) {
    cursor: default;
}

.excel-table tbody tr {
    /* Убеждаемся, что строки имеют правильное количество ячеек */
}

/* Разделение сделок в разделе База: верхняя и нижняя граница у каждого блока (пара строк) */
#base-table.base-deal-borders tbody tr:nth-child(2n+1) td {
    border-top: 2px solid #9ca3af;
}
#base-table.base-deal-borders tbody tr:nth-child(2n) td {
    border-bottom: 2px solid #9ca3af;
}

/* Скрываем лишние ячейки после 29-го столбца (в таблицах отгрузки столбцы 28–29: Место хранения, Нет позиций — видимы) */
.excel-table tbody tr td:nth-child(n+30),
.excel-table thead tr th:nth-child(n+30) {
    display: none !important;
    width: 0 !important;
    padding: 0 !important;
    border: none !important;
    visibility: hidden !important;
}

/* Дополнительная защита: ограничиваем количество видимых столбцов */
.excel-table {
    max-width: 100%;
}

.excel-table colgroup col:nth-child(n+30) {
    width: 0 !important;
    display: none !important;
}

.excel-table tbody tr:nth-child(even) td:not(.merged-cell) {
    background: #f8f9fa;
}


.excel-table td.merged-cell {
    background: #ffffff;
    text-align: center;
    vertical-align: middle;
    height: 60px; /* Высота для объединенных ячеек (2 строки по 30px) */
}

.excel-table td.id-cell {
    font-weight: 600;
    color: #374151;
}

.excel-table td.eye-cell {
    font-size: 18px;
    cursor: pointer;
    user-select: none;
    text-align: center;
    vertical-align: middle;
    position: relative;
}

.excel-table td.eye-cell[rowspan="2"] {
    height: 60px !important;
    min-height: 60px !important;
    display: table-cell !important;
}

.excel-table td.eye-cell:hover {
    background: transparent !important;
}

/* Сделка открыта у другого пользователя — глаз недоступен */
.excel-table td.eye-cell.eye-cell-locked {
    opacity: 0.5;
    cursor: not-allowed !important;
    pointer-events: none;
}

/* Стиль для закрытых сделок в разделе Отгрузка */
.excel-table tr.shipment-deal-closed {
    background-color: #e9ecef !important;
}

.excel-table tr.shipment-deal-closed td {
    background-color: #e9ecef !important;
}

/* Стили для выпадающих списков в закрытых сделках */
.excel-table tr.shipment-deal-closed select {
    background-color: #e9ecef !important;
    color: #6b7280 !important;
    cursor: not-allowed !important;
}

.excel-table tr.shipment-deal-closed select:disabled {
    background-color: #e9ecef !important;
    color: #6b7280 !important;
    opacity: 0.7;
}

.excel-table tr.shipment-deal-closed input[type="checkbox"]:disabled {
    cursor: not-allowed !important;
    opacity: 0.7;
}

/* Запрет редактирования всех ячеек в разделе Отгрузка (только просмотр) */
.excel-table#shipment-to-send-table td[contenteditable="false"],
.excel-table#shipment-pickup-table td[contenteditable="false"],
.excel-table#shipment-partial-table td[contenteditable="false"] {
    cursor: default !important;
}

.excel-table#shipment-to-send-table td[contenteditable="false"]:hover,
.excel-table#shipment-pickup-table td[contenteditable="false"]:hover,
.excel-table#shipment-partial-table td[contenteditable="false"]:hover {
    background-color: inherit !important;
}

/* Запрет редактирования ячеек в закрытых сделках */
.excel-table tr.shipment-deal-closed td[contenteditable="false"] {
    cursor: default !important;
    background-color: #e9ecef !important;
}

.excel-table tr.shipment-deal-closed td[contenteditable="false"]:hover {
    background-color: #e9ecef !important;
}

/* Убеждаемся, что во второй строке пары нет ячейки глаза - она должна быть занята rowspan из первой строки */
.excel-table tbody tr:nth-child(even) td.eye-cell:not([rowspan]) {
    display: none !important;
}

.excel-table td.eye-cell span.eye-icon {
    display: inline-block;
    transition: transform 0.2s ease;
    transform-origin: center;
}

.excel-table td.eye-cell:hover span.eye-icon {
    transform: scale(1.1);
}

.excel-table td.account-first-cell {
    position: relative;
    cursor: pointer;
    user-select: none;
}

.excel-table td.account-first-cell .account-placeholder {
    color: #9ca3af;
    font-style: italic;
    pointer-events: none;
    user-select: none;
}

.excel-table td.account-first-cell:hover {
    background: #f3f4f6 !important;
}

.excel-table td.account-first-cell .account-number-link {
    color: #2563eb;
    text-decoration: underline;
    cursor: pointer;
}

.excel-table td.account-first-cell .account-number-link:hover {
    color: #1d4ed8;
}

/* Стили для статуса оплаты */
.excel-table td.payment-status-cell {
    text-align: center;
    font-weight: 600;
    cursor: default;
}

.excel-table td.payment-status-cell.paid {
    background-color: #10b981 !important; /* Зеленый */
    color: #ffffff;
}

.excel-table td.payment-status-cell.partially-paid {
    background-color: #DB7093 !important; /* Частично оплачен */
    color: #ffffff;
}

.excel-table td.payment-status-cell.waiting {
    background-color: #ec4899 !important; /* Розовый */
    color: #ffffff;
}

/* Стили для чекбокса договора */
.excel-table td.contract-cell {
    text-align: center;
    padding: 0;
    position: relative;
}

.excel-table td.contract-cell .contract-checkbox {
    width: 20px;
    height: 20px;
    cursor: pointer;
    margin: 0;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    accent-color: #2563eb;
}

.excel-table td.contract-cell .contract-checkbox:checked {
    accent-color: #2563eb;
}

.excel-table td.contract-cell:has(.contract-checkbox:checked),
.excel-table td.contract-cell.checked {
    background-color: #dbeafe !important; /* Голубой фон при активации */
}

/* Стили для select ответственного */
.excel-table td.responsible-cell {
    text-align: center;
    padding: 4px;
    position: relative;
}

.excel-table td.responsible-cell .responsible-select {
    width: 100%;
    padding: 15px 32px 15px 12px;
    min-height: 60px;
    border: 2px solid #e5e7eb;
    border-radius: 6px;
    background-color: #ffffff;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='M2 4L6 8L10 4' stroke='%23666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 12px;
    font-size: 13px;
    font-weight: 500;
    color: #374151;
    cursor: pointer;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    -webkit-transition: all 0.2s ease;
    -moz-transition: all 0.2s ease;
    -o-transition: all 0.2s ease;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.excel-table td.responsible-cell .responsible-select:hover {
    border-color: #2563eb;
    background-color: #f9fafb;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='M2 4L6 8L10 4' stroke='%232563eb' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.excel-table td.responsible-cell .responsible-select:focus {
    border-color: #2563eb;
    background-color: #ffffff;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='M2 4L6 8L10 4' stroke='%232563eb' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.excel-table td.responsible-cell .responsible-select option {
    padding: 8px 12px;
    background-color: #ffffff;
    color: #374151;
}

.excel-table td.responsible-cell .responsible-select option:hover {
    background-color: #f3f4f6;
}

/* Стили для ячейки даты отгрузки */
.excel-table td.shipment-date-cell {
    text-align: center;
}

/* Просроченная дата отгрузки в Базе — подсветка ячейки */
.excel-table td.shipment-date-cell.shipment-date-overdue {
    background-color: #F08080 !important;
}

/* Стили для select состояния */
.excel-table td.condition-cell {
    text-align: center;
    padding: 4px;
    position: relative;
}

.excel-table td.condition-cell .condition-select {
    width: 100%;
    min-width: 220px;
    padding: 15px 32px 15px 12px;
    min-height: 60px;
    border: 2px solid #e5e7eb;
    border-radius: 6px;
    background-color: #ffffff;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='M2 4L6 8L10 4' stroke='%23666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 12px;
    font-size: 13px;
    font-weight: 500;
    color: #374151;
    cursor: pointer;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    -webkit-transition: all 0.2s ease;
    -moz-transition: all 0.2s ease;
    -o-transition: all 0.2s ease;
    transition: all 0.2s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    box-sizing: border-box;
}

.excel-table td.condition-cell .condition-select:hover {
    border-color: #2563eb;
    background-color: #f9fafb;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='M2 4L6 8L10 4' stroke='%232563eb' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.excel-table td.condition-cell .condition-select:focus {
    border-color: #2563eb;
    background-color: #ffffff;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='M2 4L6 8L10 4' stroke='%232563eb' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.excel-table td.condition-cell .condition-select option {
    padding: 8px 12px;
    background-color: #ffffff;
    color: #374151;
    white-space: normal;
    min-width: 220px;
}

/* Цвета для разных состояний */
.excel-table td.condition-cell.waiting {
    background-color: #fef3c7 !important; /* Желтый */
}

.excel-table td.condition-cell.partially {
    background-color: #dbeafe !important; /* Голубой */
}

.excel-table td.condition-cell.full {
    background-color: #d1fae5 !important; /* Зеленый */
}

/* Цвета для самого select элемента в зависимости от выбранного состояния */
.excel-table td.condition-cell .condition-select.waiting {
    background-color: #fef3c7 !important; /* Желтый */
}

.excel-table td.condition-cell .condition-select.partially {
    background-color: #dbeafe !important; /* Голубой */
}

.excel-table td.condition-cell .condition-select.full {
    background-color: #d1fae5 !important; /* Зеленый */
}

/* Стили для select статуса отгрузки */
.excel-table td.shipment-status-cell {
    text-align: center;
    padding: 4px;
    position: relative;
}

.excel-table td.shipment-status-cell .shipment-status-select {
    width: 100%;
    min-width: 220px;
    padding: 15px 32px 15px 12px;
    min-height: 60px;
    border: 2px solid #e5e7eb;
    border-radius: 6px;
    background-color: #ffffff;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='M2 4L6 8L10 4' stroke='%23666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 12px;
    font-size: 13px;
    font-weight: 500;
    color: #374151;
    cursor: pointer;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    -webkit-transition: all 0.2s ease;
    -moz-transition: all 0.2s ease;
    -o-transition: all 0.2s ease;
    transition: all 0.2s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    box-sizing: border-box;
}

.excel-table td.shipment-status-cell .shipment-status-select:hover {
    border-color: #2563eb;
    background-color: #f9fafb;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='M2 4L6 8L10 4' stroke='%232563eb' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.excel-table td.shipment-status-cell .shipment-status-select:focus {
    border-color: #2563eb;
    background-color: #ffffff;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='M2 4L6 8L10 4' stroke='%232563eb' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.excel-table td.shipment-status-cell .shipment-status-select option {
    padding: 8px 12px;
    background-color: #ffffff;
    color: #374151;
    white-space: normal;
    min-width: 220px;
}

/* Цвета для разных состояний статуса отгрузки */
.excel-table td.shipment-status-cell.waiting {
    background-color: #fef3c7 !important; /* Желтый */
}

.excel-table td.shipment-status-cell.partially {
    background-color: #dbeafe !important; /* Голубой */
}

.excel-table td.shipment-status-cell.full {
    background-color: #d1fae5 !important; /* Зеленый */
}

/* Цвета для самого select элемента в зависимости от выбранного статуса отгрузки */
.excel-table td.shipment-status-cell .shipment-status-select.waiting {
    background-color: #fef3c7 !important; /* Желтый */
}

.excel-table td.shipment-status-cell .shipment-status-select.partially {
    background-color: #dbeafe !important; /* Голубой */
}

.excel-table td.shipment-status-cell .shipment-status-select.full {
    background-color: #d1fae5 !important; /* Зеленый */
}

/* Стили для «Статус отправки» в Отгрузке — как у «Ответственный» в Базе */
.excel-table td.delivery-status-cell {
    text-align: center;
    padding: 4px;
    position: relative;
}

.excel-table td.delivery-status-cell .delivery-status-select {
    width: 100%;
    padding: 15px 32px 15px 12px;
    min-height: 60px;
    border: 2px solid #e5e7eb;
    border-radius: 6px;
    background-color: #ffffff;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='M2 4L6 8L10 4' stroke='%23666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 12px;
    font-size: 13px;
    font-weight: 500;
    color: #374151;
    cursor: pointer;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    -webkit-transition: all 0.2s ease;
    -moz-transition: all 0.2s ease;
    -o-transition: all 0.2s ease;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.excel-table td.delivery-status-cell .delivery-status-select:hover {
    border-color: #2563eb;
    background-color: #f9fafb;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='M2 4L6 8L10 4' stroke='%232563eb' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.excel-table td.delivery-status-cell .delivery-status-select:focus {
    border-color: #2563eb;
    background-color: #ffffff;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='M2 4L6 8L10 4' stroke='%232563eb' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.excel-table td.delivery-status-cell .delivery-status-select option {
    padding: 8px 12px;
    background-color: #ffffff;
    color: #374151;
}

.excel-table td.delivery-status-cell .delivery-status-select option:hover {
    background-color: #f3f4f6;
}

/* Модальное окно */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    backdrop-filter: blur(4px);
}

/* Модальное окно счета должно быть поверх модального окна просмотра сделки */
#account-modal {
    z-index: 10001;
    backdrop-filter: blur(8px);
}

/* Мини модальное окно для уведомлений */
#notification-modal {
    z-index: 10002;
    backdrop-filter: blur(4px);
}

.notification-modal-content {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: auto;
    min-width: 300px;
    max-width: 500px;
    padding: 0;
    animation: modalFadeIn 0.3s ease-out;
}

.notification-body {
    padding: 32px 40px;
    text-align: center;
}

.notification-message {
    font-size: 18px;
    font-weight: 500;
    color: #111827;
    margin: 0 0 24px 0;
    line-height: 1.5;
}

.notification-ok-btn {
    padding: 12px 32px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    -webkit-transition: all 0.2s ease;
    -moz-transition: all 0.2s ease;
    -o-transition: all 0.2s ease;
    transition: all 0.2s ease;
    min-width: 100px;
}

.notification-ok-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
}

.notification-ok-btn:active {
    transform: translateY(0);
}

/* Мини модальное окно для кредита */
.credit-delete-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10003;
    backdrop-filter: blur(4px);
    animation: fadeInModal 0.2s ease;
}

@keyframes fadeInModal {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.credit-delete-modal-content {
    background: #ffffff;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    max-width: 400px;
    width: 90%;
    text-align: center;
    animation: slideUpModal 0.3s ease;
}

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

.credit-delete-modal-message {
    font-size: 16px;
    color: #374151;
    margin-bottom: 20px;
    line-height: 1.5;
    font-weight: 500;
}

.credit-delete-modal-close {
    background: #2563eb;
    color: #ffffff;
    border: none;
    border-radius: 6px;
    padding: 10px 24px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease;
    min-width: 80px;
}

.credit-delete-modal-close:hover {
    background: #1d4ed8;
}

.credit-delete-modal-close:active {
    background: #1e40af;
}

.modal-content {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalFadeIn 0.3s ease-out;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 24px 20px;
    border-bottom: 1px solid #e5e7eb;
}

.modal-title {
    font-size: 20px;
    font-weight: 600;
    color: #111827;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: #6b7280;
    transition: color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    color: #111827;
}

.modal-close svg {
    width: 20px;
    height: 20px;
}

.modal-body {
    padding: 24px;
}

.modal-form-group {
    margin-bottom: 20px;
}

.modal-form-group:last-child {
    margin-bottom: 0;
}

.modal-form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #374151;
    font-size: 14px;
}

.modal-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    color: #111827;
    -webkit-transition: all 0.2s ease;
    -moz-transition: all 0.2s ease;
    -o-transition: all 0.2s ease;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.modal-input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.modal-input::placeholder {
    color: #9ca3af;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 20px 24px 24px;
    border-top: 1px solid #e5e7eb;
}

.modal-btn {
    padding: 10px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    -webkit-transition: all 0.2s ease;
    -moz-transition: all 0.2s ease;
    -o-transition: all 0.2s ease;
    transition: all 0.2s ease;
}

.modal-btn-cancel {
    background: #f3f4f6;
    color: #374151;
}

.modal-btn-cancel:hover {
    background: #e5e7eb;
}

.modal-btn-ok {
    background: #2563eb;
    color: #ffffff;
}

.modal-btn-ok:hover {
    background: #1d4ed8;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

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

/* Адаптивность модального окна */
@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        margin: 20px;
    }
    
    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 20px;
    }
    
    .modal-title {
        font-size: 18px;
    }
}

.excel-table tbody tr:nth-child(even) td.merged-cell {
    background: #f8f9fa;
}

.excel-table td:focus,
.excel-table td:active {
    outline: 2px solid #2563eb;
    outline-offset: -2px;
    background: #dbeafe !important;
}

/* Адаптивность таблицы */
@media (max-width: 1200px) {
    .table-section {
        padding: 16px;
    }
    
    .excel-table {
        font-size: 12px;
    }
    
    .excel-table th,
    .excel-table td {
        padding: 6px;
        min-width: 70px;
    }
}

@media (max-width: 768px) {
    .table-section {
        padding: 12px;
        border-radius: 6px;
    }
    
    .table-header {
        margin-bottom: 16px;
        padding-bottom: 16px;
    }
    
    .table-header-content {
        gap: 12px;
    }
    
    .table-title {
        font-size: 18px;
    }
    
    .table-actions {
        flex-direction: column;
        width: 100%;
        gap: 8px;
    }
    
    .action-btn {
        width: 100%;
        justify-content: center;
        padding: 10px 16px;
        font-size: 13px;
    }
    
    .excel-table {
        font-size: 11px;
        min-width: 2000px;
    }
    
    .excel-table th,
    .excel-table td {
        padding: 5px 4px;
        min-width: 60px;
        height: 28px;
    }
    
    .dashboard-container {
        padding: 0;
    }
    
    .main-content {
        padding: 20px 12px;
    }
}

@media (max-width: 480px) {
    .table-section {
        padding: 8px;
    }
    
    .excel-table {
        font-size: 10px;
        min-width: 1800px;
    }
    
    .excel-table th,
    .excel-table td {
        padding: 4px 3px;
        min-width: 55px;
        height: 26px;
    }
}

/* Стили для select транспорта */
.excel-table td.transport-cell {
    text-align: center;
    padding: 4px;
    position: relative;
}

.excel-table td.transport-cell .transport-select {
    width: 100%;
    min-width: 220px;
    padding: 15px 32px 15px 12px;
    min-height: 60px;
    border: 2px solid #e5e7eb;
    border-radius: 6px;
    background-color: #ffffff;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='M2 4L6 8L10 4' stroke='%23666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 12px;
    font-size: 13px;
    font-weight: 500;
    color: #374151;
    cursor: pointer;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    -webkit-transition: all 0.2s ease;
    -moz-transition: all 0.2s ease;
    -o-transition: all 0.2s ease;
    transition: all 0.2s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    box-sizing: border-box;
}

.excel-table td.transport-cell .transport-select:hover {
    border-color: #2563eb;
    background-color: #f9fafb;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='M2 4L6 8L10 4' stroke='%232563eb' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.excel-table td.transport-cell .transport-select:focus {
    border-color: #2563eb;
    background-color: #ffffff;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='M2 4L6 8L10 4' stroke='%232563eb' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.excel-table td.transport-cell .transport-select option {
    padding: 8px 12px;
    background-color: #ffffff;
    color: #374151;
    white-space: normal;
    min-width: 220px;
}

/* Стили для модального окна логистики */
.logistics-input-group {
    display: flex;
    gap: 8px;
    align-items: stretch;
}

.logistics-input-group .modal-input {
    flex: 1;
}

.logistics-add-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    min-width: 48px;
    height: 48px;
    padding: 0;
    background: #2563eb;
    color: #ffffff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    -webkit-transition: all 0.2s ease;
    -moz-transition: all 0.2s ease;
    -o-transition: all 0.2s ease;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.logistics-add-btn:hover {
    background: #1d4ed8;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.logistics-add-btn:active {
    transform: translateY(0);
}

.logistics-add-btn svg {
    width: 20px;
    height: 20px;
}

.logistics-list-section {
    margin-top: 24px;
}

.logistics-list-section label {
    display: block;
    margin-bottom: 12px;
    font-weight: 500;
    color: #374151;
    font-size: 14px;
}

.logistics-list {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 300px;
    overflow-y: auto;
}

.logistics-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    margin-bottom: 8px;
    -webkit-transition: all 0.2s ease;
    -moz-transition: all 0.2s ease;
    -o-transition: all 0.2s ease;
    transition: all 0.2s ease;
}

.logistics-item:hover {
    background: #f3f4f6;
    border-color: #d1d5db;
}

.logistics-item span {
    flex: 1;
    color: #374151;
    font-size: 14px;
}

.logistics-empty {
    padding: 20px;
    text-align: center;
    color: #9ca3af;
    font-style: italic;
}

.logistics-delete-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    background: transparent;
    color: #ef4444;
    border: 1px solid #fee2e2;
    border-radius: 6px;
    cursor: pointer;
    -webkit-transition: all 0.2s ease;
    -moz-transition: all 0.2s ease;
    -o-transition: all 0.2s ease;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.logistics-delete-btn:hover {
    background: #fee2e2;
    border-color: #ef4444;
    transform: scale(1.1);
}

.logistics-delete-btn:active {
    transform: scale(0.95);
}

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

/* Анимация для крестика закрытия модального окна логистики */
.logistics-modal-close {
    transition: all 0.3s ease;
    transform-origin: center;
}

.logistics-modal-close:hover {
    transform: rotate(90deg) scale(1.1);
    color: #ef4444;
}

.logistics-modal-close:active {
    transform: rotate(90deg) scale(0.9);
}

/* Стили для модального окна просмотра полных данных сделки */
.deal-details-modal-content {
    max-width: 1200px;
    width: 95%;
    max-height: 90vh;
}

.deal-details-body {
    display: flex;
    flex-direction: row;
    gap: 20px;
    padding: 24px;
    min-height: 400px;
}

.deal-details-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 20px;
    background: #f9fafb;
}

.deal-details-section-title {
    font-size: 18px;
    font-weight: 600;
    color: #111827;
    margin: 0 0 16px 0;
    padding-bottom: 12px;
    border-bottom: 2px solid #e5e7eb;
}

.deal-details-section-content {
    flex: 1;
    color: #374151;
    font-size: 14px;
    line-height: 1.6;
}

.deal-details-section-content p {
    margin: 0;
    color: #6b7280;
}

/* Стили для полей в модальном окне просмотра сделки */
.deal-details-field {
    margin-bottom: 16px;
}

.deal-details-field:last-child {
    margin-bottom: 0;
}

/* Просроченная дата отгрузки в модальном окне — подсветка только поля ввода */
.deal-details-field.shipment-date-field.overdue .deal-details-input {
    background-color: #F08080;
}

.deal-details-label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: #374151;
    font-size: 14px;
}

.deal-details-input,
.deal-details-select {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #e5e7eb;
    border-radius: 6px;
    font-size: 14px;
    color: #111827;
    background: #ffffff;
    box-sizing: border-box;
}

.deal-details-input:focus,
.deal-details-select:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.deal-details-input[readonly] {
    background: #f9fafb;
    cursor: default;
}

/* Только отображение (Место хранения, Нет позиций в модалке) — не редактируются */
.deal-details-readonly-value {
    display: block;
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #e5e7eb;
    border-radius: 6px;
    font-size: 14px;
    color: #374151;
    background: #f3f4f6;
    box-sizing: border-box;
    cursor: default;
    user-select: none;
    min-height: 20px;
}

.deal-details-select[disabled] {
    background: #f9fafb;
    cursor: default;
    opacity: 1;
}

.deal-details-checkbox-wrapper {
    display: flex;
    align-items: center;
}

.deal-details-checkbox {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: #2563eb;
}

.deal-details-checkbox[disabled] {
    cursor: default;
    opacity: 0.6;
}

/* Стили для кликабельного поля счета в модальном окне просмотра сделки */
.deal-details-account-input {
    cursor: pointer !important;
    background: #ffffff !important;
}

.deal-details-account-input:hover {
    border-color: #2563eb !important;
    background: #f0f7ff !important;
}

/* Стили для глаза - делаем его кликабельным */
.excel-table td.eye-cell {
    cursor: pointer;
    user-select: none;
    font-size: 18px;
    transition: transform 0.2s ease;
    display: inline-block;
}

.excel-table td.eye-cell:hover {
    background: transparent !important;
    transform: scale(1.1);
}

/* Стили для footer модального окна просмотра сделки */
.deal-details-footer {
    padding: 20px 24px;
    border-top: 1px solid #e5e7eb;
    background: #ffffff;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.deal-details-buttons-row {
    display: flex;
    gap: 12px;
}

.deal-details-btn {
    padding: 10px 20px;
    border: 2px solid #e5e7eb;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    -webkit-transition: all 0.2s ease;
    -moz-transition: all 0.2s ease;
    -o-transition: all 0.2s ease;
    transition: all 0.2s ease;
    background: #ffffff;
    color: #374151;
}

.deal-details-btn:hover {
    background: #f9fafb;
    border-color: #d1d5db;
}

.deal-details-btn-archive {
    flex: 1;
    border-color: #f59e0b;
    color: #f59e0b;
}

.deal-details-btn-archive:hover {
    background: #fef3c7;
    border-color: #f59e0b;
}

.deal-details-btn-delete {
    flex: 1;
    border-color: #ef4444;
    color: #ef4444;
}

.deal-details-btn-delete:hover {
    background: #fee2e2;
    border-color: #ef4444;
}

.deal-details-btn-save {
    width: 100%;
    background: #2563eb;
    color: #ffffff;
    border-color: #2563eb;
}

.deal-details-btn-save:hover {
    background: #1d4ed8;
    border-color: #1d4ed8;
}

/* Стили для полей в модальном окне сделки - цвета как в таблице */
/* Статус оплаты */
.deal-details-input.payment-status-input-modal {
    font-weight: 600;
    text-align: center;
    cursor: default;
}

.deal-details-input.payment-status-input-modal.paid {
    background-color: #10b981 !important; /* Зеленый */
    color: #ffffff !important;
}

.deal-details-input.payment-status-input-modal.partially-paid {
    background-color: #DB7093 !important; /* Частично оплачен */
    color: #ffffff !important;
}

.deal-details-input.payment-status-input-modal.waiting {
    background-color: #ec4899 !important; /* Розовый */
    color: #ffffff !important;
}

/* Состояние */
.deal-details-select.condition-select-modal.waiting {
    background-color: #fef3c7 !important; /* Желтый */
}

.deal-details-select.condition-select-modal.partially {
    background-color: #dbeafe !important; /* Голубой */
}

.deal-details-select.condition-select-modal.full {
    background-color: #d1fae5 !important; /* Зеленый */
}

/* Статус отгрузки */
.deal-details-select.shipment-status-select-modal.waiting {
    background-color: #fef3c7 !important; /* Желтый */
}

.deal-details-select.shipment-status-select-modal.partially {
    background-color: #dbeafe !important; /* Голубой */
}

.deal-details-select.shipment-status-select-modal.full {
    background-color: #d1fae5 !important; /* Зеленый */
}

/* Индикатор автосохранения */
.auto-save-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: 6px;
    font-size: 13px;
    color: #0369a1;
    margin-left: 12px;
    animation: fadeIn 0.3s ease-in;
    white-space: nowrap;
    flex-shrink: 0;
    height: fit-content;
    align-self: center;
}

.auto-save-text {
    font-weight: 500;
}

.auto-save-indicator::before {
    content: '';
    width: 12px;
    height: 12px;
    border: 2px solid #0369a1;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.auto-save-indicator[data-status="saved"]::before {
    content: '✓';
    width: auto;
    height: auto;
    border: none;
    animation: none;
    color: #10b981;
    font-size: 14px;
    font-weight: bold;
}

.auto-save-indicator[data-status="saved"] {
    background: #f0fdf4;
    border-color: #86efac;
    color: #047857;
}

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

/* Индикаторы совместного редактирования */
.cell-editor-indicator {
    position: absolute;
    top: 2px;
    right: 2px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 600;
    z-index: 1000;
    pointer-events: none;
    white-space: nowrap;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
}

.excel-table td {
    position: relative;
}

/* Стили для раздела Профиль */
.profile-section {
    width: 100%;
    padding: 20px;
}

.profile-container {
    max-width: 1200px;
    margin: 0 auto;
    /* Fallback для старых браузеров */
    display: -webkit-box;
    display: -webkit-flex;
    display: -ms-flexbox;
    display: flex;
    -webkit-flex-wrap: wrap;
    -ms-flex-wrap: wrap;
    flex-wrap: wrap;
    margin: -12px;
}

.profile-container > * {
    margin: 12px;
    -webkit-box-flex: 1;
    -webkit-flex: 1 1 400px;
    -ms-flex: 1 1 400px;
    flex: 1 1 400px;
    min-width: 0;
}

/* Современные браузеры с поддержкой gap */
@supports (gap: 24px) {
    .profile-container {
        gap: 24px;
        margin: 0;
    }
    
    .profile-container > * {
        margin: 0;
    }
}

/* CSS Grid для современных браузеров */
@supports (display: grid) {
    .profile-container {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
        gap: 24px;
        margin: 0;
    }
    
    .profile-container > * {
        margin: 0;
        flex: none;
    }
}

.profile-card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border: 1px solid #e5e7eb;
}

.profile-card-title {
    font-size: 20px;
    font-weight: 600;
    color: #111827;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid #e5e7eb;
}

.profile-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.profile-form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.profile-form-group label {
    font-size: 14px;
    font-weight: 500;
    color: #374151;
}

.profile-input {
    padding: 10px 14px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    color: #111827;
    -webkit-transition: all 0.2s ease;
    -moz-transition: all 0.2s ease;
    -o-transition: all 0.2s ease;
    transition: all 0.2s ease;
    font-family: inherit;
}

.profile-input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.profile-save-btn {
    padding: 12px 24px;
    background: #2563eb;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    -webkit-transition: all 0.2s ease;
    -moz-transition: all 0.2s ease;
    -o-transition: all 0.2s ease;
    transition: all 0.2s ease;
    align-self: flex-start;
}

.profile-save-btn:hover {
    background: #1d4ed8;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.profile-save-btn:active {
    transform: translateY(0);
}

.profile-delete-btn {
    padding: 12px 24px;
    background: #dc2626;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    -webkit-transition: all 0.2s ease;
    -moz-transition: all 0.2s ease;
    -o-transition: all 0.2s ease;
    transition: all 0.2s ease;
    align-self: flex-start;
}

.profile-delete-btn:hover {
    background: #b91c1c;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
}

.profile-delete-btn:active {
    transform: translateY(0);
}

.users-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 500px;
    overflow-y: auto;
}

.user-item {
    padding: 16px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    -webkit-transition: all 0.2s ease;
    -moz-transition: all 0.2s ease;
    -o-transition: all 0.2s ease;
    transition: all 0.2s ease;
}

.user-item:hover {
    background: #f3f4f6;
    border-color: #2563eb;
    transform: translateX(4px);
}

.user-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.user-username {
    font-weight: 600;
    color: #111827;
    font-size: 15px;
}

.user-role {
    font-size: 13px;
    color: #6b7280;
    background: #e5e7eb;
    padding: 4px 12px;
    border-radius: 12px;
}

.no-users {
    text-align: center;
    color: #6b7280;
    padding: 40px;
    font-size: 14px;
}

.user-details-content {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.user-detail-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.user-detail-item label {
    font-size: 12px;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.user-detail-item span {
    font-size: 15px;
    color: #111827;
    padding: 8px 12px;
    background: #f9fafb;
    border-radius: 6px;
}

/* Поле пароля с кнопкой «показать» в форме добавления пользователя */
.password-input-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
}
.password-input-wrapper .profile-input {
    flex: 1;
    padding-right: 42px;
}
.password-input-wrapper .password-toggle-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    font-size: 18px;
    line-height: 1;
    opacity: 0.7;
}
.password-input-wrapper .password-toggle-btn:hover {
    opacity: 1;
}

.password-section {
    display: flex;
    align-items: center;
    gap: 12px;
}

.password-section span {
    flex: 1;
}

.change-password-btn {
    padding: 8px 16px;
    background: #f3f4f6;
    color: #374151;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    -webkit-transition: all 0.2s ease;
    -moz-transition: all 0.2s ease;
    -o-transition: all 0.2s ease;
    transition: all 0.2s ease;
}

.change-password-btn:hover {
    background: #e5e7eb;
    border-color: #d1d5db;
}

/* Поисковая строка */
.table-search-container {
    margin-top: 20px;
    margin-bottom: 20px;
}

.search-input-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 600px;
}

.search-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    -webkit-transition: all 0.2s ease;
    -moz-transition: all 0.2s ease;
    -o-transition: all 0.2s ease;
    transition: all 0.2s ease;
    background: #ffffff;
}

.search-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.search-input::placeholder {
    color: #9ca3af;
}

.search-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px 20px;
    background: #3b82f6;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    -webkit-transition: all 0.2s ease;
    -moz-transition: all 0.2s ease;
    -o-transition: all 0.2s ease;
    transition: all 0.2s ease;
    min-width: 48px;
    height: 48px;
}

.search-btn:hover {
    background: #2563eb;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

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

.search-btn svg {
    width: 20px;
    height: 20px;
}

/* Стили для раздела склада */
.warehouse-container {
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    margin-bottom: 20px;
}

.warehouse-title {
    font-size: 2em;
    color: #667eea;
    margin-bottom: 20px;
    font-weight: 700;
}

.warehouse-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.warehouse-table-container {
    overflow-x: auto;
    max-width: 100%;
}

.warehouse-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    font-size: 14px;
}

.warehouse-table thead {
    background: #f9fafb;
    position: sticky;
    top: 0;
    z-index: 10;
}

.warehouse-table th {
    padding: 12px 8px;
    text-align: left;
    font-weight: 600;
    color: #374151;
    border: 1px solid #e5e7eb;
    white-space: nowrap;
}

.warehouse-table td {
    padding: 10px 8px;
    border: 1px solid #e5e7eb;
    vertical-align: middle;
}

.warehouse-table tbody tr:hover {
    background-color: #f9fafb;
}

.warehouse-table td.warehouse-editable {
    min-width: 120px;
    cursor: text;
}

.warehouse-table td.warehouse-editable:focus {
    background-color: #fef3c7;
    outline: 2px solid #fbbf24;
    outline-offset: -2px;
}

.warehouse-table td.warehouse-delete-cell {
    cursor: pointer;
    color: #ef4444;
    font-weight: bold;
    text-align: center;
    user-select: none;
}

.warehouse-table td.warehouse-delete-cell:hover {
    background-color: #fee2e2;
}

.warehouse-table td.warehouse-checkbox-cell {
    text-align: center;
}

.warehouse-table td.warehouse-id-cell {
    text-align: center;
    font-weight: 600;
    color: #667eea;
    background-color: #f3f4f6;
}

.warehouse-table input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.warehouse-table td.warehouse-checkmark-cell {
    color: #10b981;
    font-size: 18px;
    font-weight: bold;
    user-select: none;
}

.warehouse-table td.warehouse-section-checkbox-cell {
    text-align: center;
}

.warehouse-table tr.warehouse-section-divider {
    background-color: #f3f4f6;
}

.warehouse-table td.warehouse-divider-cell {
    background-color: #f3f4f6 !important;
    font-weight: 600;
    padding: 12px !important;
    border: 2px solid #d1d5db;
}

.warehouse-table td.warehouse-divider-cell:focus {
    background-color: #e5e7eb !important;
    outline: 2px solid #9ca3af;
    outline-offset: -2px;
}

/* ========== СТИЛИ ДЛЯ РАЗДЕЛА ДОЛГОВ ========== */

.debts-container {
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    margin-bottom: 20px;
}

.debts-title {
    font-size: 2em;
    color: #667eea;
    margin-bottom: 20px;
    font-weight: 700;
}

.debts-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.debts-tables-container {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    width: 100%;
    overflow-x: auto;
}

.debts-table-wrapper {
    min-width: 0; /* Позволяет flex-элементам сжиматься */
}

/* Ширина таблиц - Кредит уже, Дебет шире */
#credit-table-wrapper {
    flex: 0.6; /* Кредит - уже */
}

#debit-table-wrapper {
    flex: 1.4; /* Дебет - шире */
}

/* Подсветка строк дебета по кон. дате: за 5 дней до — желтый, после кон. даты — красный */
#debit-table tbody tr.debit-row.debit-row-control-soon {
    background-color: #fef9c3;
}
#debit-table tbody tr.debit-row.debit-row-control-soon td {
    background-color: #fef9c3;
}
#debit-table tbody tr.debit-row.debit-row-control-overdue {
    background-color: #fecaca;
}
#debit-table tbody tr.debit-row.debit-row-control-overdue td {
    background-color: #fecaca;
}

.debts-table-wrapper {
    flex: 1;
}

.debts-table-wrapper h3 {
    margin-bottom: 10px;
    font-size: 18px;
    font-weight: 600;
    color: #374151;
}

.debts-table-container {
    overflow-x: auto;
    max-width: 100%;
    width: 100%;
}

.debts-table {
    width: 100%;
    table-layout: auto;
}

.debts-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    font-size: 14px;
}

.debts-table thead {
    background: #f9fafb;
    position: sticky;
    top: 0;
    z-index: 10;
}

.debts-table th {
    padding: 12px 8px;
    text-align: center;
    font-weight: 600;
    color: #374151;
    border: 1px solid #e5e7eb;
    white-space: nowrap;
    background: #f9fafb;
}

.debts-table td {
    padding: 10px 8px;
    border: 1px solid #e5e7eb;
    vertical-align: middle;
}

.debts-table tbody tr:hover {
    background-color: #f9fafb;
}

.debts-table td.debts-editable {
    min-width: 100px;
    cursor: text;
}

.debts-table td.debts-editable:focus {
    background-color: #fef3c7;
    outline: 2px solid #fbbf24;
    outline-offset: -2px;
}

.debts-table td.debts-delete-cell {
    cursor: pointer;
    color: #ef4444;
    font-weight: bold;
    text-align: center;
    user-select: none;
}

.debts-table td.debts-delete-cell:hover {
    background-color: #fee2e2;
}

.debts-table td.debts-checkbox-cell {
    text-align: center;
}

.debts-table td.debts-id-cell {
    text-align: center;
    font-weight: 600;
    color: #667eea;
    background-color: #f3f4f6;
}

.debts-table td.debts-checkmark-cell {
    cursor: pointer;
    user-select: none;
}

.debts-table td.debts-checkmark-cell:hover {
    background-color: #d1fae5;
}

.debts-table tr.debts-total-row {
    background-color: #f9fafb;
}

.debts-table tr.debts-total-row td {
    background-color: #f9fafb;
    font-weight: 600;
}

/* Стили для изменения ширины столбцов в таблицах долгов */
.debts-table th {
    position: relative;
}

/* Стили для кастомных фильтров кредита */
.credit-filter-wrapper {
    position: relative;
    display: inline-block;
    margin-left: 8px;
    vertical-align: middle;
}

.credit-filter-btn {
    background: transparent;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    -webkit-transition: all 0.2s ease;
    -moz-transition: all 0.2s ease;
    -o-transition: all 0.2s ease;
    transition: all 0.2s ease;
    color: #6b7280;
}

.credit-filter-btn:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
    color: #374151;
}

.credit-filter-btn.active {
    background: #2563eb;
    border-color: #2563eb;
    color: #ffffff;
}

.credit-filter-btn svg {
    width: 14px;
    height: 14px;
    transition: transform 0.2s ease;
}

.credit-filter-btn.active svg {
    transform: rotate(180deg);
}

.credit-filter-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    min-width: 150px;
    max-width: 250px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
    padding: 4px 0;
}

.credit-filter-dropdown.show {
    display: block;
    animation: fadeInDropdown 0.2s ease;
}

@keyframes fadeInDropdown {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.credit-filter-option {
    padding: 8px 12px;
    cursor: pointer;
    font-size: 13px;
    color: #374151;
    transition: background-color 0.15s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.credit-filter-option:hover {
    background-color: #f3f4f6;
}

.credit-filter-option.selected {
    background-color: #dbeafe;
    color: #1e40af;
    font-weight: 500;
}

.credit-filter-option:first-child {
    border-top-left-radius: 6px;
    border-top-right-radius: 6px;
}

.credit-filter-option:last-child {
    border-bottom-left-radius: 6px;
    border-bottom-right-radius: 6px;
}

.debts-table th .resizer {
    position: absolute;
    top: 0;
    right: 0;
    width: 5px;
    height: 100%;
    cursor: col-resize;
    user-select: none;
    background: transparent;
    z-index: 1;
}

.debts-table th .resizer:hover {
    background: #2563eb;
}

.debts-table th.resizing {
    user-select: none;
}

/* Стили для цветных строк в таблице дебета */
.debts-table tr.debts-row[data-color="Красный"],
.debts-table tr.debts-row.red-row {
    background-color: #fee2e2 !important;
}

.debts-table tr.debts-row[data-color="Желтый"],
.debts-table tr.debts-row.yellow-row {
    background-color: #fef3c7 !important;
}

.debts-table td.debit-editable {
    cursor: text;
}

.debts-table td.debit-editable:focus {
    outline: 2px solid #2563eb;
    outline-offset: -2px;
    background-color: #dbeafe !important;
}

.debts-table td.debit-field {
    cursor: default;
}

/* Стили для фильтров дебета (аналогично кредиту) */
.debit-filter-wrapper {
    position: relative;
    display: inline-block;
    margin-left: 8px;
    vertical-align: middle;
}

.debit-filter-btn {
    background: transparent;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    -webkit-transition: all 0.2s ease;
    -moz-transition: all 0.2s ease;
    -o-transition: all 0.2s ease;
    transition: all 0.2s ease;
    color: #6b7280;
}

.debit-filter-btn:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
    color: #374151;
}

.debit-filter-btn.active {
    background: #2563eb;
    border-color: #2563eb;
    color: #ffffff;
}

.debit-filter-btn svg {
    width: 14px;
    height: 14px;
    transition: transform 0.2s ease;
}

.debit-filter-btn.active svg {
    transform: rotate(180deg);
}

.debit-filter-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    min-width: 150px;
    max-width: 250px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
    padding: 4px 0;
}

.debit-filter-dropdown.show {
    display: block;
    animation: fadeInDropdown 0.2s ease;
}

.debit-filter-option {
    padding: 8px 12px;
    cursor: pointer;
    font-size: 13px;
    color: #374151;
    transition: background-color 0.15s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.debit-filter-option:hover {
    background-color: #f3f4f6;
}

.debit-filter-option.selected {
    background-color: #dbeafe;
    color: #1e40af;
    font-weight: 500;
}

.debit-filter-option:first-child {
    border-top-left-radius: 6px;
    border-top-right-radius: 6px;
}

.debit-filter-option:last-child {
    border-bottom-left-radius: 6px;
    border-bottom-right-radius: 6px;
}

.debts-table select.debts-color-select,
.debts-table select.debts-responsible-select {
    width: 100%;
    padding: 4px 8px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 14px;
    background-color: white;
    cursor: pointer;
}

.debts-table select.debts-color-select:focus,
.debts-table select.debts-responsible-select:focus {
    outline: 2px solid #fbbf24;
    outline-offset: -2px;
    border-color: #fbbf24;
}

/* ========== СТИЛИ ДЛЯ AI ПОМОЩНИКА ========== */
.ai-assistant-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
}

/* Кнопка для открытия чата */
.ai-assistant-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    transition: all 0.3s ease;
    z-index: 10000;
}

.ai-assistant-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.ai-assistant-toggle:active {
    transform: scale(0.95);
}

.ai-assistant-toggle svg {
    width: 28px;
    height: 28px;
}

/* Окошко чата */
.ai-assistant-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 380px;
    max-width: calc(100vw - 40px);
    height: 600px;
    max-height: calc(100vh - 120px);
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: all 0.3s ease;
}

.ai-assistant-window.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Заголовок чата */
.ai-assistant-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #e5e7eb;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 16px 16px 0 0;
}

.ai-assistant-title {
    display: flex;
    align-items: center;
    gap: 10px;
    color: white;
    font-size: 18px;
    font-weight: 600;
}

.ai-assistant-icon {
    width: 24px;
    height: 24px;
}

.ai-assistant-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-transition: all 0.2s ease;
    -moz-transition: all 0.2s ease;
    -o-transition: all 0.2s ease;
    transition: all 0.2s ease;
}

.ai-assistant-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

.ai-assistant-close svg {
    width: 18px;
    height: 18px;
}

/* Область сообщений */
.ai-assistant-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: #f9fafb;
}

.ai-message {
    display: flex;
    animation: fadeInMessage 0.3s ease;
}

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

.ai-message-user {
    justify-content: flex-end;
}

.ai-message-assistant {
    justify-content: flex-start;
}

.ai-message-content {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 12px;
    word-wrap: break-word;
}

.ai-message-user .ai-message-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-bottom-right-radius: 4px;
}

.ai-message-assistant .ai-message-content {
    background: white;
    color: #374151;
    border: 1px solid #e5e7eb;
    border-bottom-left-radius: 4px;
}

.ai-message-content p {
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
}

/* Контейнер для ввода */
.ai-assistant-input-container {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 16px 20px;
    border-top: 1px solid #e5e7eb;
    background: white;
    border-radius: 0 0 16px 16px;
}

.ai-assistant-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    font-size: 14px;
    font-family: inherit;
    resize: none;
    max-height: 120px;
    overflow-y: auto;
    -webkit-transition: all 0.2s ease;
    -moz-transition: all 0.2s ease;
    -o-transition: all 0.2s ease;
    transition: all 0.2s ease;
    line-height: 1.5;
}

.ai-assistant-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.ai-assistant-input:disabled {
    background: #f3f4f6;
    cursor: not-allowed;
    opacity: 0.7;
}

.ai-assistant-input::placeholder {
    color: #9ca3af;
}

.ai-assistant-send {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-transition: all 0.2s ease;
    -moz-transition: all 0.2s ease;
    -o-transition: all 0.2s ease;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.ai-assistant-send:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.ai-assistant-send:active {
    transform: scale(0.95);
}

.ai-assistant-send:disabled {
    background: #9ca3af;
    cursor: not-allowed;
    transform: none;
    opacity: 0.7;
}

.ai-assistant-send:disabled:hover {
    transform: none;
    box-shadow: none;
}

.ai-assistant-send svg {
    width: 20px;
    height: 20px;
}

/* Адаптивность для AI помощника */
@media (max-width: 768px) {
    .ai-assistant-container {
        bottom: 15px;
        right: 15px;
    }

    .ai-assistant-toggle {
        width: 56px;
        height: 56px;
    }

    .ai-assistant-toggle svg {
        width: 24px;
        height: 24px;
    }

    .ai-assistant-window {
        width: calc(100vw - 30px);
        height: calc(100vh - 100px);
        max-height: calc(100vh - 100px);
        bottom: 75px;
    }
}

@media (max-width: 480px) {
    .ai-assistant-container {
        bottom: 10px;
        right: 10px;
    }

    .ai-assistant-window {
        width: calc(100vw - 20px);
        height: calc(100vh - 80px);
        bottom: 70px;
    }

    .ai-assistant-header {
        padding: 12px 16px;
    }

    .ai-assistant-title {
        font-size: 16px;
    }

    .ai-assistant-messages {
        padding: 16px;
    }

    .ai-assistant-input-container {
        padding: 12px 16px;
    }
}

/* ========== СТИЛИ ДЛЯ ИНСТРУКЦИИ ========== */
.instruction-section {
    width: 100%;
    padding: 20px;
}

.instruction-container {
    max-width: 1200px;
    margin: 0 auto;
}

.instruction-header {
    background: white;
    border-radius: 12px;
    padding: 32px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border: 1px solid #e5e7eb;
    margin-bottom: 24px;
    text-align: center;
}

.instruction-title {
    font-size: 32px;
    font-weight: 700;
    color: #667eea;
    margin-bottom: 12px;
}

.instruction-subtitle {
    font-size: 16px;
    color: #6b7280;
    margin: 0;
}

.instruction-accordion {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.instruction-item {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border: 1px solid #e5e7eb;
    overflow: hidden;
    transition: all 0.3s ease;
}

.instruction-item:hover {
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
    border-color: #667eea;
}

.instruction-item.active {
    border-color: #667eea;
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.2);
}

.instruction-item-header {
    padding: 20px 24px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    -webkit-transition: all 0.2s ease;
    -moz-transition: all 0.2s ease;
    -o-transition: all 0.2s ease;
    transition: all 0.2s ease;
    user-select: none;
}

.instruction-item-header:hover {
    background: #f9fafb;
}

.instruction-item.active .instruction-item-header {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.05) 100%);
}

.instruction-item-title {
    font-size: 18px;
    font-weight: 600;
    color: #111827;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.instruction-icon {
    width: 24px;
    height: 24px;
    color: #667eea;
    flex-shrink: 0;
}

.instruction-arrow {
    width: 20px;
    height: 20px;
    color: #6b7280;
    transition: transform 0.3s ease;
    flex-shrink: 0;
}

.instruction-item.active .instruction-arrow {
    color: #667eea;
    transform: rotate(180deg);
}

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

.instruction-item.active .instruction-item-content {
    max-height: 2000px;
}

.instruction-content-inner {
    padding: 0 24px 24px 24px;
    color: #374151;
    line-height: 1.7;
}

.instruction-content-inner p {
    margin: 0 0 16px 0;
    font-size: 15px;
}

.instruction-content-inner h4 {
    font-size: 16px;
    font-weight: 600;
    color: #111827;
    margin: 24px 0 12px 0;
}

.instruction-content-inner h4:first-child {
    margin-top: 0;
}

.instruction-content-inner ul {
    margin: 0 0 16px 0;
    padding-left: 24px;
    list-style-type: disc;
}

.instruction-content-inner li {
    margin: 8px 0;
    font-size: 15px;
    line-height: 1.6;
}

.instruction-content-inner li strong {
    color: #111827;
    font-weight: 600;
}

.instruction-content-inner em {
    font-style: italic;
    color: #6b7280;
}

/* Адаптивность для инструкции */
@media (max-width: 768px) {
    .instruction-header {
        padding: 24px 20px;
    }

    .instruction-title {
        font-size: 24px;
    }

    .instruction-subtitle {
        font-size: 14px;
    }

    .instruction-item-header {
        padding: 16px 20px;
    }

    .instruction-item-title {
        font-size: 16px;
    }

    .instruction-icon {
        width: 20px;
        height: 20px;
    }

    .instruction-content-inner {
        padding: 0 20px 20px 20px;
    }

    .instruction-content-inner p,
    .instruction-content-inner li {
        font-size: 14px;
    }
}

/* ========== ONLINE USERS IN HEADER (ADMIN) ========== */
.online-users-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    color: #333;
    border-radius: 8px;
    transition: all 0.3s ease;
    font-weight: 600;
    font-size: 0.95em;
    cursor: pointer;
    user-select: none;
    position: relative;
}

.online-users-header:hover {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    transform: translateY(-2px);
}

.online-users-header-text {
    white-space: nowrap;
}

.online-users-header-text span {
    color: #2563eb;
    font-weight: 700;
}

.online-users-header:hover .online-users-header-text span {
    color: white;
}

.online-users-chevron {
    font-size: 14px;
    transition: transform 0.2s ease;
}

.online-users-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 240px;
    max-width: calc(100vw - 40px);
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 10001;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    -webkit-transition: all 0.2s ease;
    -moz-transition: all 0.2s ease;
    -o-transition: all 0.2s ease;
    transition: all 0.2s ease;
    pointer-events: none;
}

.online-users-dropdown.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

.online-users-dropdown-body {
    padding: 10px 12px;
    max-height: 280px;
    overflow-y: auto;
}

.online-users-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.online-users-item {
    font-size: 13px;
    color: #374151;
    padding: 6px 8px;
    border-radius: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.online-users-item:hover {
    background: #f3f4f6;
}

.online-users-muted {
    font-size: 13px;
    color: #9ca3af;
    text-align: center;
    padding: 12px;
}

@media (max-width: 768px) {
    .online-users-header {
        padding: 8px 12px;
        font-size: 0.9em;
    }

    .online-users-dropdown {
        width: 200px;
        right: -10px;
    }
}