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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    max-height: 95vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.header {
    background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%);
    color: white;
    padding: 25px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.header h1 {
    font-size: 24px;
}

.nav-tabs {
    display: flex;
    gap: 10px;
}

.nav-btn {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    color: white;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s;
}

.nav-btn:hover {
    background: rgba(255,255,255,0.2);
}

.nav-btn.active {
    background: white;
    color: #2d3748;
}

.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.login-box {
    background: white;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    max-width: 400px;
    width: 90%;
}

.login-box h2 {
    margin-bottom: 20px;
    color: #2d3748;
}

.logout-btn {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    color: white;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    margin-left: 10px;
    transition: all 0.3s;
}

.logout-btn:hover {
    background: rgba(255,255,255,0.2);
}

.lang-selector {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    margin-right: 10px;
    transition: all 0.3s;
}

.lang-selector:hover {
    background: rgba(255,255,255,0.2);
}

.lang-selector option {
    background: #2d3748;
    color: white;
}

.content {
    padding: 30px;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
}

.view {
    display: none;
}

.view.active {
    display: block;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #2d3748;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
}

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

.btn {
    background: #667eea;
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: background 0.3s;
}

.btn:hover {
    background: #5568d3;
}

.btn-secondary {
    background: #718096;
}

.btn-secondary:hover {
    background: #4a5568;
}

.btn-danger {
    background: #f56565;
}

.btn-danger:hover {
    background: #e53e3e;
}

.btn-success {
    background: #48bb78;
}

.btn-success:hover {
    background: #38a169;
}

.report-card {
    background: #f7fafc;
    border: 2px solid #e2e8f0;
    border-left: 6px solid #e2e8f0;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 15px;
    transition: transform 0.2s, box-shadow 0.2s;
}

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

.report-card.severity-low {
    border-left-color: #48bb78;
    background: #f0fff4;
}

.report-card.severity-medium {
    border-left-color: #ed8936;
    background: #fffaf0;
}

.report-card.severity-high {
    border-left-color: #f56565;
    background: #fff5f5;
}

.report-card.severity-critical {
    border-left-color: #c53030;
    background: #fef2f2;
    border-left-width: 8px;
}

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

.report-id {
    font-weight: 700;
    color: #667eea;
    font-size: 18px;
}

.severity-badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.severity-low { 
    background: #c6f6d5; 
    color: #22543d; 
}

.severity-medium { 
    background: #feebc8; 
    color: #7c2d12; 
}

.severity-high { 
    background: #fed7d7; 
    color: #742a2a; 
}

.severity-critical { 
    background: #feb2b2; 
    color: #63171b; 
}

.status-badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    margin-left: 10px;
}

.status-open { 
    background: #bee3f8; 
    color: #2c5282; 
}

.status-closed { 
    background: #c6f6d5; 
    color: #22543d; 
}

.status-badge.status-expiring {
    background: #ed8936;
    color: white;
}

