/* --- ОБЩИЕ СТИЛИ (СВЕТЛАЯ ТЕМА) --- */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    display: flex;
    flex-direction: column; /* Изменено для позиционирования хедера */
    align-items: center;
    margin: 0;
    background-color: #f0f2f5; /* Светлый фон */
    color: #1c1c1e; /* Темный текст по умолчанию */
}

/* --- Стили для формы входа --- */
.login-container {
    padding: 2rem;
    background: #ffffff; /* Белый фон для контейнера */
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 400px;
    box-sizing: border-box;
    margin-top: 5rem; /* Отступ сверху */
}

h1 {
    text-align: center;
    color: #1c1c1e;
    margin-bottom: 1.5rem;
}

.input-group {
    margin-bottom: 1rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    color: #555;
    font-weight: 500;
}

input[type="text"],
input[type="password"] {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
    font-size: 1rem;
    background-color: #f8f8f8;
    color: #1c1c1e;
}

button {
    width: 100%;
    padding: 0.75rem;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s;
}

button:hover {
    background-color: #0056b3;
}

#error-message {
    color: #d93025;
    text-align: center;
    margin-top: 1rem;
    min-height: 1.2em;
}

/* --- Стили для Дашборда --- */
.header-container {
    width: 100%;
    max-width: 900px;
    background: #ffffff;
    padding: 1rem 2rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-sizing: border-box;
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    border-bottom: 1px solid #e5e5e5;
}

.user-info {
    font-size: 0.9rem;
    color: #333;
}

#logout-button {
    width: auto;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

.main-container {
    width: 100%;
    max-width: 900px;
    margin-top: 80px; /* Отступ от фиксированного хедера */
    padding: 2rem;
    box-sizing: border-box;
}

.main-container section {
    margin-bottom: 2.5rem;
}

.main-container h2 {
    font-size: 1.1rem;
    color: #6c757d; /* Приглушенный цвет заголовков секций */
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 1rem;
    padding-bottom: 0;
    border-bottom: none;
}

.cards-container, .buttons-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Стили для карточек производства (светлая тема) */
.processor-card {
    background: #ffffff; /* Белый фон */
    color: #1c1c1e; /* Темный текст */
    padding: 1.25rem 1.5rem;
    border-radius: 12px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    border: 1px solid #e5e5e5; /* Светлая граница */
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.processor-card:hover {
    border-color: #c8c8c8;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    transform: translateY(-3px);
}

.processor-card .card-title {
    font-size: 1.5rem;
    font-weight: bold;
    display: block;
    margin-bottom: 0.25rem;
}

.processor-card .card-subtitle {
    font-size: 1rem;
    color: #6c757d; /* Серый цвет для подзаголовка */
}

/* Стили для кнопок управления (светлая тема) */
.btn-primary, .btn-secondary {
    width: 100%;
    padding: 1rem;
    font-size: 1.1rem;
    font-weight: 500;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    text-align: center;
    transition: background-color 0.2s;
}

.btn-primary {
    background-color: #007bff;
    color: white;
}
.btn-primary:hover {
    background-color: #0069d9;
}

.btn-secondary {
    background-color: #e9ecef; /* Светло-серый фон */
    color: #007bff; /* Синий текст */
    border: 1px solid #dee2e6;
}
.btn-secondary:hover {
    background-color: #dde1e5;
}

/* Стили для экрана со списком партий (светлая тема) */
.batch-view-header {
    display: flex;
    align-items: center;
    margin-bottom: 1.5rem;
}

#back-to-selection-button {
    background: #e9ecef;
    border: 1px solid #dee2e6;
    color: #1c1c1e;
    font-size: 1.5rem;
    padding: 0.2rem 0.8rem;
    margin-right: 1rem;
    border-radius: 8px;
    cursor: pointer;
    line-height: 1;
}

#back-to-selection-button:hover {
    background-color: #dde1e5;
}

#batch-view-title {
    margin: 0;
    color: #1c1c1e;
    text-transform: none;
    letter-spacing: 0;
}

/* Стили для элемента партии (светлая тема) */
#batch-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.batch-item {
    background: #ffffff;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    transition: box-shadow 0.2s;
    border: 1px solid #e5e5e5;
}

.batch-item:hover {
    box-shadow: 0 6px 16px rgba(0,0,0,0.12);
}

.batch-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #eee;
    padding-bottom: 1rem;
    margin-bottom: 1rem;
}

.batch-product-name {
    font-size: 1.25rem;
    font-weight: bold;
    color: #007bff;
}

.batch-date {
    font-size: 0.9rem;
    color: #6c757d;
}

.batch-details p {
    margin: 0.5rem 0;
    color: #333;
}

.batch-details ul {
    margin: 0.5rem 0;
    padding-left: 1.5rem;
}

.no-batches-message, .error-message {
    text-align: center;
    color: #6c757d;
    font-size: 1.1rem;
    padding: 2rem;
}

/* Стили для CRUD-экранов */
.crud-list-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.crud-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background-color: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
}

.crud-input {
    flex-grow: 1; /* Занимает все доступное место */
    padding: 0.75rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1.1rem;
}

.btn-save {
    width: auto;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    background-color: #28a745;
}
.btn-save:hover {
    background-color: #218838;
}
/* Стили для формы добавления */
.add-item-form {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid #e5e5e5;
}

/* Стили для кнопки смены статуса */
.btn-toggle-status {
    width: auto;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    background-color: #ffc107;
    color: #1c1c1e;
}
.btn-toggle-status:hover {
    background-color: #e0a800;
}

/* Стиль для неактивных элементов */
.crud-item.inactive {
    background-color: #f8f9fa;
}
.crud-item.inactive .crud-input {
    text-decoration: line-through;
    color: #6c757d;
}
/* Стили для финансового экрана */
#finance-view h3 {
    font-size: 1.2rem;
    color: #333;
    margin-top: 2rem;
    margin-bottom: 1rem;
}

#finance-view .add-item-form input[type="date"] {
    padding: 0.65rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1rem;
}

.period-name {
    font-weight: bold;
    flex-grow: 1;
}

