/* Agreements Module - Table styling for agreements */

/* ===== Certyfikat Neon Badges (stary - header) ===== */
.cert-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.25s ease;
    user-select: none;
    opacity: 0.35;
    border: 1.5px solid transparent;
}

.cert-badge:hover {
    opacity: 0.7;
}

.cert-badge.active {
    opacity: 1;
}

/* BRAK - szary neon */
.cert-badge.cert-brak {
    color: #999;
    background: rgba(160, 160, 160, 0.1);
    border-color: rgba(160, 160, 160, 0.3);
}
.cert-badge.cert-brak.active {
    color: #fff;
    background: rgba(160, 160, 160, 0.85);
    border-color: #aaa;
    box-shadow: 0 0 8px rgba(160, 160, 160, 0.5);
}

/* GMP - zielony neon */
.cert-badge.cert-gmp {
    color: #22c55e;
    background: rgba(34, 197, 94, 0.08);
    border-color: rgba(34, 197, 94, 0.3);
}
.cert-badge.cert-gmp.active {
    color: #fff;
    background: rgba(34, 197, 94, 0.85);
    border-color: #22c55e;
    box-shadow: 0 0 10px rgba(34, 197, 94, 0.5), 0 0 20px rgba(34, 197, 94, 0.2);
}

/* KZR - niebieski neon */
.cert-badge.cert-kzr {
    color: #3b82f6;
    background: rgba(59, 130, 246, 0.08);
    border-color: rgba(59, 130, 246, 0.3);
}
.cert-badge.cert-kzr.active {
    color: #fff;
    background: rgba(59, 130, 246, 0.85);
    border-color: #3b82f6;
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.5), 0 0 20px rgba(59, 130, 246, 0.2);
}

/* ===== Certyfikat - Nowa sekcja (wyraziste przyciski) ===== */
.cert-section {
    padding-bottom: 8px !important;
}

.cert-section h3 {
    margin-bottom: 12px;
}

.cert-container-large {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
}

.cert-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 24px;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.25s ease;
    user-select: none;
    border: 2px solid transparent;
    opacity: 0.4;
    min-width: 120px;
    justify-content: center;
}

.cert-option:hover {
    opacity: 0.75;
    transform: translateY(-1px);
}

.cert-option.active {
    opacity: 1;
    transform: translateY(-2px);
}

.cert-option i {
    font-size: 1.1rem;
}

