

/* ========================================
   PEŁNA SZEROKOŚĆ EKRANU - wyjście poza kontener motywu
   ======================================== */

/* Kontener główny wtyczki */
.ocena-ryzyka-wrapper {
    width: 100vw;  /* Pełna szerokość viewportu */
    position: relative;
    left: 50%;
    right: 50%;
    margin-left: -50vw;
    margin-right: -50vw;
    max-width: 100vw;
    padding: 0 20px;
    box-sizing: border-box;
    padding-bottom: 100px;
}

/* Toolbar na pełną szerokość */
.ocena-ryzyka-toolbar {
    max-width: 100%;
    margin: 0 auto 20px auto;
}

/* Wrapper tabeli */
.ocena-ryzyka-table-wrapper {
    width: 100%;
    max-width: 100%;
}

/* Przycisk dodawania wiersza */
.ocena-ryzyka-add-row {
    max-width: 100%;
}

/* Responsywność - na małych ekranach zostaw trochę marginesu */
@media (max-width: 768px) {
    .ocena-ryzyka-wrapper {
        padding: 0 10px;
    }
}


/* ========================================
   TOOLBAR - Panel zarządzania projektem
   ======================================== */
.ocena-ryzyka-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8f9fa;
    padding: 15px 20px;
    border: 1px solid #dee2e6;
    border-radius: 5px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}

.toolbar-left {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.toolbar-right {
    display: flex;
    align-items: center;
}

/* Auto-save status */
.autosave-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 15px;
    background: #d4edda;
    border: 1px solid #c3e6cb;
    border-radius: 4px;
    color: #155724;
    font-size: 13px;
}

.status-icon {
    font-size: 16px;
}

/* Informacja o projekcie */
.projekt-info {
    background: #e7f3ff;
    border: 1px solid #b3d9ff;
    padding: 12px 20px;
    border-radius: 5px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.projekt-kod {
    font-family: 'Courier New', monospace;
    font-weight: bold;
    font-size: 16px;
    color: #0066cc;
    background: white;
    padding: 5px 10px;
    border-radius: 3px;
}

/* ========================================
   PRZYCISKI
   ======================================== */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.btn:active {
    transform: translateY(0);
}

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

.btn-primary:hover {
    background: #0056b3;
}

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

.btn-secondary:hover {
    background: #545b62;
}

.btn-success {
    background: #28a745;
    color: white;
    padding: 12px 30px;
    font-size: 15px;
}

.btn-success:hover {
    background: #218838;
}

.btn-link {
    background: transparent;
    color: #007bff;
    border: none;
    padding: 5px 10px;
    cursor: pointer;
    text-decoration: underline;
    font-size: 13px;
}

.btn-link:hover {
    color: #0056b3;
    transform: none;
    box-shadow: none;
}

/* ========================================
   TABELA - Główna struktura
   ======================================== */
.ocena-ryzyka-table-wrapper {
    overflow-x: auto;
    border: 1px solid #dee2e6;
    border-radius: 5px;
    margin-bottom: 20px;
    background: white;
}

.ocena-ryzyka-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    min-width: 2000px; /* Minimalna szerokość dla przewijania */
}

/* ========================================
   NAGŁÓWKI TABELI - 3 poziomy
   ======================================== */

/* POZIOM 1 - Najwyższy (15px) */
.header-level-1 th {
    height: 15px;
    padding: 2px 5px;
    font-size: 11px;
    font-weight: 600;
    text-align: center;
    vertical-align: middle;
    border: 1px solid #dee2e6;
    background: #f8f9fa;
}

.header-level-1 .header-category {
    background: #e3f2fd;
    color: #1565c0;
    border: 1px solid #90caf9;
}

.header-level-1 .header-empty {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
}

/* POZIOM 2 - Środkowy */
.header-level-2 th {
    padding: 10px 8px;
    font-size: 12px;
    font-weight: 600;
    text-align: center;
    vertical-align: middle;
    border: 1px solid #dee2e6;
    background: #f1f3f5;
    color: #212529;
    line-height: 1.3;
}

.header-level-2 .header-main {
    background: #f8f9fa;
}

.header-level-2 .header-section {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffc107;
}