.period-dates {
    color: #6c757d;
    margin-right: 1rem;
}
/* --- НОВЫЕ СТИЛИ ДЛЯ РАЗДЕЛА ЗАТРАТ --- */
#period-details-view section { padding: 1.5rem; background-color: #fff; border: 1px solid #e5e5e5; border-radius: 8px; margin-bottom: 2rem; }
#period-details-view h3 { margin-top: 0; }
.form-grid-item { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; align-items: center; margin-bottom: 1rem; }
.form-grid-item label { font-weight: 500; text-align: right; }
.form-actions { margin-top: 1.5rem; display: flex; justify-content: flex-end; }
.form-actions .btn-save { width: auto; min-width: 200px; }

.add-expense-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    align-items: center;
    padding-bottom: 1.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid #e5e5e5;
}
.add-expense-form select, .add-expense-form input {
    padding: 0.75rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1rem;
}
.hidden { display: none; }

.expense-item {
    display: grid;
    grid-template-columns: 2fr 2fr 1fr auto;
    gap: 1rem;
    align-items: center;
    padding: 0.75rem;
    border-bottom: 1px solid #f0f2f5;
}
.expense-item:last-child { border-bottom: none; }
.expense-item span { display: block; }
.expense-category { font-weight: 500; }
.expense-shop { color: #6c757d; }
.expense-amount { font-weight: bold; text-align: right; }
.expense-comment { grid-column: 1 / -2; font-size: 0.9rem; color: #888; padding-left: 0.5rem; }
.btn-delete { background-color: #dc3545; padding: 0.5rem 1rem; width: auto; }
.btn-delete:hover { background-color: #c82333; }
/* --- Стили для новой формы массового ввода затрат --- */
.expense-controls {
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}
.expense-controls select {
    padding: 0.75rem;
    font-size: 1rem;
    flex-grow: 1;
    border-radius: 4px;
    border: 1px solid #ccc;
}
#expense-bulk-list-container h4 { /* Заголовки категорий */
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    color: #007bff;
    border-bottom: 1px solid #e5e5e5;
    padding-bottom: 0.5rem;
}
.expense-bulk-item {
    display: grid;
    grid-template-columns: 1fr 150px;
    gap: 1rem;
    align-items: center;
    padding: 0.5rem 0;
}
.expense-bulk-item label {
    font-weight: normal;
}
.expense-bulk-item input {
    padding: 0.5rem;
    font-size: 1rem;
    text-align: right;
    border: 1px solid #ccc;
    border-radius: 4px;
}
/* --- Стили для таблицы отчета --- */
#report-container { background-color: #fff; padding: 2rem; border-radius: 8px; border: 1px solid #e5e5e5; }
.report-table { width: 90%; border-collapse: collapse; margin-top: 1rem; }
.report-table th, .report-table td { border: 1px solid #dee2e6; padding: 0.75rem; text-align: right; }
.report-table th { background-color: #f8f9fa; font-weight: bold; }
.report-table td:first-child, .report-table th:first-child { text-align: left; }
.report-table .total-row { font-weight: bold; background-color: #f1f3f5; }
.report-table .profit-positive { color: #28a745; }
.report-table .profit-negative { color: #dc3545; }

.expense-bulk-item {
    /* Меняем на grid с 3 колонками для добавления поля месяца */
    grid-template-columns: 1fr 150px 120px;
}
.expense-bulk-item.pro-rated {
    /* Убираем 3-ю колонку для обычных затрат */
    grid-template-columns: 1fr 150px;
}
.expense-month-input {
    padding: 0.5rem;
    font-size: 0.9rem;
    border: 1px solid #ccc;
    border-radius: 4px;
}
/* --- Стили для страницы сравнения --- */
.comparison-controls {
    display: flex;
    gap: 2rem;
    align-items: flex-end;
    background-color: #fff;
    padding: 1.5rem;
    border-radius: 8px;
    border: 1px solid #e5e5e5;
    margin-bottom: 2rem;
}
.period-selector {
    flex-grow: 1;
}
.period-selector label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}
.period-selector select {
    width: 100%;
    padding: 0.75rem;
    font-size: 1rem;
    border-radius: 4px;
    border: 1px solid #ccc;
}
.comparison-controls .btn-primary {
    width: auto;
    height: fit-content;
}
.diff-positive {
    color: #28a745; /* Зеленый для роста */
}
.diff-negative {
    color: #dc3545; /* Красный для падения */
}
.diff-neutral {
    color: #6c757d; /* Серый для отсутствия изменений */
}

/* style.css, в конец файла */

.summary-card {
    background: #ffffff;
    border: 1px solid #e5e5e5;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}
.summary-card-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding-bottom: 1rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid #eee;
}
.summary-card-title {
    font-size: 1.5rem;
    font-weight: bold;
}
.summary-card-dates {
    font-size: 0.9rem;
    color: #6c757d;
}
.summary-card-body {
    display: grid;
    gap: 0.75rem;
}
.summary-metric {
    display: flex;
    justify-content: space-between;
    font-size: 1.1rem;
}
.summary-metric.total-row {
    font-weight: bold;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid #eee;
}
.summary-card-footer {
    margin-top: 1.5rem;
    text-align: right;
}
.open-details-link {
    color: #007bff;
    text-decoration: none;
    font-weight: 500;
}
.open-details-link:hover {
    text-decoration: underline;
}
/* --- Стили для нового отчета по стайне --- */

.farm-report-cards-container {
    gap: 1.5rem; /* Увеличим отступ между карточками отчета */
}

/* Добавляем цветные акценты слева для каждого типа события */
.summary-card.event-purchase {
    border-left: 5px solid #28a745; /* Зеленый для закупки */
}
.summary-card.event-consumption-period {
    border-left: 5px solid #007bff; /* Синий для кормления */
}
.summary-card.event-mortality {
    border-left: 5px solid #ffc107; /* Желтый для падежа */
}

/* Стили для списка кормов внутри карточки */
.consumption-items {
    list-style: none;
    padding: 0;
    margin: 0 0 1rem 0;
    display: grid;
    gap: 0.5rem;
}
.consumption-items li {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid #f0f2f5;
}
.consumption-items li:last-child {
    border-bottom: none;
}

/* Стили для итоговой суммы внизу отчета */
.report-grand-total {
    margin-top: 2rem;
    padding: 1.5rem;
    background-color: #f8f9fa;
    border-radius: 12px;
    font-size: 1.5rem;
}
/* --- Стили для модального окна --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}
.modal-content {
    background: #ffffff;
    padding: 2rem;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e5e5e5;
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
}
.modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
}
.close-button {
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: #6c757d;
    padding: 0;
    width: auto;
}
.modal-body form label {
    margin-top: 1rem;
}
.modal-body form input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
    font-size: 1rem;
}
/* Стиль для кнопок опасных действий */
.btn-danger {
    width: auto;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    background-color: #dc3545; /* Красный цвет */
    color: white;
}
.btn-danger:hover {
    background-color: #c82333;
}

/* Применяем к report-table, который используется в обоих отчетах */
.report-table {
    border-spacing: 0; /* Убираем двойные рамки */
    margin-top: 1.5rem;
}

.report-table th {
    font-weight: 600; /* Более жирный заголовок */
    background-color: #f8f9fa;
    border-bottom: 2px solid #dee2e6; /* Четкая линия под заголовком */
}

/* Выравнивание ячеек */
.report-table td, .report-table th {
    padding: 0.8rem 1rem; /* Увеличим отступы для воздуха */
    vertical-align: middle;
}

/* Все ячейки, кроме первой (название) и последней (действия), выравниваем по правому краю */
.report-table td:not(:first-child):not(:last-child),
.report-table th:not(:first-child):not(:last-child) {
    text-align: right;
    /* ЗАПРЕЩАЕМ ПЕРЕНОС СТРОК ДЛЯ ЧИСЕЛ */
    white-space: nowrap; 
}

/* "Зебра" для строк, чтобы легче было следить за данными */
.report-table tbody tr:nth-child(odd) {
    background-color: #fdfdfd;
}

/* Подсветка строки при наведении */
.report-table tbody tr:hover {
    background-color: #f1f3f5;
}

/* Стиль для дробной части чисел (копеек) */
.fractional-part {
    font-size: 0.8em;
    color: #6c757d; /* Серый, менее навязчивый цвет */
    margin-left: 2px;
}

/* Выделяем главные колонки */
.report-table .total-row {
    font-weight: 600; /* Делаем жирным */
    background-color: #f8f9fa; /* Таким же цветом, как заголовок */
}

/* Улучшаем вид кнопок в таблице */
.report-table .btn-secondary,
.report-table .btn-danger {
    padding: 5px 12px !important;
    font-size: 0.9rem !important;
    white-space: nowrap;
}
/* --- СТИЛИ ДЛЯ УЛУЧШЕНИЯ ЧИТАЕМОСТИ ТАБЛИЦ ОТЧЕТОВ --- */

/* Применяем к report-table, который используется в обоих отчетах */
.report-table {
    border-spacing: 0; /* Убираем двойные рамки */
    margin-top: 1.5rem;
}

.report-table th {
    font-weight: 600; /* Более жирный заголовок */
    background-color: #f8f9fa;
    border-bottom: 2px solid #dee2e6; /* Четкая линия под заголовком */
}

/* Выравнивание ячеек */
.report-table td, .report-table th {
    padding: 0.8rem 1rem; /* Увеличим отступы для воздуха */
    vertical-align: middle;
}

/* Все ячейки, кроме первой (название) и последней (действия), выравниваем по правому краю */
.report-table td:not(:first-child):not(:last-child),
.report-table th:not(:first-child):not(:last-child) {
    text-align: right;
    /* ЗАПРЕЩАЕМ ПЕРЕНОС СТРОК ДЛЯ ЧИСЕЛ */
    white-space: nowrap; 
}

/* "Зебра" для строк, чтобы легче было следить за данными */
.report-table tbody tr:nth-child(odd) {
    background-color: #fdfdfd;
}

/* Подсветка строки при наведении */
.report-table tbody tr:hover {
    background-color: #f1f3f5;
}

/* Стиль для дробной части чисел (копеек) */
.fractional-part {
    font-size: 0.8em;
    color: #6c757d; /* Серый, менее навязчивый цвет */
    margin-left: 2px;
}

/* Выделяем главные колонки */
.report-table .total-row {
    font-weight: 600; /* Делаем жирным */
    background-color: #f8f9fa; /* Таким же цветом, как заголовок */
}

/* Улучшаем вид кнопок в таблице */
.report-table .btn-secondary,
.report-table .btn-danger {
    padding: 5px 12px !important;
    font-size: 0.9rem !important;
    white-space: nowrap;
}


.balance-controls, .history-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}
#total-balance-container {
    margin-bottom: 1.5rem;
    font-size: 1.2rem;
    padding: 1rem;
}
.needs-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.need-card { padding: 1rem; border: 1px solid #e5e5e5; border-radius: 8px; background: #f8f9fa; }
.need-card h4 { margin: 0 0 0.5rem 0; display: flex; justify-content: space-between; }
.need-card .btn-delete-need { background: none; border: none; color: #dc3545; cursor: pointer; padding: 0; width: auto; font-size: 1.2rem; }
.need-summary p { margin: 0.25rem 0; font-size: 0.9rem; display: flex; justify-content: space-between; }
.add-need-form { display: flex; gap: 1rem; margin-top: 1.5rem; }
.add-need-form select, .add-need-form input { padding: 0.5rem; font-size: 1rem; border: 1px solid #ccc; border-radius: 4px; }
.add-need-form select { flex-grow: 1; }
.add-need-form button { width: auto; }

#allocation-table-container table { width: 100%; }
#allocation-table-container input { width: 90%; padding: 4px; text-align: right; border: 1px solid #ccc; border-radius: 4px; }

.history-card {
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    margin-bottom: 1rem;
}
.history-card summary {
    padding: 1rem 1.5rem;
    font-size: 1.1rem;
    cursor: pointer;
    outline: none;
}
.history-card[open] summary {
    border-bottom: 1px solid #e5e5e5;
}
.history-card-content {
    padding: 0.5rem 1.5rem 1.5rem 1.5rem;
}
.history-card-content h4 {
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    color: #007bff;
}
.history-card-content ul {
    list-style: none;
    padding-left: 1rem;
    margin: 0;
}
.history-card-content li {
    padding: 0.25rem 0;
}
.history-card-content em {
    color: #6c757d;
    font-size: 0.9em;
}

.payment-group { margin-bottom: 1.5rem; }
.payment-group h4 { margin: 0 0 0.5rem 0; padding-bottom: 0.5rem; border-bottom: 1px solid #e5e5e5; }
.payment-item { display: flex; align-items: center; padding: 0.25rem 0; }
.payment-item.processed label { color: #6c757d; text-decoration: line-through; }
.payment-item input[type="checkbox"] { margin-right: 0.75rem; width: 18px; height: 18px; }
.payment-item label { font-size: 1rem; }
/* --- Стили для кнопки "Копировать" и строки платежа --- */

.payment-item {
    display: flex;
    align-items: center;
    gap: 0.75rem; /* Расстояние между элементами */
}

.payment-item label {
    flex-grow: 1; /* Заставляет текст занимать все доступное место */
}

.btn-copy-payment {
    width: auto;
    padding: 4px 10px !important;
    font-size: 0.8rem !important;
    line-height: 1;
    margin-left: 0.5rem;
}
/* Компенсация отступа для режима Бухгалтера */
body.accountant-mode .main-container {
    margin-top: 2rem;
}
/* --- СТИЛИ ДЛЯ УПЛОТНЕНИЯ ИНТЕРФЕЙСА (ДЕСКТОП) --- */

/* Увеличиваем максимальную ширину контейнера, чтобы использовать больше пространства на широких экранах */
.main-container, .header-container {
    max-width: 1200px; /* Было 900px */
}

/* Уменьшаем вертикальные отступы между секциями */
.main-container section {
    margin-bottom: 1.5rem; /* Было 2.5rem */
}

/* Делаем заголовки секций компактнее */
.main-container h2 {
    font-size: 1rem; /* Было 1.1rem */
    margin-bottom: 0.75rem; /* Было 1rem */
}

/* Уменьшаем кнопки в главном меню */
.btn-primary, .btn-secondary {
    padding: 0.8rem; /* Было 1rem */
    font-size: 1rem; /* Было 1.1rem */
}

/* Уменьшаем карточки */
.processor-card, .summary-card {
    padding: 1.25rem; /* Было 1.5rem */
}
.processor-card .card-title, .summary-card-title {
    font-size: 1.3rem; /* Было 1.5rem */
}
.summary-metric {
    font-size: 1rem; /* Было 1.1rem */
    gap: 0.5rem;
}

/* Уменьшаем отступы в формах и таблицах */
.form-card, .crud-item, #report-container, .comparison-controls {
    padding: 1.25rem; /* Было 1.5rem или 2rem */
}
.crud-input, input[type="text"], input[type="password"], select, input[type="date"], input[type="number"] {
    padding: 0.6rem; /* Было 0.75rem */
    font-size: 0.95rem;
}
.report-table td, .report-table th {
    padding: 0.6rem 0.8rem; /* Было 0.8rem 1rem */
}

/* Делаем модальные окна шире */
.modal-content {
    max-width: 600px; /* Было 500px */
}
.modal-content[style*="700px"] { /* Для широких модалок, как детали ЗП */
    max-width: 800px;
}
/* --- АДАПТАЦИЯ ДЛЯ МОБИЛЬНЫХ УСТРОЙСТВ --- */

@media (max-width: 768px) {
    
    /* Убираем боковые отступы, чтобы контент занимал всю ширину */
    .main-container, .login-container {
        padding: 1rem;
        margin-top: 60px; /* Уменьшаем отступ от хедера */
    }

    /* Адаптация хедера */
    .header-container {
        padding: 0.5rem 1rem;
        flex-direction: column; /* Ставим элементы друг под друга */
        align-items: flex-start;
        height: auto;
    }
    .user-info {
        font-size: 0.8rem;
        margin-bottom: 0.5rem;
    }
    #logout-button {
        position: absolute;
        top: 0.5rem;
        right: 1rem;
        padding: 0.4rem 0.8rem;
    }

    /* Перестраиваем формы в одну колонку */
    .form-grid-item, .add-item-form, .comparison-controls {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }
    .form-grid-item label {
        text-align: left; /* Выравниваем лейблы по левому краю */
        margin-bottom: 0.25rem;
    }
    .add-item-form button {
        margin-top: 0.5rem;
    }

    /* Адаптация CRUD-элементов */
    .crud-item {
        flex-direction: column;
        align-items: stretch;
    }
    .crud-item button {
        width: 100%;
        margin-top: 0.5rem;
    }
    
    /* Делаем таблицы горизонтально-скроллящимися */
    .report-table, #farm-inventory-table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
        border: none;
    }
    .report-table thead, .report-table tbody, .report-table tr {
        display: block;
    }
    
    /* Увеличиваем шрифты для читаемости */
    body {
        font-size: 16px; /* Базовый размер шрифта для мобильных */
    }
    h1 { font-size: 1.5rem; }
    .card-title, #batch-view-title { font-size: 1.2rem; }

    /* Уменьшаем ширину модальных окон на мобильных */
    .modal-content {
        width: 95%;
        padding: 1rem;
    }

    /* Адаптация хедера в модалках и видах */
    .batch-view-header {
        flex-wrap: wrap; /* Разрешаем перенос элементов */
    }
    .batch-view-header h2 {
        font-size: 1.1rem;
        width: 100%;
        order: -1; /* Ставим заголовок наверх */
        margin-bottom: 0.75rem;
    }
    .batch-view-header button {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }
    
    /* Адаптация модуля "Рассчитать оплаты" */
    .needs-grid {
        grid-template-columns: 1fr; /* Карточки в одну колонку */
    }
}
/* --- СТИЛИ ДЛЯ АДАПТИВНОЙ ТАБЛИЦЫ РАСПРЕДЕЛЕНИЯ --- */

/* По умолчанию показываем таблицу и скрываем карточки */
.desktop-only { display: block; }
.mobile-only { display: none; }

.fop-card {
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.fop-card-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding-bottom: 0.75rem;
    margin-bottom: 0.75rem;
    border-bottom: 1px solid #f0f2f5;
}

.fop-card-header h4 {
    margin: 0;
    font-size: 1.1rem;
}

.fop-card-header .balance-info {
    font-size: 0.9rem;
    text-align: right;
}

.fop-card-header .balance-info strong {
    display: block;
    font-size: 1rem;
}
.fop-card-footer {
    border-top: 1px solid #f0f2f5;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    display: flex;
    justify-content: space-between;
    font-size: 1.1rem;
    font-weight: bold;
}

.allocation-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 1rem;
    align-items: center;
    padding: 0.5rem 0;
}

.allocation-row label {
    font-weight: 500;
}

.allocation-row input {
    width: 120px; /* Фиксированная ширина поля ввода */
    text-align: right;
    padding: 0.5rem;
    font-size: 1rem;
}

/* На мобильных устройствах меняем видимость */
@media (max-width: 768px) {
    .desktop-only { display: none; }
    .mobile-only { display: block; }
    
    /* Убираем горизонтальный скролл для allocation-table-container, так как он теперь скрыт */
    #allocation-table-container.desktop-only {
        display: none;
        overflow-x: hidden;
    }
    .add-need-form {
        flex-direction: column; /* Ставим элементы друг под друга */
        align-items: stretch;   /* Растягиваем их на всю ширину */
    }
    .add-need-form select,
    .add-need-form input,
    .add-need-form button {
        width: 100%; /* Убеждаемся, что все элементы занимают 100% ширины */
        box-sizing: border-box; /* Важно для правильного расчета ширины */
    }
}
/* --- СТИЛИ ДЛЯ МОДУЛЯ УЧЕТА ПОСТАВОК --- */

#add-shipment-form {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}
#add-shipment-form .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    width: 100%;
}
#add-shipment-form .btn-save {
    grid-column: 1 / -1;
}
#add-shipment-form .form-row:last-of-type {
    grid-template-columns: 1fr;
}

#is-due-date {
    background-color: #e9ecef;
    cursor: not-allowed;
}

.table-controls {
    display: flex; /* Выстраиваем элементы в ряд */
    flex-wrap: wrap; /* Разрешаем перенос на маленьких экранах */
    gap: 1rem; /* Отступы между элементами */
    align-items: center; /* Выравниваем по центру по вертикали */
    justify-content: flex-end; /* Прижимаем к правому краю */
    margin-bottom: 1rem;
}

.table-controls select {
    max-width: 200px; /* Ограничиваем ширину селектов */
}

.table-controls input[type="date"] {
    padding: 0.5rem; /* Делаем поля дат компактнее */
}

.table-controls label {
    margin-bottom: 0; /* Убираем нижний отступ у лейблов */
    white-space: nowrap;
}

.table-controls .checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Стили для таблицы остаются прежними */
#incoming-shipments-table-container .report-table .is-paid-row {
    background-color: #e9f7ef;
    color: #555;
    text-decoration: line-through;
}
#incoming-shipments-table-container .report-table .is-overdue-row {
    background-color: #fdeeee;
}
.pay-checkbox-cell {
    text-align: center;
}
.pay-checkbox-cell input[type="checkbox"] {
    width: 20px;
    height: 20px;
}