/* BRAK */
.cert-option.cert-brak {
    color: #6b7280;
    background: rgba(107, 114, 128, 0.06);
    border-color: rgba(107, 114, 128, 0.2);
}
.cert-option.cert-brak.active {
    color: #fff;
    background: linear-gradient(135deg, #6b7280, #4b5563);
    border-color: #6b7280;
    box-shadow: 0 4px 15px rgba(107, 114, 128, 0.4);
}

/* GMP */
.cert-option.cert-gmp {
    color: #22c55e;
    background: rgba(34, 197, 94, 0.06);
    border-color: rgba(34, 197, 94, 0.2);
}
.cert-option.cert-gmp.active {
    color: #fff;
    background: linear-gradient(135deg, #22c55e, #16a34a);
    border-color: #22c55e;
    box-shadow: 0 4px 15px rgba(34, 197, 94, 0.4), 0 0 25px rgba(34, 197, 94, 0.15);
}

/* KZR */
.cert-option.cert-kzr {
    color: #3b82f6;
    background: rgba(59, 130, 246, 0.06);
    border-color: rgba(59, 130, 246, 0.2);
}
.cert-option.cert-kzr.active {
    color: #fff;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    border-color: #3b82f6;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4), 0 0 25px rgba(59, 130, 246, 0.15);
}

.page-container {
    padding: 30px;
}

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

.page-header h1 {
    font-size: 1.5rem;
    margin: 0;
    color: #2c3e50;
}

.content-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    overflow: hidden;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    border-bottom: 1px solid #e8ecef;
}

.card-header h2 {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.1rem;
    font-weight: 600;
    color: #2c3e50;
    margin: 0;
}

.card-body {
    padding: 0;
}

/* Filters Bar */
.filters-bar {
    display: flex;
    gap: 16px;
    padding: 16px 20px;
    background: #f7fafc;
    border-bottom: 1px solid #e8ecef;
    flex-wrap: wrap;
    align-items: center;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-group label {
    font-size: 0.9rem;
    font-weight: 600;
    color: #2c3e50;
    white-space: nowrap;
}

.filter-group select,
.filter-group input[type="date"] {
    padding: 8px 12px;
    border: 1px solid #e8ecef;
    border-radius: 6px;
    font-size: 0.9rem;
    color: #2c3e50;
    background: #fff;
    cursor: pointer;
}

.filter-group select:focus,
.filter-group input[type="date"]:focus {
    outline: none;
    border-color: #2d5a27;
    box-shadow: 0 0 0 3px rgba(45, 90, 39, 0.1);
}

/* Table Styling */
.table-wrapper {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead {
    background: #f7fafc;
}

/* Filter row in table header */
.data-table thead tr.filter-row {
    background: #ffffff;
}

.data-table thead tr.filter-row th {
    padding: 6px 8px;
    border-bottom: 1px solid #e8ecef;
    position: relative;
}

.data-table thead tr.filter-row .filter-autocomplete {
    position: relative;
    width: 100%;
}

.data-table thead tr.filter-row input[type="text"] {
    width: 100%;
    box-sizing: border-box;
    padding: 6px 8px;
    font-size: 13px;
    border: 1px solid #cbd5e0;
    border-radius: 4px;
    background: #fff;
    color: #2c3e50;
    transition: border-color 0.2s ease;
}

.data-table thead tr.filter-row input[type="text"]:focus {
    outline: none;
    border-color: #2d5a27;
    box-shadow: 0 0 0 2px rgba(45, 90, 39, 0.1);
}

.data-table thead tr.filter-row input[type="text"]::placeholder {
    color: #a0aec0;
    font-size: 12px;
}

/* Filter dropdown styling */
.filter-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 250px;
    overflow-y: auto;
    background: white;
    border: 1px solid #cbd5e0;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    margin-top: 2px;
}

.filter-dropdown.show {
    display: block;
}

.filter-dropdown-item {
    padding: 8px 12px;
    cursor: pointer;
    font-size: 13px;
    color: #2c3e50;
    transition: background-color 0.15s ease;
}

.filter-dropdown-item:hover,
.filter-dropdown-item.highlighted {
    background-color: #f0f4f8;
}

.filter-dropdown-item:active {
    background-color: #e2e8f0;
}

.data-table th {
    padding: 12px 20px;
    text-align: left;
    font-weight: 600;
    color: #2c3e50;
    border-bottom: 2px solid #e8ecef;
    font-size: 0.9rem;
}

.th-sortable {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
    transition: color 0.2s ease;
}

.th-sortable:hover {
    color: #2d5a27;
}

.sort-icon {
    font-size: 0.85rem;
    color: #a0aec0;
    transition: color 0.2s ease;
}

.sort-icon.active {
    color: #2d5a27;
}

.data-table td {
    padding: 14px 20px;
    border-bottom: 1px solid #e8ecef;
    color: #5a6c7d;
}

.data-table tbody tr {
    transition: background 0.2s ease;
    cursor: pointer;
}

.data-table tbody tr:nth-child(even) {
    background: #f8f9fa;
}

.data-table tbody tr:hover {
    background: #e8f4f8 !important;
}

/* Wiersze z brakującymi polami obowiązkowymi */
.data-table tbody tr.row-incomplete {
    background: #fef2f2 !important;
    border-left: 4px solid #ef4444;
}

.data-table tbody tr.row-incomplete:nth-child(even) {
    background: #fee2e2 !important;
}

.data-table tbody tr.row-incomplete:hover {
    background: #fecaca !important;
}

/* Status badges */
.status {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
    text-align: center;
}

.status.draft {
    background: #fecaca;
    color: #7f1d1d;
}

.status.active {
    background: #bbf7d0;
    color: #065f46;
}

.status.completed {
    background: #bfdbfe;
    color: #1e40af;
}

.status.cancelled {
    background: #d1d5db;
    color: #4b5563;
}

/* Status badges for agreements table */
.status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.status-badge:hover {
    transform: scale(1.02);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.status-przygotowane {
    background: #64748b;
    color: #fff;
    border: 2px solid #475569;
}

.status-oczekuje {
    background: #f59e0b;
    color: #fff;
    border: 2px solid #d97706;
}

.status-w-realizacji {
    background: #22c55e;
    color: #fff;
    border: 2px solid #16a34a;
}

.status-nowa {
    background: #6366f1;
    color: #fff;
    border: 2px solid #4f46e5;
}

.status-wyslana {
    background: #3b82f6;
    color: #fff;
    border: 2px solid #2563eb;
    animation: pulseBlue 2s ease-in-out infinite;
}

.status-podpisana-czesc {
    background: #8b5cf6;
    color: #fff;
    border: 2px solid #7c3aed;
    animation: pulsePurple 2s ease-in-out infinite;
}

.status-podpisana {
    background: #14b8a6;
    color: #fff;
    border: 2px solid #0d9488;
}

.status-zakonczyc {
    background: #f59e0b;
    color: #fff;
    border: 2px solid #d97706;
    cursor: pointer;
    animation: pulseOrange 2s ease-in-out infinite;
}

.status-zakonczyc:hover {
    background: #d97706;
    border-color: #b45309;
    transform: scale(1.05);
}

@keyframes pulseOrange {
    0%, 100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.4); }
    50% { box-shadow: 0 0 0 6px rgba(245, 158, 11, 0); }
}

@keyframes pulseBlue {
    0%, 100% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.4); }
    50% { box-shadow: 0 0 0 6px rgba(59, 130, 246, 0); }
}