/* POZIOM 3 - Dolny (szczegóły) */
.header-level-3 th {
    padding: 8px 6px;
    font-size: 11px;
    font-weight: 500;
    text-align: center;
    vertical-align: middle;
    border: 1px solid #dee2e6;
    background: #ffffff;
    color: #495057;
    line-height: 1.3;
}

/* ========================================
   KOMÓRKI DANYCH
   ======================================== */
.ocena-ryzyka-table tbody td {
    padding: 8px;
    border: 1px solid #dee2e6;
    vertical-align: middle;
    background: white;
}

/* Lp z ikonką */
.cell-lp {
    text-align: center;
    font-weight: 600;
    background: #f8f9fa !important;
    width: 50px;
    padding: 8px 4px !important;
}

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

.lp-number {
    font-size: 14px;
    font-weight: 600;
    color: #212529;
}

.lp-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.9;
}

.lp-icon svg {
    display: block;
}

/* Pola edytowalne */
.cell-editable {
    min-width: 150px;
}

.cell-input {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid #ced4da;
    border-radius: 3px;
    font-size: 13px;
    font-family: inherit;
}

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

.cell-input.cell-small {
    width: 60px;
}

.cell-textarea {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid #ced4da;
    border-radius: 3px;
    font-size: 13px;
    font-family: inherit;
    resize: vertical;
    min-height: 50px;
}

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

/* Listy rozwijalne */
.cell-select {
    min-width: 180px;
}

.cell-select-input {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid #ced4da;
    border-radius: 3px;
    font-size: 13px;
    background: white;
    cursor: pointer;
}

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

/* Custom multiselect dla faz życia */
.cell-fazy-zycia {
    min-width: 250px;
    position: relative;
}

.multiselect-wrapper {
    position: relative;
    width: 100%;
}

.multiselect-selected {
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 38px;
    padding: 4px 8px;
    background: white;
    border: 1px solid #ced4da;
    border-radius: 3px;
    cursor: pointer;
    user-select: none;
    transition: border-color 0.2s;
}

.multiselect-selected:hover {
    border-color: #007bff;
}

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

.multiselect-tags {
    flex: 1;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
}

.multiselect-placeholder {
    font-size: 12px;
    color: #6c757d;
    font-style: italic;
}

.multiselect-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 6px;
    background: #007bff;
    color: white;
    border-radius: 3px;
    font-size: 11px;
    line-height: 1.2;
    max-width: 150px;
}

.multiselect-tag .tag-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.multiselect-tag .tag-remove {
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    font-weight: bold;
    padding: 0 2px;
    transition: color 0.15s;
}

.multiselect-tag .tag-remove:hover {
    color: #ffcccc;
}

.multiselect-arrow {
    margin-left: 8px;
    font-size: 10px;
    color: #6c757d;
    transition: transform 0.2s;
    flex-shrink: 0;
}

.multiselect-dropdown {
    position: fixed !important;
    background: white;
    border: 1px solid #ced4da;
    border-radius: 3px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000 !important;
    max-height: 300px;
    overflow-y: auto;
    overflow-x: hidden;
    isolation: isolate;
}

.multiselect-options {
    padding: 4px 0;
}

.multiselect-option {
    display: flex;
    align-items: flex-start;
    padding: 8px 12px;
    cursor: pointer;
    transition: background 0.15s;
    user-select: none;
}

.multiselect-option:hover {
    background: #f8f9fa;
}

.multiselect-option input[type="checkbox"] {
    margin-right: 8px;
    margin-top: 2px;
    cursor: pointer;
    flex-shrink: 0;
}

.multiselect-option span {
    font-size: 12px;
    color: #212529;
    line-height: 1.4;
    word-wrap: break-word;
    overflow-wrap: break-word;
    flex: 1;
}

.multiselect-option.custom-option {
    background: #f8f9fa;
}

.multiselect-separator {
    height: 1px;
    background: #dee2e6;
    margin: 4px 0;
}

.multiselect-add-new {
    display: flex;
    gap: 4px;
    padding: 8px 12px;
    background: #f8f9fa;
    border-top: 1px solid #dee2e6;
}

.multiselect-add-new .fazy-custom-input {
    flex: 1;
    padding: 6px 8px;
    border: 1px solid #ced4da;
    border-radius: 3px;
    font-size: 12px;
}

.multiselect-add-new .btn-add-faza {
    padding: 6px 12px;
    background: #28a745;
    color: white;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    transition: background 0.2s;
}