/* Адаптация для мобильных */
@media (max-width: 768px) {
    #add-shipment-form .form-row {
        grid-template-columns: 1fr;
    }
    /* Заставляем фильтры перестраиваться в колонку на мобильных */
    .table-controls {
        flex-direction: column;
        align-items: stretch;
    }
    .table-controls select, .table-controls input[type="date"] {
        max-width: none;
        width: 100%;
    }
}
/* Стили для баланса в ячейке таблицы */
.balance-info-cell {
    font-weight: bold;
    color: #007bff; /* Синий цвет для акцента */
    display: block; /* Чтобы был на новой строке */
    margin-top: 4px;
}

/* --- СТИЛИ ДЛЯ ПЕЧАТИ ОТЧЕТА --- */
@media print {
    @page {
        size: A4 landscape; /* Альбомная ориентация */
        margin: 1cm;        /* Поля по 1 см */
    }

    body {
        background-color: #fff;
        color: #000;
        font-size: 10pt; /* Немного увеличим шрифт для читаемости */
    }

    /* Сначала всё прячем */
    body * {
        visibility: hidden;
    }

    /* Потом показываем только то, что нужно печатать */
    #report-container, #report-container *,
    #comparison-report-container, #comparison-report-container * {
        visibility: visible;
    }

    #report-container, #comparison-report-container {
        position: absolute;
        left: 0;
        top: 0;
        width: 90%;
        margin: 0;
        padding: 0;
        border: none;
        box-shadow: none;
    }

    /* Прячем все кнопки */
    .btn-primary, .btn-secondary, #print-report-btn, .batch-view-header button, .form-actions {
        display: none !important;
    }

    #report-container h3 {
        font-size: 12pt;
        text-align: center;
        margin-bottom: 10px;
    }

    /* --- САМЫЕ ВАЖНЫЕ ИСПРАВЛЕНИЯ ДЛЯ ТАБЛИЦЫ --- */
    .report-table {
        width: 90%;
        border-collapse: collapse !important; /* Убираем двойные рамки */
        display: table !important; /* Заставляем быть таблицей */
    }

    .report-table thead {
        display: table-header-group !important; /* Отображаем шапку как шапку таблицы */
    }

    .report-table tbody {
        display: table-row-group !important; /* Отображаем тело как тело таблицы */
    }

    .report-table tr {
        display: table-row !important; /* Каждая строка - это строка таблицы */
    }

    .report-table th, .report-table td {
        display: table-cell !important; /* Каждая ячейка - это ячейка таблицы */
        padding: 4px 6px;
        border: 1px solid #ccc !important;
        white-space: nowrap;
        text-align: right;
        background-color: #fff !important;
    }

    .report-table th {
        font-weight: bold;
        border-bottom: 2px solid #333 !important; /* Жирная линия под шапкой */
    }

    .report-table th:first-child, .report-table td:first-child {
        text-align: left;
        white-space: normal; /* Разрешаем перенос для длинных названий */
    }
    
    .report-table .total-row td {
        font-weight: bold;
        border-top: 1.5px solid #aaa !important;
    }

    /* Убираем цвет, чтобы не тратить краску принтера */
    .profit-positive, .profit-negative {
        color: #000 !important;
    }
}

