/**
 * Document Interface Styles - Ocena Ryzyka
 * Moduł: Dokument Oceny Ryzyka
 * Styl graficzny interfejsu: 2 zakładki + sidebar + accordiony
 * Zgodny z design systemem tabeli oceny ryzyka
 */

/* ==========================================================================
   1. ZAKŁADKI GŁÓWNE (poziome, obok siebie u góry)
   ========================================================================== */

.or-document-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid #dee2e6;
    background: #f8f9fa;
    margin-bottom: 0;
}

.or-document-tab {
    padding: 15px 30px;
    background: #e9ecef;
    color: #6c757d;
    border: none;
    border-bottom: 3px solid transparent;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.or-document-tab:hover {
    background: #dee2e6;
    color: #495057;
}

.or-document-tab.active {
    background: #ffffff;
    color: #007bff;
    border-bottom: 3px solid #007bff;
}

/* ==========================================================================
   2. PRZEŁĄCZANIE ZAWARTOŚCI ZAKŁADEK
   ========================================================================== */

.or-document-wrapper {
    width: 100%;
    background: #ffffff;
}

.or-document-tab-content {
    display: none; /* UKRYTA domyślnie */
}

.or-document-tab-content.active {
    display: block; /* WIDOCZNA gdy aktywna */
}

/* ==========================================================================
   3. LAYOUT ZAKŁADKI 1 (sidebar + główny obszar)
   ========================================================================== */

.or-document-layout {
    display: flex;
    gap: 0;
    min-height: calc(100vh - 200px);
}

/* ==========================================================================
   4. SIDEBAR (chowalny 280px → 60px)
   ========================================================================== */

.or-document-sidebar {
    width: 280px;
    background: #f8f9fa;
    border-right: 2px solid #dee2e6;
    height: calc(100vh - 200px);
    overflow-y: auto;
    overflow-x: hidden;
    transition: width 0.3s ease;
    position: relative;
    flex-shrink: 0;
}

.or-document-sidebar.collapsed {
    width: 60px;
}

.sidebar-toggle {
    position: absolute;
    top: 10px;
    right: -15px;
    width: 30px;
    height: 30px;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    transition: all 0.2s;
    z-index: 10;
}

.sidebar-toggle:hover {
    background: #0056b3;
    transform: scale(1.1);
}

/* Sekcje w sidebarze */
.sidebar-section {
    padding: 15px 12px;
    border-bottom: 1px solid #dee2e6;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 54px; /* Stała wysokość wiersza */
    height: 54px; /* Stała wysokość wiersza */
}

.sidebar-section:hover {
    background: #e9ecef;
}

.sidebar-section.active {
    background: #e3f2fd;
    border-left: 4px solid #007bff;
}

.sidebar-section-icon {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #007bff;
}

.sidebar-section-text {
    font-size: 14px;
    font-weight: 500;
    color: #495057;
    transition: opacity 0.3s, width 0.3s;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
}

.or-document-sidebar.collapsed .sidebar-section-text {
    opacity: 0;
    width: 0;
}

.sidebar-section.active .sidebar-section-text {
    color: #007bff;
    font-weight: 600;
}

/* Badge postępu */
.sidebar-progress-badge {
    flex-shrink: 0;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    transition: opacity 0.3s, width 0.3s;
    white-space: nowrap;
}

.or-document-sidebar.collapsed .sidebar-progress-badge {
    opacity: 0;
    width: 0;
    padding: 0;
    overflow: hidden;
}

.sidebar-progress-badge.in-progress {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffc107;
}

.sidebar-progress-badge.filled {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #17a2b8;
}

.sidebar-progress-badge.completed {
    background: #d4edda;
    color: #155724;
    border: 1px solid #28a745;
}

.sidebar-progress-badge.completed::before {
    content: "✓ ";
    font-weight: bold;
}

/* ==========================================================================
   5. GŁÓWNY OBSZAR TREŚCI
   ========================================================================== */

.or-document-content {
    flex: 1;
    padding: 20px 30px;
    background: #ffffff;
    overflow-y: auto;
    height: calc(100vh - 200px);
}

/* ==========================================================================
   6. TOOLBAR
   ========================================================================== */

.or-document-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 5px;
    margin-bottom: 20px;
    gap: 15px;
}

.or-document-toolbar-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.or-document-toolbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

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

.or-autosave-status::before {
    content: "✓";
    font-weight: bold;
}

.or-autosave-status.saving {
    background: #fff3cd;
    border-color: #ffc107;
    color: #856404;
}

.or-autosave-status.saving::before {
    content: "⏳";
}

.or-autosave-status.error {
    background: #f8d7da;
    border-color: #f5c6cb;
    color: #721c24;
}

.or-autosave-status.error::before {
    content: "⚠";
}

/* ==========================================================================
   7. ACCORDIONS
   ========================================================================== */

.or-accordions-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.or-accordion {
    background: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 5px;
    overflow: hidden;
    transition: all 0.2s;
}

.or-accordion:hover {
    border-color: #007bff;
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.15);
}

.or-accordion-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 20px;
    background: #f8f9fa;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s;
    gap: 15px;
}

.or-accordion-header:hover {
    background: #e9ecef;
}

.or-accordion.expanded .or-accordion-header {
    background: #e3f2fd;
    border-bottom: 1px solid #90caf9;
}

.or-accordion-title {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.or-accordion-icon {
    width: 20px;
    height: 20px;
    color: #007bff;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.or-accordion-label {
    font-size: 15px;
    font-weight: 600;
    color: #212529;
}

.or-accordion.expanded .or-accordion-label {
    color: #007bff;
}

.or-accordion-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Checkbox "Sekcja skończona" */
.accordion-complete-checkbox {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    background: #ffffff;
    border: 1px solid #ced4da;
    border-radius: 3px;
    font-size: 12px;
    color: #495057;
    cursor: pointer;
    transition: all 0.2s;
}

.accordion-complete-checkbox:hover {
    border-color: #28a745;
    background: #f8fff9;
}

.accordion-complete-checkbox input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.accordion-complete-checkbox input[type="checkbox"]:checked {
    accent-color: #28a745;
}

.accordion-complete-checkbox.checked {
    background: #d4edda;
    border-color: #28a745;
    color: #155724;
    font-weight: 600;
}

/* Progress percentage */
.accordion-progress-percentage {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffc107;
}

.accordion-progress-percentage.filled {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #17a2b8;
}

/* Arrow toggle */
.accordion-arrow {
    width: 24px;
    height: 24px;
    color: #6c757d;
    transition: transform 0.3s;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.or-accordion.expanded .accordion-arrow {
    transform: rotate(180deg);
    color: #007bff;
}

/* Zawartość accordion */
.or-accordion-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.or-accordion.expanded .or-accordion-body {
    max-height: 5000px;
}

/* Pozwól na overflow gdy dropdown części maszyny jest otwarty */
.or-accordion-body:has(.or-machine-parts-container.open),
.or-accordion-body.dropdown-open {
    overflow: visible;
}

.or-accordion-content {
    padding: 25px 20px;
    background: #ffffff;
}

/* ==========================================================================
   8. FORMULARZE
   ========================================================================== */

.or-form-grid {
    display: grid;
    gap: 10px;
}

.or-form-grid.two-columns {
    grid-template-columns: repeat(2, 1fr);
}

.or-form-grid.three-columns {
    grid-template-columns: repeat(3, 1fr);
}

.or-form-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.or-form-field.full-width {
    grid-column: 1 / -1;
}

.or-form-label {
    font-size: 13px;
    font-weight: 600;
    color: #495057;
    display: flex;
    align-items: center;
    gap: 6px;
}

.or-form-label.required::after {
    content: "*";
    color: #dc3545;
    font-weight: bold;
}

.or-form-help {
    font-size: 12px;
    color: #6c757d;
    font-style: italic;
    margin-top: 4px;
}

.or-form-input,
.or-form-select,
.or-form-textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 3px;
    font-size: 14px;
    background: #ffffff;
    transition: all 0.2s;
}

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

.or-form-input:disabled,
.or-form-select:disabled,
.or-form-textarea:disabled {
    background: #e9ecef;
    cursor: not-allowed;
    color: #6c757d;
}

/* Pola readonly dla trybu zaawansowanego - wyszarzone gdy readonly */
.or-form-input.or-advanced-field[readonly],
.or-form-select.or-advanced-field[readonly],
.or-form-textarea.or-advanced-field[readonly] {
    background: #e9ecef;
    cursor: not-allowed;
    color: #6c757d;
}

.or-form-textarea {
    min-height: 100px;
    resize: vertical;
    font-family: inherit;
    line-height: 1.5;
}

.or-form-input.invalid,
.or-form-select.invalid,
.or-form-textarea.invalid {
    border-color: #dc3545;
}

.or-form-input.invalid:focus,
.or-form-select.invalid:focus,
.or-form-textarea.invalid:focus {
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.1);
}

