/* ===== GLOBALNY SYSTEM STYLÓW ===== */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: #f8f9fa;
    min-height: 100vh;
    color: #333;
    line-height: 1.5;
}

/* ===== KONTENER GŁÓWNY ===== */
.container {
    width: auto;
    max-width: 1250px;
    margin: 0 auto;
    background: transparent;
    min-height: 100vh;
    transition: width 0.3s ease;
}



/* ===== HEADER ===== */
.header {
    background: white;
    color: #333;
    padding: 15px;
    text-align: center;
    border-bottom: 1px solid #dee2e6;
}

.header h1 {
    font-size: 1.8em;
    margin-bottom: 5px;
    font-weight: 600;
}

.header p {
    color: #666;
    font-size: 0.9em;
}

/* ===== NAWIGACJA ===== */
.nav-container {
    background: white;
    border-bottom: 1px solid #dee2e6;
    position: relative;
    z-index: 10;
    /* Menu nawigacyjne zawsze na pełną szerokość */
    left: 50%;
    right: 50%;
    margin-left: -50vw;
    margin-right: -50vw;
    width: 100vw;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.nav-tabs {
    display: flex;
    padding: 0 20px;
}

/* Hamburger menu button - ukryty domyślnie */
.hamburger-menu {
    display: none;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    padding: 15px 20px;
    color: #333;
    position: absolute;
    right: 0;
    top: 0;
    z-index: 12;
}

.nav-tab {
    padding: 10px 15px;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: #666;
    white-space: nowrap;
    transition: all 0.15s ease;
    border-bottom: 2px solid transparent;
    flex: 1;
    text-align: center;
    position: relative;
}

.nav-tab:hover {
    background: #f8f9fa;
    color: #333;
}

.nav-tab.active {
    background: white;
    color: #007bff;
    border-bottom: 2px solid #007bff;
    font-weight: 600;
    z-index: 11;
}

/* ===== ZAWARTOŚĆ ZAKŁADEK ===== */
.tab-content {
    padding: 20px;
    min-height: 500px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 10px 10px 0 0;
    margin-top: -10px;
    box-shadow: 0 -5px 20px rgba(0,0,0,0.1);
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
}

/* ===== FORMULARZ ===== */
.form-group {
    margin-bottom: 8px;
}

.form-row {
    display: flex;
    gap: 6px;
    margin-bottom: 6px;
}

.form-col {
    flex: 1;
}

.form-col-narrow {
    flex: 0 0 100px;
}

.form-col-medium {
    flex: 0 0 70px;
}

.form-col-wide {
    flex: 1;
    max-width: 380px;
}

label {
    display: block;
    margin-bottom: 2px;
    font-weight: 600;
    color: #495057;
    font-size: 11px;
    height: 15px;
    line-height: 15px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

input, select, textarea {
    width: 100%;
    padding: 4px 6px;
    border: 1px solid #dee2e6;
    border-radius: 3px;
    font-size: 13px;
    transition: border-color 0.3s ease;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: #007bff;
}

select:disabled {
    background-color: #f8f9fa;
    color: #6c757d;
    cursor: not-allowed;
}

/* Style dla pól opcjonalnych */
input[style*="background-color: rgb(248, 249, 250)"],
input[style*="background-color:#f8f9fa"] {
    border-style: dashed;
    border-color: #ced4da;
}

/* Tooltip dla pól opcjonalnych */
.optional-field-tooltip {
    font-size: 11px;
    color: #6c757d;
    font-style: italic;
    margin-top: 2px;
}

/* ===== PRZYCISKI ===== */
.btn {
    padding: 8px 16px;
    border: 1px solid;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    margin-right: 8px;
}

.btn-primary {
    background: white;
    color: #007bff;
    border-color: #007bff;
}

.btn-primary:hover {
    background: #007bff;
    color: white;
}

.btn-secondary {
    background: white;
    color: #6c757d;
    border-color: #6c757d;
}

.btn-secondary:hover {
    background: #6c757d;
    color: white;
}

.btn-success {
    background: white;
    color: #28a745;
    border-color: #28a745;
}

.btn-success:hover {
    background: #28a745;
    color: white;
}

.btn-danger {
    background: white;
    color: #dc3545;
    border-color: #dc3545;
}

.btn-danger:hover {
    background: #dc3545;
    color: white;
}

/* ===== KONTENER LINII ===== */
.lines-container {
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 8px;
    margin: 10px 0;
    background: #f8f9fa;
}

.line-item {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 6px;
    margin-bottom: 6px;
    position: relative;
}

.line-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    font-weight: 600;
    color: #495057;
    font-size: 13px;
    background: #f8f9fa;
    margin: -6px -6px 6px -6px;
    padding: 4px 6px;
    border-radius: 4px 4px 0 0;
}

.remove-line {
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 3px;
    width: 24px;
    height: 24px;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
}

/* ===== KOMUNIKATY STATUS ===== */
.status-message {
    padding: 15px;
    border-radius: 6px;
    margin: 20px 0;
    display: none;
}

.status-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.status-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* ===== PLACEHOLDER CONTENT ===== */
.placeholder-content {
    text-align: center;
    padding: 60px 20px;
    color: #6c757d;
}

.placeholder-content h3 {
    margin-bottom: 15px;
    color: #495057;
}

/* ===== TWORZENIE PAKIETÓW ===== */
.komplet-form {
    max-width: none;
}

/* Style dla zakładki tworzenia pakietów zostały przeniesione do .container.wide-mode */

/* KONTENER TABELI BEZ PRZEWIJANIA */
.towary-lista {
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 0;
    background: #f8f9fa;
    min-width: 100%;
    position: relative;
}



/* ===== KOMPAKTOWE PODSUMOWANIE PAKIETU ===== */
.pakiet-summary-table,
.pakiet-stats-table {
    border: 1px solid #dee2e6;
    border-radius: 8px;
    background: #f8f9fa;
    margin-bottom: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.pakiet-summary-header {
    background: #f8f9fa;
    color: #666;
    border-radius: 6px 6px 0 0;
    padding: 8px;
    font-size: 12px;
    font-weight: 500;
    display: grid;
    gap: 6px;
    text-align: center;
}

.pakiet-stats-header {
    background: #f8f9fa;
    color: #666;
    border-radius: 6px 6px 0 0;
    padding: 8px;
    font-size: 12px;
    font-weight: 500;
    display: grid;
    gap: 6px;
    text-align: center;
}

.pakiet-summary-header {
    grid-template-columns: 
        minmax(70px, 80px)     /* Kod pakietu - zmniejszony o połowę */
        minmax(70px, 84px)     /* Kategoria - węższa o 30% */
        minmax(108px, 132px)   /* Nazwa pakietu - węższa o 40% */
        minmax(60px, 70px)     /* Marka - zmniejszona o połowę */
        minmax(60px, 70px)     /* Model - zmniejszony o połowę */
        minmax(140px, 170px)   /* Uwagi - przesunięte przed naklejki */
        minmax(70px, 80px)     /* Naklejki - po uwagach */
        minmax(100px, 120px);  /* Przycisk zapisz */
}

.pakiet-stats-header {
    grid-template-columns: 
        minmax(110px, 130px)   /* Średnia zakup */
        minmax(110px, 130px)   /* Suma zakup */
        minmax(110px, 130px)   /* Suma HURT */
        minmax(110px, 130px)   /* Średnia HURT */
        minmax(90px, 110px)    /* Marża HURT */
        minmax(110px, 130px)   /* Suma DETAL */
        minmax(110px, 130px)   /* Średnia DETAL */
        minmax(90px, 110px);   /* Marża DETAL */
}

.pakiet-summary-row,
.pakiet-stats-row {
    background: white;
    border: 1px solid #dee2e6;
    border-top: none;
    padding: 8px;
    display: grid;
    gap: 6px;
    align-items: center;
    min-height: 50px;
}

.pakiet-summary-row {
    grid-template-columns: 
        minmax(70px, 80px)     /* Kod pakietu - zmniejszony o połowę */
        minmax(70px, 84px)     /* Kategoria - węższa o 30% */
        minmax(108px, 132px)   /* Nazwa pakietu - węższa o 40% */
        minmax(60px, 70px)     /* Marka - zmniejszona o połowę */
        minmax(60px, 70px)     /* Model - zmniejszony o połowę */
        minmax(140px, 170px)   /* Uwagi - przesunięte przed naklejki */
        minmax(70px, 80px)     /* Naklejki - po uwagach */
        minmax(100px, 120px);  /* Przycisk zapisz */
}

.pakiet-stats-row {
    grid-template-columns: 
        minmax(110px, 130px)   /* Średnia zakup */
        minmax(110px, 130px)   /* Suma zakup */
        minmax(110px, 130px)   /* Suma HURT */
        minmax(110px, 130px)   /* Średnia HURT */
        minmax(90px, 110px)    /* Marża HURT */
        minmax(110px, 130px)   /* Suma DETAL */
        minmax(110px, 130px)   /* Średnia DETAL */
        minmax(90px, 110px);   /* Marża DETAL */
}

.pakiet-summary-row input {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid #dee2e6;
    border-radius: 5px;
    font-size: 12px;
    background: white;
    transition: all 0.2s ease;
}

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

.pakiet-summary-row input:hover {
    border-color: #999;
}

.pakiet-save-btn {
    font-size: 13px;
    padding: 8px 12px;
    white-space: nowrap;
    font-weight: 600;
}

.stat-cell {
    display: flex;
    flex-direction: column;
    gap: 3px;
    text-align: center;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.stat-cell span {
    font-size: 12px;
    font-weight: 600;
    color: #495057;
}

.stat-mini-input {
    width: 100%;
    padding: 3px 6px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    font-size: 10px;
    text-align: center;
    background: #f8f9fa;
    opacity: 0.7;
    transition: all 0.2s ease;
}

.stat-mini-input:focus {
    outline: none;
    border-color: #667eea;
    background: white;
    opacity: 1;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
}

.stat-mini-input:hover {
    opacity: 1;
    border-color: #999;
}

.stat-readonly {
    background: #f8f9fa;
    border-left: 3px solid #6c757d;
}

.stat-readonly span {
    color: #6c757d;
}

.stat-editable {
    background: #fff3cd;
    border-left: 3px solid #ffc107;
}

.stat-editable:hover {
    background: #fff8e1;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.stat-editable span {
    color: #856404;
}

/* ===== MOBILE NAVIGATION ===== */
@media (max-width: 768px) {
    .hamburger-menu {
        display: block;
    }
    
    .nav-tabs {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: white;
        flex-direction: column;
        padding: 0;
        box-shadow: 0 4px 8px rgba(0,0,0,0.1);
        border-top: 1px solid #dee2e6;
    }
    
    .nav-tabs.mobile-open {
        display: flex;
    }
    
    .nav-tab {
        padding: 15px 20px;
        text-align: left;
        border-bottom: 1px solid #f8f9fa;
        border-radius: 0;
        flex: none;
    }
    
    .nav-tab:last-child {
        border-bottom: none;
    }
    
    .nav-tab.active {
        background: #f8f9fa;
        border-bottom-color: #f8f9fa;
    }
}

/* Responsywność dla podsumowania */
@media (max-width: 768px) {
    .pakiet-summary-header,
    .pakiet-summary-row {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
    
    .pakiet-stats-header,
    .pakiet-stats-row {
        grid-template-columns: 1fr 1fr 1fr 1fr;
        gap: 8px;
    }
    
    .pakiet-summary-header,
    .pakiet-stats-header {
        font-size: 11px;
        padding: 8px;
    }
    
    .pakiet-summary-row,
    .pakiet-stats-row {
        padding: 10px;
        min-height: 60px;
    }
    
    .pakiet-summary-row input {
        padding: 8px;
        font-size: 11px;
    }
    
    .stat-cell span {
        font-size: 11px;
    }
    
    .stat-mini-input {
        font-size: 9px;
        padding: 4px;
    }
    
    .pakiet-save-btn {
        font-size: 12px;
        padding: 10px;
    }
}



/* ===== KONTENER TOWARÓW - NORMALNA SZEROKOŚĆ ===== */
.towary-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    padding: 15px;
    margin-top: 20px;
    margin-bottom: 20px;
}

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

/* HEADER TABELI - UPDATED WITH STAN COLUMN */
.towary-header {
    background: #f8f9fa;
    color: #666;
    border-radius: 6px 6px 0 0;
    border: 1px solid #dee2e6;
    padding: 8px;
    font-size: 11px;
    font-weight: 500;
    display: grid;
    grid-template-columns: 
        minmax(60px, 70px)     /* Kod - kompaktowe */
        minmax(70px, 85px)     /* Kategoria - zwiększone dla 6+ znaków */
        minmax(75px, 90px)     /* Dostawca - nowe pole */
        minmax(85px, 105px)    /* Marka - kompaktowe */
        24px                   /* Copy btn - lepsze wyrównanie */
        minmax(85px, 105px)    /* Model - kompaktowe */
        24px                   /* Copy btn - lepsze wyrównanie */
        minmax(60px, 70px)     /* Długość - kompaktowe */
        minmax(80px, 100px)    /* Uwagi - węższe */
        minmax(35px, 45px)     /* Ilość - kompaktowe */
        minmax(70px, 80px)     /* Koszt dodatkowy - nowe pole */
        24px                   /* Copy btn koszt - nowy */
        minmax(90px, 110px)    /* Zakup - powiększone dla lepszej widoczności */
        minmax(75px, 90px)     /* Hurt - kompaktowe */
        minmax(75px, 90px)     /* Detal - kompaktowe */
        minmax(30px, 35px);    /* Remove btn - kompaktowe */
    gap: 6px;
    align-items: center;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Kolorowanie nagłówków hurt i detal */
.towary-header > div:nth-child(14) {
    color: #28a745;
    font-weight: 600;
}

.towary-header > div:nth-child(15) {
    color: #007bff;
    font-weight: 600;
}

/* WIERSZE TABELI - UPDATED WITH STAN COLUMN */
.towar-row {
    background: white;
    border: 1px solid #dee2e6;
    border-top: none;
    padding: 4px;
    font-size: 12px;
    display: grid;
    grid-template-columns: 
        minmax(60px, 70px)     /* Kod - kompaktowe */
        minmax(70px, 85px)     /* Kategoria - zwiększone dla 6+ znaków */
        minmax(75px, 90px)     /* Dostawca - nowe pole */
        minmax(85px, 105px)    /* Marka - kompaktowe */
        24px                   /* Copy btn - lepsze wyrównanie */
        minmax(85px, 105px)    /* Model - kompaktowe */
        24px                   /* Copy btn - lepsze wyrównanie */
        minmax(60px, 70px)     /* Długość - kompaktowe */
        minmax(80px, 100px)    /* Uwagi - węższe */
        minmax(35px, 45px)     /* Ilość - kompaktowe */
        minmax(70px, 80px)     /* Koszt dodatkowy - nowe pole */
        24px                   /* Copy btn koszt - nowy */
        minmax(90px, 110px)    /* Zakup - powiększone dla lepszej widoczności */
        minmax(75px, 90px)     /* Hurt - kompaktowe */
        minmax(75px, 90px)     /* Detal - kompaktowe */
        minmax(30px, 35px);    /* Remove btn - kompaktowe */
    gap: 6px;
    align-items: center;
    min-height: 36px;
    transition: all 0.2s ease;
}

.towar-row:hover {
    background: #f8f9fa;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.towar-row:last-child {
    border-radius: 0 0 8px 8px;
}

/* POLA FORMULARZA W TABELI */
.towar-row input,
.towar-row select {
    width: 100%;
    font-size: 11px;
    padding: 4px;
    border: 1px solid #ddd;
    border-radius: 4px;
    height: 28px;
    box-sizing: border-box;
    transition: all 0.2s ease;
    background: white;
}

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

.towar-row input:hover,
.towar-row select:hover {
    border-color: #999;
}

/* SPECJALNE POLA */
.towar-kod {
    padding: 4px;
    font-weight: bold;
    color: #495057;
    background: #f8f9fa;
    border-radius: 4px;
    text-align: center;
    border: 1px solid #e9ecef;
}

.towar-number {
    text-align: center;
}

.towar-price {
    text-align: right;
}

.readonly-price {
    background-color: #f8f9fa !important;
    color: #6c757d !important;
    border: 1px solid #e9ecef !important;
    cursor: not-allowed;
}

/* KOLUMNY CEN Z MARŻAMI */
.price-column {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

/* KOLUMNA ILOŚCI ZE STANEM */
.ilosc-column {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.price-input-hurt,
.towar-row input[id*="hurt"],
.towar-row .towar-price-hurt {
    border: 1px solid #28a745 !important;
    background: #f0f8f0 !important;
    color: #28a745 !important;
}

.price-input-detal,
.towar-row input[id*="detal"],
.towar-row .towar-price-detal {
    border: 1px solid #007bff !important;
    background: white !important;
    color: #007bff !important;
}

.margin-display {
    font-size: 9px;
    font-weight: bold;
    text-align: center;
    padding: 1px;
    border-radius: 2px;
}

/* WYŚWIETLANIE STANU */
.stan-display {
    font-size: 9px;
    font-weight: bold;
    text-align: center;
    padding: 1px;
    border-radius: 2px;
}

.stan-ok {
    color: #28a745;
}

.stan-low {
    color: #dc3545;
}

/* OVERLAY ZAPISYWANIA */
.saving-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.saving-overlay.show {
    opacity: 1;
}

.saving-content {
    background: white;
    padding: 40px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.saving-overlay.show .saving-content {
    transform: scale(1);
}

.saving-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    margin: 0 auto 20px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ANIMACJE PRZYCISKU ZAPISZ */
.btn.saving {
    background: #667eea !important;
    cursor: not-allowed;
    position: relative;
    overflow: hidden;
}

.btn.saving .spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid #ffffff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-right: 8px;
    vertical-align: middle;
}

.btn.saved {
    background: #28a745 !important;
    animation: pulse 0.5s ease;
}

.btn.error {
    background: #dc3545 !important;
    animation: shake 0.5s ease;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.margin-hurt {
    color: #28a745;
    background: rgba(40, 167, 69, 0.1);
}

.margin-detal {
    color: #1976d2;
    background: rgba(25, 118, 210, 0.1);
}

/* PRZYCISKI */
.towar-btn {
    padding: 4px;
    font-size: 11px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    height: 28px;
    width: 100%;
    transition: all 0.2s ease;
    font-weight: 500;
}

.btn-copy {
    background: #007bff;
    color: white;
}

.btn-copy:hover {
    background: #0056b3;
    transform: translateY(-1px);
}

.btn-copy-subtle {
    background: transparent;
    color: #6c757d;
    border: 1px solid transparent;
    font-size: 14px;
    padding: 2px 4px;
    border-radius: 6px;
    opacity: 0.8;
    transition: all 0.2s ease;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.btn-copy-subtle:hover {
    background: #f8f9fa;
    color: #495057;
    border: 1px solid #dee2e6;
    opacity: 1;
    transform: scale(1.1);
}

.hidden {
    display: none !important;
}

/* ===== DODAWANIE ZAKRESÓW - STYLE MINIMALISTYCZNE ===== */

/* Formularz zakresów */
#dodawanie-zakresow .form-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 6px;
}

#dodawanie-zakresow .form-col {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

#dodawanie-zakresow .form-col label {
    font-size: 12px;
    font-weight: 500;
    color: #666;
    margin-bottom: 2px;
}

#dodawanie-zakresow input, 
#dodawanie-zakresow select {
    padding: 6px 10px;
    font-size: 13px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
}

#dodawanie-zakresow input:focus,
#dodawanie-zakresow select:focus {
    outline: none;
    border-color: #667eea;
}

/* Tabela zakresów */
.lines-table-container {
    overflow-x: auto;
    margin-bottom: 15px;
    border: 1px solid #e9ecef;
    border-radius: 6px;
}

.lines-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    display: table !important;
}

.lines-table thead {
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
}

.lines-table th {
    padding: 10px 6px;
    text-align: center;
    font-weight: 500;
    font-size: 12px;
    color: #666;
    white-space: nowrap;
}

.lines-table td {
    padding: 6px 4px;
    text-align: center;
    border-bottom: 1px solid #f0f0f0;
}

.lines-table tbody tr {
    display: table-row !important;
}

.lines-table tbody td {
    display: table-cell !important;
}

.lines-table input {
    width: 100%;
    padding: 5px 8px;
    border: 1px solid #e0e0e0;
    border-radius: 3px;
    font-size: 13px;
    text-align: center;
}

.lines-table input:focus {
    outline: none;
    border-color: #667eea;
}

/* Wiersze sum */
.summary-row {
    font-weight: 600;
    background: #f8f9fa;
}

.summary-row-top {
    border-bottom: 2px solid #dee2e6;
}

.summary-row-bottom {
    border-top: 2px solid #dee2e6;
}

.text-right {
    text-align: right;
}

.suma-field {
    font-weight: 600;
    font-size: 14px;
}

.suma-eur {
    color: #0056b3;
}

.suma-pln {
    color: #28a745;
}

/* Kolumny walutowe i zakup PLN */
.waluta-netto, .pln-brutto, .cena-zakupu-pln {
    font-weight: 500;
    padding: 4px 8px;
    border-radius: 3px;
    display: inline-block;
    font-size: 13px;
}

.waluta-netto {
    background: white;
    color: #0056b3;
}

.pln-brutto {
    background: #f0faf4;
    color: #28a745;
}

.cena-zakupu-pln {
    background: #fff9e6;
    color: #d4ac0d;
    font-weight: 600;
}

/* Przycisk usuwania */
.btn-remove {
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 5px;
    cursor: pointer;
    transition: all 0.15s ease;
    color: #666;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-remove:hover {
    border-color: #dc3545;
    color: #dc3545;
}

.btn-remove svg {
    width: 14px;
    height: 14px;
}

/* Reset dla form-row w tabeli */
.lines-table .form-row {
    display: contents !important;
}

/* ===== TWORZENIE PAKIETÓW - UPROSZCZONY INPUT ===== */

/* Input i przyciski w tworzeniu pakietów */
.tworzenie-pakietow .form-row {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    margin-bottom: 15px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 6px;
}

.tworzenie-pakietow .form-col {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.tworzenie-pakietow .form-col label {
    font-size: 12px;
    font-weight: 500;
    color: #666;
    margin-bottom: 2px;
}

/* Pole kodu towaru */
#kod-towaru {
    width: 100%;
    padding: 8px 12px;
    font-size: 14px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
}

#kod-towaru:focus {
    outline: none;
    border-color: #667eea;
}

/* Grupa przycisków */
.button-group {
    display: flex !important;
    flex-direction: row !important;
    gap: 8px;
    align-items: center;
    margin-left: auto;
    flex-wrap: nowrap;
}

/* Wszystkie przyciski w grupie mają być inline */
.button-group > * {
    display: inline-flex !important;
    flex-shrink: 0;
}

/* Przyciski - minimalistyczne */
#dodaj-towar, #zapisz-komplet-top, #podsumuj-pakiet-inline,
#zapisz-komplet-footer, #podsumuj-pakiet-footer {
    height: 36px;
    padding: 0 16px;
    font-size: 13px;
    line-height: 36px;
    border-radius: 4px;
    font-weight: 500;
    transition: all 0.15s ease;
    border: 1px solid;
    cursor: pointer;
    white-space: nowrap;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
}

#dodaj-towar {
    background: white;
    color: #666;
    border-color: #ddd;
}