/* --- СТИЛИ ДЛЯ МОДУЛЯ ОБВАЛКИ --- */
.deboning-input-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem 2rem;
}

#meat-orders-table-container .yield-input,
#meat-orders-table-container .order-input {
    width: 80px;
    text-align: right;
    padding: 4px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background-color: #fff;
}
#meat-orders-table-container .yield-input {
    background-color: #e7f7fe; /* Легкий желтый фон для % выхода */
}
/* Исправление для colspan в категориях таблицы заказов */
#meat-orders-table-container .category-group .total-row td {
    text-align: center;
    font-size: 1.1rem;
    background-color: #e9ecef;
}

#meat-orders-table-container .report-table th[data-shop-id],
#meat-orders-table-container .report-table td[data-shop-id] {
    min-width: 45px; /* Минимальная ширина */
    width: 45px;     /* Желаемая ширина */
    max-width: 60px; /* Максимальная ширина */
    text-align: center; /* Центрируем текст в этих колонках */
}

/* --- СТИЛИ ДЛЯ ИНТЕРАКТИВНОЙ ТАБЛИЦЫ ЗАКАЗОВ --- */
.editable-grid .editable-cell {
    cursor: cell;
    background-color: #fef9e7; /* Легкий желтый фон для редактируемых ячеек */
    transition: background-color 0.2s;
}
.editable-grid .editable-cell:hover {
    background-color: #fdebd0;
}
.editable-grid .calculated-field {
    font-weight: bold;
}
.editable-grid .product-name {
    white-space: normal; /* Разрешаем перенос для длинных названий */
}
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* Для Firefox */
input[type=number] {
  -moz-appearance: textfield;
}


