/* invoices.css - Компактный одноколоночный дизайн */
.olga-fin-invoices-wrapper {
    width: 100%;
    margin: 0 auto;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', system-ui, sans-serif;
}

/* === ФИЛЬТРЫ === */
.invoices-table-filter {
    margin-bottom: 30px;
    padding: 20px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    width: 100%;
    box-sizing: border-box;
}

.invoices-table-filter .filter-form {
    display: flex;
    gap: 15px;
    align-items: end;
    flex-wrap: wrap;
    width: 100%;
}

.invoices-table-filter .form-group {
    flex: 1;
    min-width: 200px;
}

.invoices-table-filter .form-group label {
    font-weight: 600;
    margin-bottom: 6px;
    color: #495057;
    font-size: 13px;
}

.invoices-table-filter .form-group select,
.invoices-table-filter .form-group input {
    width: 100%;
    border: 1px solid #ced4da;
    box-sizing: border-box;
    font-size: 14px;
    background: #ffffff;
    height: 44px;
    font-family: inherit;
}

.invoices-table-filter .form-group select:focus,
.invoices-table-filter .form-group input:focus {
    outline: none;
    border-color: #007cba;
    box-shadow: 0 0 0 2px rgba(0, 124, 186, 0.1);
}

.invoices-table-filter .form-actions {
    display: flex;
    gap: 10px;
    height: 44px;
}

.invoices-table-filter .filter-btn,
.invoices-table-filter .reset-btn {
    padding: 12px 20px;
    border: none;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    white-space: nowrap;
    font-size: 14px;
    font-weight: 500;
    min-width: 120px;
    height: 44px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    font-family: inherit;
}

.invoices-table-filter .filter-btn {
    background: #165470;
    color: white;
}

.invoices-table-filter .filter-btn:hover {
    background: #165470;
    transform: translateY(-1px);
}

.invoices-table-filter .reset-btn {
    background: #6c757d;
    color: white;
}

.invoices-table-filter .reset-btn:hover {
    background: #545b62;
    transform: translateY(-1px);
}

/* === ТАБЛИЦА СЧЕТОВ === */
.invoices-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border: 1px solid #dee2e6;
    margin-bottom: 20px;
    table-layout: fixed;
    display: table;
}

/* Заголовки таблицы */
.invoices-table .table-headers {
    display: table-row;
    background: #165470;
    color: white;
    font-weight: 600;
    font-size: 14px;
}

.invoices-table .table-header {
    display: table-cell;
    padding: 16px 12px;
    border-bottom: 1px solid #0d3a4f;
    text-align: left;
    vertical-align: middle;
}

/* Ширины колонок для СЧЕТОВ */
.invoices-table .header-number { width: 12%; min-width: 100px; }
.invoices-table .header-date { width: 10%; min-width: 90px; }
.invoices-table .header-due-date { width: 10%; min-width: 90px; }
.invoices-table .header-client { width: 20%; min-width: 150px; }
.invoices-table .header-overdue { width: 8%; min-width: 70px; text-align: center; }
.invoices-table .header-paid { width: 10%; min-width: 90px; text-align: right; }
.invoices-table .header-remaining { width: 10%; min-width: 90px; text-align: right; }
.invoices-table .header-total { width: 10%; min-width: 90px; text-align: right; }
.invoices-table .header-status { width: 10%; min-width: 100px; text-align: center; }

/* Тело таблицы */
.invoices-table .table-body {
    display: table-row-group;
}

/* Строки данных */
.invoices-table .invoice-row {
    display: table-row;
    background: white;
    border-bottom: 1px solid #dee2e6;
    transition: background-color 0.2s ease;
}

.invoices-table .invoice-row:hover {
    background-color: #f8f9fa;
    cursor: pointer;
}

/* Ячейки таблицы - выравнивание по левому краю */
.invoices-table .invoice-cell {
    display: table-cell;
    padding: 14px 12px;
    vertical-align: middle;
    font-size: 14px;
    color: #333;
    text-align: left;
    line-height: 1.4;
    border-bottom: 1px solid #dee2e6;
}

/* Стили для конкретных колонок */
.invoices-table .cell-number {
    font-weight: 600;
    color: #165470;
}

.invoices-table .cell-client {
    font-weight: 500;
    color: #333;
}

.invoices-table .cell-date,
.invoices-table .cell-due-date {
    color: #666;
}

.invoices-table .cell-overdue {
    text-align: center;
    font-weight: 600;
}

.invoices-table .cell-overdue.overdue {
    color: #e74c3c;
    padding: 4px 8px;
    margin: 0 8px;
}