#dodaj-towar:hover {
    background: #f8f9fa;
    border-color: #999;
}

#zapisz-komplet-top, #zapisz-komplet-footer {
    background: white;
    color: #28a745;
    border-color: #28a745;
}

#zapisz-komplet-top:hover, #zapisz-komplet-footer:hover {
    background: #28a745;
    color: white;
}

#podsumuj-pakiet-inline, #podsumuj-pakiet-footer {
    background: white;
    color: #007bff;
    border-color: #007bff;
}

#podsumuj-pakiet-inline:hover, #podsumuj-pakiet-footer:hover {
    background: #007bff;
    color: white;
}

/* Statusy - minimalistyczne */
#loading-status, #success-status, #error-status {
    padding: 6px 10px;
    border-radius: 3px;
    font-size: 12px;
    border-left: 3px solid;
}

#loading-status {
    background: #e3f2fd;
    border-left-color: #2196f3;
}

#success-status {
    background: #d4edda;
    border-left-color: #28a745;
}

#error-status {
    background: #f8d7da;
    border-left-color: #dc3545;
}



/* INFORMACJE O TOWARZE */
.towar-ids {
    font-size: 9px;
    color: #6c757d;
    line-height: 1.2;
}

/* STOPKA TABELI */
.towary-footer {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-top: none;
    border-radius: 0 0 8px 8px;
    padding: 12px;
    font-size: 11px;
    text-align: center;
    color: #6c757d;
    line-height: 1.4;
}