@keyframes pulsePurple {
    0%, 100% { box-shadow: 0 0 0 0 rgba(139, 92, 246, 0.4); }
    50% { box-shadow: 0 0 0 6px rgba(139, 92, 246, 0); }
}

.status-zakonczony {
    background: #dc2626;
    color: #fff;
    border: 2px solid #b91c1c;
}

.status-selector-item.zakonczyc-item {
    background: #f59e0b;
    color: #fff;
    border: 2px solid #d97706;
}

.status-selector-item.zakonczyc-item:hover {
    background: #d97706;
    border-color: #b45309;
}

/* Status in table */
.status-cell {
    min-width: 110px;
}

/* Status selector dropdown */
.status-selector {
    position: absolute;
    top: 100%;
    left: 0;
    background: #fff;
    border: 1px solid #e8ecef;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1001;
    padding: 8px;
    display: none;
}

.status-selector.show {
    display: block;
}

.status-selector-item {
    display: block;
    width: 100%;
    padding: 8px 16px;
    margin: 4px 0;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    text-align: center;
    transition: all 0.2s ease;
}

.status-selector-item:hover {
    transform: scale(1.02);
}

.status-selector-item.w-realizacji {
    background: #22c55e;
    color: #fff;
}

.status-selector-item.zakonczony {
    background: #dc2626;
    color: #fff;
}

.action-buttons {
    display: flex;
    gap: 8px;
    align-items: center;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: #f0f3f7;
    color: #2c3e50;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-icon:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.btn-edit { 
    color: #2d5a27;
}

.btn-delete { 
    color: #e74c3c;
}

.loading {
    text-align: center;
    color: #718096;
    padding: 40px 20px;
}

.no-data {
    text-align: center;
    color: #718096;
    padding: 30px 20px;
}

.agreement-link {
    color: #2d5a27;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.agreement-link:hover {
    color: #1a3317;
    text-decoration: underline;
}