.status-badge.status-expired {
    background: #f56565;
    color: white;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

.status-badge.status-cancelled {
    background: #718096;
    color: white;
    text-decoration: line-through;
}

.report-info {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 15px;
}

.info-item {
    font-size: 14px;
}

.info-label {
    color: #718096;
    font-weight: 600;
}

.report-description {
    margin: 15px 0;
    padding: 15px;
    background: white;
    border-radius: 6px;
    border-left: 4px solid #667eea;
}

.comments-section {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 2px solid #e2e8f0;
}

.comment {
    background: white;
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 10px;
    border-left: 3px solid #a0aec0;
}

.comment-header {
    font-size: 12px;
    color: #718096;
    margin-bottom: 5px;
}

.comment-text {
    font-size: 14px;
    color: #2d3748;
}

.action-buttons {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.field-config {
    background: #f7fafc;
    border: 2px solid #e2e8f0;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
}

.field-config-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.inline-fields {
    display: flex;
    gap: 10px;
    align-items: end;
}

.inline-fields .form-group {
    flex: 1;
    margin-bottom: 0;
}

.message {
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 20px;
    font-weight: 600;
    animation: slideIn 0.3s ease;
}

.message-success {
    background: #c6f6d5;
    color: #22543d;
}

.message-error {
    background: #fed7d7;
    color: #742a2a;
}

@keyframes slideIn {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Toast notifications - fixed position */
.toast {
    padding: 15px 20px;
    border-radius: 8px;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    min-width: 300px;
    max-width: 500px;
    transform: translateX(120%);
    transition: transform 0.3s ease, opacity 0.3s ease;
    opacity: 0;
}

.toast.show {
    transform: translateX(0);
    opacity: 1;
}

.toast-success {
    background: #48bb78;
    color: white;
}

.toast-error {
    background: #f56565;
    color: white;
}

.toast-warning {
    background: #ed8936;
    color: white;
}

.toast-info {
    background: #4299e1;
    color: white;
}

.filter-section {
    background: #f7fafc;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    border: 1px solid #e2e8f0;
}

.filter-section h3 {
    cursor: pointer;
    user-select: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.filter-section h3::after {
    content: '▼';
    font-size: 14px;
    transition: transform 0.3s;
}

.filter-section.collapsed h3::after {
    transform: rotate(-90deg);
}

.filter-section.collapsed .filter-row {
    display: none;
}

.filter-row {
    display: flex;
    gap: 15px;
    align-items: end;
}

.filter-row .form-group {
    flex: 1;
    margin-bottom: 0;
}

.todo-card {
    background: white;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.todo-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e2e8f0;
}

.todo-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
    margin: 15px 0;
    padding: 15px;
    background: #f7fafc;
    border-radius: 6px;
}

.tab-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 2px solid #e2e8f0;
    flex-shrink: 0;
}

.tab-button {
    position: relative;
    padding: 12px 24px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    color: #718096;
    transition: all 0.2s;
}

.tab-button:hover {
    color: #667eea;
}

.tab-button.active {
    color: #667eea;
    border-bottom-color: #667eea;
}

.tab-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background: #f56565;
    color: white;
    font-size: 11px;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    line-height: 18px;
    text-align: center;
    border-radius: 9px;
    padding: 0 4px;
    animation: pulse 2s infinite;
}

.tab-content {
    display: none;
}

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

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 8px;
    min-width: 400px;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* Document version list styling */
.document-version-item {
    background: white;
    padding: 12px;
    margin: 5px 0;
    border-radius: 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-left: 3px solid #1890ff;
    transition: all 0.2s ease;
}

.document-version-item:hover {
    background: #f0f8ff;
    border-left-width: 5px;
}

/* Performed dates styling */
.performed-date-item {
    background: white;
    padding: 10px;
    margin: 5px 0;
    border-radius: 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-left: 3px solid #52c41a;
}

/* Comment/note styling */
.comment-item {
    background: white;
    padding: 12px;
    margin: 5px 0;
    border-radius: 6px;
    position: relative;
    border-left: 3px solid #ffc107;
}

.comment-item:hover {
    background: #fffef7;
}

/* Days until indicator */
.days-indicator {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: bold;
    font-size: 12px;
}

.days-indicator.overdue {
    background: #fee;
    color: #c00;
}

.days-indicator.urgent {
    background: #fff3cd;
    color: #856404;
}

.days-indicator.ok {
    background: #d4edda;
    color: #155724;
}

/* Nextcloud config section */
.nextcloud-config-section {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.nextcloud-config-section input,
.nextcloud-config-section select {
    background: rgba(255, 255, 255, 0.9);
}

/* Agreement detail view */
.agreement-detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.agreement-detail-card {
    background: #f7fafc;
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.agreement-detail-card h4 {
    margin-top: 0;
    color: #2d3748;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.agreement-detail-card .value {
    font-size: 18px;
    font-weight: 600;
    color: #1a202c;
    margin-top: 5px;
}

/* Upload zone styling */
.upload-zone {
    border: 2px dashed #cbd5e0;
    border-radius: 8px;
    padding: 30px;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
}

.upload-zone:hover {
    border-color: #667eea;
    background: #f7fafc;
}

.upload-zone.dragging {
    border-color: #667eea;
    background: #edf2f7;
}

/* Loading spinner for async operations */
.loading-spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    animation: spin 1s linear infinite;
    display: inline-block;
    margin: 0 10px;
}

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

/* Scrollbar styling for lists */
.agreement-list::-webkit-scrollbar,
.content::-webkit-scrollbar {
    width: 8px;
}

.agreement-list::-webkit-scrollbar-track,
.content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.agreement-list::-webkit-scrollbar-thumb,
.content::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 10px;
}

.agreement-list::-webkit-scrollbar-thumb:hover,
.content::-webkit-scrollbar-thumb:hover {
    background: #a0aec0;
}

/* Quick action buttons */
.quick-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 15px;
}

.quick-actions .btn {
    flex: 1;
    min-width: 120px;
}

/* Icon badges */
.icon-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: #edf2f7;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 13px;
    color: #2d3748;
}

/* Urgent indicator */
.urgent-indicator {
    animation: blink 1.5s infinite;
}

@keyframes blink {
    0%, 50%, 100% {
        opacity: 1;
    }
    25%, 75% {
        opacity: 0.5;
    }
}

/* Section headers in detail view */
.section-header {
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 10px 15px;
    border-radius: 6px;
    margin: 20px 0 15px 0;
    font-weight: 600;
}