/* ===== PANEL STATYSTYK ===== */
.statystyki-panel {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 15px;
    margin: 10px 0;
}

.statystyki-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 15px;
}

.statystyki-row:last-child {
    margin-bottom: 0;
}

.stat-item {
    background: white;
    border-radius: 4px;
    padding: 12px;
    border: 1px solid #dee2e6;
    border-left: 3px solid #007bff;
}

.stat-item:hover {
    background: #f8f9fa;
}

.stat-item label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: #495057;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-item span {
    display: block;
    font-size: 18px;
    font-weight: bold;
    color: #2c3e50;
}

/* KOLOROWE WARIANTY STATYSTYK */
.stat-primary {
    border-left-color: #007bff;
}

.stat-primary span {
    color: #007bff;
}

.stat-success {
    border-left-color: #28a745;
}

.stat-success span {
    color: #28a745;
}

.stat-info {
    border-left-color: #1976d2;
}

.stat-info span {
    color: #1976d2;
}

.stat-warning {
    border-left-color: #fd7e14;
}

.stat-warning span {
    color: #fd7e14;
}

/* RESPONSIVE STATYSTYKI */
@media (max-width: 768px) {
    .statystyki-row {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .stat-item {
        padding: 12px;
    }
    
    .stat-item label {
        font-size: 10px;
        margin-bottom: 6px;
    }
    
    .stat-item span {
        font-size: 16px;
    }
}

.towar-item {
    transition: all 0.2s ease;
}

.towar-item:hover {
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transform: translateY(-1px);
}

.empty-state {
    user-select: none;
}

#loading-status {
    animation: pulse 1.5s ease-in-out infinite alternate;
}