/* --- СТИЛИ ДЛЯ ПЕЧАТИ ОТЧЕТА --- */
@media print {
    @page {
        size: A4 landscape; /* Альбомная ориентация */
        margin: 1cm;        /* Поля по 1 см */
    }

    body {
        background-color: #fff;
        color: #000;
        font-size: 10pt; /* Немного увеличим шрифт для читаемости */
    }

    /* Сначала всё прячем */
    body * {
        visibility: hidden;
    }

    /* Потом показываем только то, что нужно печатать */
    #comparison-report-container, #comparison-report-container * {
        visibility: visible;
    }

    #comparison-report-container {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        margin: 0;
        padding: 0;
        border: none;
        box-shadow: none;
    }

    /* Прячем все кнопки и ненужные элементы */
    .btn-primary, .btn-secondary, .batch-view-header, .comparison-controls, section h3 {
        display: none !important;
    }

    #comparison-report-container h3 {
        visibility: visible;
        font-size: 14pt;
        text-align: center;
        margin-bottom: 10px;
    }

    /* --- САМЫЕ ВАЖНЫЕ ИСПРАВЛЕНИЯ ДЛЯ ТАБЛИЦЫ --- */
    .report-table {
        width: 100%;
        border-collapse: collapse !important; /* Убираем двойные рамки */
        display: table !important; /* Заставляем быть таблицей */
        overflow-x: hidden; /* Убираем скролл в печати */
        white-space: normal; /* Разрешаем перенос текста */
    }

    .report-table thead, .report-table tbody, .report-table tr {
        display: table-row-group; /* Сбрасываем блочное отображение */
    }
    .report-table tr {
        display: table-row !important;
    }

    .report-table th, .report-table td {
        display: table-cell !important; /* Каждая ячейка - это ячейка таблицы */
        padding: 4px 6px;
        border: 1px solid #ccc !important;
        white-space: nowrap;
        text-align: right;
        background-color: #fff !important;
    }

    .report-table th {
        font-weight: bold;
        border-bottom: 2px solid #333 !important; /* Жирная линия под шапкой */
    }

    .report-table th:first-child, .report-table td:first-child {
        text-align: left;
        white-space: normal; /* Разрешаем перенос для длинных названий */
    }
    
    .report-table .total-row, .report-table .total-row td {
        font-weight: bold;
        border-top: 1.5px solid #aaa !important;
        background-color: #f0f0f0 !important;
    }

    /* Убираем цвет, чтобы не тратить краску принтера */
    .profit-positive, .profit-negative, .diff-positive, .diff-negative {
        color: #000 !important;
    }
}

