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

body {
    font-family: 'Raleway', sans-serif;
    font-weight: 400;
    background: #f5f5f5;
    padding: 20px;
    line-height: 1.6;
}

/* ==================== LOGIN OVERLAY ==================== */
.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #175aa7 0%, #0d3a6e 100%);
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.login-overlay.hidden {
    display: none;
}

.login-modal {
    background: white;
    padding: 50px 40px;
    border-radius: 20px;
    box-shadow: 0 30px 60px rgba(0,0,0,0.3);
    max-width: 420px;
    width: 100%;
    text-align: center;
    animation: loginSlideIn 0.5s ease;
}

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

.login-logo { margin-bottom: 30px; }
.login-logo img { max-width: 200px; height: auto; }

.login-title {
    font-family: 'Raleway', sans-serif;
    font-size: 28px;
    font-weight: 600;
    color: #333;
    margin-bottom: 10px;
}

.login-subtitle {
    font-family: 'Raleway', sans-serif;
    font-size: 14px;
    color: #666;
    margin-bottom: 30px;
}

.login-form { text-align: left; }
.login-input-group { margin-bottom: 20px; }

.login-input-group label {
    display: block;
    font-family: 'Raleway', sans-serif;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
}

.password-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-wrapper input {
    width: 100%;
    padding: 15px 50px 15px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-family: 'Raleway', sans-serif;
    font-size: 16px;
    transition: all 0.3s;
}

.password-wrapper input:focus {
    outline: none;
    border-color: #175aa7;
    box-shadow: 0 0 15px rgba(23, 90, 167, 0.2);
}

.toggle-password {
    position: absolute;
    right: 15px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    padding: 5px;
    opacity: 0.6;
    transition: opacity 0.3s;
}

.toggle-password:hover { opacity: 1; }
.eye-icon { font-size: 20px; }

.login-error {
    color: #e74c3c;
    font-size: 13px;
    margin-bottom: 15px;
    min-height: 20px;
    text-align: center;
}

.login-btn {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, #175aa7 0%, #0d3a6e 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-family: 'Raleway', sans-serif;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.login-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(23, 90, 167, 0.4);
}

.login-footer {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.login-footer p { font-size: 11px; color: #999; }

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.shake { animation: shake 0.5s ease; }

/* ==================== PROGRESS OVERLAY ==================== */
.progress-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 9999;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(5px);
}

.progress-overlay.active { display: flex; }

.progress-modal {
    background: white;
    padding: 40px 50px;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    max-width: 400px;
    width: 90%;
    animation: slideIn 0.3s ease;
}

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

.progress-icon-wrapper { margin-bottom: 20px; }

.progress-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #e0e0e0;
    border-top: 4px solid #175aa7;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

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

.progress-title {
    font-family: 'Raleway', sans-serif;
    font-size: 20px;
    font-weight: 600;
    color: #333;
    margin-bottom: 25px;
}

.progress-bar-container {
    width: 100%;
    height: 12px;
    background: #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 15px;
}

.progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(135deg, #175aa7 0%, #0d3a6e 100%);
    border-radius: 10px;
    transition: width 0.3s ease;
}

.progress-percent {
    font-family: 'Raleway', sans-serif;
    font-size: 28px;
    font-weight: 700;
    color: #175aa7;
    margin-bottom: 10px;
}

.progress-status {
    font-family: 'Raleway', sans-serif;
    font-size: 14px;
    color: #666;
    min-height: 20px;
}

/* ==================== ARCHIVIO PANEL ==================== */
.archivio-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 8000;
}

.archivio-overlay.active { display: block; }

.archivio-panel {
    position: fixed;
    top: 0;
    left: -400px;
    width: 400px;
    height: 100%;
    background: white;
    box-shadow: 5px 0 30px rgba(0,0,0,0.2);
    z-index: 9000;
    transition: left 0.3s ease;
    display: flex;
    flex-direction: column;
}

.archivio-panel.active { left: 0; }