@keyframes pulse {
    from { opacity: 0.6; }
    to { opacity: 1.0; }
}

.status-message.status-warning {
    background-color: #fff3cd;
    border-color: #ffeaa7;
    color: #856404;
}

/* Scanner modal styles */
#scanner-modal {
    backdrop-filter: blur(4px);
}

/* ===== WGRYWANIE ZDJĘĆ ===== */
.upload-form {
    max-width: none;
}

.upload-area {
    margin-bottom: 15px;
}

.file-upload-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    width: 100%;
    padding: 30px 20px;
    border: 2px dashed #dee2e6;
    border-radius: 8px;
    background: #f8f9fa;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.file-upload-label:hover {
    border-color: #667eea;
    background: #f0f4ff;
}

.upload-icon {
    font-size: 2em;
    color: #667eea;
}

.upload-text {
    color: #495057;
}

.upload-text strong {
    font-size: 1.1em;
    color: #667eea;
}

.upload-text small {
    color: #6c757d;
    font-size: 0.9em;
}

.file-status {
    text-align: center;
    padding: 10px;
    color: #6c757d;
    font-size: 0.9em;
    background: #f8f9fa;
    border-radius: 4px;
    margin-bottom: 15px;
}

.file-status.has-files {
    color: #28a745;
    background: #d4edda;
    border: 1px solid #c3e6cb;
}

.preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
    margin-bottom: 15px;
}

.preview-item {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.preview-item img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    display: block;
}

.preview-item .remove-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    background: rgba(220, 53, 69, 0.8);
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.preview-item .remove-btn:hover {
    background: rgba(220, 53, 69, 1);
}

.progress-container {
    margin: 20px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #dee2e6;
}