/* --- СТИЛИ ДЛЯ ПЕЧАТИ ОТЧЕТА ПО ОПЛАТАМ --- */
@media print {
    body * {
        visibility: hidden;
    }

    #payment-print-view, #payment-print-view *,
    #printable-area, #printable-area * { /* Добавили #printable-area для совместимости */
        visibility: visible;
    }

    #payment-print-view, #printable-area {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        font-family: Arial, sans-serif;
    }
    
    #payment-print-view h2, #printable-area h2 {
        text-align: center;
        font-size: 16pt;
    }

    /* Стили для группировки */
    .print-group { 
        margin-bottom: 25px; 
        page-break-inside: avoid; /* Не разрывать группу между страницами */
    }
    .print-group h3 { 
        font-size: 14pt; 
        border-bottom: 2px solid #000; 
        padding-bottom: 5px; 
        margin-bottom: 10px; 
    }
    
    .report-table {
        width: 100%;
        border-collapse: collapse;
        font-size: 11pt;
    }
    
    .report-table th, 
    .report-table td {
        border: 1px solid #ccc;
        padding: 6px;
        text-align: left;
        vertical-align: top; /* Для строк с <br> */
    }
    
    .report-table th {
        background-color: #f2f2f2;
    }

    .report-table small {
        color: #555;
        font-size: 9pt;
    }
    
    .report-table .total-row { 
        font-weight: bold; 
        background-color: #f2f2f2;
    }

    /* Выравниваем последнюю колонку (сумму) по правому краю */
    .report-table td:last-child, .report-table th:last-child { 
        text-align: right; 
    }
    
    #payment-print-summary, .print-grand-total {
        margin-top: 25px;
        text-align: right;
        font-size: 16pt;
        border-top: 3px double #000;
        padding-top: 10px;
    }
}

/* --- Стили для отчета по месяцам --- */
.monthly-report .month-header td {
    font-weight: bold;
    font-size: 1.1rem;
    background-color: #e9ecef;
    text-align: center;
    border-top: 2px solid #343a40 !important;
    border-bottom: 2px solid #343a40 !important;
}
.monthly-report .month-block {
    page-break-inside: avoid; /* Главное правило! */
}

.monthly-report .grand-total-header td {
    font-weight: bold;
    font-size: 1.2rem;
    background-color: #fafafa;
    color: rgb(2, 0, 0);
    text-align: center;
    border-top: 3px solid #000 !important;
}

/* ==========================================================================
   --- МОДУЛЬ ОБВАЛКА (Заказы, Мониторинг, Разделка) ---
   ========================================================================== */