.multiselect-add-new .btn-add-faza:hover {
    background: #218838;
}

/* Komórki z obrazami */
.cell-image {
    text-align: center;
    width: 80px;
}

.btn-upload {
    padding: 6px 12px;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 16px;
    transition: background 0.2s;
}

.btn-upload:hover {
    background: #0056b3;
}

.file-input {
    display: none;
}

.preview-image {
    max-width: 50px;
    max-height: 50px;
    margin-top: 5px;
    border: 1px solid #dee2e6;
    border-radius: 3px;
}

/* Komórki obliczeniowe */
.cell-calculated {
    text-align: center;
    background: #f8f9fa;
    font-weight: 600;
    color: #495057;
    min-width: 80px;
}

.cell-calculated span {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 3px;
}

.calc-hrn-przed,
.calc-hrn-po {
    /* Kolor tła ustawiany dynamicznie przez JavaScript */
    color: #1565c0;
}

.calc-stopien-przed,
.calc-stopien-po {
    /* Kolor tła ustawiany dynamicznie przez JavaScript */
    font-size: 11px;
    padding: 3px 6px;
}

/* Red text for negative risk reduction values */
.risk-increased .calc-redukcja {
    color: #721c24;
    font-weight: bold;
}

/* Green text for positive risk reduction values */
.risk-decreased .calc-redukcja {
    color: #155724;
    font-weight: bold;
}

/* Kolumna akcji */
.cell-actions {
    text-align: center;
    width: 50px;
    background: #f8f9fa !important;
}

.btn-delete-row {
    padding: 5px 10px;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 16px;
    transition: background 0.2s;
}

.btn-delete-row:hover {
    background: #c82333;
}

/* ========================================
   PRZYCISK DODAWANIA WIERSZA
   ======================================== */
.ocena-ryzyka-add-row {
    text-align: center;
    padding: 20px 0;
}

/* ========================================
   MODALE
   ======================================== */
.ocena-modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    animation: fadeIn 0.2s;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background-color: white;
    margin: 10% auto;
    padding: 30px;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    animation: slideDown 0.3s;
    position: relative;
}

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

.modal-content h3 {
    margin-top: 0;
    margin-bottom: 20px;
    color: #212529;
}

.modal-close,
.modal-close-nazwa {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 20px;
    position: absolute;
    right: 20px;
    top: 20px;
}

.modal-close:hover,
.modal-close-nazwa:hover {
    color: #000;
}

.modal-input {
    width: 100%;
    padding: 12px;
    margin: 10px 0 20px 0;
    border: 1px solid #ced4da;
    border-radius: 5px;
    font-size: 14px;
    box-sizing: border-box;
}

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