.progress-bar-bg {
    width: 100%;
    height: 20px;
    background: #e9ecef;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #28a745, #20c997);
    border-radius: 10px;
    transition: width 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.progress-text {
    color: white;
    font-size: 11px;
    font-weight: bold;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.progress-status {
    text-align: center;
    color: #6c757d;
    font-size: 0.9em;
}

.radio-group {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 6px;
    transition: background-color 0.2s ease;
    font-size: 14px;
    color: #495057;
}

.radio-label:hover {
    background: #f8f9fa;
}

.radio-label input[type="radio"] {
    display: none;
}

.radio-custom {
    width: 16px;
    height: 16px;
    border: 2px solid #dee2e6;
    border-radius: 50%;
    position: relative;
    transition: all 0.2s ease;
}

.radio-label input[type="radio"]:checked + .radio-custom {
    border-color: #667eea;
    background: #667eea;
}

.radio-label input[type="radio"]:checked + .radio-custom::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 6px;
    height: 6px;
    background: white;
    border-radius: 50%;
}

@media (max-width: 768px) {
    .preview-grid {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    }
    
    .preview-item img {
        height: 80px;
    }
    
    .file-upload-label {
        padding: 40px 15px;
        flex-direction: column;
        gap: 15px;
        min-height: 120px;
    }
    
    .upload-icon {
        font-size: 1.5em;
    }
    
    .radio-group {
        flex-direction: column;
        gap: 10px;
    }
}

/* ===== SEKCJA PAKIET I STATYSTYKI ===== */
.pakiet-stats-container {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

.pakiet-form-section {
    flex: 0 0 280px; /* Stała szerokość formularza */
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.pakiet-stats-section {
    flex: 1; /* Pozostała przestrzeń dla statystyk */
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.pakiet-form-row {
    margin-bottom: 12px;
}

.pakiet-form-row label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #495057;
    margin-bottom: 4px;
}

.pakiet-form-row input {
    width: 100%;
    padding: 6px 8px;
    font-size: 13px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    background: #fff;
    transition: all 0.2s ease;
}

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

/* Mniejsze pola hurt/detal w pakietach */
.pakiet-form-row input#sprzedaz-hurt,
.pakiet-form-row input#sprzedaz-detal {
    width: 120px;
    max-width: 120px;
}

/* KOMPAKTOWE STATYSTYKI */
.stats-compact {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.stat-compact {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 8px;
    text-align: center;
    transition: all 0.2s ease;
}

.stat-compact:hover {
    background: #e9ecef;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.stat-compact label {
    display: block;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 3px;
    color: #6c757d;
    line-height: 1.2;
}

.stat-compact span {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: #495057;
    line-height: 1.1;
}

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

.stat-display-edit span {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: #495057;
    line-height: 1.1;
    min-height: 16px;
}

.stat-edit-input {
    width: 100%;
    padding: 3px 5px;
    border: 1px solid #dee2e6;
    border-radius: 3px;
    font-size: 10px;
    text-align: center;
    background: #f8f9fa;
    color: #495057;
    transition: all 0.2s ease;
    opacity: 0.7;
}

.stat-edit-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
    background: #fff;
    opacity: 1;
}

.stat-edit-input:hover {
    border-color: #999;
    opacity: 1;
}

.stat-edit-input::placeholder {
    font-size: 9px;
    color: #6c757d;
}

.stat-compact.stat-primary {
    border-left: 3px solid #007bff;
}

.stat-compact.stat-success {
    border-left: 3px solid #28a745;
}

.stat-compact.stat-info {
    border-left: 3px solid #17a2b8;
}

/* ===== RESPONSYWNOŚĆ ===== */
@media (max-width: 768px) {
    .container {
        width: 95%; /* Szerszy na tablecie */
    }
    
    .pakiet-stats-container {
        flex-direction: column;
        gap: 15px;
    }
    
    .pakiet-form-section {
        flex: none;
    }
    
    .stats-compact {
        grid-template-columns: 1fr;
    }
    
    .form-row {
        flex-direction: column;
    }
    
    .tab-content {
        padding: 10px;
    }
    
    .nav-tabs {
        flex-wrap: wrap;
    }
    
    .nav-tab {
        flex: 1;
        min-width: 90px;
        padding: 10px 6px;
        font-size: 12px;
    }
    
    .header h1 {
        font-size: 2em;
    }
    
    .form-col-narrow,
    .form-col-medium,
    .form-col-wide {
        flex: 1;
        max-width: none;
    }
    
    /* RESPONSIVE TABELA TOWARÓW */
    .towary-table-container {
        font-size: 11px;
    }
    
    .towary-header,
    .towar-row {
        font-size: 11px;
        padding: 8px;
        gap: 4px;
        grid-template-columns: 
            minmax(55px, 60px)     /* Kod - mobilne */
            minmax(45px, 50px)     /* Kat - mobilne (6+ znaków) */
            minmax(65px, 75px)     /* Dostawca - mobilne */
            minmax(70px, 85px)     /* Marka - mobilne */
            16px                   /* Copy btn - mobilne */
            minmax(70px, 85px)     /* Model - mobilne */
            16px                   /* Copy btn - mobilne */
            minmax(50px, 60px)     /* Długość - mobilne */
            minmax(100px, 1fr)     /* Uwagi - mobilne */
            minmax(30px, 35px)     /* Ilość - mobilne */
            minmax(30px, 35px)     /* Stan - mobilne */
            minmax(70px, 85px)     /* Koszt dod. - mobilne */
            14px                   /* Copy btn koszt - mobilne */
            minmax(75px, 85px)     /* Zakup - mobilne (powiększone) */
            minmax(60px, 70px)     /* Hurt - mobilne */
            minmax(60px, 70px)     /* Detal - mobilne */
            minmax(25px, 30px);    /* Remove btn - mobilne */
    }
    
    .towar-row input,
    .towar-row select {
        font-size: 11px;
        padding: 6px;
        height: 32px;
    }
    
    .towar-btn {
        font-size: 10px;
        padding: 6px;
        height: 32px;
    }
}

@media (max-width: 480px) {
    /* ULTRA MOBILE - jeszcze mniejsze */
    .container {
        width: 98%; /* Bardzo szeroki na mobile */
    }
    
    .towary-table-container {
        font-size: 10px;
    }
    
    .towary-header,
    .towar-row {
        font-size: 10px;
        padding: 6px;
        gap: 3px;
    }
    
    .towar-row input,
    .towar-row select {
        font-size: 10px;
        padding: 4px;
        height: 28px;
    }
    
    .towar-btn {
        font-size: 9px;
        padding: 4px;
        height: 28px;
    }
}

/* ===== NOWE STYLE STATYSTYK - UPORZĄDKOWANY LAYOUT ===== */

/* Sekcje statystyk */
.stats-section {
    margin-bottom: 16px;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid #e0e6ed;
}

.stats-purchase {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-color: #6c757d;
}

.stats-sales {
    background: #f8f9fa;
    border-color: #2196f3;
}

/* Tytuły grup */
.stats-group-title {
    margin: 0 0 8px 0;
    font-size: 13px;
    font-weight: 600;
    color: #495057;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid rgba(0,0,0,0.1);
    padding-bottom: 4px;
}

/* Rząd statystyk zakupu */
.stats-row {
    display: flex;
    gap: 12px;
    justify-content: center;
}

/* Kolumny sprzedaży */
.stats-columns {
    display: flex;
    gap: 16px;
}

.stats-column {
    flex: 1;
    padding: 8px;
    border-radius: 6px;
    border: 1px solid rgba(0,0,0,0.1);
}

.stats-hurt {
    background: linear-gradient(135deg, #e8f5e8 0%, #d4edda 100%);
    border-color: #28a745;
}

.stats-detal {
    background: linear-gradient(135deg, #e1f5fe 0%, #b3e5fc 100%);
    border-color: #17a2b8;
}

/* Tytuły kolumn */
.stats-column-title {
    margin: 0 0 6px 0;
    font-size: 11px;
    font-weight: 700;
    color: #495057;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.stats-hurt .stats-column-title {
    color: #155724;
}

.stats-detal .stats-column-title {
    color: #0c5460;
}

/* Responsywność dla statystyk */
@media (max-width: 768px) {
    .stats-columns {
        flex-direction: column;
        gap: 12px;
    }
    
    .stats-row {
        flex-direction: column;
        gap: 8px;
    }
    
    .stats-section {
        padding: 8px;
        margin-bottom: 12px;
    }
}

@media (max-width: 480px) {
    .stats-group-title {
        font-size: 12px;
    }
    
    .stats-column-title {
        font-size: 10px;
    }
    
    .stat-compact {
        padding: 6px 8px;
    }
    
    .stat-compact label {
        font-size: 10px;
    }
    
    .stat-compact span {
        font-size: 11px;
    }
}

/* ===== TOWARY FOOTER Z PRZYCISKIEM ===== */
.towary-footer {
    background: #e9ecef;
    padding: 8px 12px;
    font-size: 11px;
    color: #6c757d;
    border-radius: 0 0 8px 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    line-height: 1.4;
}

.footer-left {
    flex: 1;
    text-align: left;
}

.footer-right {
    flex: 0 0 auto;
    margin-left: 15px;
}

.footer-summary-btn {
    font-size: 12px;
    padding: 6px 12px;
    white-space: nowrap;
}

@media (max-width: 768px) {
    .towary-footer {
        flex-direction: column;
        gap: 8px;
        text-align: center;
    }
    
    .footer-left {
        text-align: center;
    }
    
    .footer-right {
        margin-left: 0;
    }
    
    .footer-summary-btn {
        font-size: 11px;
        padding: 5px 10px;
    }
}

/* ===== 2-WIERSZOWE PODSUMOWANIE PAKIETU ===== */
.pakiet-summary-container {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 12px;
}

.pakiet-row {
    margin-bottom: 8px;
    align-items: end;
}

/* Grid layout tylko dla desktop */
@media (min-width: 769px) {
    .pakiet-row-1 {
        display: grid;
        gap: 6px;
        padding: 0; /* Usuń padding żeby wyrównać z row-2 */
        margin: 0;
        /* Używamy tego samego grid co tabela towarów */
        grid-template-columns: 
            minmax(60px, 70px)     /* Kod */
            minmax(70px, 85px)     /* Kategoria */
            minmax(75px, 90px)     /* Dostawca (spacer w pakiecie) */
            minmax(85px, 105px)    /* Marka */
            24px                   /* Copy btn (spacer) */
            minmax(85px, 105px)    /* Model */
            24px                   /* Copy btn (spacer) */
            minmax(60px, 70px)     /* Długość (spacer) */
            minmax(80px, 100px)    /* Uwagi */
            minmax(35px, 45px)     /* Ilość (spacer) */
            minmax(70px, 80px)     /* Koszt dodatkowy */
            24px                   /* Copy btn (spacer) */
            minmax(90px, 110px)    /* Zakup */
            minmax(75px, 90px)     /* Hurt */
            minmax(75px, 90px)     /* Detal */
            minmax(30px, 35px);    /* Remove btn (przycisk zapisz) */
    }
    
    .pakiet-row-2 {
        display: grid;
        gap: 6px;
        padding: 0;
        margin: 0;
        /* Dokładnie ten sam grid co wiersz 1 */
        grid-template-columns: 
            minmax(60px, 70px)     /* Kod */
            minmax(70px, 85px)     /* Kategoria */
            minmax(75px, 90px)     /* Dostawca (spacer w pakiecie) */
            minmax(85px, 105px)    /* Marka */
            24px                   /* Copy btn (spacer) */
            minmax(85px, 105px)    /* Model */
            24px                   /* Copy btn (spacer) */
            minmax(60px, 70px)     /* Długość (spacer) */
            minmax(80px, 100px)    /* Uwagi */
            minmax(35px, 45px)     /* Ilość (spacer) */
            minmax(70px, 80px)     /* Koszt dodatkowy */
            24px                   /* Copy btn (spacer) */
            minmax(90px, 110px)    /* Zakup */
            minmax(75px, 90px)     /* Hurt */
            minmax(75px, 90px)     /* Detal */
            minmax(30px, 35px);    /* Remove btn (przycisk zapisz) */
    }
    
    /* Nazwa pakietu */
    .pakiet-field-nazwa {
        flex: 0 0 250px; /* Stała szerokość 250px */
        min-width: 200px;
    }
    
    /* Uwagi - taka sama szerokość jak nazwa */
    .pakiet-field-uwagi {
        flex: 0 0 250px; /* Taka sama szerokość jak nazwa pakietu */
        min-width: 200px;
    }
    
    /* Naklejki - poszerzone dla napisu "Naklejki" */
    .pakiet-field-naklejki {
        min-width: 80px; /* Poszerz żeby pomieścić "Naklejki" */
    }
    
    /* Spacer żeby przesunąć ceny w prawo - mniejszy spacer */
    .pakiet-spacer {
        flex: 1; /* Zajmie całą dostępną przestrzeń */
        min-width: 50px; /* Mniejszy spacer bo mamy teraz uwagi */
    }
    .pakiet-field-spacer-150 {
        margin-left: 365px;

    }
    
    /* Wyrównanie szerokości sum i średnich */
    .pakiet-stat-field {
        flex: 0 0 100px; /* Stała szerokość dla wszystkich pól statystyk */
        min-width: 90px;
    }
}

.pakiet-row:last-child {
    margin-bottom: 0;
}

/* Wiersze pakietu jako flexbox */
.pakiet-row {
    display: flex;
    gap: 6px;
    align-items: flex-start;
    flex-wrap: nowrap;
}

.pakiet-row-1 {
    margin-bottom: 8px;
}

.pakiet-row-2 {
    display: flex;
    gap: 6px;
    align-items: flex-start;
    flex-wrap: nowrap;
}



/* Style dla wierszy pakietu z polami statystyk - nadpisanie dla nowego układu */
.pakiet-summary-container .pakiet-row {
    display: flex;
    gap: 6px;
    align-items: flex-start;
    padding: 8px 12px;
    border: 1px solid #dee2e6;
    border-top: none;
    background: white;
    flex-wrap: nowrap;
    margin-bottom: 0; /* Nadpisz stary margin */
}

.pakiet-summary-container .pakiet-row:first-child {
    border-top: 1px solid #dee2e6;
}

/* Style dla poszczególnych pól statystyk */
.pakiet-stat-field {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 80px;
    flex: 0 0 auto;
}

.pakiet-stat-field label {
    font-size: 9px;
    font-weight: 600;
    color: #495057;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 2px;
}

.pakiet-stat-field span {
    font-size: 11px;
    font-weight: 500;
    padding: 4px 6px;
    background: #f8f9fa;
    border-radius: 3px;
    border: 1px solid #dee2e6;
    text-align: center;
}

/* Kolory dla różnych typów cen */
.pakiet-stat-field span#stat-marza-hurt,
.pakiet-stat-field span#stat-suma-hurt,
.pakiet-stat-field span#stat-srednia-hurt {
    color: #28a745;
    font-weight: 600;
}

.pakiet-stat-field span#stat-marza-detal,
.pakiet-stat-field span#stat-suma-detal,
.pakiet-stat-field span#stat-srednia-detal {
    color: #007bff;
    font-weight: 600;
}

/* Trzeci wiersz - średnie wyrównane do lewej */
.pakiet-summary-container .pakiet-row-3 {
    justify-content: flex-start;
}

.pakiet-summary-container .pakiet-row-3 .pakiet-stat-field {
    margin-right: 12px;
}

/* Specjalne szerokości dla pól kod zestawu i kategoria - 30% obecnej szerokości */
.pakiet-summary-container .pakiet-row-1 .pakiet-field:first-child {
    /* Kod zestawu - zmniejsz do 30% (z ~100px do ~30px) */
    flex: 0 0 30px;
    min-width: 25px;
}

.pakiet-summary-container .pakiet-row-1 .pakiet-field:nth-child(2) {
    /* Kategoria - zmniejsz do 30% (z ~120px do ~36px) */
    flex: 0 0 36px;
    min-width: 30px;
}

/* Mniejsza czcionka dla wąskich pól */
.pakiet-summary-container .pakiet-row-1 .pakiet-field:first-child input,
.pakiet-summary-container .pakiet-row-1 .pakiet-field:nth-child(2) input {
    font-size: 9px;
    padding: 2px 3px;
}

.pakiet-summary-container .pakiet-row-1 .pakiet-field:first-child label,
.pakiet-summary-container .pakiet-row-1 .pakiet-field:nth-child(2) label {
    font-size: 8px;
}

/* Spacer - puste miejsce między rozmiarówką a sumami */
.pakiet-spacer {
    flex: 1; /* Zajmij dostępne miejsce */
    min-width: 20px;
}

/* Odstępy w wierszu 2 */
.pakiet-summary-container .pakiet-row-2 .pakiet-field-uwagi {
    margin-right: 30px; /* 30px odstęp między uwagami a marżami */
}

.pakiet-summary-container .pakiet-row-2 .pakiet-stat-field:nth-child(4) {
    /* Marża detal % - ostatnia marża */
    margin-right: 177px; /* 177px odstęp między marżami a śr. zakup */
}


/* Drugi wiersz - specjalne szerokości */
.pakiet-row-2 .pakiet-field-nazwa {
    flex: 0 0 180px !important;
    min-width: 160px !important;
}

.pakiet-row-2 .pakiet-field-uwagi {
    flex: 0 0 200px !important;
    min-width: 180px !important;
}

/* ===== STYLE DLA TWORZENIA PAKIETÓW ===== */

/* Ujednolicona szerokość wszystkich pól z kwotami */
#tworzenie-pakietow .pakiet-stat-field {
    flex: 0 0 85px !important;
    min-width: 85px !important;
}

/* Pozycjonowanie marży - używa oryginalnych selektorów ID */
#tworzenie-pakietow .pakiet-row-2 .pakiet-stat-field:nth-child(3) {
    flex: 0 0 85px !important;
    min-width: 85px !important;
    margin-left: 90px !important;
}

