footer {
    background-color: #343a40;
    color: white;
}

.custom-alert {
    background-color: #d4edda;
    color: #155724;
}

/* Горизонтальная прокрутка, если сумма ширин колонок шире окна */
.table-responsive {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.guide-table,
.products-view-table {
    width: max-content;
    min-width: 100%;
    table-layout: auto;
}

.guide-table.cols-resized,
.products-view-table.cols-resized {
    min-width: 0;
    max-width: none;
    table-layout: fixed;
}

/* Обычные колонки: ширина по заголовку и содержимому */
.guide-table > :not(caption) > * > *,
.products-view-table > :not(caption) > * > * {
    white-space: nowrap;
    width: 1%;
    vertical-align: middle;
}

.guide-table td,
.products-view-table td {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.guide-table th,
.products-view-table th {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.guide-table.cols-resized td,
.products-view-table.cols-resized td {
    max-width: 0;
}

/*
 * Длинный контент (комментарий, штрихкод, путь и т.п.):
 * обрезается с многоточием, полный текст — в title.
 */
.guide-table .col-wide,
.products-view-table .col-wide,
.guide-table th.col-wide,
.guide-table td.col-wide,
.products-view-table th.col-wide,
.products-view-table td.col-wide {
    white-space: nowrap;
    width: auto;
    min-width: 6rem;
    overflow: hidden;
    text-overflow: ellipsis;
    word-break: normal;
    overflow-wrap: normal;
}

/* Блоки с формами (права, склады) — без обрезки */
.guide-table .col-panel,
.guide-table th.col-panel,
.guide-table td.col-panel {
    white-space: normal;
    width: auto;
    min-width: 10rem;
    max-width: none;
    vertical-align: top;
    overflow: visible;
    text-overflow: clip;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.guide-table .form-control,
.guide-table .form-select,
.products-view-table .form-control,
.products-view-table .form-select {
    min-width: 0;
    width: auto;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.guide-table .col-wide .form-control,
.guide-table .col-wide .form-select,
.guide-table .col-panel .form-control,
.guide-table .col-panel .form-select {
    width: 100%;
}

.guide-table .col-check,
.products-view-table .col-check {
    width: 2.5rem;
    text-align: center;
}

.guide-table th.col-resizable,
.products-view-table th.col-resizable {
    position: relative;
}

.guide-table th .col-resizer,
.products-view-table th .col-resizer {
    position: absolute;
    top: 0;
    right: 0;
    width: 6px;
    height: 100%;
    cursor: col-resize;
    user-select: none;
    z-index: 2;
}

.guide-table th .col-resizer:hover,
.products-view-table th .col-resizer:hover,
body.col-resizing .guide-table th .col-resizer,
body.col-resizing .products-view-table th .col-resizer {
    background: rgba(13, 110, 253, 0.35);
}

body.col-resizing {
    cursor: col-resize;
    user-select: none;
}

.guide-table th.col-visibility-hidden,
.guide-table td.col-visibility-hidden,
.products-view-table th.col-visibility-hidden,
.products-view-table td.col-visibility-hidden {
    display: none !important;
}

.pagination .page-jump-input {
    min-height: calc(1.5em + 0.5rem + 2px);
}

.guide-table td .invalid-feedback,
.products-view-table td .invalid-feedback,
.table td .invalid-feedback {
    display: block;
    font-size: 0.75rem;
    margin-top: 0.15rem;
}

.is-invalid {
    border-color: #dc3545 !important;
}

.catalog-suggestions {
    z-index: 1050;
    max-height: 240px;
    overflow-y: auto;
    top: 100%;
    left: 0;
}

/* Белая кнопка меню на тёмном header (смартфон) */
.navbar-dark .navbar-toggler {
    border-color: rgba(255, 255, 255, 0.55);
    color: #fff;
}

.navbar-dark .navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255, 255, 255, 1%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

.navbar-scan-brand {
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 53px;
    height: 40px;
}

.navbar-scan-brand svg {
    width: 34px;
    height: 34px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.9;
}

#productBarcodeScanReader {
    width: 100%;
    min-height: 240px;
    overflow: hidden;
    border-radius: 0.375rem;
    background: #111;
}

#productBarcodeScanReader video {
    width: 100% !important;
    border-radius: 0.375rem;
}

/* Карточка товара: вкладки Основное / Изображения / Документы */
.product-card-tabs {
    padding: 0.5rem 0.75rem 0.5rem 1rem;
}

.product-card-tabs .product-card-tabs-inner {
    padding-left: 0;
    padding-right: 0;
}

.product-card-tabs .navbar-nav .nav-link {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
}

@media (max-width: 767.98px) {
    .product-card-tabs {
        padding-left: 1.25rem;
        padding-right: 0.75rem;
    }

    .product-card-tabs .navbar-nav .nav-link:first-child {
        padding-left: 0.25rem;
    }

    .product-card-page {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
}

/* Оприходование: карточки позиций (адаптив под смартфон) */
.receive-page {
    padding-bottom: 5.5rem;
}

.receive-hint {
    font-size: 0.9rem;
}

.receive-scan-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}

.receive-scan-btn svg {
    width: 1.25rem;
    height: 1.25rem;
    flex-shrink: 0;
}

.receive-photo-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    position: relative;
}

.receive-photo-btn .receive-photo-icon {
    width: 1.1rem;
    height: 1.1rem;
}

.receive-photo-btn .receive-photo-count {
    font-size: 0.7rem;
}

.receive-photo-previews {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.receive-photo-thumb {
    position: relative;
    width: 4.5rem;
    height: 4.5rem;
    border-radius: 0.375rem;
    overflow: hidden;
    border: 1px solid #dee2e6;
    background: #f8f9fa;
}

.receive-photo-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.receive-photo-thumb .receive-photo-remove {
    position: absolute;
    top: 0.15rem;
    right: 0.15rem;
    width: 0.7rem;
    height: 0.7rem;
    padding: 0.35rem;
    background-color: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    opacity: 1;
}

.receive-photo-camera-wrap {
    width: 100%;
    min-height: 240px;
    overflow: hidden;
    border-radius: 0.375rem;
    background: #111;
}

#receivePhotoVideo {
    width: 100%;
    display: block;
    max-height: 60vh;
    object-fit: cover;
    background: #111;
}

#shelfScanReader {
    width: 100%;
    min-height: 240px;
    overflow: hidden;
    border-radius: 0.375rem;
    background: #111;
}

#shelfScanReader video {
    width: 100% !important;
    border-radius: 0.375rem;
}

