/* Base Reset */
* {
    box-sizing: border-box;
}

body {
    background-color: #555;
    margin: 0;
    padding: 20px;
    font-family: Arial, sans-serif;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
}

/* Page Container (A4) */
.page-container {
    background-color: white;
    width: 210mm;
    /* Fixed A4 height logic or min-height */
    min-height: 297mm;
    padding: 10mm 10mm;
    /* Standard margins */
    margin: 0 auto;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
    position: relative;
}

/* Standardized spacer tweaks for filling A4 */

/* Header Section */
/* Header Section */
.header-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2mm;
    gap: 10px;
    /* Ensure minimum gap */
}

/* RESTORED STYLES */
.logo-container img {
    height: 90px;
    width: auto;
}

/* General Section Styles */
.section {
    border: 1px solid black;
    margin-bottom: 3mm;
    page-break-inside: avoid;
    border-radius: 10px;
    overflow: hidden;
}

.header-box {
    border: 1px solid black;
}

.text-area-large {
    height: 70px;
    /* Reduced to fit page */
    padding: 5px;
}

/* ... */

.text-area-medium {
    height: 40px;
    /* Reduced */
}

/* ... */

.split-grid {
    display: flex;
    min-height: 130px;
    /* Slight increase to perfectly match calculated Applicant height */
}

/* ... */

/* Remarks in Split Grid (IT / Approvals) */
.remarks-row {
    display: flex;
    min-height: 80px;
    /* Increased to allow more text input */
    height: auto;
    flex: 1;
    /* Grow to fill the section height */
    border-top: none !important;
    /* Strict removal of top border */
}

.remarks-row .sub-label {
    min-width: 35mm;
    max-width: 35mm;
    border-right: 1px solid black;
    border-bottom: none !important;
    /* Strict removal of bottom border */
    border-top: none !important;
    /* Strict removal */
    align-items: flex-start;
    padding-top: 6px;
}

.remarks-row .sub-input {
    flex: 1;
    background-color: #dbeaff;
    border-bottom: none !important;
    /* Strict removal of bottom border */
    border-top: none !important;
    /* Strict removal */
}

.remarks-row textarea,
.remarks-row input {
    width: 100%;
    height: 100%;
    border: none;
    background: transparent;
    resize: none;
    padding: 4px;
    font-family: inherit;
    font-size: inherit;
}

.company-list label {
    display: flex;
    /* Better alignment */
    align-items: center;
    font-size: 8pt;
    /* Slightly smaller to accommodate 5 items */
    margin-bottom: 3px;
    cursor: pointer;
    font-weight: bold;
    color: #333;
    line-height: 1.1;
}

.company-list input[type="checkbox"] {
    margin-right: 5px;
    width: 12px;
    height: 12px;
}

.form-title-box {
    border: 2px solid black;
    border-radius: 12px;
    /* Rounded corners as per reference */
    padding: 5px 10px;
    text-align: center;
    width: 240px;
    height: auto;
    /* Allow auto height */
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 0;
    /* Remove top margin for perfect alignment */
    overflow: hidden;
}

.form-title-box h1 {
    font-size: 13pt;
    margin: 0;
    line-height: 1.2;
    text-transform: uppercase;
    font-weight: 800;
}

/* General Section Styles */
.section-title {
    font-weight: 800;
    font-size: 10pt;
    padding: 4px 5px;
    border-bottom: 1px solid black;
    background-color: white;
    /* Title background */
    text-transform: uppercase;
    position: relative;
    /* Ensure it sits above content */
    z-index: 20;
}

/* Common Cell Styles */
.label-cell {
    border-right: 1px solid black;
    border-bottom: 1px solid black;
    padding: 4px 6px;
    font-size: 9pt;
    display: flex;
    align-items: center;
    font-weight: bold;
    /* Labels usually normal weight in forms */
    background-color: white;
    position: relative;
    z-index: 5;
}

.input-cell {
    background-color: #dbeaff;
    /* Softer blue */
    border-right: 1px solid black;
    border-bottom: 1px solid black;
    padding: 0;
    position: relative;
    z-index: 5;
}