#tworzenie-pakietow .pakiet-row-2 .pakiet-stat-field:nth-child(3) span {
    color: #28a745;
    font-weight: 600;
}

#tworzenie-pakietow .pakiet-row-2 .pakiet-stat-field:nth-child(4) {
    flex: 0 0 85px !important;
    min-width: 85px !important;
}

#tworzenie-pakietow .pakiet-row-2 .pakiet-stat-field:nth-child(4) span {
    color: #007bff;
    font-weight: 600;
}

/* Średnie w "Tworzenie pakietów" (5, 6, 7 pozycja) */
#tworzenie-pakietow .pakiet-row-2 .pakiet-stat-field:nth-child(5) { 
    flex: 0 0 85px !important; 
    min-width: 85px !important;
    margin-left: 10px !important;
}
#tworzenie-pakietow .pakiet-row-2 .pakiet-stat-field:nth-child(6) { 
    flex: 0 0 85px !important; 
    min-width: 85px !important;
}
#tworzenie-pakietow .pakiet-row-2 .pakiet-stat-field:nth-child(6) span {
    color: #28a745;
    font-weight: 600;
}
#tworzenie-pakietow .pakiet-row-2 .pakiet-stat-field:nth-child(7) { 
    flex: 0 0 85px !important; 
    min-width: 85px !important;
}
#tworzenie-pakietow .pakiet-row-2 .pakiet-stat-field:nth-child(7) span {
    color: #007bff;
    font-weight: 600;
}

/* ===== STYLE DLA PODGLĄDU PAKIETU ===== */

/* Ujednolicona szerokość wszystkich pól z kwotami */
#podglad-pakietu .pakiet-stat-field {
    flex: 0 0 85px !important;
    min-width: 85px !important;
}

/* Suma kosztów - margin left 50px */


/* Przywrócone oryginalne selektory ID dla podglądu */
#podglad-pakietu .pakiet-row-2 .pakiet-stat-field:nth-child(4) {
    flex: 0 0 85px !important;
    min-width: 85px !important;
    margin: 0 !important;
}

#podglad-pakietu .pakiet-row-2 .pakiet-stat-field:nth-child(4) span {
    color: #28a745;
    font-weight: 600;
}

#podglad-pakietu .pakiet-row-2 .pakiet-stat-field:nth-child(5) {
    flex: 0 0 85px !important;
    min-width: 85px !important;
    margin-left: 0px !important;
}

#podglad-pakietu .pakiet-row-2 .pakiet-stat-field:nth-child(5) span {
    color: #007bff;
    font-weight: 600;
}

/* Średnie w "Podgląd pakietu" (6, 7, 8 pozycja) - ujednolicona szerokość */
#podglad-pakietu .pakiet-row-2 .pakiet-stat-field:nth-child(6) { 
    flex: 0 0 85px !important; 
    min-width: 85px !important;
    margin: 0 !important;
}
#podglad-pakietu .pakiet-row-2 .pakiet-stat-field:nth-child(7) { 
    flex: 0 0 85px !important; 
    min-width: 85px !important;
    margin: 0 !important;
}
#podglad-pakietu .pakiet-row-2 .pakiet-stat-field:nth-child(7) span {
    color: #28a745;
    font-weight: 600;
}
#podglad-pakietu .pakiet-row-2 .pakiet-stat-field:nth-child(8) { 
    flex: 0 0 85px !important; 
    min-width: 85px !important;
    margin: 0 !important;
}
#podglad-pakietu .pakiet-row-2 .pakiet-stat-field:nth-child(8) span {
    color: #007bff;
    font-weight: 600;
}

/* Zmniejsz czcionkę i padding w sekcji podsumowania dla "Podgląd pakietu" */
#podglad-pakietu .pakiet-row {
    margin-bottom: 0px;
}

#podglad-pakietu .pakiet-stat-field {
    gap: 0px;
}

#podglad-pakietu .pakiet-stat-field label {
    font-size: 8px !important;
    font-weight: 500;
    margin: 0 !important;
}

#podglad-pakietu .pakiet-stat-field span {
    font-size: 10px !important;
    padding: 3px 4px !important;
    min-height: 24px !important;
    line-height: 1.2;
}

#podglad-pakietu .pakiet-stat-field input.stat-mini-input {
    font-size: 9px !important;
    padding: 2px 3px !important;
    min-height: 20px !important;
    margin: 0 !important;
}

/* Wiersz AI Opis - szeroki na całą tabelę */
.pakiet-row-ai-opis {
    display: flex;
    width: 100%;
    margin-top: 8px;
}

.pakiet-field-ai-opis {
    flex: 1;
    width: 100%;
}

.pakiet-field-ai-opis label {
    font-size: 9px;
    font-weight: 600;
    color: #495057;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 3px;
    display: block;
}

.pakiet-field-ai-opis textarea {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    font-size: 11px;
    background: #f8f9fa;
    color: #495057;
    resize: vertical;
    min-height: 60px;
    font-family: inherit;
    line-height: 1.4;
}

.pakiet-field-ai-opis textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
}

.pakiet-field {
    display: flex;
    flex-direction: column;
    gap: 3px;
    justify-self: stretch;
    align-self: stretch;
}

.pakiet-field label {
    font-size: 9px;
    font-weight: 600;
    color: #495057;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0;
    line-height: 1;
    text-align: center;
}

.pakiet-field input {
    padding: 4px 6px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    font-size: 11px;
    background: white;
    transition: all 0.2s ease;
    min-height: 28px;
    width: 100%;
}

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

.pakiet-field input:hover {
    border-color: #999;
}



