/* === Stock Page === */
.stock-main {
    margin-top: 80px;
    padding: 20px 30px;
    min-height: auto;
    display: block;
    text-align: left;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.header-actuality-box {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 6px 10px;
    border: 1px solid #d7e0e8;
    border-radius: 8px;
    background: #f9fcff;
    min-height: 36px;
    white-space: nowrap;
    max-width: 100%;
    box-sizing: border-box;
}

.header-actuality-nav {
    margin: 0 14px 0 0;
    flex-shrink: 0;
}

.header-actuality-label {
    font-size: 0.72rem;
    line-height: 1.1;
    color: #6c7a89;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.2px;
}

.header-actuality-value {
    font-size: 0.88rem;
    line-height: 1.1;
    color: #2c3e50;
    font-weight: 700;
}

/* Keep stock header height aligned with other pages */
.page-stock .header-actuality-box {
    height: 36px;
    min-height: 36px;
    padding: 2px 10px;
    gap: 0;
}

.page-stock .header-actuality-label {
    font-size: 0.62rem;
    line-height: 1;
}

.page-stock .header-actuality-value {
    font-size: 0.8rem;
    line-height: 1.05;
}

/* === Sync Status Panel === */
.sync-status-panel {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    padding: 15px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.sync-status-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 18px;
    border-radius: 6px;
    flex: 1;
    transition: all 0.3s ease;
}

.sync-status-ok {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    border-left: 4px solid #28a745;
}

.sync-status-warning {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
    border-left: 4px solid #ffc107;
    animation: pulse-warning 2s ease-in-out infinite;
}

.sync-status-critical {
    background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%);
    border-left: 4px solid #dc3545;
    animation: pulse-critical 1.5s ease-in-out infinite;
}

.sync-status-no_data {
    background: linear-gradient(135deg, #e2e3e5 0%, #d6d8db 100%);
    border-left: 4px solid #6c757d;
}

@keyframes pulse-warning {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255, 193, 7, 0.4); }
    50% { box-shadow: 0 0 0 8px rgba(255, 193, 7, 0); }
}

@keyframes pulse-critical {
    0%, 100% { box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.4); }
    50% { box-shadow: 0 0 0 10px rgba(220, 53, 69, 0); }
}

.sync-status-icon {
    font-size: 1.5rem;
    line-height: 1;
}

.sync-status-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sync-status-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #495057;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sync-status-time {
    font-size: 0.95rem;
    font-weight: 500;
    color: #212529;
}

.sync-status-ok .sync-status-time {
    color: #155724;
}

.sync-status-warning .sync-status-time {
    color: #856404;
}

.sync-status-critical .sync-status-time {
    color: #721c24;
    font-weight: 700;
}

.sync-status-no_data .sync-status-time {
    color: #6c757d;
    font-style: italic;
}

.stock-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.stock-header h1 {
    font-size: 1.6rem;
    text-align: left;
}

/* === Stats Row === */
.stock-stats {
    display: none;
}