/* --- Общая структура экранов --- */
.deboning-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.deboning-category h3 {
    text-align: center;
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

/* --- Таблицы --- */
.editable-grid .product-name-cell {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.editable-grid .btn-copy-name {
    padding: 2px 8px !important;
    font-size: 0.8em !important;
    line-height: 1.2;
    width: auto !important;
    flex-shrink: 0;
}

.editable-grid .calculated-field {
    font-weight: bold;
}

/* --- Редактируемые ячейки и инпут --- */
.editable-grid .editable-cell {
    cursor: cell;
    position: relative;
    background-color: #fef9e7; /* Легкий желтый фон для редактируемых ячеек */
    transition: background-color 0.2s;
}

.editable-grid .editable-cell:hover {
    background-color: #fdebd0;
}

.grid-input-editor {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    height: calc(100% + 6px); /* Делаем чуть выше для лучшего вида */
    z-index: 10;
    border: 2px solid #007bff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    border-radius: 4px;
    box-sizing: border-box;
    text-align: right;
    font-family: inherit;
    outline: none;
    background-color: #fff;
}

/* Широкий инпут для Заказов, Мониторинга и Разделки */
#meat-orders-view .grid-input-editor,
#price-monitoring-view .grid-input-editor,
#deboning-view .deboning-table .grid-input-editor {
    width: 70px; 
    height: 40px;
    font-size: 1.1em; 
    padding: 0 8px; 
}

/* Убираем стрелочки у инпутов */
.grid-input-editor::-webkit-outer-spin-button,
.grid-input-editor::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.grid-input-editor[type=number] {
    -moz-appearance: textfield;
}


/* --- Специфичные стили для Разделки --- */
.input-batch-row {
    display: grid;
    grid-template-columns: 1fr 1fr auto auto;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 0.5rem;
}

.input-batch-row input {
    width: 100%;
}

.deboning-table th,
.deboning-table td {
    padding: 4px 6px !important;
    font-size: 0.9em;
}

/* --- Специфичные стили для Мониторинга цен --- */
.price-monitoring-table th:first-child,
.price-monitoring-table td:first-child {
    min-width: 130px;
    text-align: left;
    white-space: normal;
}

.price-monitoring-table th:not(:first-child),
.price-monitoring-table td:not(:first-child) {
    min-width: 85px;
    text-align: center;
}

.price-monitoring-table .our-price-header {
    background-color: #eaf2f8;
}

.price-monitoring-table .our-price.changed-today {
    color: #007bff;
}

/* --- Адаптация для мобильных --- */
@media (max-width: 900px) {
    .deboning-container {
        grid-template-columns: 1fr;
    }
}
/* ==========================================================================
   --- ФИНАЛЬНЫЕ СТИЛИ ДЛЯ ПЕЧАТИ ЗАКАЗОВ (БЛАНК СБОРКИ) ---
   ========================================================================== */
@media print {
    /* --- Общие настройки страницы --- */
    @page {
        size: A4 landscape;
        margin: 1cm;
    }

    body {
        font-family: Arial, sans-serif;
        font-size: 10pt;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
    
    /* --- Скрываем всё, кроме нужной таблицы --- */
    body * { visibility: hidden; }
    #meat-orders-table-container, #meat-orders-table-container * { visibility: visible; }
    #meat-orders-table-container { position: absolute; left: 0; top: 0; width: 100%; margin: 0; padding: 0; }

    /* --- ГЛАВНОЕ ПРАВИЛО: Скрываем все элементы с классом .print-hide --- */
    .print-hide {
        display: none !important;
    }
    
    /* --- НОВЫЙ БЛОК: Скрываем все колонки после 11-й --- */
    #meat-orders-view .report-table th:nth-child(n+12),
    #meat-orders-view .report-table td:nth-child(n+12) {
        display: none !important;
    }


    /* --- Стилизация таблицы для печати --- */
    #meat-orders-view .report-table.editable-grid {
        border-collapse: collapse !important;
        width: 100%;
    }

    #meat-orders-view .report-table.editable-grid th,
    #meat-orders-view .report-table.editable-grid td {
        border: 1px solid #000 !important;
        padding: 4px 5px;
        height: auto;
        background-color: #fff !important;
        color: #000 !important;
        text-align: left;
    }

    #meat-orders-view .report-table.editable-grid th {
        font-weight: bold;
        text-align: center;
    }
    
    #meat-orders-view td.editable-cell[data-field="order"] {
        text-align: left !important;
        font-weight: bold;
        vertical-align: middle;
    }
    
    #meat-orders-view .product-name-cell,
    #meat-orders-view .product-name {
        text-align: left;
        font-weight: normal;
        white-space: normal;
    }
    
    /* --- Разрыв страницы перед каждой группой --- */
    .report-table.editable-grid .category-group {
        page-break-before: always; /* Главное правило! */
        break-before: page; /* Более современный аналог */
    }
    #meat-orders-view tbody:first-of-type .category-header {
        page-break-before: avoid;
    }
    #meat-orders-view .category-header td {
        font-size: 16pt;
        font-weight: bold;
        text-align: center;
        border: none !important;
        padding: 15px 0 5px 0;
        /* ИСПРАВЛЕНО: Обновляем colspan, чтобы соответствовать 11 колонкам */
        colspan: 11;
    }
}

/* --- Стили для блоков рецептов в "Разделке" --- */
.recipe-block {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    background-color: #fdfdfd;
}

.recipe-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #eee;
}

.recipe-header input[type="text"] {
    font-weight: bold;
    font-size: 1.1em;
    border: none;
    background: transparent;
    padding: 2px 5px;
    border-radius: 4px;
}
.recipe-header input[type="text"]:focus {
    background: #fff;
    box-shadow: 0 0 0 1px #007bff;
}

.ingredient-row {
    display: grid;
    /* Ингредиент | Вес | С/С | Итого | Кнопка */
    grid-template-columns: 2.5fr 1fr 1fr 1fr auto;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 0.5rem;
    font-size: 0.9em;
}

.ingredient-row select, .ingredient-row input {
    width: 100%;
    padding: 4px;
    font-size: 1em;
}

.ingredient-row .cost-price-cell {
    display: flex;
    align-items: center;
}
.ingredient-row .cost-price-cell input {
    flex-grow: 1;
}

.ingredient-row .btn-edit-price {
    padding: 2px 4px !important;
    font-size: 0.8em !important;
    line-height: 1;
    margin-left: 4px;
    width: auto !important;
}

.recipe-summary {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #eee;
    font-size: 0.9em;
}

.recipe-summary .summary-metric {
    font-size: 1em;
    padding: 0.25rem 0;
}