/* Modal styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    visibility: hidden;
    opacity: 0;
    transition: background 0.4s ease, opacity 0.4s ease, visibility 0.4s ease;
    pointer-events: none;
    perspective: 1200px;
}

.modal.active {
    visibility: visible;
    opacity: 1;
    background: rgba(0,0,0,0.6);
    pointer-events: auto;
}

.modal-content {
    background: #fff;
    border-radius: 12px;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 80px rgba(0,0,0,0.4);
    transform: rotateX(-90deg);
    transform-origin: top center;
    opacity: 0;
    transition: transform 0.5s cubic-bezier(0.23, 1, 0.32, 1), opacity 0.3s ease;
}

.modal-content.modal-large {
    max-width: 1000px;
}

.modal.active .modal-content {
    transform: rotateX(0deg);
    opacity: 1;
}

/* Animacja zamykania - opadanie w dół */
.modal.closing .modal-content {
    transform: rotateX(90deg);
    transform-origin: bottom center;
    opacity: 0;
    transition: transform 0.4s cubic-bezier(0.55, 0.055, 0.675, 0.19), opacity 0.3s ease;
}

.modal-small {
    max-width: 450px;
}

.warning-text {
    color: #ef4444;
    font-size: 0.9rem;
    margin-top: 8px;
    font-weight: 500;
}

.btn-danger {
    background: #ef4444;
    color: #fff;
}

.btn-danger:hover {
    background: #dc2626;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #e8ecef;
    background: #f7fafc;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.25rem;
    color: #2c3e50;
    display: flex;
    align-items: center;
    gap: 10px;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #718096;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.close-btn:hover {
    background: rgba(0,0,0,0.05);
    color: #2c3e50;
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

/* Form sections */
.form-section {
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid #e8ecef;
}

.form-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

/* Sekcja komentarzy - żółte tło */
.form-section.comments-section {
    background: linear-gradient(135deg, #fffef0 0%, #fff9e6 100%);
    border: 1px solid #f0e68c;
    border-radius: 12px;
    padding: 20px;
    margin-top: 16px;
    box-shadow: 0 2px 8px rgba(240, 230, 140, 0.3);
}

.form-section.comments-section h3 {
    color: #8b7500;
    border-bottom-color: #f0e68c;
}

/* Nagłówek sekcji komentarzy z wyszukiwarką */
.comments-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 0;
}

.comments-section-header h3 {
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
    border-bottom: none !important;
    white-space: nowrap;
}

.comments-search-wrapper {
    position: relative;
    flex: 0 1 220px;
    min-width: 140px;
}

.comments-search-wrapper input {
    width: 100%;
    padding: 5px 10px 5px 28px;
    border: 1px solid #e0d8a8;
    border-radius: 6px;
    font-size: 12px;
    background: rgba(255,255,255,0.7);
    color: #555;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.comments-search-wrapper input:focus {
    border-color: #c9b84c;
    box-shadow: 0 0 0 2px rgba(201, 184, 76, 0.15);
    background: #fff;
}

.comments-search-wrapper .search-icon {
    position: absolute;
    left: 9px;
    top: 50%;
    transform: translateY(-50%);
    color: #b8a940;
    font-size: 11px;
    pointer-events: none;
}

.form-section h3 {
    font-size: 1rem;
    font-weight: 600;
    color: #2c3e50;
    margin: 0 0 16px 0;
    padding-bottom: 12px;
    border-bottom: 2px solid #e8ecef;
}

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

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

.form-row.three-col {
    grid-template-columns: 1fr 1fr 1fr;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-size: 0.9rem;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 6px;
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 10px 14px;
    border: 1px solid #e8ecef;
    border-radius: 8px;
    font-size: 0.95rem;
    color: #2c3e50;
    transition: all 0.2s ease;
    font-family: inherit;
    background: #fff;
}

.form-group select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2395a5a6' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 38px;
    cursor: pointer;
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #2d5a27;
    box-shadow: 0 0 0 3px rgba(45, 90, 39, 0.1);
}

.form-group input.readonly {
    background: #f7fafc;
    color: #5a6c7d;
    cursor: default;
}

.form-group input[readonly] {
    background: #f7fafc;
    color: #5a6c7d;
}

.form-group select[disabled],
.form-group input[disabled] {
    background: #f7fafc;
    color: #5a6c7d;
    cursor: default;
    opacity: 0.6;
}

/* Autocomplete styling */
.autocomplete-wrapper {
    position: relative;
    width: 100%;
}

