* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: #f0f0f0;
    font-family: 'Arial', 'Helvetica', sans-serif;
    /* Standard sans-serif */
    padding: 20px;
}

@media print {
    @page {
        size: A4;
        margin: 5mm;
        /* Small margin safely handled by printer */
    }

    html,
    body {
        width: 100%;
        height: auto;
        /* Let height be natural */
        margin: 0;
        padding: 0;
        background: transparent;
        display: block !important;
        overflow: hidden;
        /* debugging */
    }

    .page-container {
        width: 100%;
        max-width: 100%;
        min-height: 0;
        /* Remove force height */
        height: auto;
        margin: 0 auto;
        padding: 0;
        box-shadow: none;
        border: none;

        /* Scale content to 100% as requested */
        transform: scale(0.96);
        transform-origin: top center;
    }

    /* Show color bar and force print colors */
    .color-bar-bottom {
        display: block !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .top-bar,
    .main-header,
    footer,
    .mobile-menu-btn {
        display: none !important;
    }
}

.page-container {
    background-color: white;
    /* Removed fixed A4 dimensions as requested */
    width: 100%;
    max-width: 210mm;
    /* Keep outline limitation but allow flow */
    min-height: auto;
    /* Remove fixed height */
    margin: 10mm auto;
    /* Center the page with top spacing */
    padding: 10mm 15mm;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    position: relative;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    display: flex;
    justify-content: flex-end;
    /* Logos are usually on top right or distributed */
    align-items: center;
    margin-bottom: 20px;
}

.logo-area {
    width: 100%;
    display: flex;
    justify-content: center;
    /* Center the single image */
    align-items: center;
}

.header-image {
    width: auto;
    /* Allow width to scale */
    max-width: 100%;
    /* Don't overflow */
    height: auto;
    object-fit: contain;
    max-height: 120px;
    /* Reasonable header height */
}

/* Content */
.content {
    flex-grow: 1;
}

.document-title {
    text-align: center;
    font-weight: bold;
    font-size: 14px;
    margin-bottom: 20px;
    text-transform: uppercase;
}

.intent-text {
    font-weight: bold;
    font-size: 14px;
    margin-bottom: 25px;
    text-align: justify;
}

/* Form Sections */
.form-section {
    margin-bottom: 25px;
}

.section-title {
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 2px;
}

.grid-box {
    border: 1px solid #000;
    display: grid;
}

/* Grid Layouts */
.vehicle-grid {
    grid-template-columns: 1fr 1fr;
    /* Two columns */
}

.seller-grid,
.buyer-grid {
    grid-template-columns: 1fr;
    /* Single column */
}

/* Fields */
.field-box {
    border-bottom: 1px solid #000;
    border-right: 1px solid #000;
    padding: 5px;
    display: flex;
    flex-direction: column;
    min-height: 50px;
    position: relative;
}

/* Remove right border for the last item in a row if it's 2 columns */
.vehicle-grid .field-box:nth-child(2n) {
    border-right: none;
}

/* Remove bottom border for the last row items */
.vehicle-grid .field-box:nth-last-child(-n+1) {
    border-bottom: none;
    border-right: none;
}

.vehicle-grid .field-box:nth-child(5) {
    /* Valor Venda */
    grid-column: span 2;
    border-right: none;
    border-bottom: none;
}

/* Reset all borders for grid items */
.grid-box .field-box {
    border: none;
    border-right: 1px solid #000;
    border-bottom: 1px solid #000;
}

/* Right borders adjustments for vehicle grid */
.vehicle-grid .field-box:nth-child(2),
.vehicle-grid .field-box:nth-child(4),
.vehicle-grid .field-box:nth-child(5) {
    border-right: none;
}

/* Bottom borders adjustments */
.vehicle-grid .field-box:nth-child(5) {
    border-bottom: none;
}

/* Seller/Buyer Grids (Single Column) */
.seller-grid .field-box,
.buyer-grid .field-box {
    border-right: none;
}

.seller-grid .field-box:last-child,
.buyer-grid .field-box:last-child {
    border-bottom: none;
}


.field-box label {
    font-size: 12px;
    font-weight: normal;
    margin-bottom: 2px;
}

.field-box input {
    border: none;
    outline: none;
    font-size: 14px;
    width: 100%;
    background: transparent;
    font-family: inherit;
    margin-top: auto;
}

/* Footer Signature */
.footer-sign {
    margin-top: 60px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.signature-line {
    width: 50%;
    border-top: 1px solid #000;
    margin-bottom: 5px;
}

.signature-info {
    text-align: center;
    font-size: 12px;
}

/* Page Footer Info */
.page-footer-info {
    position: absolute;
    bottom: 25px;
    left: 15mm;
    right: 15mm;
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    color: #333;
}

.website-link {
    font-weight: bold;
    color: #0066cc;
}

.color-bar-bottom {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 10px;
    background: linear-gradient(90deg, #005eb8 70%, #009e49 70%);
}

.field-box input:focus {
    background-color: rgba(0, 0, 0, 0.02);
}