/* Pola statystyk */
.pakiet-stat-field {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.pakiet-stat-field span {
    display: block;
    padding: 6px 8px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    color: #495057;
    text-align: center;
    min-height: 32px;
    line-height: 20px;
}

.pakiet-stat-editable span {
    background: #fff8e1;
    border-color: #ff9800;
    color: #e65100;
}

.pakiet-stat-editable .stat-mini-input {
    position: static; /* Usuń absolute positioning */
    width: 100%;
    height: 24px;
    padding: 4px;
    border: 1px solid #dee2e6;
    border-radius: 3px;
    font-size: 10px;
    text-align: center;
    background: white;
    margin-top: 4px; /* Odstęp od wartości powyżej */
    transition: all 0.2s ease;
}

.pakiet-stat-editable .stat-mini-input:focus {
    outline: none;
    border-color: #667eea;
    opacity: 1;
    box-shadow: 0 0 0 1px rgba(102, 126, 234, 0.2);
}

.pakiet-action {
    align-self: end;
}

.pakiet-save-btn {
    padding: 8px 16px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    min-height: 36px;
}

/* Przycisk zapisz pod śr. detal */
.pakiet-save-under {
    margin-top: 8px;
    width: 100%;
    padding: 6px 12px;
    font-size: 11px;
}

/* Pole z przyciskiem pod spodem */
.pakiet-field-with-button {
    min-width: 100px;
}

/* Kontener przycisku zapisz poza gridem */
.pakiet-save-container {
    margin-top: 15px;
    text-align: center;
    padding: 10px;
    border-top: 1px solid #e9ecef;
}

/* Przycisk zapisz na dole */
.pakiet-save-btn-bottom {
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 600;
    min-width: 200px;
    box-shadow: 0 2px 4px rgba(40, 167, 69, 0.2);
}

/* Usunięcie przycisków góra/dół (spinboxes) z pól numerycznych */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Firefox */
input[type="number"] {
    -moz-appearance: textfield;
    appearance: textfield; /* Standard property */
}

/* Mobile layout - flexbox zamiast grid */
@media (max-width: 768px) {
    .pakiet-summary-container {
        padding: 8px;
    }
    
    .pakiet-row-1 {
        display: flex;
        flex-direction: column;
        gap: 8px;
    }
    
    /* pakiet-row-2 zostaje z gridem nawet na mobile */
    
    .pakiet-row-1 {
        border-bottom: 1px solid #e9ecef;
        padding-bottom: 8px;
    }
    
    .pakiet-row-2 {
        padding-top: 8px;
    }
    
    .pakiet-row-1 .pakiet-field,
    .pakiet-row-1 .pakiet-field-nazwa {
        /* Na mobile wszystkie pola na pełną szerokość TYLKO w row-1 */
        grid-column: auto;
        width: 100%;
    }
    
    .pakiet-row-2 .pakiet-field,
    .pakiet-row-2 .pakiet-field-nazwa {
        /* W row-2 pola mogą być obok siebie nawet na mobile */
        width: auto !important;
        flex: none;
    }
    
    .pakiet-field input,
    .pakiet-stat-field span {
        font-size: 12px;
        padding: 6px;
        min-height: 32px;
    }
    
    .pakiet-field label {
        font-size: 10px;
        text-align: left;
    }
    
    .pakiet-save-btn {
        font-size: 12px;
        padding: 8px 12px;
        min-height: 36px;
    }
}

/* Style dla podstron Airtable */
.airtable-page .container {
    max-width: none;
    width: 100%;
    padding: 0;
    margin: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.airtable-page .nav-tabs {
    flex-shrink: 0;
}

.airtable-page .airtable-container {
    flex: 1;
    overflow: hidden;
}

/* Style dla sub-navigation na stronach Airtable */
.sub-navigation {
    background: #f8f9fa;
    padding: 10px 20px;
    border-bottom: 1px solid #dee2e6;
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

@media (max-width: 768px) {
    .sub-navigation {
        gap: 10px;
        padding: 10px;
    }
    
    .sub-navigation .sub-nav-link {
        flex: 1;
        min-width: calc(50% - 5px);
        text-align: center;
        font-size: 13px;
        padding: 6px 12px;
    }
}

@media (max-width: 480px) {
    .sub-navigation .sub-nav-link {
        min-width: 100%;
        font-size: 12px;
    }
}

/* ===== IKONA USTAWIEŃ MARŻY ===== */
.settings-btn {
    background: #667eea;
    border: 2px solid #667eea;
    border-radius: 8px;
    width: 36px;
    height: 36px;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s ease;
    color: white;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    margin-right: 0;
    flex-shrink: 0;
}

.settings-btn:hover {
    background: #5a67d8;
    color: white;
    border-color: #5a67d8;
    transform: rotate(90deg) scale(1.05);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
}

.settings-btn:active {
    transform: rotate(90deg) scale(0.95);
}

/* ===== MODAL USTAWIEŃ ===== */
#settings-modal {
    backdrop-filter: blur(4px);
}

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

#settings-modal .form-group input[id*="hurt"]:focus {
    border-color: #28a745;
    box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.2);
}

#settings-modal .form-group input[id*="detal"]:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.2);
}

/* Responsywność dla ikony ustawień */
@media (max-width: 768px) {
    .settings-btn {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .settings-btn {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }
    
    #settings-modal .form-group input {
        padding: 8px;
        font-size: 14px;
    }
}

/* Loading spinner */
.loading-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid #e3f2fd;
    border-top: 2px solid #2196f3;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    flex-shrink: 0;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Status info dla loading */
.status-message.status-info {
    background-color: #e3f2fd;
    border-left: 4px solid #2196f3;
    color: #1565c0;
}

/* Pasek ładowania w status message */
.status-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.status-text {
    display: block;
    font-weight: 500;
}

.loading-bar {
    width: 100%;
    height: 4px;
    background-color: rgba(0, 0, 0, 0.08);
    border-radius: 2px;
    overflow: hidden;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
}