.archivio-header {
    background: linear-gradient(135deg, #175aa7 0%, #0d3a6e 100%);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.archivio-header h3 {
    font-family: 'Raleway', sans-serif;
    font-size: 18px;
    font-weight: 600;
    margin: 0;
}

.archivio-close {
    background: none;
    border: none;
    color: white;
    font-size: 28px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.archivio-search {
    padding: 15px;
    border-bottom: 1px solid #eee;
}

.archivio-search input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-family: 'Raleway', sans-serif;
    font-size: 14px;
}

.archivio-search input:focus {
    outline: none;
    border-color: #175aa7;
}

.archivio-actions {
    padding: 15px;
    display: flex;
    gap: 10px;
    border-bottom: 1px solid #eee;
}

.archivio-btn {
    flex: 1;
    padding: 10px;
    background: #175aa7;
    color: white;
    border: none;
    border-radius: 6px;
    font-family: 'Raleway', sans-serif;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    text-align: center;
    transition: all 0.3s;
}

.archivio-btn:hover { background: #0d3a6e; }

.archivio-btn-import {
    background: #28a745;
    display: flex;
    align-items: center;
    justify-content: center;
}

.archivio-btn-import:hover { background: #218838; }

.archivio-stats {
    padding: 10px 15px;
    background: #f8f9fa;
    font-size: 12px;
    color: #666;
    border-bottom: 1px solid #eee;
}

.archivio-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.archivio-item {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 10px;
    border-left: 4px solid #175aa7;
    cursor: pointer;
    transition: all 0.3s;
}

.archivio-item:hover {
    background: #e9ecef;
    transform: translateX(5px);
}

.archivio-item.active {
    border-left-color: #28a745;
    background: #e8f5e9;
}

.archivio-item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
    flex-wrap: wrap;
    gap: 5px;
}

.archivio-item-code {
    font-family: 'Courier New', monospace;
    font-size: 11px;
    color: #175aa7;
    background: #e3f2fd;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 600;
}

.archivio-item-version {
    font-size: 10px;
    background: linear-gradient(135deg, #ffc107 0%, #ff9800 100%);
    color: #333;
    padding: 3px 8px;
    border-radius: 4px;
    font-weight: 600;
}

.archivio-item-date {
    font-size: 11px;
    color: #999;
}

.archivio-item-title {
    font-family: 'Raleway', sans-serif;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
}

.archivio-item-subtitle {
    font-size: 12px;
    color: #666;
}

.archivio-item-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #ddd;
}

.archivio-item-btn {
    flex: 1;
    padding: 6px 10px;
    border: none;
    border-radius: 4px;
    font-family: 'Raleway', sans-serif;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s;
}

.archivio-item-btn.load { background: #175aa7; color: white; }
.archivio-item-btn.load:hover { background: #0d3a6e; }
.archivio-item-btn.history { background: #6c757d; color: white; }
.archivio-item-btn.history:hover { background: #5a6268; }
.archivio-item-btn.duplicate { background: #ffc107; color: #333; }
.archivio-item-btn.duplicate:hover { background: #e0a800; }
.archivio-item-btn.delete { background: #dc3545; color: white; }
.archivio-item-btn.delete:hover { background: #c82333; }

.archivio-empty {
    text-align: center;
    padding: 40px 20px;
    color: #999;
}

.archivio-empty-icon {
    font-size: 48px;
    margin-bottom: 15px;
    opacity: 0.5;
}

/* ==================== DASHBOARD PANEL ==================== */
.dashboard-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 8000;
}

.dashboard-overlay.active { display: block; }

.dashboard-panel {
    position: fixed;
    top: 0;
    right: -520px;
    width: 500px;
    height: 100%;
    background: white;
    box-shadow: -5px 0 30px rgba(0,0,0,0.2);
    z-index: 9000;
    transition: right 0.3s ease;
    display: flex;
    flex-direction: column;
}

.dashboard-panel.active { right: 0; }

.dashboard-header {
    background: linear-gradient(135deg, #175aa7 0%, #0d3a6e 100%);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.dashboard-header h3 {
    font-family: 'Raleway', sans-serif;
    font-size: 18px;
    font-weight: 600;
    margin: 0;
}

.dashboard-close {
    background: none;
    border: none;
    color: white;
    font-size: 28px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.dashboard-content {
    flex: 1;
    overflow-y: auto;
    padding-bottom: 20px;
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    padding: 20px;
}

.kpi-card {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    border-left: 4px solid #175aa7;
    transition: transform 0.2s, box-shadow 0.2s;
}

.kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.kpi-card.highlight {
    border-left-color: #28a745;
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
}

.kpi-value {
    font-size: 36px;
    font-weight: 700;
    color: #175aa7;
    font-family: 'Raleway', sans-serif;
}

.kpi-card.highlight .kpi-value { color: #28a745; }

.kpi-label {
    font-size: 12px;
    color: #666;
    margin-top: 5px;
    text-transform: uppercase;
    font-family: 'Raleway', sans-serif;
    font-weight: 500;
}

.chart-section {
    padding: 20px;
    border-top: 1px solid #eee;
}

.chart-section h4 {
    font-family: 'Raleway', sans-serif;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 15px;
    color: #333;
}

.chart-container {
    height: 200px;
    position: relative;
}

.chart-container.chart-small { height: 180px; }

.top-comuni-section {
    padding: 20px;
    border-top: 1px solid #eee;
}

.top-comuni-section h4 {
    font-family: 'Raleway', sans-serif;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 15px;
    color: #333;
}

.top-comune-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 8px;
    transition: background 0.2s;
}

.top-comune-item:hover { background: #e9ecef; }

.comune-name {
    font-family: 'Raleway', sans-serif;
    font-weight: 500;
    color: #333;
}

.comune-count {
    background: linear-gradient(135deg, #175aa7 0%, #0d3a6e 100%);
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.attivita-section {
    padding: 20px;
    border-top: 1px solid #eee;
}

.attivita-section h4 {
    font-family: 'Raleway', sans-serif;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 15px;
    color: #333;
}

.attivita-item {
    display: grid;
    grid-template-columns: auto 1fr auto auto;
    gap: 10px;
    align-items: center;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 8px;
    font-size: 12px;
}

.attivita-codice {
    font-family: 'Courier New', monospace;
    background: #175aa7;
    color: white;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
}

.attivita-info {
    font-family: 'Raleway', sans-serif;
    color: #555;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.attivita-versione {
    background: #ffc107;
    color: #333;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 10px;
}

.attivita-data {
    color: #999;
    font-size: 11px;
}

.dashboard-empty {
    text-align: center;
    padding: 30px 20px;
    color: #999;
}

/* ==================== OCR MODAL ==================== */
.ocr-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    animation: fadeIn 0.2s ease;
}

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

.ocr-modal {
    background: white;
    border-radius: 16px;
    padding: 30px;
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from { transform: translateY(30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.ocr-modal h3 {
    font-family: 'Raleway', sans-serif;
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 5px;
    color: #333;
}

.ocr-subtitle {
    color: #666;
    font-size: 14px;
    margin-bottom: 25px;
    font-family: 'Raleway', sans-serif;
}

.ocr-fields {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ocr-field {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ocr-field label {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 180px;
    font-size: 14px;
    font-family: 'Raleway', sans-serif;
}

.ocr-field input[type="text"] {
    flex: 1;
    padding: 10px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    font-family: 'Raleway', sans-serif;
    transition: border-color 0.2s;
}

.ocr-field input[type="text"]:focus {
    outline: none;
    border-color: #175aa7;
}

.ocr-field input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: #175aa7;
}

.ocr-raw {
    margin-top: 25px;
    padding: 15px;
    background: #f5f5f5;
    border-radius: 8px;
}

.ocr-raw summary {
    cursor: pointer;
    font-weight: 500;
    font-family: 'Raleway', sans-serif;
    color: #666;
}

.ocr-raw pre {
    margin-top: 15px;
    font-size: 11px;
    white-space: pre-wrap;
    max-height: 200px;
    overflow-y: auto;
    background: white;
    padding: 15px;
    border-radius: 6px;
    border: 1px solid #ddd;
}

.ocr-actions {
    display: flex;
    gap: 15px;
    margin-top: 25px;
    justify-content: flex-end;
}

.btn-ocr-cancel {
    padding: 12px 25px;
    background: #e0e0e0;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    font-family: 'Raleway', sans-serif;
    font-size: 14px;
    transition: background 0.2s;
}

.btn-ocr-cancel:hover { background: #d0d0d0; }

.btn-ocr-import {
    padding: 12px 25px;
    background: linear-gradient(135deg, #28a745 0%, #1e7e34 100%);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-family: 'Raleway', sans-serif;
    font-size: 14px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-ocr-import:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(40, 167, 69, 0.3);
}

/* ==================== STORIA VERSIONI MODAL ==================== */
.storia-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.storia-modal {
    background: white;
    border-radius: 16px;
    padding: 25px;
    max-width: 500px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
}

.storia-modal h3 {
    font-family: 'Raleway', sans-serif;
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 20px;
    color: #333;
    padding-bottom: 15px;
    border-bottom: 2px solid #175aa7;
}

.storia-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.storia-item {
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
    border-left: 4px solid #175aa7;
    font-family: 'Raleway', sans-serif;
}

.storia-item strong {
    color: #175aa7;
    font-size: 14px;
}

.storia-item small {
    color: #999;
    display: block;
    margin-top: 5px;
}

.storia-empty {
    text-align: center;
    padding: 30px;
    color: #999;
}

.storia-modal button {
    margin-top: 20px;
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #175aa7 0%, #0d3a6e 100%);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-family: 'Raleway', sans-serif;
    font-size: 15px;
    transition: transform 0.2s;
}

.storia-modal button:hover { transform: translateY(-2px); }

/* ==================== CURRENT CERTIFICATE BAR ==================== */
.current-certificate-bar {
    background: linear-gradient(135deg, #28a745 0%, #1e7e34 100%);
    color: white;
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.current-certificate-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.current-certificate-code {
    font-family: 'Courier New', monospace;
    font-size: 12px;
    background: rgba(255,255,255,0.2);
    padding: 4px 10px;
    border-radius: 4px;
    font-weight: 600;
}

.current-certificate-name {
    font-size: 14px;
    font-weight: 500;
}

.current-certificate-actions {
    display: flex;
    gap: 8px;
}

.btn-small {
    padding: 6px 12px;
    border: none;
    border-radius: 4px;
    font-family: 'Raleway', sans-serif;
    font-size: 12px;
    cursor: pointer;
    background: white;
    color: #333;
    transition: all 0.2s;
}

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

/* ==================== CONTAINER ==================== */
.container {
    max-width: 900px;
    margin: 0 auto;
    background: white;
    box-shadow: 0 0 20px rgba(0,0,0,0.1);
}

/* ==================== ACTION BAR ==================== */
.action-bar {
    background: linear-gradient(135deg, #175aa7 0%, #0d3a6e 100%);
    padding: 15px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

.btn-action {
    padding: 10px 20px;
    background: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-family: 'Raleway', sans-serif;
    font-weight: 500;
    font-size: 14px;
    transition: all 0.3s;
}

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

.btn-action.btn-dashboard {
    background: linear-gradient(135deg, #17a2b8 0%, #138496 100%);
    color: white;
}

.btn-action.btn-dashboard:hover {
    background: linear-gradient(135deg, #138496 0%, #117a8b 100%);
}

.btn-action.btn-ocr {
    background: linear-gradient(135deg, #6f42c1 0%, #5a32a3 100%);
    color: white;
}

.btn-action.btn-ocr:hover {
    background: linear-gradient(135deg, #5a32a3 0%, #4a2785 100%);
}

.btn-action.btn-save {
    background: linear-gradient(135deg, #28a745 0%, #1e7e34 100%);
    color: white;
}

.btn-action.btn-save:hover {
    background: linear-gradient(135deg, #1e7e34 0%, #155724 100%);
}

.btn-logout { background: #e74c3c; color: white; }
.btn-logout:hover { background: #c0392b; }

/* ==================== LOGO ==================== */
.logo-container { text-align: center; padding: 30px 20px 10px; }
.logo-placeholder { display: inline-block; }
.logo-placeholder img { max-width: 200px; height: auto; }

/* ==================== HEADER ==================== */
.header { text-align: center; padding: 20px 40px; }

.header h1 {
    font-family: 'Raleway', sans-serif;
    font-size: 24px;
    color: #000;
    font-weight: 600;
    margin-bottom: 10px;
    letter-spacing: 1px;
}

.subtitle {
    color: #666;
    font-size: 14px;
    font-style: italic;
}

/* ==================== LEGAL TEXT ==================== */
.legal-text {
    padding: 20px 40px;
    font-size: 11px;
    color: #555;
    line-height: 1.6;
    text-align: justify;
}

.legal-text p { margin-bottom: 8px; }

/* ==================== PASSPORT CARD ==================== */
.passport-card {
    margin: 30px 40px;
    background: linear-gradient(135deg, #a8b8d8 0%, #8a9bb5 100%);
    border-radius: 20px;
    padding: 30px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.passport-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

.passport-background img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.5;
}

.passport-title {
    font-family: 'Raleway', sans-serif;
    font-size: 28px;
    font-weight: 600;
    color: #000;
    margin-bottom: 25px;
    position: relative;
    z-index: 1;
}

.passport-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    position: relative;
    z-index: 1;
}

.passport-column {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.passport-section h3 {
    font-family: 'Raleway', sans-serif;
    font-size: 12px;
    font-weight: 600;
    color: #000;
    margin-bottom: 10px;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.field-group { margin-bottom: 8px; }

.field-group label {
    display: block;
    font-family: 'Raleway', sans-serif;
    font-size: 12px;
    font-weight: 500;
    color: #000;
    margin-bottom: 3px;
}

.field-group input {
    width: 100%;
    padding: 8px 10px;
    border: 2px solid rgba(255,255,255,0.5);
    border-radius: 5px;
    font-family: 'Raleway', sans-serif;
    font-size: 13px;
    background: rgba(255,255,255,0.9);
    transition: all 0.3s;
}

.field-group input:focus {
    outline: none;
    border-color: #175aa7;
    background: white;
    box-shadow: 0 0 10px rgba(23, 90, 167, 0.3);
}

.passport-footer {
    margin-top: 20px;
    text-align: center;
    position: relative;
    z-index: 1;
}

.passport-footer p {
    font-family: 'Raleway', sans-serif;
    font-size: 10px;
    color: #333;
    font-style: italic;
}

/* ==================== DUE DILIGENCE SECTION ==================== */
.due-diligence-section { padding: 30px 40px; }

.section-title {
    font-family: 'Raleway', sans-serif;
    font-size: 22px;
    font-weight: 600;
    color: #000;
    margin-bottom: 25px;
}

.analysis-table { margin-bottom: 20px; }

.table-header {
    background: #8B7355;
    color: white;
    padding: 12px 20px;
    font-family: 'Raleway', sans-serif;
    font-weight: 600;
    font-size: 13px;
    letter-spacing: 1px;
}

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

thead th {
    background: #f0f0f0;
    padding: 10px 12px;
    text-align: left;
    font-family: 'Raleway', sans-serif;
    font-size: 11px;
    font-weight: 600;
    color: #333;
    border: 1px solid #ddd;
    text-transform: uppercase;
}

tbody td {
    padding: 12px;
    background: #e8e8e8;
    border: 1px solid #ddd;
    font-family: 'Raleway', sans-serif;
    font-size: 12px;
    vertical-align: middle;
}

tbody tr:nth-child(odd) td { background: #d8d8d8; }
tbody td:first-child { font-weight: 500; color: #000; }
.checkbox-cell { text-align: center; }

tbody input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: #175aa7;
}

tbody input[type="text"] {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid #ccc;
    border-radius: 3px;
    font-family: 'Raleway', sans-serif;
    font-size: 11px;
    background: white;
}

tbody input[type="text"]:focus {
    outline: none;
    border-color: #175aa7;
}

/* ==================== DATE COMPILATION ==================== */
.date-compilation-container {
    display: flex;
    justify-content: flex-end;
    margin-top: 30px;
}

.date-compilation-box {
    background: linear-gradient(135deg, #175aa7 0%, #0d3a6e 100%);
    padding: 15px 25px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 5px 15px rgba(23, 90, 167, 0.3);
}

.date-compilation-box label {
    font-family: 'Raleway', sans-serif;
    font-size: 14px;
    font-weight: 600;
    color: white;
}

.date-compilation-box input[type="date"] {
    padding: 10px 15px;
    border: none;
    border-radius: 5px;
    font-family: 'Raleway', sans-serif;
    font-size: 14px;
    font-weight: 500;
    background: white;
    cursor: pointer;
    min-width: 180px;
}

/* ==================== GENERATE BUTTON ==================== */
.btn-generate {
    width: calc(100% - 80px);
    margin: 30px 40px;
    padding: 18px;
    background: linear-gradient(135deg, #175aa7 0%, #0d3a6e 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-family: 'Raleway', sans-serif;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-generate:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(23, 90, 167, 0.4);
}

.btn-generate:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 768px) {
    .passport-grid { grid-template-columns: 1fr; }
    body { padding: 10px; }
    .header h1 { font-size: 18px; }
    .legal-text, .due-diligence-section { padding: 15px 20px; }
    .passport-card { margin: 20px; padding: 20px; }
    .btn-generate { width: calc(100% - 40px); margin: 20px; }
    .archivio-panel { width: 100%; left: -100%; }
    .dashboard-panel { width: 100%; right: -100%; }
    .current-certificate-bar { flex-direction: column; text-align: center; }
    .date-compilation-container { justify-content: center; }
    .date-compilation-box { flex-direction: column; text-align: center; }
    .kpi-grid { grid-template-columns: 1fr 1fr; gap: 10px; padding: 15px; }
    .kpi-card { padding: 15px; }
    .kpi-value { font-size: 28px; }
    .ocr-field { flex-direction: column; align-items: flex-start; }
    .ocr-field label { min-width: auto; }
    .ocr-field input[type="text"] { width: 100%; }
    .attivita-item { grid-template-columns: 1fr; gap: 5px; }
    .ocr-actions { flex-direction: column; }
    .btn-ocr-cancel, .btn-ocr-import { width: 100%; }
}

@media print {
    .action-bar, .btn-generate, .progress-overlay, .login-overlay, 
    .archivio-panel, .archivio-overlay, .current-certificate-bar,
    .dashboard-panel, .dashboard-overlay { display: none !important; }
    body { padding: 0; background: white; }
    .container { box-shadow: none; }
}