/* Typography for Inputs */
input[type="text"],
input[type="number"],
input[type="date"],
textarea {
    width: 100%;
    height: 100%;
    border: none;
    background: transparent;
    font-family: inherit;
    font-size: 10pt;
    padding: 4px 6px;
    color: #000;
}

select {
    width: 100%;
    height: 100%;
    border: none;
    background-color: transparent;
    font-family: inherit;
    font-size: 10pt;
    color: #000;

    /* Custom Appearance for Alignment */
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;

    /* Custom Arrow (Dark Grey) */
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23333' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 16px;

    padding: 4px 6px;
    padding-right: 30px;
    /* Space to avoid text overlapping arrow */
    cursor: pointer;
}

textarea {
    resize: none;
    line-height: 1.3;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    background-color: #fffde7;
    /* Yellow highlight on focus */
}


/* Signature Line */
.signature-line {
    position: absolute;
    bottom: 4px;
    left: 4px;
    right: 4px;
    border-top: 1px solid black;
    font-size: 8pt;
    padding-top: 2px;
    color: #444;
    z-index: 20;
    /* Ensure visibility above overlapping elements */
}

/* ------------------------------- */
/* Computer Assigned Form Specifics */
/* ------------------------------- */

/* Asset Details Grid */
.details-grid {
    display: grid;
    grid-template-columns: 50mm 1fr;
    grid-auto-rows: 35px;
    /* Label | Input */
}

.details-grid>div {
    border-bottom: 1px solid black;
    border-right: 1px solid black;
}

.details-grid>div:nth-child(2n) {
    border-right: none;
}

/* Specs Grid */
.specs-grid-header {
    display: grid;
    grid-template-columns: 10mm 2fr 1fr 1fr;
    /* NO | SPECS | REF | REMARKS */
    background-color: white;
    font-weight: bold;
    text-align: center;
    font-size: 9pt;
}

.specs-grid-header>div {
    padding: 5px;
    border-right: 1px solid black;
    border-bottom: 1px solid black;
    display: flex;
    align-items: center;
    justify-content: center;
}

.specs-grid-header>div:last-child {
    border-right: none;
}

.specs-table {
    display: grid;
    grid-template-columns: 10mm 2fr 1fr 1fr;
    /* Same as header */
}

.specs-row-cell {
    border-right: 1px solid black;
    border-bottom: 1px solid black;
    min-height: 25px;
    background-color: #dbeaff;
}

.specs-row-cell.no-cell {
    background-color: white;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9pt;
}

.specs-table>div:nth-child(4n) {
    /* Last column cells */
    border-right: none;
}

/* Last row bottom border handling if needed, but usually we keep it for the section end */

/* Declaration Section */
.declaration-text {
    padding: 10px;
    font-size: 9pt;
    line-height: 1.5;
}

.declaration-text input.declaration-input {
    border: none;
    border-bottom: 1px solid black;
    /* Ensure line is drawn */
    background-color: #dbeaff;
    /* Blue background */
    padding: 0 5px;
    height: 30px;
    outline: none;
    text-align: center;
    font-size: 11pt;
    /* width handled by flex */
}

.declaration-text input.declaration-input:focus {
    background-color: #dbeaff;
    /* Keep blue on focus */
    border-bottom: 1px solid black;
    /* Keep border on focus */
}

.declaration-input.short {
    width: 160px;
}

.signature-section-grid {
    display: grid;
    grid-template-columns: 1fr 30%;
    height: 100px;
}

.sig-box {
    border-right: 1px solid black;
    position: relative;
    padding: 5px;
}

.sig-box:last-child {
    border-right: none;
}

.date-label {
    position: absolute;
    bottom: 5px;
    left: 5px;
    font-size: 9pt;
}

.full-width {
    width: 100%;
}


/* PRINT OPTIMIZATION */
@media print {
    @page {
        size: A4 portrait;
        margin: 0;
        /* Browser handles margins usually, but we set body/page-container */
    }

    body {
        margin: 0;
        padding: 0;
        background-color: white;
    }

    .page-container {
        width: 100%;
        min-height: auto;
        /* Allow auto height for print */
        height: 100vh;
        /* Force full height? */
        box-shadow: none;
        margin: 0;
        padding: 10mm;
        /* Print margin */
        border: none;
    }

    /* Force background colors */
    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        color-adjust: exact !important;
    }
}