@media print {
    body { margin: 0; padding: 0; }
    .no-print { display: none !important; }
    .print-page { page-break-inside: avoid; }
}

.ot-container {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.ot-header {
    border-bottom: 3px solid var(--accent-color, #0066CC);
    padding-bottom: 12px;
    margin-bottom: 20px;
}

.ot-section {
    margin-bottom: 24px;
    page-break-inside: avoid;
}

.ot-section-title {
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 1px;
    color: var(--header-color, #003366);
    text-transform: uppercase;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #e2e8f0;
}

.ot-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
    margin-bottom: 12px;
}

.ot-table th {
    background: #f8fafc;
    padding: 8px;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid #cbd5e1;
    color: #334155;
}

.ot-table td {
    padding: 8px;
    border-bottom: 1px solid #e2e8f0;
}

.ot-table tr:last-child td {
    border-bottom: none;
}

.ot-key-value {
    display: flex;
    gap: 20px;
    margin-bottom: 8px;
    font-size: 11px;
}

.ot-key {
    font-weight: 600;
    color: #475569;
    min-width: 150px;
}

.ot-value {
    color: #1e293b;
    flex: 1;
    min-width: 0;
    overflow-wrap: anywhere;
}

/* Mantiene tipo, estado y prioridad dentro de las columnas también al ajustar el documento a A4. */
.ot-summary-grid .ot-key { min-width: 0; flex: 0 0 50%; }
.ot-summary-grid .ot-key-value { min-width: 0; }

.ot-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.ot-photo {
    max-width: 100%;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    margin-bottom: 8px;
}

.ot-signature-line {
    border-top: 1px solid #334155;
    margin-top: 30px;
    padding-top: 5px;
    font-size: 10px;
    text-align: center;
}

.ot-footer {
    font-size: 9px;
    color: #64748b;
    border-top: 1px solid #e2e8f0;
    padding-top: 10px;
    margin-top: 30px;
    text-align: center;
}

/* Preview Modal */
.preview-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.preview-container {
    background: white;
    border-radius: 12px;
    width: 100%;
    max-width: 900px;
    max-height: 90vh;
    overflow: auto;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

.preview-header {
    background: linear-gradient(135deg, #0066CC 0%, #003366 100%);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 12px 12px 0 0;
}

/* La vista del correo comparte el mismo marco y presenta las páginas del PDF original. */
.ot-shared-viewer .preview-container {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.ot-shared-viewer .preview-header { flex-shrink: 0; gap: 16px; }
.ot-shared-viewer .preview-content { flex: 1; min-height: 0; overflow-y: auto; padding: 0; }
.ot-shared-viewer .preview-actions { flex-shrink: 0; }
.ot-pdf-page { width: 100%; overflow: hidden; background: white; }
.ot-pdf-page + .ot-pdf-page { border-top: 1px solid #e2e8f0; }
.ot-pdf-page canvas { display: block; width: 100%; height: 100%; }
@media (max-width: 600px) {
    .ot-shared-viewer { padding: 0; }
    .ot-shared-viewer .preview-container { height: 100dvh; max-height: 100dvh; border-radius: 0; }
    .ot-shared-viewer .preview-header { border-radius: 0; padding: 16px; }
}

.preview-content {
    padding: 30px;
    background: white;
}

@media print {
    .preview-header, .preview-actions { display: none !important; }
    .preview-modal { position: static; display: block; padding: 0; background: white; }
    .preview-container { max-height: none; overflow: visible; box-shadow: none; }
    .preview-content { padding: 0; }
}

/* Loading Spinner */
.spinner {
    border: 4px solid #f3f4f6;
    border-top: 4px solid #0066CC;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

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