.autocomplete-wrapper .dropdown-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.7rem;
    color: #95a5a6;
    pointer-events: none;
    padding-top: 8px;
}

.autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #e8ecef;
    border-top: none;
    border-radius: 0 0 8px 8px;
    max-height: 200px;
    overflow-y: auto;
    display: none;
    z-index: 1000;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    margin-top: -1px;
}

.autocomplete-dropdown.show {
    display: block;
}

.autocomplete-item {
    padding: 10px 14px;
    cursor: pointer;
    font-size: 0.95rem;
    color: #2c3e50;
    transition: background-color 0.2s;
}

.autocomplete-item:hover {
    background-color: #f7fafc;
}

.autocomplete-item.active {
    background-color: #e8f4f8;
}

.autocomplete-no-results {
    padding: 10px 14px;
    font-size: 0.95rem;
    color: #95a5a6;
    text-align: center;
}

/* Remove spinner arrows from number inputs */
input[type="number"].no-spin::-webkit-outer-spin-button,
input[type="number"].no-spin::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type="number"].no-spin[type="number"] {
    -moz-appearance: textfield;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid #e8ecef;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    background: #f7fafc;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.btn-primary {
    background: linear-gradient(135deg, #2d5a27 0%, #4a9142 100%);
    color: #fff;
    border: none;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #1e3d1a 0%, #2d5a27 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(45, 90, 39, 0.3);
}

.btn-success {
    background: linear-gradient(135deg, #2d5a27 0%, #4a9142 100%);
    color: #fff;
    border: none;
}

.btn-success:hover {
    background: linear-gradient(135deg, #1e3d1a 0%, #2d5a27 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(45, 90, 39, 0.3);
}

.btn-secondary {
    background: #e8ecef;
    color: #2c3e50;
}

.btn-secondary:hover {
    background: #d1d5db;
}

.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #fff;
    color: #2c3e50;
    padding: 10px 14px;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.12);
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.25s ease;
    z-index: 1000;
}

.notification.show {
    opacity: 1;
    transform: translateY(0);
}

.notification-info {
    border-left: 4px solid #3b82f6;
}

.notification-success {
    border-left: 4px solid #10b981;
}

.notification-error {
    border-left: 4px solid #ef4444;
}

/* ==========================================
   SEKCJA KOMENTARZY / AKTYWNOŚCI
   ========================================== */

.comment-input-wrapper {
    position: relative;
    display: flex;
    align-items: flex-end;
}

.comment-input-wrapper textarea {
    flex: 1;
    padding-right: 45px;
    resize: none;
    min-height: 60px;
}

.comment-add-btn {
    position: absolute;
    right: 8px;
    bottom: 8px;
    width: 32px;
    height: 32px;
    border: none;
    background: #2d5a27;
    color: #fff;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.comment-add-btn:hover {
    background: #3d7a37;
    transform: scale(1.1);
}

.comment-add-btn i {
    font-size: 14px;
}

/* Checkbox "Dodaj do kalendarza" pod polem komentarza */
.comment-calendar-row {
    margin-top: 6px;
    position: relative;
}

.comment-calendar-row label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: #666;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

.comment-calendar-row label i {
    color: #b8a940;
    font-size: 13px;
}

.comment-calendar-row input[type="checkbox"] {
    accent-color: #2d5a27;
    width: 14px;
    height: 14px;
    cursor: pointer;
}

/* Mini popup kalendarza */
.comment-calendar-picker {
    display: none;
    margin-top: 8px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    padding: 14px;
    z-index: 1000;
    width: 260px;
    animation: calPickerFadeIn 0.15s ease;
}

.comment-calendar-picker.active {
    display: block;
}

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

.cal-picker-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.cal-picker-header span {
    font-size: 13px;
    font-weight: 600;
    color: #333;
}

.cal-picker-header button {
    background: none;
    border: none;
    cursor: pointer;
    color: #666;
    font-size: 14px;
    padding: 2px 6px;
    border-radius: 4px;
}

.cal-picker-header button:hover {
    background: #f0f0f0;
    color: #333;
}

.cal-picker-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    margin-bottom: 10px;
}