.invoices-table .cell-paid,
.invoices-table .cell-remaining,
.invoices-table .cell-total {
    font-family: 'Courier New', monospace;
    font-weight: 600;
    text-align: right;
    color: #333;
}

.invoices-table .cell-total {
    color: #2c3e50;
    font-size: 15px;
}

/* Статусы счетов */
.invoices-table .cell-status {
    font-weight: 600;
    font-size: 12px;
    padding: 8px 12px;
    text-align: center;
    white-space: nowrap;
    box-sizing: border-box;
    vertical-align: middle;
    margin: 4px 8px;
    display: inline-block;
    min-width: 100px;
}

.invoices-table .cell-status::first-letter {
    text-transform: uppercase;
}

.status-draft {
    background: #f8f9fa;
    color: #6c757d;
    border: 1px solid #dee2e6;
}

.status-sent {
    background: #d1edff;
    color: #165470;
    border: 1px solid #a8d8ff;
}

.status-overdue {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.status-paid {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

/* === КНОПКА СОЗДАНИЯ СЧЕТА === */
.table-actions {
    margin-bottom: 20px;
    text-align: right;
}

#create-invoice-btn {
    background: #165470;
    color: white;
    border: none;
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
    font-family: inherit;
    min-width: 160px;
    justify-content: center;
}

#create-invoice-btn:hover {
    background: #165470;
    transform: translateY(-1px);
}

/* === ПАГИНАЦИЯ === */
.invoices-pagination {
    margin-top: 30px;
    text-align: center;
    width: 100%;
}

.invoices-pagination .page-numbers {
    display: inline-flex;
    gap: 5px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.invoices-pagination .page-numbers li {
    display: inline;
}

.invoices-pagination .page-numbers a,
.invoices-pagination .page-numbers span {
    padding: 8px 12px;
    border: 1px solid #dee2e6;
    text-decoration: none;
    color: #165470;
    font-weight: 500;
}

.invoices-pagination .page-numbers .current {
    background: #165470;
    color: white;
    border-color: #165470;
}

.invoices-pagination .page-numbers a:hover {
    background: #f8f9fa;
}

/* === СООБЩЕНИЕ ОТСУТСТВИЯ РЕЗУЛЬТАТОВ === */
.invoices-table .no-results {
    text-align: center;
    padding: 40px;
    color: #6c757d;
    font-style: italic;
    width: 100%;
    display: table-cell;
    font-size: 16px;
}

/* === МОДАЛЬНОЕ ОКНО СЧЕТА - ОДНА КОЛОНКА === */
.invoice-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 20px;
    animation: invoiceFadeIn 0.3s ease;
    overflow-y: auto;
}

.invoice-modal-overlay.active {
    display: flex;
}

.invoice-modal-container {
    background: white;
    width: 95%;
    max-width: 1000px;
    max-height: 95vh;
    display: flex;
    flex-direction: column;
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    animation: invoiceSlideUp 0.3s ease;
    overflow: hidden;
    margin: auto;
}

/* Заголовок модалки */
.invoice-modal-header {
    padding: 20px 30px;
    border-bottom: 1px solid #dee2e6;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #165470;
    color: white;
    flex-shrink: 0;
    position: relative;
    z-index: 100;
}

.invoice-modal-title {
    margin: 0;
    font-size: 22px;
    font-weight: 600;
    color: white;
}

.invoice-modal-close {
    font-size: 28px;
    cursor: pointer;
    background: none;
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.3s ease;
    z-index: 101;
}

.invoice-modal-close:hover {
    background: rgba(255,255,255,0.1);
}

/* Основное содержимое */
.invoice-modal-body {
    padding: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}

.invoice-modal-content {
    flex: 1;
    overflow-y: auto;
    padding: 25px;
    min-height: 0;
}

/* Сетка основной информации */
.invoice-main-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 25px;
}

.invoice-form-group {
    display: flex;
    flex-direction: column;
}

.invoice-form-label {
    font-weight: 600;
    margin-bottom: 8px;
    color: #495057;
    font-size: 14px;
}

.invoice-form-input,
.invoice-form-select,
.invoice-form-textarea {
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
    transition: all 0.2s ease;
    background: white;
    width: 100%;
    box-sizing: border-box;
}

.invoice-form-input:focus,
.invoice-form-select:focus,
.invoice-form-textarea:focus {
    outline: none;
    border-color: #007cba;
    box-shadow: 0 0 0 2px rgba(0, 124, 186, 0.1);
}