.or-form-error {
    font-size: 12px;
    color: #dc3545;
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.or-form-error::before {
    content: "⚠";
}

.or-form-input[type="date"] {
    padding: 8px 12px;
    font-family: inherit;
}

/* ==========================================================================
   9. FILE UPLOAD
   ========================================================================== */

.or-file-upload {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.or-file-upload-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: #007bff;
    color: #ffffff;
    border: none;
    border-radius: 3px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.or-file-upload-button:hover {
    background: #0056b3;
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.or-file-upload-button::before {
    content: "📎";
    font-size: 16px;
}

.or-file-preview {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
    margin-top: 10px;
}

.or-file-preview-item {
    position: relative;
    border: 1px solid #dee2e6;
    border-radius: 3px;
    overflow: hidden;
    background: #f8f9fa;
    aspect-ratio: 16/9;
}

.or-file-preview-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.or-file-preview-remove {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 24px;
    height: 24px;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all 0.2s;
}

.or-file-preview-remove:hover {
    background: #c82333;
    transform: scale(1.1);
}

/* ==========================================================================
   10. NAWIGACJA MIĘDZY SEKCJAMI
   ========================================================================== */

.or-section-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
    margin-top: 30px;
    border-top: 2px solid #dee2e6;
}

.or-nav-button {
    padding: 10px 20px;
    background: #007bff;
    color: #ffffff;
    border: none;
    border-radius: 5px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.or-nav-button:hover {
    background: #0056b3;
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.or-nav-button:disabled {
    background: #e9ecef;
    color: #6c757d;
    cursor: not-allowed;
    transform: none;
}

.or-nav-button.prev::before {
    content: "←";
    font-size: 16px;
}

.or-nav-button.next::after {
    content: "→";
    font-size: 16px;
}

/* ==========================================================================
   11. ANIMACJE
   ========================================================================== */

.or-accordion.just-activated {
    animation: highlightSection 1s ease-out;
}

@keyframes highlightSection {
    0% {
        background: #fff3cd;
        box-shadow: 0 0 20px rgba(255, 193, 7, 0.5);
    }
    100% {
        background: transparent;
        box-shadow: none;
    }
}

.sidebar-progress-badge.updated {
    animation: badgePulse 0.5s ease-out;
}

@keyframes badgePulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.2);
    }
}

/* ==========================================================================
   12. ACCESSIBILITY
   ========================================================================== */

.or-accordion-header:focus,
.sidebar-section:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

.or-nav-button:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

/* ==========================================================================
   13. RESPONSYWNOŚĆ
   ========================================================================== */

@media (min-width: 1400px) {
    .or-form-grid.auto-columns {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 1200px) and (max-width: 1399px) {
    .or-form-grid.auto-columns {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 768px) and (max-width: 1199px) {
    .or-document-sidebar {
        width: 240px;
    }

    .or-document-sidebar.collapsed {
        width: 240px;
    }

    .sidebar-toggle {
        display: none;
    }

    .or-form-grid.auto-columns {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 767px) {
    .or-document-layout {
        flex-direction: column;
    }

    .or-document-sidebar {
        width: 100%;
        height: auto;
        border-right: none;
        border-bottom: 2px solid #dee2e6;
    }

    .or-document-sidebar.collapsed {
        width: 100%;
    }

    .sidebar-toggle {
        display: none;
    }

    .or-form-grid {
        grid-template-columns: 1fr;
    }

    .or-document-content {
        padding: 15px;
    }

    .or-accordion-header {
        padding: 12px 15px;
    }

    .or-accordion-content {
        padding: 15px;
    }
}

/* ==========================================================================
   DEFINITIONS TABLE
   ========================================================================== */

.or-definitions-table {
    width: 100%;
    margin-top: 10px;
}

.or-definitions-table .or-table {
    width: 100%;
    border-collapse: collapse;
    background: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    margin-bottom: 15px;
}

.or-definitions-table .or-table thead {
    background: #f8f9fa;
}

.or-definitions-table .or-table th {
    padding: 8px 10px;
    text-align: left;
    font-weight: 600;
    color: #495057;
    border-bottom: 2px solid #dee2e6;
    font-size: 14px;
}

.or-definitions-table .or-table td {
    padding: 6px 10px;
    border-bottom: 1px solid #dee2e6;
    vertical-align: top;
}

.or-definitions-table .or-table tbody tr:last-child td {
    border-bottom: none;
}

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

.or-definitions-table .or-table td strong {
    color: #007bff;
    font-size: 14px;
    display: block;
}

/* Edytowalny textarea (wygląda jak tekst dopóki nie klikniemy) */
.or-editable-textarea {
    position: relative;
    cursor: pointer;
    min-height: 24px;
}

.or-textarea-display {
    padding: 4px 8px;
    min-height: 24px;
    line-height: 1.5;
    font-size: 14px;
    color: #495057;
    border: 1px solid transparent;
    border-radius: 4px;
    transition: all 0.2s;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.or-textarea-display:hover {
    background: #f8f9fa;
    border-color: #dee2e6;
}

.or-textarea-display:empty::before {
    content: 'Kliknij aby edytować...';
    color: #adb5bd;
    font-style: italic;
}

.or-editable-textarea.editing .or-textarea-display {
    display: none;
}

.or-editable-textarea.editing .or-textarea-input {
    display: block !important;
}

.or-textarea-input {
    width: 100%;
    min-height: 60px;
    resize: vertical;
    border: 1px solid #007bff;
    border-radius: 4px;
    padding: 8px 12px;
    font-size: 14px;
    line-height: 1.5;
    font-family: inherit;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

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

.or-textarea-input::placeholder {
    color: #adb5bd;
    font-style: italic;
}

/* Input dla terminu (niestandardowe definicje) */
.or-definition-term-input {
    width: 100%;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 8px 12px;
    font-size: 14px;
    font-weight: 600;
    color: #007bff;
    transition: border-color 0.2s, box-shadow 0.2s;
}

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

.or-definition-term-input::placeholder {
    color: #adb5bd;
    font-weight: normal;
    font-style: italic;
}

/* Przyciski akcji */
.or-definition-actions {
    text-align: center;
    padding: 8px !important;
}

.or-btn-remove-definition {
    background: #dc3545;
    color: white;
    border: none;
    padding: 6px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    transition: background 0.2s;
}

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

/* Przycisk dodawania definicji */
.or-add-definition-row {
    margin-top: 15px;
    text-align: left;
}

.or-btn-add-definition {
    background: #28a745;
    color: white;
    padding: 12px 30px;
    font-size: 15px;
    font-weight: 600;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
}

.or-btn-add-definition:hover {
    background: #218838;
}

/* Styl readonly dla input terminu */
.or-definition-term-input[readonly] {
    border: none;
    background: transparent;
    padding: 8px 12px;
    font-weight: bold;
    color: #212529;
    cursor: default;
}

.or-definition-term-input[readonly]:focus {
    outline: none;
    box-shadow: none;
}

/* Styl edytowalny dla input terminu */
.or-definition-term-input:not([readonly]) {
    cursor: text;
}

/* Ukryj elementy zaawansowane domyślnie */
.or-advanced-only {
    display: none;
}

/* ==========================================================================
   COPYRIGHT SLIDER COMPONENT
   ========================================================================== */

.or-copyright-slider-container {
    display: flex;
    gap: 20px;
    width: 100%;
    align-items: stretch;
}

.or-copyright-textarea-wrapper {
    flex: 1;
    min-width: 0;
}

.or-copyright-textarea {
    width: 100%;
    min-height: 180px;
    resize: vertical;
    font-size: 14px;
    line-height: 1.6;
    padding: 15px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    background: #ffffff;
    transition: all 0.2s;
}

/* Wyszarzone textarea gdy readonly (nie-zaawansowany użytkownik) */
.or-copyright-textarea[readonly] {
    background: #f5f5f5;
    color: #6c757d;
    cursor: not-allowed;
}

/* Aktywne textarea (tryb zaawansowany) */
.or-copyright-textarea:not([readonly]) {
    background: #ffffff;
    color: #212529;
    cursor: text;
}

.or-copyright-textarea:not([readonly]):focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

/* Wrapper dla suwaka pionowego */
.or-copyright-slider-wrapper {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    gap: 10px;
    min-height: 180px;
}

/* Etykiety suwaka */
.or-slider-labels {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 5px 0;
    min-width: 140px;
}

.or-slider-label {
    font-size: 13px;
    color: #6c757d;
    padding: 8px 12px;
    border-radius: 4px;
    transition: all 0.2s;
    cursor: pointer;
    text-align: right;
    white-space: nowrap;
}

.or-slider-label:hover {
    background: #f8f9fa;
    color: #495057;
}

.or-slider-label.active {
    background: #007bff;
    color: #ffffff;
    font-weight: 600;
}

/* Pionowy suwak (range input) */
/* Używamy writing-mode + direction zamiast przestarzałego appearance: slider-vertical */
.or-copyright-slider {
    writing-mode: vertical-lr;
    direction: rtl;
    width: 40px;
    height: 150px;
    background: transparent;
    cursor: pointer;
}

/* Stylowanie dla Firefox */
.or-copyright-slider::-moz-range-track {
    width: 8px;
    background: linear-gradient(to bottom, #28a745, #ffc107, #dc3545);
    border-radius: 4px;
}

.or-copyright-slider::-moz-range-thumb {
    width: 24px;
    height: 24px;
    background: #007bff;
    border: 3px solid #ffffff;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

/* Stylowanie dla Chrome/Safari */
.or-copyright-slider::-webkit-slider-runnable-track {
    width: 8px;
    background: linear-gradient(to bottom, #28a745, #ffc107, #dc3545);
    border-radius: 4px;
}

.or-copyright-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 24px;
    height: 24px;
    background: #007bff;
    border: 3px solid #ffffff;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    margin-left: -8px;
}

/* Focus state */
.or-copyright-slider:focus {
    outline: none;
}

.or-copyright-slider:focus::-webkit-slider-thumb {
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.3), 0 2px 6px rgba(0, 0, 0, 0.3);
}

.or-copyright-slider:focus::-moz-range-thumb {
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.3), 0 2px 6px rgba(0, 0, 0, 0.3);
}

/* Responsywność dla copyright slider */
@media (max-width: 767px) {
    .or-copyright-slider-container {
        flex-direction: column;
    }

    .or-copyright-slider-wrapper {
        flex-direction: column;
        min-height: auto;
    }

    .or-slider-labels {
        flex-direction: row;
        justify-content: space-between;
        min-width: auto;
    }

    .or-slider-label {
        text-align: center;
        font-size: 12px;
        padding: 6px 8px;
    }

    .or-copyright-slider {
        writing-mode: horizontal-tb;
        direction: ltr;
        width: 100%;
        height: 40px;
        min-height: auto;
    }
}

/* ==========================================================================
   LEGAL REQUIREMENTS SELECTOR
   ========================================================================== */

.or-legal-requirements-container {
    width: 100%;
}

.or-legal-intro {
    font-size: 14px;
    color: #495057;
    margin-bottom: 15px;
    line-height: 1.5;
}

/* Checkboxy poziomo */
.or-legal-checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 20px;
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
}

.or-legal-checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    cursor: pointer;
    flex: 1 1 auto;
    min-width: 200px;
    max-width: 350px;
}

.or-legal-checkbox {
    width: 18px;
    height: 18px;
    margin-top: 2px;
    cursor: pointer;
    flex-shrink: 0;
}

.or-legal-checkbox-text {
    font-size: 13px;
    color: #495057;
    line-height: 1.4;
}

/* Tabela aktów prawnych */
.or-legal-table-container {
    margin-top: 15px;
}

.or-legal-table-header {
    font-size: 15px;
    font-weight: 600;
    color: #212529;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 2px solid #dee2e6;
}

.or-legal-acts-table {
    width: 100%;
    border-collapse: collapse;
    background: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 4px;
}

.or-legal-act-row {
    border-bottom: 1px solid #dee2e6;
}

.or-legal-act-row:last-child {
    border-bottom: none;
}

/* Lewa kolumna z kategorią - pionowy tekst */
.or-legal-category-cell {
    width: 40px;
    min-width: 40px;
    max-width: 40px;
    background: #f8f9fa;
    border-right: 2px solid #dee2e6;
    text-align: center;
    vertical-align: middle;
    padding: 10px 5px;
}

.or-legal-category-text {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    transform: rotate(180deg);
    font-size: 12px;
    font-weight: 600;
    color: #007bff;
    white-space: nowrap;
    letter-spacing: 0.5px;
}

/* Prawa kolumna z tekstami */
.or-legal-text-cell {
    padding: 8px 12px;
    vertical-align: top;
}

.or-legal-text-input {
    width: 100%;
    min-height: 50px;
    resize: vertical;
    border: 1px solid #dee2e6;
    border-radius: 3px;
    padding: 8px 10px;
    font-size: 13px;
    line-height: 1.5;
    font-family: inherit;
    background: #ffffff;
    transition: all 0.2s;
}

/* Specjalne wysokości dla konkretnych pól */
.or-legal-text-input[data-custom-key="directive_machinery_0"],
.or-legal-text-input[data-custom-key="directive_tools_2"] {
    min-height: 75px;
}

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

/* Wyszarzone gdy readonly (tryb niezaawansowany) */
.or-legal-text-input[readonly] {
    background: #f5f5f5;
    color: #6c757d;
    cursor: not-allowed;
}

/* Aktywne (tryb zaawansowany) */
.or-legal-text-input:not([readonly]) {
    background: #ffffff;
    color: #212529;
    cursor: text;
}

/* Responsywność */
@media (max-width: 767px) {
    .or-legal-checkboxes {
        flex-direction: column;
        gap: 10px;
    }

    .or-legal-checkbox-label {
        max-width: none;
        min-width: auto;
    }

    .or-legal-category-cell {
        width: 30px;
        min-width: 30px;
        max-width: 30px;
    }

    .or-legal-category-text {
        font-size: 10px;
    }

    .or-legal-text-input {
        font-size: 12px;
    }

    .or-legal-category-input {
        font-size: 10px;
        min-height: 60px;
    }
}

/* Textarea w kategorii (dla custom rows) */
.or-legal-category-input {
    width: 100%;
    resize: none;
    border: 1px solid #dee2e6;
    border-radius: 3px;
    padding: 5px;
    font-size: 12px;
    font-weight: 600;
    color: #007bff;
    background: #f8f9fa;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    transform: rotate(180deg);
    text-align: center;
    min-height: 80px;
}

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

.or-legal-category-input[readonly] {
    background: #f5f5f5;
    color: #6c757d;
    cursor: not-allowed;
}

.or-legal-category-input:not([readonly]) {
    background: #ffffff;
    color: #007bff;
    cursor: text;
}

/* Przycisk dodawania wiersza */
.or-btn-add-legal-row {
    padding: 8px 16px;
    background: #28a745;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.2s;
}

.or-btn-add-legal-row:hover {
    background: #218838;
}

.or-btn-add-legal-row:active {
    background: #1e7e34;
}

/* Przycisk usuwania wiersza */
.or-btn-remove-legal-row {
    padding: 4px 12px;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
    transition: background 0.2s;
}

.or-btn-remove-legal-row:hover {
    background: #c82333;
}

.or-btn-remove-legal-row:active {
    background: #bd2130;
}

/* ==========================================================================
   HTML CONTENT FIELDS
   ========================================================================== */

/* Nadpisanie stylów WordPressa dla HTML content */
.or-html-content p {
    margin-top: 0;
    margin-bottom: 10px !important;
    line-height: 1.6;
}

.or-html-content p:last-child {
    margin-bottom: 0 !important;
}

.or-html-content ul {
    margin-top: 0;
    margin-bottom: 10px !important;
}

.or-html-content ul:last-child {
    margin-bottom: 0 !important;
}

/* Tabele w sekcji metodologii */
.or-methodology-table {
    width: 100%;
    border-collapse: collapse;
    background: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    margin-top: 10px;
    margin-bottom: 15px;
}

.or-methodology-table thead {
    background: #f8f9fa;
}

.or-methodology-table th {
    padding: 8px 10px;
    text-align: left;
    font-weight: 600;
    color: #495057;
    border-bottom: 2px solid #dee2e6;
    font-size: 14px;
}

.or-methodology-table td {
    padding: 6px 10px;
    border-bottom: 1px solid #dee2e6;
    vertical-align: top;
    font-size: 14px;
}

.or-methodology-table tbody tr:last-child td {
    border-bottom: none;
}

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

/* Tabela ryzyka HRN - węższa i z kolorowymi wierszami */
.or-hrn-risk-table {
    /*width: 50%;*/
    max-width: 600px;
    min-width: 400px;
    border: 2px solid #000000;
}

.or-hrn-risk-table th {
    border: 1px solid #000000 !important;
    color: #000000 !important;
}

.or-hrn-risk-table td {
    border: 1px solid #000000 !important;
    color: #000000 !important;
}

.or-hrn-risk-table tbody tr.risk-negligible_\&_very-low {
    background: #90EE90 !important;
}

.or-hrn-risk-table tbody tr.risk-low {
    background: #FFEB3B !important;
}

.or-hrn-risk-table tbody tr.risk-significant_\&_high_\&_very_high {
    background: #FFA726 !important;
}

.or-hrn-risk-table tbody tr.risk-extreme_\&_unacceptable {
    background: #F44336 !important;
}

/* Wyłącz hover effect dla kolorowych wierszy */
.or-hrn-risk-table tbody tr:hover {
    background: inherit !important;
}

/* ==========================================================================
   HRN BRACKETS - INTERAKTYWNE KLAMRY AKCEPTOWALNOŚCI RYZYKA
   ========================================================================== */

/* Kontener tabeli z klamrami */
.or-hrn-table-with-brackets {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    width: fit-content;
}

/* Kontener klamr (po prawej stronie tabeli) */
.or-hrn-brackets-container {
    display: flex;
    flex-direction: column;
    position: relative;
    min-width: 120px;
    margin-top: 52px; /* Wysokość headera tabeli */
}

/* Pojedyncza klamra */
.or-hrn-bracket {
    position: relative;
    display: flex;
    align-items: center;
    transition: height 0.15s ease-out;
}

/* Linia klamry (kształt nawiasu klamrowego) */
.or-hrn-bracket-line {
    width: 20px;
    height: 100%;
    position: relative;
    flex-shrink: 0;
}

/* Kształt klamry - pionowa linia z zagięciami */
.or-hrn-bracket-line::before {
    content: '';
    position: absolute;
    left: 10px;
    top: 0;
    bottom: 0;
    width: 1px;
    background: #00B0F0;
}

/* Górne zagięcie klamry */
.or-hrn-bracket-line::after {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 10px;
    height: 1px;
    background: #00B0F0;
}

/* Dolne zagięcie klamry */
.or-hrn-bracket::before {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 10px;
    height: 1.5px;
    background: #00B0F0;
}

/* Środkowy grot klamry (skierowany w prawo) */
.or-hrn-bracket::after {
    content: '';
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
    border-left: 8px solid #00B0F0;
}

/* Etykieta klamry */
.or-hrn-bracket-label {
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    margin-left: 25px;
    transition: transform 0.15s ease-out;
}

/* Kolor etykiety dla klamry akceptowalnej - zielony */
.or-hrn-bracket-acceptable .or-hrn-bracket-label {
    color: #28a745;
}

/* Kolor etykiety dla klamry nieakceptowalnej - czerwony */
.or-hrn-bracket-unacceptable .or-hrn-bracket-label {
    color: #dc3545;
}

/* Divider między klamrami (przeciągalny) */
.or-hrn-bracket-divider {
    height: 8px;
    background: transparent;
    cursor: ns-resize;
    position: relative;
    z-index: 10;
    margin: -2px 0;
}

/* Wizualne oznaczenie dividera */
.or-hrn-bracket-divider::before {
    content: '';
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 2px;
    background: #00B0F0;
    border-radius: 1px;
}

/* Stan hover dividera */
.or-hrn-bracket-divider:hover::before {
    height: 4px;
    background: #0090D0;
}

/* Stan przeciągania dividera */
.or-hrn-bracket-divider.dragging::before {
    height: 4px;
    background: #0070B0;
    box-shadow: 0 0 8px rgba(0, 176, 240, 0.5);
}

/* Klamra akceptowalna (góra) */
.or-hrn-bracket-acceptable {
    /* Dynamiczna wysokość ustawiana przez JS */
}

/* Klamra nieakceptowalna (dół) */
.or-hrn-bracket-unacceptable {
    /* Dynamiczna wysokość ustawiana przez JS */
}

/* Zablokowany divider (tryb nie-zaawansowany) */
.or-hrn-bracket-divider.locked {
    cursor: not-allowed;
    pointer-events: none;
}

/*.or-hrn-bracket-divider.locked::before {
    background: #adb5bd;
}*/

/*.or-hrn-bracket-divider.locked:hover::before {
    height: 2px;
    background: #adb5bd;
}

/* Zablokowane klamry (tryb nie-zaawansowany) */
/*.or-hrn-brackets-container.locked .or-hrn-bracket-line::before,
.or-hrn-brackets-container.locked .or-hrn-bracket-line::after,
.or-hrn-brackets-container.locked .or-hrn-bracket::before,
.or-hrn-brackets-container.locked .or-hrn-bracket::after {
    background: #adb5bd;
}*/

/*.or-hrn-brackets-container.locked .or-hrn-bracket::after {
    border-left-color: #adb5bd;
}*/

/*.or-hrn-brackets-container.locked .or-hrn-bracket-label {
    color: #6c757d;
}*/

/* Responsywność dla klamr */
@media (max-width: 767px) {
    .or-hrn-table-with-brackets {
        flex-direction: column;
    }

    .or-hrn-brackets-container {
        display: none; /* Ukryj klamry na małych ekranach */
    }
}

/* ==========================================================================
   UPLOAD OBRAZU MASZYNY
   ========================================================================== */

.or-image-upload-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.or-image-upload-row {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

/* Przycisk uploadu - styl jak w tabeli oceny ryzyka (.btn-upload) */
.or-image-upload-container .btn-upload {
    padding: 6px 12px;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 16px;
    transition: background 0.2s;
}

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

/* Podgląd obrazu */
.or-image-upload-container .or-image-preview {
    max-width: 170px;
    max-height: 200px;
    border: 1px solid #dee2e6;
    border-radius: 3px;
    object-fit: contain;
}

/* Przycisk usuwania - styl jak .or-standard-remove */
.or-image-remove {
    background: #d63638;
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    transition: all 0.2s;
    flex-shrink: 0;
}

.or-image-remove:hover {
    background: #b32d2e;
    transform: scale(1.1);
}

/* Loading state */
.or-image-upload-container .or-image-loading {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #007bff;
    font-size: 14px;
}

.or-image-loading-spinner {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Error state */
.or-image-upload-container .or-image-error {
    padding: 8px 12px;
    background: #f8d7da;
    color: #721c24;
    border-radius: 4px;
    font-size: 13px;
}

/* Responsywność */
@media (max-width: 767px) {
    .or-image-upload-container .or-image-preview {
        max-width: 200px;
        max-height: 150px;
    }
}

/* ==========================================================================
   BUTTON GROUP (przyciski wyboru Tak/Nie/Nie dotyczy)
   ========================================================================== */

.or-button-group-wrapper {
    display: block;
    width: 100%;
}

.or-button-group {
    display: inline-flex;
    align-items: stretch;
    border: 1px solid #007bff;
    border-radius: 4px;
    overflow: hidden;
    background: #ffffff;
}

.or-button-group-btn {
    padding: 8px 16px;
    border: none;
    background: #ffffff;
    color: #007bff;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    border-right: 1px solid #007bff;
    white-space: nowrap;
    flex-shrink: 0;
}

.or-button-group-btn:hover {
    background: #e7f1ff;
}

.or-button-group-btn.active {
    background: #007bff;
    color: #ffffff;
}

.or-button-group-btn:focus {
    outline: none;
    box-shadow: inset 0 0 0 2px rgba(0, 123, 255, 0.3);
}

/* Pole uwag w button group */
.or-button-group-notes {
    flex: 1;
    min-width: 80px;
    max-width: 200px;
    padding: 8px 12px;
    border: none;
    border-left: 1px solid #007bff;
    background: #ffffff;
    font-size: 13px;
    color: #495057;
    outline: none;
}

.or-button-group-notes::placeholder {
    color: #adb5bd;
    font-style: italic;
}

.or-button-group-notes:focus {
    background: #f8f9fa;
}

/* Responsywność dla button group */
@media (max-width: 767px) {
    .or-button-group {
        display: flex;
        flex-wrap: wrap;
        width: 100%;
    }

    .or-button-group-btn {
        flex: 1;
        padding: 8px 10px;
        font-size: 12px;
    }

    .or-button-group-notes {
        flex-basis: 100%;
        max-width: none;
        border-left: none;
        border-top: 1px solid #007bff;
    }
}

/* ==========================================================================
   TABBED FIELD (pole z zakładkami - textarea/pytania)
   ========================================================================== */

.or-tabbed-field {
    width: 100%;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    overflow: hidden;
}

.or-tabbed-field-tabs {
    display: flex;
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
}

.or-tabbed-field-tab {
    flex: 1;
    padding: 10px 16px;
    border: none;
    background: #f8f9fa;
    color: #6c757d;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    border-right: 1px solid #dee2e6;
}

.or-tabbed-field-tab:last-child {
    border-right: none;
}

.or-tabbed-field-tab:hover {
    background: #e9ecef;
    color: #495057;
}

.or-tabbed-field-tab.active {
    background: #ffffff;
    color: #007bff;
    font-weight: 600;
    border-bottom: 2px solid #007bff;
    margin-bottom: -1px;
}

.or-tabbed-field-content {
    display: none;
    padding: 15px;
    background: #ffffff;
}

.or-tabbed-field-content.active {
    display: block;
}

/* Textarea w tabbed field - dziedziczy style z or-form-textarea */
.or-tabbed-textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
    min-height: 150px;
    resize: vertical;
    font-family: inherit;
}

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

.or-tabbed-textarea:disabled {
    background: #e9ecef;
    cursor: not-allowed;
    color: #6c757d;
}

/* Pytania w zakładce - grid 2 kolumny */
.or-tabbed-field-questions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.or-tabbed-question-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.or-tabbed-question-label {
    font-size: 13px;
    font-weight: 500;
    color: #495057;
    line-height: 1.4;
}

.or-tabbed-question-row .or-button-group {
    align-self: flex-start;
}

/* Responsywność dla tabbed field */
@media (max-width: 767px) {
    .or-tabbed-field-tab {
        padding: 8px 12px;
        font-size: 12px;
    }

    .or-tabbed-field-content {
        padding: 10px;
    }

    .or-tabbed-field-questions {
        grid-template-columns: 1fr;
    }

    .or-tabbed-question-label {
        font-size: 12px;
    }
}

/* ==========================================================================
   FIELD GROUP (grupy pól z nagłówkiem)
   ========================================================================== */

.or-field-group {
    border: 1px solid #dee2e6;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 10px;
}

.or-field-group-title {
    background: #f8f9fa;
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 600;
    color: #495057;
    border-bottom: 1px solid #dee2e6;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
}

.or-unit-selector {
    font-size: 11px;
    font-weight: 400;
    padding: 2px 18px 2px 6px;
    border: 1px solid #ced4da;
    border-radius: 3px;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='5'%3E%3Cpath d='M0 0l4 5 4-5z' fill='%236c757d'/%3E%3C/svg%3E") no-repeat right 5px center;
    color: #6c757d;
    cursor: pointer;
    width: auto;
    max-width: 120px;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.or-unit-selector:hover {
    border-color: #007bff;
}

.or-field-group-content {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px;
    background: #ffffff;
}

.or-field-group-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    min-width: 120px;
}

.or-field-group-label {
    font-size: 12px;
    font-weight: 500;
    color: #6c757d;
}

.or-field-group-item .or-form-input {
    padding: 8px 10px;
    font-size: 13px;
}

/* Range input (od-do z jednostką) */
.or-range-input {
    display: flex;
    align-items: center;
    gap: 6px;
}

.or-range-label {
    font-size: 12px;
    color: #6c757d;
    white-space: nowrap;
}

.or-range-field {
    width: 70px;
    max-width: 70px;
    min-width: 50px;
    flex: 0 1 auto;
    text-align: center;
}

.or-range-unit {
    font-size: 13px;
    color: #495057;
    white-space: nowrap;
    font-weight: 500;
}

/* Toggleable textarea (input z przyciskiem rozwijania) */
.or-toggleable-textarea {
    width: 100%;
}

.or-toggleable-input-wrapper {
    display: flex;
    align-items: stretch;
    border: 1px solid #ced4da;
    border-radius: 4px;
    overflow: hidden;
}

.or-toggleable-textarea .or-toggleable-input {
    flex: 1;
    border: none;
    border-radius: 0;
}

.or-toggleable-btn {
    padding: 8px 10px;
    background: #f8f9fa;
    border: none;
    border-left: 1px solid #ced4da;
    cursor: pointer;
    transition: background 0.15s ease;
    flex-shrink: 0;
}

.or-toggleable-btn:hover {
    background: #e9ecef;
}

.or-toggleable-icon {
    font-size: 10px;
    color: #6c757d;
}

/* Wrapper dla textarea z przyciskiem zwijania */
.or-toggleable-textarea-wrapper {
    display: none;
    position: relative;
}

.or-toggleable-textarea-wrapper .or-toggleable-expanded {
    width: calc(100% - 36px);
    border: 1px solid #ced4da;
    border-radius: 4px 0 0 4px;
    border-right: none;
    resize: vertical;
    min-height: 80px;
}

.or-toggleable-textarea-wrapper .or-toggleable-btn {
    position: absolute;
    top: 0;
    right: 0;
    width: 36px;
    height: 100%;
    border: 1px solid #ced4da;
    border-radius: 0 4px 4px 0;
}

/* Responsywność dla field group */
@media (max-width: 767px) {
    .or-field-group-content {
        flex-direction: column;
    }

    .or-field-group-item {
        min-width: 100%;
    }
}

/* ==========================================================================
   IMAGES TABLE (Tabela rysunków i zdjęć)
   ========================================================================== */

.or-images-table-container {
    width: 100%;
    margin-top: 10px;
}

.or-images-table {
    width: 100%;
    border-collapse: collapse;
    background: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    margin-bottom: 15px;
}

.or-images-table thead {
    background: #f8f9fa;
}

.or-images-table th {
    padding: 8px 10px;
    text-align: left;
    font-weight: 600;
    color: #495057;
    border-bottom: 2px solid #dee2e6;
    font-size: 14px;
}

.or-images-table td {
    padding: 8px 10px;
    border-bottom: 1px solid #dee2e6;
    vertical-align: middle;
}

.or-images-table tbody tr:last-child td {
    border-bottom: none;
}

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

/* Komórka z opisem - pole toggleable */
.or-images-description-cell {
    width: 50%;
}

.or-images-description-cell .or-toggleable-textarea {
    width: 100%;
}

.or-images-description-cell .or-toggleable-input-wrapper {
    display: flex;
    align-items: stretch;
}

.or-images-description-cell .or-toggleable-input {
    flex: 1;
    min-width: 0;
}

/* Komórka z obrazem */
.or-images-image-cell {
    width: 45%;
}

.or-images-image-cell .or-image-upload-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.or-images-image-cell .or-image-upload-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* Podgląd obrazu w tabeli - mniejszy */
.or-images-table-preview,
.or-images-image-cell .or-image-preview {
    max-width: 150px;
    max-height: 100px;
    border: 1px solid #dee2e6;
    border-radius: 3px;
    object-fit: contain;
}

/* Komórka z akcjami */
.or-images-actions {
    width: 5%;
    text-align: center;
    padding: 8px !important;
}

.or-btn-remove-row {
    background: #dc3545;
    color: white;
    border: none;
    padding: 6px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    transition: background 0.2s;
}

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

/* Przycisk dodawania wiersza - styl jak dla definicji */
.or-add-row-container {
    margin-top: 15px;
    text-align: left;
}

.or-btn-add-row {
    background: #28a745;
    color: white;
    padding: 12px 30px;
    font-size: 15px;
    font-weight: 600;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
}

.or-btn-add-row:hover {
    background: #218838;
}

/* Responsywność dla tabeli obrazów */
@media (max-width: 767px) {
    .or-images-table th,
    .or-images-table td {
        padding: 6px 8px;
        font-size: 13px;
    }

    .or-images-table-preview {
        max-width: 100px;
        max-height: 70px;
    }

    .or-btn-add-row {
        width: 100%;
        padding: 10px 20px;
    }
}

/* ==========================================================================
   MACHINE PARTS MULTISELECT (Części maszyny)
   ========================================================================== */

.or-machine-parts-container {
    position: relative;
    width: 100%;
    z-index: 1;
}

.or-machine-parts-container.open {
    z-index: 100;
}

.or-machine-parts-selected {
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 42px;
    padding: 6px 12px;
    background: #ffffff;
    border: 1px solid #ced4da;
    border-radius: 4px;
    cursor: pointer;
    user-select: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.or-machine-parts-selected:hover {
    border-color: #007bff;
}

.or-machine-parts-selected:focus,
.or-machine-parts-container.open .or-machine-parts-selected {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.or-machine-parts-tags {
    flex: 1;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.or-machine-parts-placeholder {
    font-size: 14px;
    color: #6c757d;
    font-style: italic;
}

.or-machine-parts-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    background: #007bff;
    color: #ffffff;
    border-radius: 4px;
    font-size: 13px;
    line-height: 1.3;
    max-width: 200px;
}

.or-machine-parts-tag .tag-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.or-machine-parts-tag .tag-remove {
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    font-weight: bold;
    padding: 0 2px;
    transition: color 0.15s;
    flex-shrink: 0;
}

.or-machine-parts-tag .tag-remove:hover {
    color: #ffcccc;
}

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

.or-machine-parts-container.open .or-machine-parts-arrow {
    transform: rotate(180deg);
}

/* Dropdown */
.or-machine-parts-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 4px;
    background: #ffffff;
    border: 1px solid #ced4da;
    border-radius: 4px;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
    z-index: 9999;
    max-height: 300px;
    overflow-y: auto;
}

/* Portal pattern - dropdown przeniesiony do body */
body > .or-machine-parts-dropdown {
    position: fixed !important;
    z-index: 999999 !important;
    right: auto !important;
}

.or-machine-parts-options {
    padding: 6px 0;
}

.or-machine-parts-option {
    display: flex;
    align-items: center;
    padding: 10px 14px;
    cursor: pointer;
    transition: background 0.15s;
    user-select: none;
}

.or-machine-parts-option:hover {
    background: #f8f9fa;
}

.or-machine-parts-option input[type="checkbox"] {
    margin-right: 10px;
    cursor: pointer;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.or-machine-parts-option span {
    font-size: 14px;
    color: #212529;
    line-height: 1.4;
}

.or-machine-parts-option.default-option {
    background: #f0f7ff;
    border-bottom: 1px solid #dee2e6;
}

.or-machine-parts-option.default-option span {
    font-weight: 600;
    color: #007bff;
}

.or-machine-parts-separator {
    height: 1px;
    background: #dee2e6;
    margin: 6px 0;
}

/* Pole dodawania nowej części - zawsze widoczne pod dropdownem */
.or-machine-parts-add-new {
    display: flex;
    gap: 8px;
    padding: 10px 0;
    margin-top: 10px;
}

.or-machine-parts-custom-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

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

.or-machine-parts-custom-input::placeholder {
    color: #adb5bd;
}

.or-btn-add-machine-part {
    padding: 8px 16px;
    background: #28a745;
    color: #ffffff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    transition: background 0.2s;
    flex-shrink: 0;
}

.or-btn-add-machine-part:hover {
    background: #218838;
}

.or-btn-add-machine-part:active {
    background: #1e7e34;
}

/* Pusta lista */
.or-machine-parts-empty {
    padding: 20px;
    text-align: center;
    color: #6c757d;
    font-style: italic;
}

/* Responsywność */
@media (max-width: 767px) {
    .or-machine-parts-tag {
        max-width: 150px;
        font-size: 12px;
        padding: 3px 6px;
    }

    .or-machine-parts-option {
        padding: 8px 12px;
    }

    .or-machine-parts-option span {
        font-size: 13px;
    }
}

/* ==========================================================================
   ATTACHMENTS TABLE (Tabela załączników PDF)
   ========================================================================== */

.or-attachments-table-container {
    width: 100%;
    margin-top: 10px;
}

.or-attachments-table {
    width: 100%;
    border-collapse: collapse;
    background: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    margin-bottom: 15px;
}

.or-attachments-table thead {
    background: #f8f9fa;
}

.or-attachments-table th {
    padding: 8px 10px;
    text-align: left;
    font-weight: 600;
    color: #495057;
    border-bottom: 2px solid #dee2e6;
    font-size: 14px;
}

.or-attachments-table td {
    padding: 8px 10px;
    border-bottom: 1px solid #dee2e6;
    vertical-align: middle;
}

.or-attachments-table tbody tr:last-child td {
    border-bottom: none;
}

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

/* Komórka z opisem - pole toggleable */
.or-attachments-description-cell {
    width: 50%;
}

.or-attachments-description-cell .or-toggleable-textarea {
    width: 100%;
}

.or-attachments-description-cell .or-toggleable-input-wrapper {
    display: flex;
    align-items: stretch;
}

.or-attachments-description-cell .or-toggleable-input {
    flex: 1;
    min-width: 0;
}

/* Komórka z plikiem PDF */
.or-attachments-file-cell {
    width: 45%;
}

.or-pdf-upload-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.or-pdf-upload-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* Przycisk uploadu PDF - styl jak dla obrazów */
.or-pdf-upload-container .btn-upload {
    padding: 6px 12px;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 16px;
    transition: background 0.2s;
}

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

/* Nazwa pliku PDF */
.or-pdf-filename {
    display: inline-block;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    background: #e9ecef;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 13px;
    color: #495057;
}

/* Przycisk usuwania pliku PDF - styl jak dla obrazów */
.or-pdf-remove {
    background: #d63638;
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    transition: all 0.2s;
    flex-shrink: 0;
}

.or-pdf-remove:hover {
    background: #b32d2e;
    transform: scale(1.1);
}

/* Error state dla PDF */
.or-pdf-upload-container .or-pdf-error {
    padding: 8px 12px;
    background: #f8d7da;
    color: #721c24;
    border-radius: 4px;
    font-size: 13px;
}

/* Komórka z akcjami */
.or-attachments-actions {
    width: 5%;
    text-align: center;
    padding: 8px !important;
}

.or-btn-remove-attachment-row {
    background: #dc3545;
    color: white;
    border: none;
    padding: 6px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    transition: background 0.2s;
}

.or-btn-remove-attachment-row:hover {
    background: #c82333;
}

/* Przycisk dodawania wiersza załącznika */
.or-btn-add-attachment-row {
    background: #28a745;
    color: white;
    padding: 12px 30px;
    font-size: 15px;
    font-weight: 600;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
}

.or-btn-add-attachment-row:hover {
    background: #218838;
}

/* Responsywność dla tabeli załączników */
@media (max-width: 767px) {
    .or-attachments-table th,
    .or-attachments-table td {
        padding: 6px 8px;
        font-size: 13px;
    }

    .or-pdf-filename {
        max-width: 120px;
        font-size: 12px;
        padding: 4px 8px;
    }

    .or-btn-add-attachment-row {
        width: 100%;
        padding: 10px 20px;
    }
}

/* ==========================================================================
   LIFE PHASES TABLE (Fazy życia maszyny)
   ========================================================================== */

.or-life-phases-table {
    width: 100%;
    margin-top: 10px;
}

.or-life-phases-table .or-table {
    width: 100%;
    border-collapse: collapse;
    background: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    margin-bottom: 15px;
}

.or-life-phases-table .or-table thead {
    background: #f8f9fa;
}

.or-life-phases-table .or-table th {
    padding: 8px 10px;
    text-align: left;
    font-weight: 600;
    color: #495057;
    border-bottom: 2px solid #dee2e6;
    font-size: 14px;
}

.or-life-phases-table .or-table td {
    padding: 6px 10px;
    border-bottom: 1px solid #dee2e6;
    vertical-align: middle;
}

/* Niższa wysokość wierszy */
.or-life-phase-row {
    height: 42px;
}

.or-life-phase-drag-handle {
    cursor: grab;
    text-align: center;
    color: #999;
    font-size: 16px;
    user-select: none;
    width: 30px;
}

.or-life-phase-drag-handle:hover {
    color: #555;
}

.or-life-phase-drag-handle:active {
    cursor: grabbing;
}

.or-life-phase-sortable-placeholder {
    height: 42px;
    background: #e3f2fd;
    border: 2px dashed #90caf9;
}

.or-life-phases-table .or-table tbody tr:last-child td {
    border-bottom: none;
}

.or-life-phases-table .or-table tbody tr:hover {
    background: #f8f9fa;
}

/* Tag fazy życia - styl podobny do .multiselect-tag */
.or-life-phase-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    background: #007bff;
    color: white;
    border-radius: 3px;
    font-size: 12px;
    line-height: 1.3;
    max-width: 100%;
}

.or-life-phase-tag-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    outline: none;
    min-width: 50px;
    cursor: text;
}

/* Placeholder dla pustego contenteditable */
.or-life-phase-tag-text:empty::before {
    content: attr(data-placeholder);
    color: rgba(255, 255, 255, 0.6);
    font-style: italic;
}

/* Focus state dla edycji nazwy */
.or-life-phase-tag-text:focus {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    padding: 2px 4px;
    margin: -2px -4px;
}

/* Komórka z opisem */
.or-life-phase-desc-cell {
    width: 70%;
}

.or-life-phase-desc-input {
    width: 100%;
    padding: 6px 10px !important;
    font-size: 13px !important;
    border: 1px solid #ced4da;
    border-radius: 4px;
}

.or-life-phase-desc-input:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.15);
    outline: none;
}

/* Komórka z akcjami */
.or-life-phase-actions {
    width: 5%;
    text-align: center;
    padding: 6px !important;
}

.or-btn-remove-phase {
    background: #dc3545;
    color: white;
    border: none;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s;
    line-height: 1;
}

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

/* Przycisk dodawania fazy */
.or-add-phase-row {
    margin-top: 15px;
    text-align: left;
}

.or-btn-add-phase {
    background: #28a745;
    color: white;
    padding: 10px 24px;
    font-size: 14px;
    font-weight: 600;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
}

.or-btn-add-phase:hover {
    background: #218838;
}

/* Responsywność dla tabeli faz życia */
@media (max-width: 767px) {
    .or-life-phases-table .or-table th,
    .or-life-phases-table .or-table td {
        padding: 4px 6px;
        font-size: 12px;
    }

    .or-life-phase-tag {
        padding: 3px 6px;
        font-size: 11px;
    }

    .or-life-phase-desc-input {
        font-size: 12px !important;
    }

    .or-btn-add-phase {
        width: 100%;
        padding: 10px 20px;
    }
}

/* ==========================================================================
   MARKING CHECKBOXES - Wymagane oznakowanie (CE, ATEX, itp.)
   ========================================================================== */

.or-marking-checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: flex-start;
}

.or-marking-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 10px 15px;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #f8f9fa;
    min-width: 80px;
}

.or-marking-option:hover {
    border-color: #007bff;
    background: #e7f1ff;
}

.or-marking-option.checked {
    border-color: #28a745;
    background: #d4edda;
}

.or-marking-option input[type="checkbox"] {
    width: 20px;
    height: 20px;
    min-width: 20px;
    min-height: 20px;
    flex-shrink: 0;
    cursor: pointer;
    accent-color: #28a745;
}

.or-marking-image {
    height: 27px;
    width: auto;
    object-fit: contain;
}

.or-marking-label {
    font-size: 14px;
    font-weight: 600;
    color: #495057;
}

/* Opcja "Inne" z polem tekstowym - w jednej linii */
.or-marking-option:has(.or-marking-other-input) {
    flex-direction: row;
    align-items: center;
    gap: 8px;
    height: 56px;
    box-sizing: content-box;
}

.or-marking-option:has(.or-marking-other-input) .or-marking-label {
    white-space: nowrap;
}

.or-marking-other-input {
    width: 120px;
    padding: 6px 10px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 13px;
    margin-top: 0;
}

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

/* Kontener dynamicznych pól "Inne" */
.or-marking-other-items {
    display: contents;
}

/* Pole "Inne" z opcjonalnym obrazkiem */
.or-marking-other-item {
    flex-direction: row !important;
    align-items: center !important;
    gap: 8px !important;
    min-width: auto !important;
    flex-wrap: nowrap;
}

.or-marking-other-item .or-marking-other-input {
    flex: 0 0 120px;
}

.or-marking-other-upload-btn {
    background: #e9ecef;
    border: 1px solid #ced4da;
    border-radius: 4px;
    padding: 4px 8px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
}

.or-marking-other-upload-btn:hover {
    background: #dee2e6;
    border-color: #007bff;
}

.or-marking-other-preview {
    height: 27px;
    width: auto;
    object-fit: contain;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 2px;
}

.or-marking-other-remove-img {
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 14px;
    line-height: 18px;
    text-align: center;
    cursor: pointer;
    padding: 0;
}

.or-marking-other-remove-img:hover {
    background: #c82333;
}

.or-marking-other-remove-item {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 14px;
    padding: 2px 4px;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.or-marking-other-remove-item:hover {
    opacity: 1;
}

/* Przycisk dodawania nowego pola "Inne" */
.or-marking-add-other {
    background: #f8f9fa;
    border: 2px dashed #dee2e6;
    border-radius: 8px;
    padding: 10px;
    cursor: pointer;
    font-size: 13px;
    color: #6c757d;
    transition: all 0.2s ease;
    width: 80px;
    height: 80px;
    box-sizing: border-box;
    text-align: center;
    line-height: 1.3;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.or-marking-add-other:hover {
    border-color: #007bff;
    color: #007bff;
    background: #e7f1ff;
}

/* Responsywność */
@media (max-width: 768px) {
    .or-marking-checkboxes {
        gap: 10px;
    }

    .or-marking-option {
        padding: 8px 12px;
        min-width: 70px;
    }

    .or-marking-image {
        height: 20px;
    }

    .or-marking-other-input {
        width: 100px;
    }
}

/* ==========================================================================
   23. OVERLAY EKSPORTU PDF
   ========================================================================== */

.pdf-export-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.pdf-export-modal {
    background: #ffffff;
    border-radius: 12px;
    padding: 40px 50px;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    max-width: 400px;
}

.pdf-export-spinner {
    font-size: 48px;
    animation: pdf-spinner-pulse 1.5s ease-in-out infinite;
    margin-bottom: 20px;
}

@keyframes pdf-spinner-pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.7;
    }
}

.pdf-export-message {
    color: #333;
}

.pdf-export-message strong {
    font-size: 16px;
    display: block;
    margin-bottom: 10px;
    color: #1a237e;
}

.pdf-export-message p {
    font-size: 14px;
    color: #666;
    margin: 0;
}
