:root {
    --suno-dark: #020617;
    --suno-blue: #042a66;
    --suno-accent: #0ea5e9;
}

body { font-family: 'Inter', sans-serif; }
.termo-font { font-family: 'Roboto', sans-serif !important; }

/* ========= Preview do Contrato na Tela ========= */
.page-a4 {
    width: 210mm;
    min-height: 297mm;
    background: white;
    padding: 15mm;
    margin: 0 auto;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    position: relative;
    font-size: 11px;
    color: #334155;
    line-height: 1.5;
    transform: scale(0.9);
    transform-origin: top center;
    transition: all 0.3s ease;
}

.page-a4::before {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 6px;
    background: linear-gradient(90deg, #042a66 0%, #0056b3 100%);
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 15px;
    margin-bottom: 25px;
}

.contract-h2 {
    font-size: 11px;
    color: #042a66;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 4px;
    margin: 18px 0 10px 0;
    text-transform: uppercase;
    font-weight: 700;
}

.contract-table { width: 100%; border-collapse: collapse; margin-bottom: 12px; table-layout: auto; }
.contract-table th, .contract-table td { border: 1px solid #e2e8f0; padding: 6px 10px; vertical-align: middle; word-wrap: break-word; }
.contract-table th { background-color: #f8fafc; color: #042a66; font-weight: 600; text-align: left; width: 22%; }

.sig-line {
    border-top: 1px solid #475569;
    width: 90%;
    margin: 0 auto 8px auto;
}

/* ========= Sidebar Mecânica ========= */
#sidebar { 
    transition: margin-left 0.4s cubic-bezier(0.4, 0, 0.2, 1); 
    width: 400px;
    flex-shrink: 0;
    z-index: 40;
}

.sidebar-collapsed { 
    margin-left: -400px; 
}

.toggle-btn {
    position: absolute;
    right: -44px;
    top: 20px;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--suno-dark);
    color: white;
    border-radius: 0 8px 8px 0;
    cursor: pointer;
    box-shadow: 4px 0 10px rgba(0,0,0,0.1);
    border: 1px solid #1e293b;
    border-left: none;
}

.form-input { background: #1e293b; border: 1px solid #334155; color: white; padding: 8px 12px; border-radius: 6px; width: 100%; font-size: 13px; transition: all 0.2s; }
.form-input:focus { border-color: var(--suno-accent); outline: none; box-shadow: 0 0 0 2px rgba(14, 165, 233, 0.2); }
.form-label { display: block; font-size: 11px; color: #94a3b8; margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.5px; }
.loader { border: 2px solid #f3f3f3; border-top: 2px solid var(--suno-accent); border-radius: 50%; width: 16px; height: 16px; animation: spin 1s linear infinite; display: none; }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* ========= ESTILOS ABSOLUTOS DE IMPRESSÃO ========= */
@media print {
    @page { 
        size: A4; 
        margin: 10mm; /* Diminuído para 10mm para dar o respiro na máquina sem encolher demais */
    }
    
    body {
        visibility: hidden !important;
        background: white !important;
        overflow: visible !important;
    }

    .main-wrapper, main {
        display: block !important;
        height: auto !important;
        overflow: visible !important;
    }

    #preview {
        visibility: visible !important;
        position: relative !important; 
        left: 0 !important;
        top: 0 !important;
        width: 100% !important;
        margin: 0 !important;
        
        /* Devolve o padding do documento na impressão (15mm em todos os lados) */
        padding: 15mm !important; 
        
        box-shadow: none !important;
        transform: none !important;
    }

    #preview * {
        visibility: visible !important;
    }

    .no-print { 
        display: none !important; 
    }

    /* Evita cortes secos no meio das cláusulas e das assinaturas */
    .contract-section { page-break-inside: avoid; }
    .signature-block { page-break-inside: avoid; }
    
    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
}