.modal-buttons {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

.modal-error {
    background: #f8d7da;
    color: #721c24;
    padding: 10px;
    border-radius: 5px;
    margin-top: 15px;
    border: 1px solid #f5c6cb;
}

/* ========================================
   RESPONSYWNOŚĆ
   ======================================== */
@media (max-width: 768px) {
    .ocena-ryzyka-toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .toolbar-left,
    .toolbar-right {
        width: 100%;
        justify-content: center;
    }
    
    .btn {
        width: 100%;
        justify-content: center;
    }
    
    .modal-content {
        margin: 20% auto;
        width: 95%;
    }
}

/* ========================================
   KOLOROWANIE POZIOMÓW RYZYKA
   ======================================== */
/* Zakomentowane - kolory są teraz ustawiane dynamicznie przez JavaScript
.calc-stopien-przed:contains("pomijalne"),
.calc-stopien-po:contains("pomijalne") {
    background: #d4edda;
    color: #155724;
}

.calc-stopien-przed:contains("bardzo niskie"),
.calc-stopien-po:contains("bardzo niskie") {
    background: #d1ecf1;
    color: #0c5460;
}

.calc-stopien-przed:contains("niskie"),
.calc-stopien-po:contains("niskie") {
    background: #cce5ff;
    color: #004085;
}

.calc-stopien-przed:contains("znaczące"),
.calc-stopien-po:contains("znaczące") {
    background: #fff3cd;
    color: #856404;
}

.calc-stopien-przed:contains("wysokie"),
.calc-stopien-po:contains("wysokie") {
    background: #f8d7da;
    color: #721c24;
}

.calc-stopien-przed:contains("bardzo wysokie"),
.calc-stopien-po:contains("bardzo wysokie"),
.calc-stopien-przed:contains("ekstremalne"),
.calc-stopien-po:contains("ekstremalne"),
.calc-stopien-przed:contains("nieakceptowalne"),
.calc-stopien-po:contains("nieakceptowalne") {
    background: #dc3545;
    color: white;
}
*/

/* ========================================
   ZEBRA STRIPING dla wierszy
   ======================================== */
.ocena-ryzyka-table tbody tr:nth-child(even) {
    background-color: #f8f9fa;
}

.ocena-ryzyka-table tbody tr:hover {
    background-color: #e9ecef;
}

/* ========================================
   ŁADOWANIE
   ======================================== */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* ========================================
   KOLUMNA RODZAJU ZAGROŻENIA
   ======================================== */
   .cell-rodzaj-zagrozenia {
    min-width: 250px;
}

.rodzaj-zagrozenia-select {
    width: 100%;
    font-weight: 600;
}

/* ========================================
   KOLOROWANIE WIERSZY WEDŁUG RODZAJU ZAGROŻENIA
   ======================================== */
.rodzaj-0 {
    /* Zagrożenia mechaniczne */
    background-color: #fff3e0 !important;
    border-left: 4px solid #ff9800;
}

.rodzaj-1 {
    /* Zagrożenia elektryczne */
    background-color: #e3f2fd !important;
    border-left: 4px solid #2196f3;
}

.rodzaj-2 {
    /* Zagrożenia termiczne */
    background-color: #ffebee !important;
    border-left: 4px solid #f44336;
}

.rodzaj-3 {
    /* Zagrożenia hałasem */
    background-color: #f3e5f5 !important;
    border-left: 4px solid #9c27b0;
}

.rodzaj-4 {
    /* Zagrożenia powodowane drganiami */
    background-color: #e0f2f1 !important;
    border-left: 4px solid #009688;
}

.rodzaj-5 {
    /* Zagrożenia powodowane promieniowaniem */
    background-color: #fff9c4 !important;
    border-left: 4px solid #fbc02d;
}

.rodzaj-6 {
    /* Zagrożenia powodowane materiałami/substancjami */
    background-color: #fce4ec !important;
    border-left: 4px solid #e91e63;
}

.rodzaj-7 {
    /* Zagrożenia powodowane nieprzestrzeganiem zasad ergonomii */
    background-color: #e8eaf6 !important;
    border-left: 4px solid #3f51b5;
}

.rodzaj-8 {
    /* Zagrożenia wynikające ze środowiska */
    background-color: #e8f5e9 !important;
    border-left: 4px solid #4caf50;
}

.rodzaj-9 {
    /* Kombinacja zagrożeń */
    background-color: #efebe9 !important;
    border-left: 4px solid #795548;
}

/* Efekt hover dla wierszy z rodzajem */
tr[data-rodzaj]:hover {
    opacity: 0.9;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Separator wizualny między grupami */
tr[data-rodzaj] {
    border-top: 2px solid #dee2e6;
}

/* ========================================
   WIERSZ WYBORU RODZAJU ZAGROŻENIA (zielony overlay)
   ======================================== */
   .selection-row {
    background: rgba(40, 167, 69, 0.7) !important;
    backdrop-filter: blur(2px);
}

.selection-row:hover {
    background: rgba(40, 167, 69, 0.8) !important;
}

.selection-cell {
    padding: 12px 20px !important;
    text-align: left !important;
}

.selection-content {
    display: flex;
    align-items: center;
    justify-content: flex-start !important;  /* Wyraźnie po lewej */
    gap: 12px;
    flex-wrap: wrap;
    margin-left: 0 !important;
}

.selection-label {
    font-size: 14px;
    font-weight: 600;
    color: white;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
    white-space: nowrap;  /* Nie łam tekstu */
}

.selection-dropdown {
    padding: 8px 12px;
    border: 3px solid #155724;
    border-radius: 5px;
    font-size: 13px;
    min-width: 250px;  /* ZMNIEJSZONE z 300px */
    max-width: 400px;  /* Maksymalna szerokość */
    background: white;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.selection-dropdown:focus {
    outline: none;
    border-color: #ffc107;
    box-shadow: 0 0 0 3px rgba(255, 193, 7, 0.3);
}

.btn-confirm-selection {
    padding: 8px 20px;
    background: white;
    color: #28a745;
    border: 2px solid white;
    border-radius: 5px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    white-space: nowrap;  /* Nie łam tekstu na przycisku */
}

.btn-confirm-selection:hover {
    background: #28a745;
    color: white;
    transform: scale(1.05);
}

/* ========================================
   KOLUMNA "Obniżono ryzyko o [%]" - Kolory
   ======================================== */

/* Ryzyko obniżone - zielone tło */
.risk-decreased {
    background-color: #d4edda !important;
}

/* Ryzyko wzrosło - czerwone tło */
.risk-increased {
    background-color: #f8d7da !important;
    position: relative;
}

/* Tooltip dla wzrostu ryzyka */
.risk-tooltip {
    position: relative;
}

.risk-tooltip .tooltip-content {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #3b50db;
    color: white;
    padding: 8px 40px 8px 12px;  /* Zwiększony padding-right dla przycisku */
    border-radius: 4px;
    font-size: 13px;
    z-index: 9999;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.3s, visibility 0.3s;
    margin-bottom: 5px;
    box-shadow: 0 0px 10px rgba(0, 0, 0, .5);
    width: 850px;  /* Zwiększona szerokość */
    max-width: 90vw;
    white-space: normal;
    word-wrap: break-word;
    text-align: justify;
    hyphens: auto;
}

.risk-tooltip .tooltip-close {
    position: absolute;
    top: 5px;
    right: 5px;
    background: transparent;
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
    padding: 0;
    width: 20px;
    height: 20px;
    line-height: 20px;
    text-align: center;
}

.risk-tooltip .tooltip-close:hover {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
}

/* ========================================
   CZĘŚĆ SYSTEMU - ZARZĄDZANIE LISTĄ
   ======================================== */

/* Przycisk zarządzania listą części */
.btn-manage-czesci {
    background: #6c757d;
    color: white;
    border: none;
    padding: 0;
    border-radius: 3px;
    cursor: pointer;
    font-size: 16px;
    transition: background 0.2s;
}

.btn-manage-czesci:hover {
    background: #5a6268;
}

/* Modal overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

/* Modal content */
.modal-content {
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    max-height: 80vh;
    overflow-y: auto;
}

/* Modal header */
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #dee2e6;
}

.modal-header h3 {
    margin: 0;
    font-size: 18px;
    color: #333;
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    color: #999;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 30px;
    height: 30px;
}

.modal-close:hover {
    color: #333;
}

/* Modal body */
.modal-body {
    padding: 20px;
}

/* Lista części */
.czesci-items {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.czesc-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    transition: background 0.2s;
}

.czesc-item:hover {
    background: #e9ecef;
}

.czesc-name {
    flex: 1;
    color: #333;
    font-size: 14px;
}

.btn-remove-czesc {
    background: #dc3545;
    color: white;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-remove-czesc:hover {
    background: #c82333;
}

/* Domyślna część systemu - wyróżnienie */
.czesc-item.default-item {
    background: #e7f3ff;
    border-color: #90c9ff;
}

.czesc-item.default-item:hover {
    background: #d4e9ff;
}

.czesc-item.default-item .czesc-name {
    font-weight: 600;
    color: #0056b3;
}

.default-label {
    font-size: 18px;
    color: #0056b3;
}

/* ========================================
   GRUPOWANIE WIERSZY I SCALANIE KOMÓREK
   ======================================== */

/* Ukryte komórki w scalonych grupach */
.cell-czesc-systemu.merged-hidden,
.cell-obraz-czesci.merged-hidden {
    display: none !important;
}

/* Animacja przesuwania wiersza */
.row-animating {
    transition: transform 800ms cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 100;
    position: relative;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Highlight po przesunięciu wiersza */
.row-just-moved {
    background: #fff3cd !important;
    transition: background 2s ease-out;
}

.row-just-moved td {
    background: #fff3cd !important;
}

/* Scalona komórka - vertical align i border */
.cell-czesc-systemu[rowspan],
.cell-obraz-czesci[rowspan] {
    vertical-align: top;
    border-bottom: 2px solid #dee2e6;
}

/* Pierwsza komórka w grupie - wyraźniejszy border top */
tr[data-merge-position="first"] .cell-czesc-systemu,
tr[data-merge-position="first"] .cell-obraz-czesci {
    border-top: 2px solid #495057;
}