/* Empty state styling */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #a0aec0;
}

.empty-state-icon {
    font-size: 64px;
    margin-bottom: 20px;
    opacity: 0.5;
}

.empty-state-text {
    font-size: 18px;
    margin-bottom: 20px;
}

/* Info cards */
.info-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.info-card h3 {
    margin-top: 0;
}

/* Tags for agreement types */
.type-tag {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.type-tag.annual {
    background: #d4edda;
    color: #155724;
}

.type-tag.quarterly {
    background: #cce5ff;
    color: #004085;
}

.type-tag.monthly {
    background: #fff3cd;
    color: #856404;
}

.type-tag.one-time {
    background: #f8d7da;
    color: #721c24;
}

.type-tag.as-needed {
    background: #e2e3e5;
    color: #383d41;
}

/* Responsive Design */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    .container {
        max-height: 98vh;
    }

    .header {
        flex-direction: column;
        gap: 15px;
        padding: 20px;
        align-items: flex-start;
    }

    .header h1 {
        width: 100%;
        text-align: center;
    }

    .header > div {
        width: 100%;
        flex-wrap: wrap;
        justify-content: center;
    }

    .nav-tabs {
        width: 100%;
        flex-direction: column;
    }

    .nav-btn {
        width: 100%;
    }

    #header-auth-buttons {
        flex-wrap: wrap !important;
        justify-content: center !important;
    }

    #header-auth-buttons .btn {
        flex: 1 1 auto;
        min-width: fit-content;
        white-space: nowrap;
    }

    #auth-status {
        width: 100%;
        text-align: center;
        margin-top: 5px;
    }
    
    .content {
        padding: 20px;
    }
    
    .tab-buttons {
        flex-wrap: wrap;
    }
    
    .tab-button {
        flex: 1 1 auto;
        min-width: 120px;
    }
    
    .report-info {
        grid-template-columns: 1fr;
    }
    
    .report-header {
        flex-direction: column;
        align-items: flex-start !important;
    }
    
    .report-header > div:last-child {
        margin-top: 10px;
        width: 100%;
    }
    
    .status-badge {
        display: block;
        text-align: center;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .filter-section {
        padding: 12px;
        margin-bottom: 15px;
    }

    .filter-section h3 {
        margin-bottom: 10px;
        font-size: 16px;
    }

    .filter-section.mobile-collapsed .filter-row {
        display: none;
    }

    .filter-row {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .filter-row .form-group {
        margin-bottom: 0;
    }

    .filter-row button {
        grid-column: 1 / -1;
    }

    .filter-row .form-group label {
        margin-bottom: 4px;
        font-size: 13px;
    }

    .filter-row .form-group input,
    .filter-row .form-group select,
    .filter-row .form-group textarea {
        padding: 8px;
        font-size: 14px;
    }

    
    .agreement-detail-grid {
        grid-template-columns: 1fr;
    }
    
    .quick-actions .btn {
        flex: 1 1 100%;
    }
    
    .modal-content {
        min-width: auto;
        width: 90%;
        max-height: 80vh;
    }
}

@media (max-width: 640px) {
    .header h1 {
        font-size: 18px;
    }

    .header {
        padding: 15px;
    }

    .btn, .btn-secondary {
        padding: 10px 16px;
        font-size: 13px;
    }

    #header-auth-buttons {
        gap: 8px !important;
    }

    #header-auth-buttons span {
        width: 100%;
        text-align: center;
        font-size: 14px;
    }

    .tab-button {
        padding: 10px 16px;
        font-size: 14px;
    }

    .filter-section {
        padding: 10px;
        margin-bottom: 12px;
    }

    .filter-section h3 {
        font-size: 15px;
        margin-bottom: 8px;
    }

    .filter-row {
        gap: 6px;
        grid-template-columns: 1fr 1fr;
    }

    .filter-row .form-group {
        margin-bottom: 0;
    }

    .filter-row .form-group label {
        margin-bottom: 3px;
        font-size: 12px;
    }

    .filter-row .form-group input,
    .filter-row .form-group select {
        padding: 7px;
        font-size: 13px;
    }
}

/* Print styles */
@media print {
    body {
        background: white;
        padding: 0;
		}
    
    .container {
        box-shadow: none;
        max-height: none;
    }
    
    .btn, .filter-section, .nextcloud-config, .tab-buttons, .logout-btn, .lang-selector {
        display: none !important;
    }
    
    .report-card {
        page-break-inside: avoid;
        border: 2px solid #000;
        margin-bottom: 20px;
    }
    
    .status-badge {
        border: 1px solid #000;
    }
    
    .content {
        overflow: visible;
        max-height: none;
    }
}