/* === Filters (reuse from events) === */
.filters-form {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 15px;
    padding: 12px 15px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
    align-items: center;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.filters-form > * {
    min-width: 0;
}

.filter-search {
    flex: 1;
    min-width: 150px;
    max-width: 250px;
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 0.85rem;
    outline: none;
}

.filter-search:focus { border-color: #3498db; }

.filter-select {
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 0.85rem;
    background: #fff;
    cursor: pointer;
    min-width: 110px;
    max-width: 150px;
    flex-shrink: 0;
}

.price-filter {
    min-width: 260px;
    max-width: 320px;
    padding: 9px 12px;
    border: 1px solid #dbe6ef;
    border-radius: 8px;
    background: linear-gradient(180deg, #fbfdff 0%, #f2f8fd 100%);
    flex-shrink: 0;
}

.price-filter.is-disabled {
    opacity: 0.7;
}

.price-filter__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 0.82rem;
}

.price-filter__title {
    color: #4b5d6f;
    font-weight: 700;
    white-space: nowrap;
}

.price-filter__values {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: #1f3d5a;
    font-weight: 700;
    white-space: nowrap;
}

.price-filter__separator,
.price-filter__currency {
    color: #6f8193;
    font-weight: 600;
}

.price-filter__sliders {
    position: relative;
    height: 28px;
    margin-bottom: 6px;
}

.price-filter__track,
.price-filter__range {
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    height: 6px;
    transform: translateY(-50%);
    border-radius: 999px;
    pointer-events: none;
}

.price-filter__track {
    background: #d7e3ee;
    z-index: 1;
}

.price-filter__range {
    background: linear-gradient(90deg, #3498db 0%, #1d7fbe 100%);
    left: 0;
    width: 100%;
    z-index: 2;
}

.price-filter__slider {
    -webkit-appearance: none;
    appearance: none;
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 28px;
    margin: 0;
    background: transparent;
    outline: none;
    border: 0;
    box-shadow: none;
    -webkit-tap-highlight-color: transparent;
    pointer-events: none;
    z-index: 3;
}

.price-filter__slider::-webkit-slider-runnable-track {
    height: 6px;
    background: transparent;
    border: 0;
    box-shadow: none;
}

.price-filter__slider::-moz-range-track {
    height: 6px;
    background: transparent;
    border: none;
    box-shadow: none;
}

.price-filter__slider::-moz-range-progress {
    background: transparent;
    border: none;
    box-shadow: none;
}

.price-filter__slider::-ms-track {
    height: 6px;
    background: transparent;
    border-color: transparent;
    color: transparent;
}

.price-filter__slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    margin-top: -6px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid #2980b9;
    box-shadow: 0 1px 5px rgba(41, 128, 185, 0.25);
    cursor: pointer;
    pointer-events: auto;
}

.price-filter__slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid #2980b9;
    box-shadow: 0 1px 5px rgba(41, 128, 185, 0.25);
    cursor: pointer;
    pointer-events: auto;
}

.price-filter__limits {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    color: #6f8193;
    font-size: 0.74rem;
}

.price-filter__empty {
    color: #7b8a98;
    font-size: 0.8rem;
}

.btn-filter {
    padding: 8px 20px;
    background: #3498db;
    color: #fff;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9rem;
}

.btn-filter:hover { background: #2980b9; }

.btn-reset {
    padding: 8px 12px;
    background: #f39c12;
    color: #fff;
    border: none;
    border-radius: 5px;
    text-decoration: none;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    flex-shrink: 0;
    white-space: nowrap;
}

.btn-reset:hover { background: #e67e22; }

.btn-download {
    padding: 8px 12px;
    background: #2e8b57;
    color: #fff;
    border: none;
    border-radius: 5px;
    text-decoration: none;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    flex-shrink: 0;
    white-space: nowrap;
}

.btn-download:hover { background: #256f46; }

.filters-form a.btn-download,
.filters-form a.btn-download:visited,
.filters-form a.btn-download:hover,
.filters-form a.btn-download:focus,
.filters-form a.btn-download:active {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    text-decoration: none;
}

.filters-form a.btn-reset,
.filters-form a.btn-reset:visited,
.filters-form a.btn-reset:hover,
.filters-form a.btn-reset:focus,
.filters-form a.btn-reset:active {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.filters-spacer {
    flex: 1 1 auto;
    min-width: 10px;
}

.btn-cart {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #2c3e50;
    color: #fff;
    border-radius: 5px;
    text-decoration: none;
    font-size: 0.85rem;
    white-space: nowrap;
    flex-shrink: 0;
}

.btn-cart:hover {
    background: #1f2d3a;
}

.cart-count-badge {
    min-width: 22px;
    height: 22px;
    border-radius: 11px;
    background: #e74c3c;
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0 6px;
}

.cart-count-badge.empty {
    background: #7f8c8d;
}

/* === Stock Content Wrapper === */
.stock-content-wrapper {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

/* === Table === */
.table-wrapper {
    flex: 1;
    min-width: 0;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.stock-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    table-layout: auto;
}

.stock-table thead {
    background: #3498db;
    color: #fff;
}

.stock-table th {
    padding: 10px 14px;
    text-align: center;
    font-weight: 600;
    white-space: nowrap;
}

.stock-table td {
    padding: 10px 14px;
    border-bottom: 1px solid #eee;
    vertical-align: middle;
    text-align: right;
}

.stock-table th.col-article,
.stock-table td.cell-article {
    width: 15ch;
    min-width: 15ch;
    max-width: 15ch;
}

.stock-table th.col-available,
.stock-table td.cell-free {
    width: 20ch;
    min-width: 20ch;
    max-width: 20ch;
}

.stock-table th.col-reserve,
.stock-table td.cell-reserve {
    width: 12ch;
    min-width: 12ch;
    max-width: 12ch;
}

.stock-table th.col-unit,
.stock-table td.cell-unit {
    width: 6ch;
    min-width: 6ch;
    max-width: 6ch;
}

.stock-table th.col-price,
.stock-table td.cell-price {
    width: 14ch;
    min-width: 14ch;
    max-width: 14ch;
}

.stock-table th.col-warehouses,
.stock-table td.cell-warehouses {
    width: 15ch;
    min-width: 15ch;
    max-width: 15ch;
}

.stock-table th.col-actions,
.stock-table td.cell-action {
    width: 1%;
    white-space: nowrap;
}

.stock-table tbody tr:hover {
    background: #f0f7ff;
}

.row-zero {
    opacity: 0.5;
}

.row-zero:hover {
    opacity: 0.8;
}

.cell-name {
    width: auto;
    min-width: 0;
    text-align: left !important;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    overflow: hidden;
}

.cell-name-text {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* === Favorite Star Button === */
.btn-favorite {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: #ddd;
    transition: all 0.2s ease;
    padding: 0;
    line-height: 1;
    flex-shrink: 0;
}

.btn-favorite:hover {
    color: #f1c40f;
    transform: scale(1.2);
}

.btn-favorite.active {
    color: #f1c40f;
}

/* === Favorites Filter Checkbox === */
.filter-checkbox {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: #fff;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.85rem;
    white-space: nowrap;
    user-select: none;
    transition: background 0.2s;
}

.filter-checkbox:hover {
    background: #f8f9fa;
}

.filter-checkbox input[type="checkbox"] {
    cursor: pointer;
    width: 16px;
    height: 16px;
    margin: 0;
}

.filter-checkbox span {
    color: #555;
}

.favorites-count {
    color: #f1c40f;
    font-weight: 700;
}

.cell-unit {
    text-align: center;
    white-space: nowrap;
}

.cell-num {
    text-align: right;
    white-space: nowrap;
}

.cell-reserve {
    color: #e67e22;
}

.cell-free {
    color: #27ae60;
}

.cell-free-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: none;
    background: transparent;
    color: inherit;
    font: inherit;
    line-height: inherit;
    cursor: pointer;
}

.cell-free-trigger:hover {
    text-decoration: underline;
}

.cell-price {
    font-variant-numeric: tabular-nums;
}

.sort-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    color: inherit;
    text-decoration: none;
}

.sort-link:hover {
    text-decoration: underline;
}

.sort-link.active {
    font-weight: 700;
}

.sort-link.disabled {
    opacity: 0.8;
    text-decoration: none;
    cursor: default;
}

.sort-link__icon {
    font-size: 0.9em;
    line-height: 1;
    opacity: 0.95;
}

/* === Warehouse Details === */
.cell-warehouses {
    text-align: center !important;
    white-space: nowrap;
}

.btn-wh-open {
    margin-right: 0;
    min-width: 54px;
    justify-content: center;
}

.wh-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    z-index: 10020;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.wh-modal-overlay.active {
    opacity: 1;
}

.wh-modal-content {
    width: min(920px, 92vw);
    max-height: 85vh;
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 35px rgba(0, 0, 0, 0.25);
}

.wh-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid #e8edf2;
    background: #f7fbff;
}

.wh-modal-header h3 {
    margin: 0;
    font-size: 1rem;
    color: #2c3e50;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wh-modal-header h3 span {
    color: #6c7a89;
    font-weight: 500;
    font-size: 0.92em;
}

.wh-modal-close {
    border: none;
    background: transparent;
    font-size: 1.8rem;
    line-height: 1;
    color: #8a96a3;
    cursor: pointer;
    padding: 0 4px;
}

.wh-modal-close:hover {
    color: #2c3e50;
}

.wh-modal-body {
    padding: 12px 14px 14px;
    overflow: auto;
}

.whm-head,
.whm-row {
    display: grid;
    grid-template-columns: 1fr 110px 90px 100px;
    gap: 8px;
    align-items: center;
}

.whm-head {
    position: sticky;
    top: 0;
    background: #fff;
    padding: 8px 10px;
    font-weight: 700;
    color: #4a5b6c;
    border-bottom: 1px solid #dce6f0;
    font-size: 0.82rem;
    text-transform: uppercase;
}

.whm-row {
    padding: 8px 10px;
    border-bottom: 1px solid #edf2f7;
    font-size: 0.9rem;
}

.whm-name {
    font-weight: 600;
    color: #2c3e50;
}

.whm-val {
    text-align: right;
    color: #3f4d5a;
}

.whm-res {
    color: #e67e22;
}

.whm-free {
    color: #27ae60;
    font-weight: 700;
}

/* === Header Actions === */
.header-actions {
    display: flex;
    gap: 10px;
}

/* === Analysis Button === */
.btn-analysis {
    padding: 8px 18px;
    background: #8e44ad;
    color: #fff;
    border: none;
    border-radius: 5px;
    font-size: 0.95rem;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-analysis:hover { background: #7d3c98; }
.btn-analysis.active { background: #6c3483; box-shadow: inset 0 2px 4px rgba(0,0,0,0.2); }

/* === Analysis Panel === */
.analysis-panel {
    display: none;
    margin-bottom: 20px;
}

.analysis-panel.active {
    display: block;
    animation: slideDown 0.3s ease;
}

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

.analysis-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.analysis-card {
    background: #fff;
    border-radius: 8px;
    padding: 18px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.analysis-card h3 {
    font-size: 1rem;
    color: #2c3e50;
    margin-bottom: 14px;
    padding-bottom: 8px;
    border-bottom: 2px solid #eee;
}

.card-summary { grid-column: 1 / -1; }

.summary-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
}

.stat {
    text-align: center;
    padding: 12px 8px;
    background: #f8f9fa;
    border-radius: 8px;
}

.stat-value {
    display: block;
    font-size: 1.3rem;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 4px;
}

.stat-value.stat-green { color: #27ae60; }
.stat-value.stat-orange { color: #e67e22; }
.stat-value.stat-red { color: #e74c3c; }

.stat-label {
    font-size: 0.78rem;
    color: #7f8c8d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Bar Charts */
.analysis-bars {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 300px;
    overflow-y: auto;
}

.bar-row { display: flex; align-items: center; gap: 10px; }

.bar-label {
    width: 120px;
    min-width: 120px;
    font-size: 0.82rem;
    color: #555;
    text-align: right;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bar-track {
    flex: 1;
    height: 20px;
    background: #ecf0f1;
    border-radius: 4px;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    background: #e67e22;
    border-radius: 4px;
    transition: width 0.5s ease;
    min-width: 3px;
}

.bar-fill.bar-blue { background: #3498db; }
.bar-fill.bar-green { background: #27ae60; }

.bar-value {
    min-width: 120px;
    font-size: 0.82rem;
    font-weight: 600;
    color: #333;
    white-space: nowrap;
}

.bar-value small { font-weight: 400; color: #999; }

/* Analysis Table */
.analysis-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.analysis-table th {
    text-align: left;
    padding: 8px 10px;
    background: #f8f9fa;
    color: #555;
    font-weight: 600;
    border-bottom: 2px solid #eee;
}

.analysis-table td {
    padding: 7px 10px;
    border-bottom: 1px solid #f0f0f0;
}

.analysis-table tbody tr:hover { background: #f8f9fa; }

.cell-sum {
    text-align: right;
    font-family: monospace;
    font-weight: 600;
    white-space: nowrap;
}

/* === Pagination === */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 5px;
    margin-top: 20px;
    padding: 15px 0;
}

.page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    text-decoration: none;
    color: #333;
    font-size: 0.9rem;
    background: #fff;
}

.page-link:hover {
    background: #3498db;
    color: #fff;
    border-color: #3498db;
}

.page-link.active {
    background: #3498db;
    color: #fff;
    border-color: #3498db;
    font-weight: bold;
}

.page-dots {
    color: #999;
    padding: 0 5px;
}

.pagination-total {
    margin-left: 14px;
    color: #667788;
    font-size: 0.9rem;
    white-space: nowrap;
}

.no-data {
    text-align: center;
    color: #999;
    padding: 40px !important;
}

/* === New Order Panel === */
.new-order-panel {
    width: 350px;
    min-width: 350px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    height: fit-content;
    max-height: calc(100vh - 200px);
    position: sticky;
    top: 100px;
}

.new-order-panel h3 {
    padding: 16px 20px;
    margin: 0;
    background: #3498db;
    color: #fff;
    border-radius: 8px 8px 0 0;
    font-size: 1.1rem;
    text-align: center;
}

.order-items-list {
    overflow-y: auto;
    padding: 15px;
    max-height: calc(100vh - 400px);
}

.empty-order-msg {
    text-align: center;
    color: #999;
    padding: 40px 20px;
    font-size: 0.9rem;
}

.order-item {
    background: #f8f9fa;
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 10px;
    border: 1px solid #e0e0e0;
}

.order-item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.order-item-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: #2c3e50;
    flex: 1;
    margin-right: 10px;
}

.btn-remove-item {
    background: #e74c3c;
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-remove-item:hover {
    background: #c0392b;
}

.order-item-details {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.85rem;
    color: #666;
    flex-wrap: wrap;
}

.order-item-article {
    font-family: monospace;
    color: #7f8c8d;
}

.order-item-price {
    color: #27ae60;
    font-weight: 600;
    font-size: 0.85rem;
}

.order-item-qty-control {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    margin-top: 8px;
    flex-wrap: nowrap;
}

.qty-field,
.unit-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.qty-label {
    font-size: 0.75rem;
    color: #666;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.qty-input {
    width: 90px;
    height: 36px;
    padding: 6px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
    text-align: center;
    transition: border-color 0.2s;
}

/* Всегда показывать стрелки увеличения/уменьшения */
.qty-input::-webkit-inner-spin-button,
.qty-input::-webkit-outer-spin-button {
    opacity: 1;
    height: 30px;
}

.qty-input.error {
    border-color: #e74c3c;
    background-color: #ffe6e6;
}

.unit-select {
    height: 36px;
    padding: 6px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
    background: #fff;
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s;
    min-width: 150px;
}

.unit-select:focus {
    border-color: #3498db;
}

.qty-error-msg {
    color: #e74c3c;
    font-size: 0.72rem;
    width: 100%;
    margin-top: 4px;
    display: none;
    line-height: 1.3;
}

.qty-error-msg.visible {
    display: block;
}

.order-item-unit {
    font-size: 0.85rem;
    color: #7f8c8d;
}

.order-footer {
    padding: 15px 20px;
    border-top: 2px solid #eee;
}

.btn-place-order {
    width: 100%;
    padding: 14px;
    background: #3498db;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-place-order:hover:not(:disabled) {
    background: #2980b9;
}

.btn-place-order:disabled {
    background: #95a5a6;
    cursor: not-allowed;
}

/* === Order Item Total === */
.order-item-total {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #ddd;
    text-align: right;
    font-size: 0.9rem;
    color: #27ae60;
}

/* === Order Totals === */
.order-totals {
    margin-top: 15px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
    border: 1px solid #e0e0e0;
}

.order-total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    color: #2c3e50;
}

.order-total-row:not(:last-child) {
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.order-total-label {
    font-size: 0.95rem;
    font-weight: 500;
}

.order-total-value {
    font-size: 1.1rem;
    font-weight: 700;
    font-family: monospace;
}

.order-total-sum {
    padding-top: 12px;
    margin-top: 4px;
}

.order-total-sum .order-total-label {
    font-size: 1.1rem;
    font-weight: 700;
}

.order-total-sum .order-total-value {
    font-size: 1.4rem;
}

.order-total-warning {
    justify-content: center;
    color: #f39c12;
    font-weight: 600;
}

/* === Add to Order Button === */
.cell-action {
    text-align: center;
    white-space: nowrap;
    padding-left: 4px !important;
    padding-right: 4px !important;
}

.btn-add-to-order {
    width: auto;
    min-width: 0;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 7px;
    background: #3498db;
    color: #fff;
    border: none;
    border-radius: 5px;
    font-size: inherit;
    line-height: 1.1;
    cursor: pointer;
    transition: background 0.2s;
    white-space: nowrap;
}

.btn-add-to-order:hover:not(:disabled) {
    background: #2980b9;
}

.btn-add-to-order.in-cart {
    background: #27ae60;
}

.btn-add-to-order.in-cart:hover:not(:disabled) {
    background: #1f8f4f;
}

.btn-add-to-order:disabled {
    background: #bdc3c7;
    cursor: not-allowed;
    opacity: 0.6;
}

/* === Photo Button Styles === */
.btn-photo {
    padding: 6px 14px;
    border: none;
    border-radius: 5px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    margin-right: 5px;
}

/* Кнопка с активной ссылкой - синяя как "Заказать" */
.btn-photo.has-link {
    background: #3498db;
    color: #fff;
}

.btn-photo.has-link:hover {
    background: #2980b9;
}

/* Кнопка без ссылки - тусклая */
.btn-photo.no-link {
    background: #bdc3c7;
    color: #fff;
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-photo.no-link:hover {
    background: #bdc3c7;
}

/* === Photo Modal Styles === */
.photo-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.photo-modal-overlay.active {
    opacity: 1;
}

.photo-modal-content {
    background: #fff;
    border-radius: 12px;
    max-width: 900px;
    width: 90%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.photo-modal-overlay.active .photo-modal-content {
    transform: scale(1);
}

.photo-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 2px solid #eee;
}

.photo-modal-header h3 {
    margin: 0;
    font-size: 1.3rem;
    color: #2c3e50;
}

.photo-modal-close {
    background: none;
    border: none;
    font-size: 2rem;
    color: #95a5a6;
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.photo-modal-close:hover {
    background: #ecf0f1;
    color: #e74c3c;
}

.photo-modal-body {
    padding: 25px;
    overflow-y: auto;
}

.photo-gallery {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.photo-main {
    width: 100%;
    height: 500px;
    background: #f8f9fa;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.photo-main img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    cursor: zoom-in;
}

/* Кнопки навигации слева и справа */
.photo-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(52, 152, 219, 0.9);
    color: #fff;
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.photo-nav-btn:hover {
    background: rgba(41, 128, 185, 1);
    transform: translateY(-50%) scale(1.1);
}

.photo-nav-btn.prev {
    left: 15px;
}

.photo-nav-btn.next {
    right: 15px;
}

.photo-nav-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.photo-nav-btn:disabled:hover {
    transform: translateY(-50%);
}

.photo-thumb-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.photo-thumbnails {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding: 10px 0;
    flex: 1;
    min-width: 0;
}

.photo-thumbnail {
    width: 100px;
    height: 100px;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    border: 3px solid transparent;
    transition: all 0.2s;
    flex-shrink: 0;
}

.photo-thumbnail:hover {
    border-color: #3498db;
}

.photo-thumbnail.active {
    border-color: #667eea;
    box-shadow: 0 0 10px rgba(102, 126, 234, 0.5);
}

.photo-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    cursor: pointer;
}

.photo-fullscreen-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 11000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.photo-fullscreen-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.photo-fullscreen-overlay img {
    max-width: 96vw;
    max-height: 96vh;
    object-fit: contain;
}

.photo-fullscreen-close {
    position: absolute;
    top: 16px;
    right: 20px;
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.photo-fullscreen-close:hover {
    background: rgba(255, 255, 255, 0.24);
}

.btn-open-cloud {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: #3498db;
    color: #fff;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1rem;
    transition: all 0.3s;
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
}

.photo-cloud-inline {
    flex-shrink: 0;
    white-space: nowrap;
}

.btn-open-cloud:hover {
    background: #2980b9;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(52, 152, 219, 0.5);
}

.btn-open-cloud.is-disabled {
    opacity: 0.55;
    pointer-events: none;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-open-cloud span {
    font-size: 1.2rem;
}

/* === Responsive === */
@media (max-width: 1200px) {
    .stock-main {
        padding: 16px 12px 18px;
    }

    .filters-form {
        flex-wrap: wrap;
    }

    .table-wrapper {
        max-width: 100%;
    }

    .stock-table {
        font-size: 0.82rem;
    }

    .stock-table th,
    .stock-table td {
        padding: 8px 8px;
    }

    .stock-table th.col-article,
    .stock-table td.cell-article {
        width: 11ch;
        min-width: 11ch;
        max-width: 11ch;
    }

    .stock-table th.col-available,
    .stock-table td.cell-free {
        width: 13ch;
        min-width: 13ch;
        max-width: 13ch;
    }

    .stock-table th.col-reserve,
    .stock-table td.cell-reserve {
        width: 10ch;
        min-width: 10ch;
        max-width: 10ch;
    }

    .stock-table th.col-unit,
    .stock-table td.cell-unit {
        width: 5ch;
        min-width: 5ch;
        max-width: 5ch;
    }

    .stock-table th.col-price,
    .stock-table td.cell-price {
        width: 11ch;
        min-width: 11ch;
        max-width: 11ch;
    }

    .stock-table th.col-warehouses,
    .stock-table td.cell-warehouses {
        width: 10ch;
        min-width: 10ch;
        max-width: 10ch;
    }

    .btn-wh-open,
    .btn-photo {
        min-width: 0;
        padding-left: 8px;
        padding-right: 8px;
        font-size: 0.78rem;
    }
}

@media (max-width: 768px) {
    .stock-main {
        padding: 10px 6px 14px;
        margin-top: 12px;
    }

    .stock-stats {
        flex-direction: column;
    }

    .header-actuality-nav,
    .header-actuality-box,
    .page-stock .header-actuality-box {
        display: none;
    }

    .filters-form {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
        padding: 10px;
    }

    .price-filter {
        width: 100%;
        max-width: none;
    }

    .stock-content-wrapper {
        flex-direction: column;
    }

    .filter-search,
    .filter-select,
    .btn-download,
    .btn-reset,
    .filter-checkbox,
    .price-filter {
        width: 100%;
        max-width: none;
        min-width: 0;
        font-size: 0.76rem;
    }

    .filter-search,
    .filter-select,
    .btn-download,
    .btn-reset {
        min-height: 30px;
    }

    .filter-checkbox {
        justify-content: flex-start;
        padding: 6px 8px;
    }

    .stock-table {
        table-layout: auto;
        font-size: 0.66rem;
    }

    .stock-table th,
    .stock-table td {
        padding: 5px 4px;
        font-size: 0.66rem;
        text-align: center;
        vertical-align: middle;
    }

    .stock-table th {
        font-weight: 700;
    }

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

    .stock-table th.col-article,
    .stock-table td.cell-article {
        width: 1%;
        min-width: 0;
        max-width: none;
        white-space: nowrap;
    }

    .stock-table th.col-available,
    .stock-table td.cell-free {
        width: 1%;
        min-width: 0;
        max-width: none;
        white-space: nowrap;
    }

    .stock-table th.col-unit,
    .stock-table td.cell-unit {
        width: 4ch;
        min-width: 4ch;
        max-width: 4ch;
    }

    .stock-table th.col-price,
    .stock-table td.cell-price {
        width: 9ch;
        min-width: 9ch;
        max-width: 9ch;
    }

    .stock-table th.col-actions,
    .stock-table td.cell-action {
        width: 1%;
        min-width: 0;
        max-width: none;
        white-space: nowrap;
    }

    .stock-table th.col-stock,
    .stock-table td.cell-stock,
    .stock-table th.col-unit,
    .stock-table td.cell-unit,
    .stock-table th.col-warehouses,
    .stock-table td.cell-warehouses {
        display: none;
    }

    .stock-table th.col-name,
    .stock-table td.cell-name {
        width: auto;
        min-width: 0;
        max-width: none;
    }

    .cell-name {
        display: table-cell;
        position: relative;
        white-space: normal;
        overflow: visible;
        line-height: 1.18;
        text-align: center !important;
    }

    .cell-name .btn-favorite {
        position: absolute;
        left: 4px;
        top: 5px;
        margin: 0;
        font-size: 0.85rem;
        line-height: 1;
    }

    .cell-name-text {
        display: block;
        min-width: 0;
        width: 100%;
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
        word-break: break-word;
        overflow-wrap: break-word;
        font-size: 0.66rem;
    }

    .cell-name .btn-favorite + .cell-name-text {
        padding-left: 14px;
        box-sizing: border-box;
    }

    .sort-link {
        gap: 2px;
        font-size: 0.66rem;
        line-height: 1.05;
        font-weight: 700;
    }

    .cell-action {
        padding-left: 2px !important;
        padding-right: 2px !important;
        text-align: center !important;
    }

    .btn-add-to-order {
        padding: 3px 5px;
        font-size: inherit;
        border-radius: 4px;
    }

    .btn-photo {
        margin-right: 0;
        padding: 4px 5px;
        font-size: 0.62rem;
        line-height: 1.05;
        border-radius: 4px;
    }

    .pagination {
        gap: 4px;
        padding: 12px 0 0;
    }

    .pagination-total {
        width: 100%;
        text-align: center;
        margin-left: 0;
        font-size: 0.72rem;
    }

    .wh-modal-content {
        width: calc(100vw - 16px);
        max-width: none;
    }

    .wh-modal-header {
        padding: 10px 12px;
    }

    .wh-modal-header h3 {
        font-size: 0.76rem;
        line-height: 1.2;
        white-space: normal;
    }

    .wh-modal-close {
        font-size: 1.4rem;
    }

    .wh-modal-body {
        display: table;
        width: 100%;
        padding: 8px;
        overflow-x: auto;
    }

    .whm-head,
    .whm-row {
        display: table-row;
    }

    .whm-head {
        position: static;
        background: transparent;
        border-bottom: none;
        font-size: 0.62rem;
    }

    .whm-head > div,
    .whm-row > div {
        display: table-cell;
        padding: 6px 4px;
        vertical-align: middle;
    }

    .whm-head > div:first-child,
    .whm-row > div:first-child {
        width: 46%;
    }

    .whm-head > div:not(:first-child),
    .whm-row > div:not(:first-child) {
        width: 18%;
    }

    .whm-head > div {
        font-size: 0.62rem;
        font-weight: 700;
        text-transform: none;
        line-height: 1.1;
    }

    .whm-row {
        font-size: 0.62rem;
    }

    .whm-name {
        font-size: 0.62rem;
        line-height: 1.15;
        word-break: break-word;
    }

    .whm-val {
        font-size: 0.62rem;
        white-space: nowrap;
    }

    .new-order-panel {
        width: 100%;
        min-width: 100%;
    }

    .photo-thumb-actions {
        gap: 8px;
    }

    .photo-cloud-inline {
        padding: 10px 14px;
        font-size: 0.9rem;
    }
}

@media (max-width: 424px) {
    .stock-table {
        font-size: 0.58rem;
    }

    .stock-table th,
    .stock-table td,
    .sort-link,
    .cell-name-text,
    .btn-photo,
    .btn-add-to-order,
    .cell-free-trigger {
        font-size: 0.58rem;
    }

    .stock-table th,
    .stock-table td {
        padding: 4px 3px;
    }

    .stock-table th.col-actions,
    .stock-table td.cell-action {
        width: 46px;
        min-width: 46px;
        max-width: 46px;
        white-space: normal;
    }

    .cell-action {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 4px;
    }

    .cell-action .btn-photo,
    .cell-action .btn-add-to-order {
        display: inline-flex;
        width: auto;
        min-width: 38px;
        justify-content: center;
        margin: 0;
        padding: 2px 4px;
        font-size: 0.54rem;
        line-height: 1;
        border-radius: 3px;
    }
}