.cal-picker-grid .cal-day-label {
    text-align: center;
    font-size: 10px;
    font-weight: 600;
    color: #999;
    padding: 2px 0 4px;
}

.cal-picker-grid .cal-day {
    text-align: center;
    font-size: 12px;
    padding: 5px 2px;
    border-radius: 6px;
    cursor: pointer;
    color: #333;
    transition: all 0.1s;
}

.cal-picker-grid .cal-day:hover {
    background: #e8f5e9;
}

.cal-picker-grid .cal-day.today {
    font-weight: 700;
    color: #2d5a27;
    background: rgba(45,90,39,0.08);
}

.cal-picker-grid .cal-day.selected {
    background: #2d5a27;
    color: #fff;
    font-weight: 600;
}

.cal-picker-grid .cal-day.other-month {
    color: #ccc;
}

.cal-picker-time {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-top: 8px;
    border-top: 1px solid #eee;
}

.cal-picker-time label {
    font-size: 12px;
    color: #666;
    white-space: nowrap;
}

.cal-picker-time input[type="time"] {
    flex: 1;
    padding: 4px 8px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 12px;
    color: #333;
}

.cal-picker-time input[type="time"]:focus {
    border-color: #2d5a27;
    outline: none;
    box-shadow: 0 0 0 2px rgba(45,90,39,0.12);
}

.comments-list {
    max-height: 300px;
    overflow-y: auto;
    padding: 10px 0;
}

.comment-item {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 12px 15px;
    margin-bottom: 10px;
    border-left: 3px solid #2d5a27;
    cursor: pointer;
    transition: all 0.2s ease;
}

.comment-item:hover {
    background: #eef2f5;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.comment-item.editing {
    border-left-color: #f59e0b;
    background: #fffbeb;
}

.comment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 0.75rem;
    color: #6b7280;
}

.comment-author {
    font-weight: 600;
    color: #2d5a27;
}

.comment-date {
    display: flex;
    align-items: center;
    gap: 5px;
}

.comment-date i {
    font-size: 10px;
}

.comment-content {
    font-size: 0.9rem;
    color: #2c3e50;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
}

.comment-edit-info {
    margin-top: 8px;
    font-size: 0.7rem;
    color: #9ca3af;
    font-style: italic;
    display: flex;
    align-items: center;
    gap: 5px;
}

.comment-edit-info i {
    font-size: 10px;
}

.comment-edit-wrapper {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.comment-edit-wrapper textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.9rem;
    resize: none;
    min-height: 60px;
}