.invoice-form-textarea {
    resize: vertical;
    min-height: 80px;
}

/* Секция позиций */
.invoice-items-section {
    margin-bottom: 25px;
}

.invoice-section-title {
    margin: 0 0 15px 0;
    color: #165470;
    font-size: 18px;
    font-weight: 600;
    padding-bottom: 8px;
    border-bottom: 2px solid #165470;
}

/* Контейнер для позиций */
.invoice-items-container {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    margin-bottom: 15px;
}

/* Строки позиций */
.invoice-items-header {
    display: grid;
    grid-template-columns: 2fr 100px 120px 120px 60px;
    gap: 10px;
    padding: 12px 15px;
    background: #165470;
    color: white;
    font-weight: 600;
    font-size: 13px;
    flex-shrink: 0;
}

.invoice-item-row {
    display: grid;
    grid-template-columns: 2fr 100px 120px 120px 60px;
    gap: 10px;
    padding: 12px 15px;
    border-bottom: 1px solid #e9ecef;
    align-items: center;
    background: white;
    transition: background-color 0.2s ease;
    position: relative;
}

.invoice-item-row:hover {
    background-color: #f8f9fa;
}

.invoice-item-row:last-child {
    border-bottom: none;
}

/* Поля ввода в таблицах */
.invoice-item-input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 13px;
    font-family: inherit;
    box-sizing: border-box;
    transition: border-color 0.2s ease;
    background: white;
}

.invoice-item-input:focus {
    outline: none;
    border-color: #007cba;
    box-shadow: 0 0 0 2px rgba(0, 124, 186, 0.1);
}

.invoice-item-input[readonly] {
    background-color: #f8f9fa;
    color: #6c757d;
    cursor: not-allowed;
}

/* Кнопки удаления в строках */
.invoice-item-delete {
    background: #dc3545;
    color: white;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    font-size: 12px;
    position: relative;
    z-index: 1;
}

.invoice-item-delete:hover {
    background: #c82333;
    transform: scale(1.05);
}