/* --- СТИЛИ ДЛЯ КОМПАКТНОЙ ТАБЛИЦЫ ИНГРЕДИЕНТОВ В РАЗДЕЛКЕ --- */

.ingredients-table {
    border: none !important; /* Убираем внешнюю рамку */
    margin-top: 0.5rem !important;
}

.ingredients-table th,
.ingredients-table td {
    padding: 4px 6px !important; /* Уменьшаем отступы в ячейках */
    font-size: 0.95em; /* Уменьшаем шрифт относительно родителя */
    border: 1px solid #f0f2f5 !important; /* Делаем рамки очень светлыми */
}

.ingredients-table th {
    background-color: transparent !important; /* Убираем фон у заголовков */
    border-bottom: 1px solid #e9ecef !important; /* Оставляем только нижнюю границу */
    font-weight: normal; /* Делаем шрифт нежирным */
    color: #6c757d; /* Приглушенный цвет текста */
}

/* Стили для инпутов и селектов внутри таблицы */
.ingredients-table .recipe-input {
    padding: 2px 4px;
    font-size: 1em; /* Размер шрифта наследуется от ячейки */
    border: 1px solid #ced4da;
    border-radius: 3px;
    background-color: #fff;
    width: 100%;
    box-sizing: border-box;
}

.ingredients-table .recipe-input:disabled {
    background-color: #e9ecef;
    border-color: #e9ecef;
    color: #495057;
}

.ingredients-table .cost-price-cell {
    display: flex;
    align-items: center;
    gap: 4px; /* Уменьшаем отступ между инпутом и кнопкой */
}

.ingredients-table .btn-edit-price {
    padding: 1px 5px !important;
    font-size: 0.9em !important;
}

/* --- СТИЛИ ДЛЯ ПЕЧАТИ ОТЧЕТА ПО РАЗДЕЛКЕ (V7 - СБАЛАНСИРОВАННЫЙ МАКЕТ) --- */
@media print {
    @page {
        size: A4 landscape;
        margin: 0.5cm;
    }

    body {
        font-family: Arial, sans-serif;
        font-size: 6pt; /* Можно играть этим значением (6.5pt - 7.5pt) */
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    /* Скрываем всё, кроме нужной области */
    body * { visibility: hidden; }
    #deboning-view, #deboning-view * { visibility: visible; }
    #deboning-view {
        position: absolute; left: 0; top: 0;
        width: 98%;
        margin: 0 !important; padding: 0 !important;
    }

    /* Скрываем все кнопки и лишние элементы */
    #deboning-view .btn-sm, 
    #deboning-view .btn-secondary,
    #deboning-view .btn-danger,
    #deboning-view .batch-view-header {
        display: none !important;
    }
    
    /* --- ГЛАВНАЯ ЛОГИКА МАКЕТА --- */
    #deboning-view .deboning-container {
        display: flex;
        flex-direction: row;
        align-items: flex-start;
        gap: 8px;
    }
    
    #deboning-pork-section {
        width: 50%; /* Равные колонки */
        flex-shrink: 0;
    }
    
    #deboning-chicken-section-wrapper {
        width: 50%; /* Равные колонки */
        flex-shrink: 0;
        display: flex;
        flex-direction: column;
    }
    
    /* Уплотняем все элементы */
    .form-card {
        border: 1px solid #999 !important;
        box-shadow: none !important;
        padding: 2px !important;
        margin-bottom: 3px !important;
        page-break-inside: avoid;
    }
    
    h3, h4 {
        font-size: 0.9em;
        margin: 1px 0 2px 0;
        padding-bottom: 1px;
        border-bottom: 1px solid #bbb;
        text-align: center;
        font-weight: bold;
    }
    .summary-metric { font-size: 1.1em; }
    
    /* Таблицы */
    .report-table {
        table-layout: fixed;
        width: 100%;
        border-collapse: collapse !important;
        margin: 0 !important;
    }
    
    .report-table th, .report-table td {
        border: 1px solid #bbb !important;
        padding: 1px 2px !important;
        font-size: 0.8em !important;
        text-align: right;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .report-table th:first-child, .report-table td:first-child {
        text-align: left;
        white-space: normal;
        width: 35%;
    }
    
    .report-table th {
        background-color: #e8e8e8 !important;
    }

    /* Очистка инпутов и селектов для печати */
    .editable-cell { background-color: transparent !important; }
    .input-batch-row { margin-bottom: 1px; }
    .input-batch-row input {
       border: none !important; padding: 1px; background: transparent; width: 100%;
    }
    .ingredients-table select {
       -webkit-appearance: none; -moz-appearance: none; appearance: none;
       border: none; background: transparent; width: 100%; font-size: 0.6em;
    }
}

/* --- СТИЛИ ДЛЯ ПОДСВЕТКИ (УПРОЩЕННАЯ ВЕРСИЯ) --- */

/* Делаем заголовки магазинов кликабельными */
#meat-orders-table-container .report-table th[data-shop-id] {
    cursor: pointer;
}

/* Единственное правило для подсветки. Простое и прямолинейное. */
.column-highlighted {
    background-color: #bed0dd !important; 
}
#meat-orders-table-container .report-table th[data-shop-id] {
    cursor: pointer;
}
#meat-orders-table-container .report-table th[data-shop-id]:hover {
    background-color: #bed0dd; /* Легкая подсветка при наведении на заголовок */
}

/* --- СТИЛИ ДЛЯ ПЕЧАТИ ФИНАНСОВЫХ ОТЧЕТОВ --- */
@media print {
    /* Сначала прячем абсолютно всё */
    body * {
        visibility: hidden;
    }
    /* Затем показываем только наш контейнер и всё, что внутри него */
    #finance-print-area, #finance-print-area * {
        visibility: visible;
    }
    /* Позиционируем контейнер на всю страницу */
    #finance-print-area {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        margin: 1cm;
        padding: 0;
        font-size: 10pt;
    }
    
    /* Стили для заголовка и таблицы внутри контейнера */
    #finance-print-area h3 {
        text-align: center;
        font-size: 14pt;
    }
    #finance-print-area .report-table {
        width: 100%;
        border-collapse: collapse !important;
    }
    #finance-print-area .report-table th,
    #finance-print-area .report-table td {
        border: 1px solid #333 !important;
        padding: 5px;
    }
    /* и т.д. - здесь можно скопировать ваши существующие стили для .report-table, 
       но перед каждым селектором добавить #finance-print-area */
}