.loading-progress {
    height: 100%;
    background: linear-gradient(90deg, #2196f3, #1976d2);
    border-radius: 2px;
    animation: loading-animation 2s ease-in-out infinite;
    box-shadow: 0 2px 4px rgba(33, 150, 243, 0.3);
}

@keyframes loading-animation {
    0% {
        width: 0%;
        margin-left: 0%;
    }
    30% {
        width: 30%;
        margin-left: 0%;
    }
    70% {
        width: 30%;
        margin-left: 70%;
    }
    100% {
        width: 0%;
        margin-left: 100%;
    }
}

/* ===== MOBILE STYLES FOR WGRYWANIE ZDJĘĆ ===== */
@media (max-width: 768px) {
    .upload-form {
        padding: 15px;
    }
    
    .form-group h3 {
        font-size: 16px !important;
        margin-bottom: 12px !important;
    }
    
    .form-row {
        flex-direction: column;
        gap: 10px;
    }
    
    .form-col {
        flex: none;
        width: 100%;
    }
    
    .form-col[style*="flex: 0 0 200px"] {
        flex: none !important;
        width: 100% !important;
    }
    
    .form-col[style*="flex: 0 0 auto"] {
        flex: none !important;
        width: 100% !important;
        margin-top: 10px;
    }
    
    .radio-group {
        flex-direction: column !important;
        gap: 10px !important;
    }
    
    .radio-label {
        padding: 12px;
        background: #f8f9fa;
        border-radius: 8px;
        border: 2px solid #dee2e6;
        transition: all 0.2s ease;
    }
    
    .radio-label:has(input:checked) {
        background: #e3f2fd;
        border-color: #2196f3;
        color: #1565c0;
    }
    
    .file-input-container {
        margin: 15px 0;
    }
    
    .file-input-label {
        padding: 20px !important;
        font-size: 16px !important;
        text-align: center;
    }
    
    .file-input-label .upload-icon {
        font-size: 32px !important;
        margin-bottom: 10px;
    }
    
    .file-upload-label {
        padding: 50px 20px !important;
        min-height: 140px !important;
        gap: 20px !important;
    }
    
    .upload-icon {
        font-size: 2.5em !important;
    }
    
    .upload-text {
        font-size: 16px !important;
    }
    
    .upload-text strong {
        font-size: 18px !important;
    }
    
    .file-list {
        margin-top: 15px;
    }
    
    .file-item {
        padding: 15px !important;
        margin-bottom: 10px;
        border-radius: 8px;
    }
    
    .file-info {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 8px;
    }
    
    .file-name {
        font-size: 14px !important;
        word-break: break-all;
    }
    
    .file-size {
        font-size: 12px !important;
    }
    
    .file-actions {
        margin-top: 10px;
        width: 100%;
        justify-content: flex-end;
    }
    
    .btn-remove {
        padding: 8px 16px !important;
        font-size: 14px !important;
    }
    
    .upload-actions {
        margin-top: 20px;
        flex-direction: column;
        gap: 15px;
    }
    
    .btn-upload, .btn-clear {
        width: 100% !important;
        padding: 15px !important;
        font-size: 16px !important;
        border-radius: 8px;
    }
    
    .upload-progress {
        margin-top: 15px;
    }
    
    .progress-bar {
        height: 8px !important;
        border-radius: 4px;
    }
    
    .upload-status {
        margin-top: 15px;
        padding: 15px;
        border-radius: 8px;
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .upload-form {
        padding: 10px;
    }
    
    .form-group h3 {
        font-size: 14px !important;
    }
    
    .file-input-label {
        padding: 15px !important;
        font-size: 14px !important;
    }
    
    .file-input-label .upload-icon {
        font-size: 24px !important;
    }
    
    .file-upload-label {
        padding: 40px 15px !important;
        min-height: 120px !important;
        gap: 15px !important;
    }
    
    .upload-icon {
        font-size: 2em !important;
    }
    
    .upload-text {
        font-size: 14px !important;
    }
    
    .upload-text strong {
        font-size: 16px !important;
    }
    
    .btn-upload, .btn-clear {
        padding: 12px !important;
        font-size: 14px !important;
    }
}

/* ===== MODUŁ AI I ZDJĘĆ W PODGLĄDZIE PAKIETU ===== */
.ai-photos-module {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    margin: 20px 0;
    padding: 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.module-header {
    background: #f8f9fa;
    color: #495057;
    padding: 12px 20px;
    border-radius: 8px 8px 0 0;
    margin: 0;
    border-bottom: 2px solid #e9ecef;
}

.module-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.ai-section {
    padding: 20px;
    border-bottom: 1px solid #e9ecef;
}

.ai-section:last-of-type {
    border-bottom: none;
}

.photos-section {
    padding: 20px;
}

.ai-label {
    display: block;
    font-weight: 600;
    color: #495057;
    margin-bottom: 8px;
    font-size: 14px;
}

/* AI Tytuł */
.ai-title-section {
    margin-bottom: 0;
}

.ai-title-container {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.ai-title-input {
    flex: 1;
    padding: 10px 12px;
    border: 2px solid #ced4da;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.ai-title-input:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0,123,255,0.1);
}

.ai-title-input.changed {
    border-color: #ffc107;
    background-color: #fff3cd;
}

.ai-title-buttons {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

/* AI Opis - większy i szerszy */
.ai-description-section {
    margin-bottom: 0;
}

.ai-description-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ai-description-textarea-large {
    width: 100%;
    padding: 12px;
    border: 2px solid #ced4da;
    border-radius: 6px;
    font-size: 14px;
    line-height: 1.5;
    resize: vertical;
    min-height: 120px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    transition: border-color 0.2s;
}

.ai-description-textarea-large:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0,123,255,0.1);
}

.ai-description-textarea-large.changed {
    border-color: #ffc107;
    background-color: #fff3cd;
}

.ai-description-buttons {
    display: flex;
    gap: 8px;
    justify-content: flex-start;
}

/* Zdjęcia - większe miniatury */
.photo-thumbnails-large {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 15px;
}

.photo-item-large {
    position: relative;
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: transform 0.2s, box-shadow 0.2s;
}

.photo-item-large:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.photo-thumbnail-large {
    width: 100%;
    height: 100%;
    object-fit: cover;
    cursor: pointer;
    transition: opacity 0.2s;
}

.photo-thumbnail-large:hover {
    opacity: 0.9;
}

.photo-placeholder-large {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
    color: #6c757d;
    font-size: 12px;
    text-align: center;
    border: 2px dashed #dee2e6;
}

.photo-info-large {
    text-align: center;
    color: #6c757d;
    font-style: italic;
}

/* Brak zdjęć - większy komunikat */
.no-photos-message-large {
    text-align: center;
    padding: 40px 20px;
    background: #f8f9fa;
    border: 2px dashed #dee2e6;
    border-radius: 8px;
    color: #6c757d;
}

.no-photos-icon-large {
    font-size: 48px;
    margin-bottom: 15px;
    opacity: 0.5;
}

.no-photos-text-large {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 8px;
}

.no-photos-hint-large {
    font-size: 14px;
    opacity: 0.8;
}

/* Responsywność */
@media (max-width: 768px) {
    .ai-title-container {
        flex-direction: column;
        gap: 8px;
    }
    
    .ai-title-buttons,
    .ai-description-buttons {
        justify-content: stretch;
    }
    
    .ai-title-buttons .btn,
    .ai-description-buttons .btn {
        flex: 1;
    }
    
    .photo-thumbnails-large {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 10px;
    }
    
    .ai-photos-module {
        margin: 15px 0;
    }
    
    .ai-section,
    .photos-section {
        padding: 15px;
    }
}

/* ===== PODGLĄDY ZDJĘĆ W MODULE WGRYWANIA ===== */
.photo-grid {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    margin-bottom: 15px;
    overflow-x: auto;
    padding-bottom: 8px;
}

.photo-item {
    position: relative;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 4px;
    transition: all 0.2s ease;
    flex: 0 0 80px;
    width: 80px;
}

.photo-item:hover {
    border-color: #007bff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.photo-item.uploaded {
    opacity: 0.7;
    background: #d4edda;
}

.photo-preview {
    width: 100%;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: 4px;
    background: white;
    position: relative;
}

.photo-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.photo-loading {
    font-size: 10px;
    color: #6c757d;
    text-align: center;
}

.photo-info {
    margin-top: 4px;
    font-size: 9px;
    line-height: 1.2;
}

.photo-name {
    font-weight: 500;
    color: #495057;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.photo-size {
    color: #6c757d;
}

.photo-status {
    color: #28a745;
    margin-top: 2px;
}

.photo-item.pending .photo-status {
    color: #ffc107;
}

.photo-actions {
    position: absolute;
    top: 2px;
    right: 2px;
    opacity: 0;
    transition: opacity 0.2s;
}

.photo-item:hover .photo-actions {
    opacity: 1;
}

.btn-remove-photo {
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 3px;
    padding: 2px 4px;
    font-size: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-remove-photo:hover {
    background: #c82333;
    transform: scale(1.1);
}

.photo-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 6px;
    font-size: 12px;
    color: #6c757d;
    margin-top: 10px;
}

.summary-left {
    font-weight: 500;
}

.summary-right {
    opacity: 0.8;
}

/* Preview section container */
#preview-section {
    margin-bottom: 15px;
    padding: 10px;
    background: #fafbfc;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

/* Scrollbar styling dla poziomego przewijania */
.photo-grid::-webkit-scrollbar {
    height: 6px;
}

.photo-grid::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.photo-grid::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 3px;
}

.photo-grid::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Responsywność dla małych ekranów */
@media (max-width: 768px) {
    .photo-item {
        flex: 0 0 60px;
        width: 60px;
    }
    
    .photo-grid {
        gap: 6px;
    }
    
    .photo-preview {
        height: 50px;
    }
    
    .photo-info {
        font-size: 8px;
    }
}

/* ===== MINI INPUTY DLA MARŻ I SUM W PODGLĄDZIE PAKIETU ===== */
.stat-mini-input {
    width: 60px;
    padding: 4px 6px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 11px;
    text-align: center;
    background: white;
    display: block; /* Zawsze widoczne */
    margin-top: 4px;
}

.stat-mini-input:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.1);
}

.stat-mini-input.changed {
    border-color: #ffc107;
    background-color: #fff3cd;
}

.stat-mini-input::placeholder {
    color: #adb5bd;
    font-size: 10px;
}

/* ===== PRZYCISK USUWANIA TOWARU ===== */
.btn-remove-item {
    background: #dc3545;
    color: white;
    border: 1px solid #dc3545;
    transition: all 0.2s ease;
}

.btn-remove-item:hover {
    background: #c82333;
    border-color: #bd2130;
    transform: scale(1.1);
}

.btn-remove-item:active {
    transform: scale(0.95);
}

/* Przyciski kopiowania - subtelniejsze */
.btn-copy-subtle {
    opacity: 0.6;
    font-size: 12px;
}

.btn-copy-subtle:hover {
    opacity: 1;
    background: #007bff;
    color: white;
    border-color: #007bff;
}

/* Styles for items with API errors */
.towar-row-error {
    background-color: #fdf2f2 !important;
    border-left: 4px solid #e74c3c !important;
}

.towar-btn-retry {
    background-color: #3498db;
    color: white;
    border: none;
    padding: 4px 8px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
    transition: background-color 0.2s;
}

.towar-btn-retry:hover {
    background-color: #2980b9;
}

/* Przesunięcie elementu Marża hurt % o 232px w prawo */
.margin-hurt-shifted {
    margin-left: 232px;
}

/* ===== PODŚWIETLENIA PÓL ===== */
.highlight-success {
    border-color: #4caf50 !important;
    background-color: #e8f5e9 !important;
    animation: flash-success 0.5s ease-in-out;
}

.highlight-warning {
    border-color: #ff9800 !important;
    background-color: #fff3e0 !important;
    animation: flash-warning 0.5s ease-in-out;
}

@keyframes flash-success {
    0%, 100% { box-shadow: 0 0 0 0 rgba(76, 175, 80, 0); }
    50% { box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.4); }
}

@keyframes flash-warning {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255, 152, 0, 0); }
    50% { box-shadow: 0 0 0 3px rgba(255, 152, 0, 0.4); }
}