.receive-card .form-label {
    font-size: 0.8rem;
    margin-bottom: 0.2rem;
    color: #495057;
}

.receive-card .card-header {
    background: #f8f9fa;
}

.receive-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

@media (max-width: 767.98px) {
    .receive-page {
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
    }

    .receive-page h2 {
        font-size: 1.35rem;
        margin-top: 1rem !important;
    }

    .receive-actions-bar {
        position: sticky;
        bottom: 0;
        z-index: 1020;
        margin: 0 -0.75rem;
        padding: 0.75rem;
        background: rgba(255, 255, 255, 0.96);
        border-top: 1px solid #dee2e6;
        box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.06);
    }

    .receive-actions-bar .btn {
        flex: 1 1 auto;
        min-height: 44px;
    }

    .receive-card .form-control,
    .receive-card .form-select {
        font-size: 16px; /* без авто-зума iOS */
        min-height: 42px;
    }

    .receive-card .form-check-input {
        width: 1.25rem;
        height: 1.25rem;
    }
}

/* Desktop: порядок полей в карточке оприходования */
@media (min-width: 768px) {
    .receive-card .row {
        display: flex;
        flex-wrap: wrap;
    }

    .receive-card .receive-pos-1 { order: 1; }
    .receive-card .receive-pos-2 { order: 2; }
    .receive-card .receive-pos-3 { order: 3; }
    .receive-card .receive-pos-4 { order: 4; }
    .receive-card .receive-pos-5 { order: 5; }
    .receive-card .receive-pos-6 { order: 6; }
    .receive-card .receive-pos-7 { order: 7; }
    .receive-card .receive-pos-8 { order: 8; }
    .receive-card .receive-pos-9 { order: 9; }
    .receive-card .receive-pos-10 { order: 10; }
    .receive-card .receive-pos-11 { order: 11; }
    .receive-card .receive-pos-12 { order: 12; }
    .receive-card .receive-pos-13 { order: 13; }
    .receive-card .receive-pos-14 { order: 14; }
}