.comment-edit-buttons {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.comment-edit-buttons button {
    padding: 6px 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all 0.2s ease;
}

.comment-edit-buttons .btn-save-comment {
    background: linear-gradient(135deg, #2d5a27 0%, #4a9142 100%);
    color: #fff;
    border: none;
}

.comment-edit-buttons .btn-save-comment:hover {
    background: linear-gradient(135deg, #1e3d1a 0%, #2d5a27 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(45, 90, 39, 0.3);
}

.comment-edit-buttons .btn-cancel-comment {
    background: #e5e7eb;
    color: #4b5563;
}

.comment-edit-buttons .btn-cancel-comment:hover {
    background: #d1d5db;
}

.comment-edit-buttons .btn-delete-comment {
    background: #fee2e2;
    color: #dc2626;
}

.comment-edit-buttons .btn-delete-comment:hover {
    background: #fecaca;
}

.comments-empty {
    text-align: center;
    color: #9ca3af;
    padding: 20px;
    font-size: 0.9rem;
}

.comments-empty i {
    font-size: 24px;
    margin-bottom: 10px;
    display: block;
}

/* Checkboxy dla dodatkowych wymagań */
.checkboxes-group {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 8px 0;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    padding: 6px 12px;
    background: #f3f4f6;
    border-radius: 6px;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    user-select: none;
}

.checkbox-label:hover {
    background: #e5e7eb;
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: #22c55e;
}

.checkbox-label input[type="checkbox"]:checked + span,
.checkbox-label:has(input[type="checkbox"]:checked) {
    color: #166534;
    font-weight: 500;
}

.checkbox-label:has(input[type="checkbox"]:checked) {
    background: #dcfce7;
    border: 1px solid #22c55e;
}

/* Relations Section in Modal */
.relations-section {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 12px;
}

.relations-section h3 {
    color: #2c3e50;
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0 0 12px 0;
    padding-bottom: 8px;
    border-bottom: 1px solid #e0e0e0;
}

.relations-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.relation-item {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.relation-item:hover {
    border-color: #22c55e;
    box-shadow: 0 2px 4px rgba(34, 197, 94, 0.1);
}

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

.relation-item-title {
    font-weight: 500;
    color: #2c3e50;
    font-size: 0.85rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

.relation-item-status {
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 6px;
    white-space: nowrap;
}

.status-new {
    background: #dbeafe;
    color: #1e40af;
}

.status-in-progress {
    background: #fef3c7;
    color: #92400e;
}

.status-completed {
    background: #dcfce7;
    color: #166534;
}

.status-cancelled {
    background: #fee2e2;
    color: #991b1b;
}

.relation-item-details {
    font-size: 0.75rem;
    color: #666;
    line-height: 1.3;
}

.relation-item-detail-row {
    display: flex;
    justify-content: space-between;
    margin: 4px 0;
}

.relation-item-detail-label {
    font-weight: 500;
    color: #999;
}

.relation-item-detail-value {
    color: #2c3e50;
}

.relations-empty {
    text-align: center;
    color: #999;
    padding: 20px 8px;
    font-size: 0.85rem;
}

.relations-empty i {
    display: block;
    font-size: 1.5rem;
    margin-bottom: 8px;
}

/* Historia Zmian */
.history-section {
    margin-top: 20px;
    border-top: 1px solid #e8ecef;
    padding-top: 15px;
}

.history-section h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #6b7280;
    font-size: 0.95rem;
    margin-bottom: 15px;
}

.history-section h3 i {
    color: #9ca3af;
}

.history-list {
    max-height: 300px;
    overflow-y: auto;
    padding: 5px 0;
}

.history-loading {
    text-align: center;
    color: #9ca3af;
    padding: 20px;
    font-size: 0.85rem;
}

.history-item {
    display: flex;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid #f3f4f6;
    font-size: 0.85rem;
}

.history-item:last-child {
    border-bottom: none;
}

.history-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.75rem;
}

.history-icon.create {
    background: #d1fae5;
    color: #059669;
}

.history-icon.update {
    background: #dbeafe;
    color: #2563eb;
}

.history-icon.delete {
    background: #fee2e2;
    color: #dc2626;
}

.history-icon.status_change {
    background: #fef3c7;
    color: #d97706;
}

.history-content {
    flex: 1;
    min-width: 0;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 4px;
}

.history-user {
    font-weight: 600;
    color: #374151;
}

.history-date {
    font-size: 0.75rem;
    color: #9ca3af;
    white-space: nowrap;
}

.history-description {
    color: #6b7280;
    line-height: 1.4;
}

.history-field {
    font-weight: 500;
    color: #374151;
}

.history-values {
    margin-top: 4px;
    padding: 6px 10px;
    background: #f9fafb;
    border-radius: 6px;
    font-size: 0.8rem;
}

.history-old-value {
    color: #dc2626;
    text-decoration: line-through;
    margin-right: 8px;
}

.history-new-value {
    color: #059669;
}

.history-arrow {
    color: #9ca3af;
    margin: 0 6px;
}

.history-empty {
    text-align: center;
    color: #9ca3af;
    padding: 30px 15px;
    font-size: 0.85rem;
}

.history-empty i {
    display: block;
    font-size: 2rem;
    margin-bottom: 10px;
    opacity: 0.5;
}
/* ==================== PRZYCISK UMOWA PODPISANA ==================== */
.podpisana-btn {
    border: 2px solid;
    user-select: none;
}

/* ==================== PRZYCISK PLIKI ==================== */
.files-btn {
    border: 2px solid #3b82f6;
    user-select: none;
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    color: #2563eb;
}

.files-btn:hover {
    background: linear-gradient(135deg, #bfdbfe 0%, #93c5fd 100%);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
    transform: translateY(-2px);
}

.files-btn .files-icon {
    font-size: 1rem;
    transition: transform 0.3s ease;
}

.files-btn .files-text {
    font-size: 0.85rem;
}

.podpisana-btn.not-signed {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    border-color: #ef4444;
    color: #dc2626;
}

.podpisana-btn.not-signed:hover {
    background: linear-gradient(135deg, #fecaca 0%, #fca5a5 100%);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
    transform: translateY(-2px);
}

.podpisana-btn.signed {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    border-color: #10b981;
    color: #059669;
}

.podpisana-btn.signed:hover {
    background: linear-gradient(135deg, #a7f3d0 0%, #6ee7b7 100%);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
    transform: translateY(-2px);
}

.podpisana-btn .podpisana-icon {
    font-size: 1rem;
    transition: transform 0.3s ease;
}

.podpisana-btn.signed .podpisana-icon {
    transform: scale(1.1);
}

.podpisana-btn .podpisana-text {
    font-size: 0.85rem;
}

/* ============== PRZYCISKI AWIZO ============== */

/* Footer modalu z przyciskiem awizo po lewej */
.modal-footer-left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.modal-footer-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.modal-footer .btn {
    white-space: nowrap;
    flex-shrink: 0;
}

/* Przycisk Wyślij Awizo - niebieski */
.btn-awizo {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: #fff;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.4);
}

.btn-awizo:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.5);
    transform: translateY(-1px);
}

/* Stan: Awizo ponownie — zielony (modal) */
.btn-awizo.awizo-resend {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    box-shadow: 0 2px 8px rgba(34, 197, 94, 0.4);
}

.btn-awizo.awizo-resend:hover {
    background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.5);
}

/* Stan: Zmiana Awizo — pomarańczowy (modal) */
.btn-awizo.awizo-change {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.4);
}

.btn-awizo.awizo-change:hover {
    background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.5);
}

/* Stan: Zmiana ponownie — fioletowy (modal) */
.btn-awizo.awizo-change-resend {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    box-shadow: 0 2px 8px rgba(139, 92, 246, 0.4);
}

.btn-awizo.awizo-change-resend:hover {
    background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.5);
}