/* Кнопки добавления */
.invoice-add-item-btn {
    background: #165470;
    color: white;
    border: none;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.invoice-add-item-btn:hover {
    background: #165470;
    transform: translateY(-2px);
}

/* Секция платежей */
.invoice-payments-section {
    margin-bottom: 25px;
}

.invoice-payments-header {
    display: grid;
    grid-template-columns: 150px 200px 200px 1fr 40px;
    gap: 10px;
    padding: 12px 15px;
    background: #165470;
    color: white;
    font-weight: 600;
    font-size: 13px;
}

.invoice-payments-container {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    margin-bottom: 15px;
}

.invoice-payment-row {
    display: grid;
    grid-template-columns: 150px 200px 200px 1fr 40px;
    gap: 10px;
    padding: 12px 15px;
    border-bottom: 1px solid #e9ecef;
    align-items: center;
    background: white;
    transition: background-color 0.2s ease;
    position: relative;
}

.invoice-payment-row:hover {
    background-color: #f8f9fa;
}

.invoice-payment-row:last-child {
    border-bottom: none;
}

.invoice-payment-delete {
    background: #dc3545;
    color: white;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    font-size: 12px;
    position: relative;
    z-index: 1;
}

.invoice-payment-delete:hover {
    background: #c82333;
    transform: scale(1.05);
}

.invoice-add-payment-btn {
    background: #165470;
    color: white;
    border: none;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.invoice-add-payment-btn:hover {
    background: #138496;
    transform: translateY(-2px);
}

/* Финансовая информация - компактная */
.invoice-financial-section {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    padding: 20px;
    margin-top: 20px;
}

.invoice-financial-title {
    margin: 0 0 15px 0;
    color: #165470;
    font-size: 16px;
    font-weight: 600;
}

.invoice-totals-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
}

.invoice-total-row {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 10px;
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    text-align: center;
}

.invoice-total-label {
    font-weight: 600;
    color: #495057;
    font-size: 12px;
    text-transform: uppercase;
}

.invoice-total-value {
    font-weight: 700;
    font-family: 'Courier New', monospace;
    font-size: 16px;
    color: #2c3e50;
}

.invoice-total-row.main-total {
    background: #165470;
    border-color: #165470;
}

.invoice-total-row.main-total .invoice-total-label {
    color: white;
}

.invoice-total-row.main-total .invoice-total-value {
    color: white;
    font-size: 18px;
}

/* Футер модалки */
.invoice-modal-footer {
    padding: 20px 30px;
    border-top: 1px solid #dee2e6;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8f9fa;
    flex-shrink: 0;
}

.invoice-modal-footer-left {
    display: flex;
    gap: 10px;
}

.invoice-modal-footer-right {
    display: flex;
    gap: 10px;
}

.invoice-modal-btn {
    padding: 12px 24px;
    border: none;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 140px;
    position: relative;
}

.invoice-modal-primary {
    background: #165470;
    color: white;
}

.invoice-modal-primary:hover {
    background: #165470;
    transform: translateY(-2px);
}

.invoice-modal-secondary {
    background: #6c757d;
    color: white;
}

.invoice-modal-secondary:hover {
    background: #545b62;
    transform: translateY(-2px);
}

.invoice-modal-danger {
    background: #dc3545;
    color: white;
}

.invoice-modal-danger:hover {
    background: #c82333;
    transform: translateY(-2px);
}

.invoice-modal-success {
    background: #28a745;
    color: white;
}

.invoice-modal-success:hover {
    background: #218838;
    transform: translateY(-2px);
}

/* Анимации */
@keyframes invoiceFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes invoiceSlideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* === АДАПТИВНОСТЬ ДЛЯ МОБИЛЬНЫХ УСТРОЙСТВ === */

/* Планшетная версия */
@media (max-width: 992px) {
    .invoice-main-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .invoice-items-header {
        grid-template-columns: 1fr 60px 80px 60px 60px 80px 40px;
        font-size: 12px;
        gap: 8px;
        padding: 10px;
    }
    
    .invoice-item-row {
        grid-template-columns: 1fr 60px 80px 60px 60px 80px 40px;
        gap: 8px;
        padding: 10px;
        font-size: 12px;
    }
    
    .invoice-payments-header {
        grid-template-columns: 100px 100px 80px 1fr 40px;
        font-size: 12px;
    }
    
    .invoice-payment-row {
        grid-template-columns: 100px 100px 80px 1fr 40px;
        font-size: 12px;
    }
    
    .invoice-totals-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Мобильная версия (до 768px) */
@media (max-width: 768px) {
    /* Таблица счетов - преобразуем в карточки */
    .invoices-table {
        display: block;
        border: none;
        background: transparent;
    }
    
    .invoices-table .table-headers {
        display: none;
    }
    
    .invoices-table .table-body {
        display: block;
    }
    
    .invoices-table .invoice-row {
        display: block;
        margin-bottom: 15px;
        background: white;
        border: 1px solid #dee2e6;
        border-radius: 8px;
        box-shadow: 0 2px 4px rgba(0,0,0,0.05);
        overflow: hidden;
    }
    
    /* ВСЕ ячейки выравниваем по левому краю */
    .invoices-table .invoice-cell {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        padding: 12px 15px;
        border-bottom: 1px solid #f1f1f1;
        width: 100%;
        box-sizing: border-box;
        font-family: 'Segoe UI', system-ui, sans-serif;
        font-size: 14px;
        text-align: left !important;
    }
    
    .invoices-table .invoice-cell:last-child {
        border-bottom: none;
    }
    
    /* Числовые колонки тоже по левому краю */
    .invoices-table .cell-paid,
    .invoices-table .cell-remaining,
    .invoices-table .cell-total {
        text-align: left !important;
        font-family: 'Segoe UI', system-ui, sans-serif;
    }
    
    /* Добавляем заголовки для ячеек */
    .invoices-table .invoice-cell::before {
        content: attr(data-label);
        font-weight: 600;
        color: #165470;
        margin-right: 15px;
        min-width: 120px;
        font-size: 14px;
        flex-shrink: 0;
    }
    
    /* Особый стиль для статуса - в ряд с цветным бейджем */
    .invoices-table .cell-status {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 12px 15px;
    }
    .invoices-table .cell-status{
		margin: 0;
		border-radius: 0;
	}
    .invoices-table .cell-status::before {
        content: "Статус:";
        font-weight: 600;
        color: #165470;
        margin-right: 15px;
        font-size: 14px;
    }
    
    .invoices-table .cell-status .status-draft,
    .invoices-table .cell-status .status-sent,
    .invoices-table .cell-status .status-overdue,
    .invoices-table .cell-status .status-paid {
        min-width: 100px;
        text-align: center;
        padding: 8px 12px;
        font-weight: 600;
        font-size: 12px;

        display: inline-block;
        border: 1px solid transparent;
    }
    
    /* Цвета статусов */
    .status-draft {
        background: #f8f9fa !important;
        color: #6c757d !important;
        border-color: #dee2e6 !important;
    }
    
    .status-sent {
        background: #d1edff !important;
        color: #165470 !important;
        border-color: #a8d8ff !important;
    }
    
    .status-overdue {
        background: #f8d7da !important;
        color: #721c24 !important;
        border-color: #f5c6cb !important;
    }
    
    .status-paid {
        background: #d4edda !important;
        color: #155724 !important;
        border-color: #c3e6cb !important;
    }
    
    /* Фильтры на мобильных */
    .invoices-table-filter {
        padding: 15px;
        margin-bottom: 20px;
    }
    
    .invoices-table-filter .filter-form {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    
    .invoices-table-filter .form-group {
        min-width: 100%;
    }
    
    .invoices-table-filter .form-actions {
        width: 100%;
        height: auto;
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        margin-top: 10px;
        padding-top: 10px;
        border-top: 1px solid #dee2e6;
    }
    
    .invoices-table-filter .filter-btn,
    .invoices-table-filter .reset-btn {
        flex: 1;
        min-width: calc(50% - 4px);
        height: 42px;
        padding: 10px 15px;
        font-size: 14px;
        border-radius: 6px;
    }
    
    /* Кнопка создания счета */
    .table-actions {
        text-align: center;
    }
    
    #create-invoice-btn {
        width: 100%;
        justify-content: center;
        padding: 14px 20px;
        font-size: 15px;
    }
    
    /* Модальное окно */
    .invoice-modal-container {
        width: 100%;
        height: 100%;
        border-radius: 0;
        max-height: 100vh;
        margin: 0;
    }
    
    .invoice-modal-content {
        padding: 15px;
        padding-bottom: 80px; /* Место для кнопок */
    }
    
    .invoice-modal-header {
        padding: 15px 20px;
    }
    
    /* Кнопки в футере модалки - иконки по центру */
    .invoice-modal-footer {
        padding: 12px 15px;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        gap: 8px;
        min-height: 60px;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 100;
        background: #f8f9fa;
        border-top: 1px solid #dee2e6;
        box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    }
    
    .invoice-modal-footer-left,
    .invoice-modal-footer-right {
        display: flex;
        gap: 8px;
        flex: 1;
        min-width: 0;
    }
    
    .invoice-modal-footer-left {
        justify-content: flex-start;
    }
    
    .invoice-modal-footer-right {
        justify-content: flex-end;
    }
    
    .invoice-modal-btn {
        min-width: 44px;
        width: 44px;
        height: 44px;
        padding: 0;
        border-radius: 8px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 0;
        position: relative;
        overflow: visible;
    }
    
    /* Иконки для кнопок - идеальный центр */
    .invoice-modal-btn i,
    .invoice-modal-btn::before {
        font-size: 18px;
        line-height: 1;
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        margin: 0;
        padding: 0;
    }
    
    /* Если используются иконки FontAwesome */
    .invoice-modal-btn i {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 100%;
        height: 100%;
    }
    
    /* Если используются псевдоэлементы */
    .invoice-modal-primary::before {
        content: "✓";
    }
    
    .invoice-modal-secondary::before {
        content: "✕";
    }
    
    .invoice-modal-danger::before {
        content: "🗑";
    }
    
    .invoice-modal-success::before {
        content: "💳";
    }
    
    /* Tooltip при наведении */
    .invoice-modal-btn:hover::after {
        content: attr(title);
        position: absolute;
        bottom: 100%;
        left: 50%;
        transform: translateX(-50%);
        background: rgba(0, 0, 0, 0.8);
        color: white;
        padding: 6px 10px;
        border-radius: 4px;
        font-size: 12px;
        white-space: nowrap;
        margin-bottom: 5px;
        z-index: 1000;
        pointer-events: none;
    }
    
    /* Позиции и платежи - преобразуем в карточки с заголовками */
    .invoice-items-header,
    .invoice-payments-header {
        display: none !important;
    }
    
    .invoice-items-container,
    .invoice-payments-container {
        max-height: none;
        border: none;
        padding: 0;
        background: transparent;
    }
    
    /* Создаем карточки для позиций */
    .invoice-item-row {
        display: flex !important;
        flex-direction: column !important;
        gap: 15px !important;
        padding: 20px !important;
        margin-bottom: 15px !important;
        border: 1px solid #dee2e6 !important;
        border-radius: 10px !important;
        background: #f8f9fa !important;
        position: relative !important;
    }
    
    /* Кнопка удаления внутри карточки позиции */
    .invoice-item-delete {
        position: absolute !important;
        top: 15px !important;
        right: 15px !important;
        width: 40px !important;
        height: 40px !important;
        border-radius: 8px !important;
        background: #dc3545 !important;
        color: white !important;
        border: none !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        cursor: pointer !important;
        font-size: 16px !important;
        z-index: 2 !important;
    }
    
    .invoice-item-delete i {
        font-size: 16px !important;
    }
    
    /* Каждое поле позиции */
    .invoice-item-field {
        display: flex !important;
        flex-direction: column !important;
        gap: 6px !important;
        width: 100% !important;
        position: relative !important;
    }
    
    /* Добавляем заголовки к полям позиций */
    .invoice-item-field::before {
        content: attr(data-label) !important;
        font-weight: 600 !important;
        color: #165470 !important;
        font-size: 13px !important;
        margin-bottom: 2px !important;
        display: block !important;
    }
    
    /* Поля ввода позиций */
    .invoice-item-input {
        width: 100% !important;
        padding: 12px 15px !important;
        border: 1px solid #ced4da !important;
        border-radius: 8px !important;
        font-size: 14px !important;
        background: white !important;
        box-sizing: border-box !important;
    }
    
    /* Создаем карточки для платежей */
    .invoice-payment-row {
        display: flex !important;
        flex-direction: column !important;
        gap: 15px !important;
        padding: 20px !important;
        margin-bottom: 15px !important;
        border: 1px solid #dee2e6 !important;
        border-radius: 10px !important;
        background: #f8f9fa !important;
        position: relative !important;
    }
    
    /* Кнопка удаления внутри карточки платежа */
    .invoice-payment-delete {
        position: absolute !important;
        top: 15px !important;
        right: 15px !important;
        width: 40px !important;
        height: 40px !important;
        border-radius: 8px !important;
        background: #dc3545 !important;
        color: white !important;
        border: none !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        cursor: pointer !important;
        font-size: 16px !important;
        z-index: 2 !important;
    }
    
    .invoice-payment-delete i {
        font-size: 16px !important;
    }
    
    /* Каждое поле платежа */
    .invoice-payment-field {
        display: flex !important;
        flex-direction: column !important;
        gap: 6px !important;
        width: 100% !important;
        position: relative !important;
    }
    
    /* Добавляем заголовки к полям платежей */
    .invoice-payment-field::before {
        content: attr(data-label) !important;
        font-weight: 600 !important;
        color: #165470 !important;
        font-size: 13px !important;
        margin-bottom: 2px !important;
        display: block !important;
    }
    
    /* Поля ввода платежей */
    .invoice-payment-row input {
        width: 100% !important;
        padding: 12px 15px !important;
        border: 1px solid #ced4da !important;
        border-radius: 8px !important;
        font-size: 14px !important;
        background: white !important;
        box-sizing: border-box !important;
    }
    
    /* Финансовая информация */
    .invoice-financial-section {
        padding: 15px;
        margin-top: 15px;
    }
    
    .invoice-totals-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .invoice-total-row {
        padding: 12px;
    }
    
    .invoice-total-value {
        font-size: 15px;
    }
    
    .invoice-total-row.main-total .invoice-total-value {
        font-size: 16px;
    }
}

/* Мобильная версия (до 480px) */
@media (max-width: 480px) {
    /* Таблица счетов */
    .invoices-table .invoice-cell {
        flex-direction: column;
        align-items: flex-start;
        padding: 12px;
        gap: 6px;
    }
    
    .invoices-table .invoice-cell::before {
        margin-bottom: 0;
        min-width: 100%;
        font-size: 13px;
        margin-right: 0;
    }
    
    .invoices-table .invoice-cell > *:not(::before) {
        width: 100%;
        text-align: left;
        font-size: 14px;
        color: #333;
    }
    
    /* Статус на очень маленьких экранах */
    .invoices-table .cell-status {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .invoices-table .cell-status::before {
        margin-bottom: 0;
        margin-right: 0;
        width: 100%;
    }
    
    .invoices-table .cell-status .status-draft,
    .invoices-table .cell-status .status-sent,
    .invoices-table .cell-status .status-overdue,
    .invoices-table .cell-status .status-paid {
        width: 100%;
        text-align: center;
        padding: 10px;
    }
    
    /* Фильтры */
    .invoices-table-filter .filter-btn,
    .invoices-table-filter .reset-btn {
        min-width: 100%;
        margin-bottom: 8px;
    }
    
    .invoices-table-filter .filter-btn:last-child,
    .invoices-table-filter .reset-btn:last-child {
        margin-bottom: 0;
    }
    
    /* Пагинация */
    .invoices-pagination .page-numbers {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .invoices-pagination .page-numbers a,
    .invoices-pagination .page-numbers span {
        padding: 6px 8px;
        font-size: 13px;
        min-width: 36px;
    }
    
    /* Модальное окно */
    .invoice-modal-content {
        padding: 12px;
        padding-bottom: 70px;
    }
    
    .invoice-modal-footer {
        padding: 10px 12px;
        gap: 6px;
    }
    
    .invoice-modal-footer-left,
    .invoice-modal-footer-right {
        gap: 6px;
    }
    
    .invoice-modal-btn {
        width: 40px;
        height: 40px;
    }
    
    .invoice-modal-btn i,
    .invoice-modal-btn::before {
        font-size: 16px;
    }
    
    /* Позиции и платежи */
    .invoice-item-row,
    .invoice-payment-row {
        padding: 15px;
        margin-bottom: 12px;
    }
    
    .invoice-item-input,
    .invoice-payment-row input {
        padding: 10px 12px;
        font-size: 13px;
    }
    
    .invoice-item-delete,
    .invoice-payment-delete {
        width: 36px;
        height: 36px;
        top: 12px;
        right: 12px;
    }
}

/* Очень маленькие экраны (до 360px) */
@media (max-width: 360px) {
    .invoices-table .invoice-cell {
        padding: 10px;
    }
    
    .invoices-table .invoice-cell::before {
        font-size: 12px;
    }
    
    .invoices-table .invoice-cell > *:not(::before) {
        font-size: 13px;
    }
    
    .invoices-table .cell-status .status-draft,
    .invoices-table .cell-status .status-sent,
    .invoices-table .cell-status .status-overdue,
    .invoices-table .cell-status .status-paid {
        font-size: 11px;
        padding: 8px;
    }
    
    .invoice-modal-btn {
        width: 36px;
        height: 36px;
        min-width: 36px;
    }
    
    .invoice-modal-btn i,
    .invoice-modal-btn::before {
        font-size: 14px;
    }
}

/* Ландшафтная ориентация на мобильных */
@media (max-height: 500px) and (orientation: landscape) {
    .invoice-modal-container {
        max-height: 90vh;
    }
    
    .invoice-modal-content {
        max-height: calc(90vh - 120px);
        overflow-y: auto;
    }
    
    .invoice-modal-footer {
        position: fixed;
    }
}

/* Скрытие скроллбара для Webkit браузеров */
.invoice-items-container::-webkit-scrollbar,
.invoice-payments-container::-webkit-scrollbar,
.invoice-modal-content::-webkit-scrollbar {
    width: 6px;
}

.invoice-items-container::-webkit-scrollbar-track,
.invoice-payments-container::-webkit-scrollbar-track,
.invoice-modal-content::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.invoice-items-container::-webkit-scrollbar-thumb,
.invoice-payments-container::-webkit-scrollbar-thumb,
.invoice-modal-content::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.invoice-items-container::-webkit-scrollbar-thumb:hover,
.invoice-payments-container::-webkit-scrollbar-thumb:hover,
.invoice-modal-content::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Предотвращение скролла body при открытой модалке */
body.invoice-modal-open {
    overflow: hidden;
}

/* Стили для уведомлений */
.invoice-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10001;
    min-width: 300px;
    max-width: 500px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    animation: notificationSlideIn 0.3s ease;
    border-left: 4px solid #007cba;
}

.invoice-notification.success {
    border-left-color: #28a745;
}

.invoice-notification.error {
    border-left-color: #dc3545;
}

.invoice-notification.info {
    border-left-color: #165470;
}

.invoice-notification-content {
    padding: 15px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.invoice-notification-icon {
    font-size: 20px;
}

.invoice-notification.success .invoice-notification-icon {
    color: #28a745;
}

.invoice-notification.error .invoice-notification-icon {
    color: #dc3545;
}

.invoice-notification.info .invoice-notification-icon {
    color: #165470;
}

.invoice-notification-message {
    font-weight: 500;
    color: #333;
}

@keyframes notificationSlideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* === СТИЛИ ДЛЯ ЗАГОЛОВКОВ ПОЛЕЙ НА МОБИЛЬНЫХ === */
@media (max-width: 768px) {
    .mobile-field-container {
        display: flex !important;
        flex-direction: column !important;
        gap: 4px !important;
        width: 100% !important;
        margin-bottom: 12px !important;
    }
    
    .mobile-field-label {
        font-weight: 600 !important;
        color: #165470 !important;
        font-size: 13px !important;
        margin-bottom: 2px !important;
        display: block !important;
    }
    
    /* Преобразуем строки таблицы в карточки */
    .invoice-item-row,
    .invoice-payment-row {
        display: flex !important;
        flex-direction: column !important;
        gap: 15px !important;
        padding: 20px !important;
        margin-bottom: 15px !important;
        border: 1px solid #dee2e6 !important;
        border-radius: 10px !important;
        background: #f8f9fa !important;
        position: relative !important;
    }
    
    /* Скрываем заголовки таблиц */
    .invoice-items-header,
    .invoice-payments-header {
        display: none !important;
    }
    
    /* Контейнеры для скролла */
    .invoice-items-container,
    .invoice-payments-container {
        max-height: none !important;
        border: none !important;
        padding: 0 !important;
        background: transparent !important;
    }
    
    /* Поля ввода в карточках */
    .invoice-item-row input,
    .invoice-item-row select,
    .invoice-item-row textarea,
    .invoice-payment-row input,
    .invoice-payment-row select,
    .invoice-payment-row textarea {
        width: 100% !important;
        padding: 10px 12px !important;
        border: 1px solid #ced4da !important;
        border-radius: 6px !important;
        font-size: 14px !important;
        background: white !important;
        box-sizing: border-box !important;
    }
    
    /* Кнопки удаления */
    .invoice-item-delete,
    .invoice-payment-delete {
        align-self: flex-end !important;
        margin-top: 10px !important;
        width: 40px !important;
        height: 40px !important;
        border-radius: 8px !important;
        background: #dc3545 !important;
        color: white !important;
        border: none !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        cursor: pointer !important;
        position: relative !important;
        top: auto !important;
        right: auto !important;
    }
    
    .invoice-item-delete i,
    .invoice-payment-delete i {
        font-size: 16px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
}

/* === ИСПРАВЛЕНИЯ ДЛЯ РАБОТЫ КНОПОК УДАЛЕНИЯ === */

/* Для простого подхода - добавляем заголовки через псевдоэлементы */
@media (max-width: 768px) {
    .invoice-item-row,
    .invoice-payment-row {
        display: flex !important;
        flex-direction: column !important;
        gap: 15px !important;
        padding: 20px !important;
        margin-bottom: 15px !important;
        border: 1px solid #dee2e6 !important;
        border-radius: 10px !important;
        background: #f8f9fa !important;
        position: relative !important;
    }
    
    /* Скрываем заголовки таблиц */
    .invoice-items-header,
    .invoice-payments-header {
        display: none !important;
    }
    
    /* Контейнеры для полей с заголовками */
    .field-with-label {
        display: flex !important;
        flex-direction: column !important;
        gap: 6px !important;
        width: 100% !important;
    }
    
    /* Заголовки через CSS */
    .invoice-item-row > div:not(.invoice-item-delete),
    .invoice-payment-row > div:not(.invoice-payment-delete) {
        position: relative;
        padding-top: 22px;
    }
    
    .invoice-item-row > div:not(.invoice-item-delete)::before,
    .invoice-payment-row > div:not(.invoice-payment-delete)::before {
        content: attr(data-label);
        position: absolute;
        top: 0;
        left: 0;
        font-weight: 600;
        color: #165470;
        font-size: 13px;
        margin-bottom: 4px;
    }
    
    /* Поля ввода */
    .invoice-item-row input,
    .invoice-item-row select,
    .invoice-item-row textarea,
    .invoice-payment-row input,
    .invoice-payment-row select,
    .invoice-payment-row textarea {
        width: 100% !important;
        padding: 10px 12px !important;
        border: 1px solid #ced4da !important;
        border-radius: 6px !important;
        font-size: 14px !important;
        background: white !important;
        box-sizing: border-box !important;
    }
    
    /* Кнопки удаления - остаются на своих местах и работают */
    .invoice-item-delete,
    .invoice-payment-delete {
        align-self: flex-end !important;
        margin-top: 10px !important;
        width: 40px !important;
        height: 40px !important;
        border-radius: 8px !important;
        background: #dc3545 !important;
        color: white !important;
        border: none !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        cursor: pointer !important;
        position: relative !important;
        top: auto !important;
        right: auto !important;
        z-index: 2 !important;
    }
    
    .invoice-item-delete i,
    .invoice-payment-delete i {
        font-size: 16px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
    
    /* Если используется JavaScript подход */
    .mobile-item-card,
    .mobile-payment-card {
        position: relative;
    }
    
    .mobile-item-card .invoice-item-delete,
    .mobile-payment-card .invoice-payment-delete {
        position: static !important;
        margin-left: auto !important;
    }
}