.btn-awizo i {
    font-size: 14px;
}

/* ============== PASEK POSTĘPU TRANSPORTU ============== */

.transport-progress-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px 30px;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-bottom: 1px solid #e2e8f0;
}

.progress-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    min-width: 100px;
}

.progress-step .step-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #e2e8f0;
    color: #94a3b8;
    font-size: 18px;
    transition: all 0.3s ease;
    border: 3px solid #e2e8f0;
}

.progress-step .step-label {
    margin-top: 8px;
    font-size: 11px;
    font-weight: 600;
    color: #94a3b8;
    text-align: center;
    transition: all 0.3s ease;
}

.progress-connector {
    flex: 1;
    height: 4px;
    background: #e2e8f0;
    margin: 0 8px;
    margin-bottom: 26px;
    border-radius: 2px;
    transition: all 0.3s ease;
    min-width: 40px;
    max-width: 80px;
}

/* Etap aktywny (aktualny) */
.progress-step.active .step-icon {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: #fff;
    border-color: #3b82f6;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
    transform: scale(1.1);
}

.progress-step.active .step-label {
    color: #3b82f6;
    font-weight: 700;
}

/* Etap ukończony */
.progress-step.completed .step-icon {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #fff;
    border-color: #10b981;
}

.progress-step.completed .step-label {
    color: #10b981;
}

.progress-connector.completed {
    background: linear-gradient(90deg, #10b981 0%, #10b981 100%);
}

/* Animacja pulsacji dla aktywnego etapu */
@keyframes pulse-step {
    0%, 100% { box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4); }
    50% { box-shadow: 0 4px 20px rgba(59, 130, 246, 0.6); }
}

.progress-step.active .step-icon {
    animation: pulse-step 2s ease-in-out infinite;
}