body {
    margin: 0;
    padding: 0;
    font-family: "Siliguri Hind", "Noto Sans Bengali", Arial, sans-serif;
    background: #f5f5f5;
}

@page {
    size: Letter;
    margin: 0;
}

.page {
    position: relative;
    width: 8.5in;
    height: 11in;
    background: #fff;
    border: 2px solid #000;
    box-sizing: border-box;
    padding: 15px 0.5in;
    margin: 0 auto;
}

.sheet-layout {
    position: relative;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    min-height: 0;
}

.left-side-table {
    display: block;
    border-collapse: collapse;
    margin: 8px 0 8px;
    background: #fff;
}

.side-tables {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 30px;
}

.right-side-table {
    border-collapse: collapse;
    margin: 8px 0;
    background: #fff;
}

.right-side-table td {
    width: 36px;
    height: 36px;
    padding: 0;
    border: 1px solid #E63946;
    background: #fff;
    box-sizing: border-box;
    text-align: center;
    vertical-align: middle;
}

.right-side-table tr:first-child td {
    text-align: center;
    vertical-align: middle;
}

.right-side-table tr td:nth-child(2),
.right-side-table tr td:nth-child(4),
.right-side-table tr td:nth-child(6) {
    background: #FCE5E5;
}

.right-side-table-group {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 30px;
}

.subject-code-table {
    border-collapse: collapse;
    margin: 8px 0 0;
    background: #fff;
}

.subject-code-table td {
    width: 36px;
    height: 36px;
    padding: 0;
    border: 1px solid #E63946;
    background: #fff;
    box-sizing: border-box;
    text-align: center;
    vertical-align: middle;
}

.subject-code-table tr:first-child td {
    text-align: center;
    vertical-align: middle;
}

.subject-code-table tr td:nth-child(1),
.subject-code-table tr td:nth-child(3) {
    background: #FCE5E5;
}

.subject-code-table tr:first-child td {
    background: #fff;
}

.set-code-table {
    border-collapse: collapse;
    margin: 8px 0 0;
    background: #fff;
}

.set-code-table td {
    width: 30px;
    height: 30px;
    padding: 0;
    border: 1px solid #E63946;
    background: #fff;
    box-sizing: border-box;
}

.set-code-table tr:first-child td {
    text-align: center;
    vertical-align: middle;
}

.set-code-table td:nth-child(2) {
    text-align: center;
    vertical-align: middle;
}

.set-option {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border: 2px solid #000;
    border-radius: 50%;
    background: #fff;
    font-size: 11px;
    font-weight: bold;
    line-height: 1;
}

.roll-option {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border: 2px solid #000;
    border-radius: 50%;
    background: #fff;
    font-size: 11px;
    font-weight: bold;
    line-height: 1;
}

.left-side-table tr:first-child td,
.right-side-table tr:first-child td,
.subject-code-table tr:first-child td,
.set-code-table tr:first-child td,
.omr-sheet tr:first-child td {
    font-weight: bold;
}

.left-side-table td {
    width: 30px;
    height: 30px;
    padding: 0;
    border: 1px solid #E63946;
    background: #fff;
    box-sizing: border-box;
}

.left-side-table .no-bottom-border {
    border-bottom: none;
}

.left-side-table .no-top-border {
    border-top: none;
}

.left-side-table .no-left-border {
    border-left: none;
}

.left-side-table .no-right-border {
    border-right: none;
}

.left-side-table tr:first-child td {
    text-align: center;
    vertical-align: middle;
}

.left-side-table .student-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border: 2px solid #000;
    border-radius: 50%;
    background: #fff;
    font-size: 11px;
    font-weight: bold;
    line-height: 1;
    margin: 0 auto;
}

.left-side-table td:nth-child(2) {
    text-align: center;
    vertical-align: middle;
}

.set-code-table td:nth-child(1),
.set-code-table td:nth-child(3) {
    border-top: none;
    border-bottom: none;
}

.set-code-table tr:first-child td {
    border-top: 1px solid #E63946;
    border-bottom: 1px solid #E63946;
}

.set-code-table tr:last-child td:nth-child(1),
.set-code-table tr:last-child td:nth-child(3) {
    border-bottom: 1px solid #E63946;
}

.set-code-table tr:last-child td:nth-child(2) {
    border-left: none;
    border-right: none;
}

.set-code-table tr:last-child td:nth-child(1) {
    border-right: none;
}

.set-code-table tr:last-child td:nth-child(3) {
    border-left: none;
}

.set-code-group {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.set-code-row {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 14px;
}

.qr-placeholder {
    width: 92px;
    height: 194px;
    box-sizing: border-box;
    border: 1px dashed #999;
    margin: 8px 0 0;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    background: #fff;
    font-size: 10px;
    color: #999;
    font-family: Arial, sans-serif;
}

.signature-stack {
    margin-top: 26px;
}

.signature-box {
    width: 240px;
    box-sizing: border-box;
    border-top: 1px solid #000;
    border-left: 1px solid #000;
    border-right: 1px solid #E63946;
    border-bottom: 1px solid #E63946;
    margin: 10px 0 0;
    height: 78px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 0 6px 6px;
}

.signature-box span {
    color: #E63946;
    font-weight: bold;
    font-size: 11px;
    line-height: 1.4;
    text-align: center;
    font-family: "Siliguri Hind", "Noto Sans Bengali", Arial, sans-serif;
}

.omr-sheet {
    flex: 1 1 0;
    min-width: 0;
    border-collapse: separate;
    border-spacing: 0 2px;
    margin: 0;
    background: #fff;
}

.omr-sheet td {
    padding: 3px 4px;
    text-align: center;
    border: 1px solid #E63946;
    background: #fff;
    font-size: 12px;
}

.omr-sheet tr td:nth-child(2),
.omr-sheet tr td:nth-child(4) {
    background: #FCE5E5;
}

.omr-sheet tr:first-child td:nth-child(2) {
    background: #fff;
}

.omr-sheet tr td:nth-child(2) .omr-option,
.omr-sheet tr td:nth-child(4) .omr-option {
    background: #FCE5E5;
}

.omr-option {
    width: 16px;
    height: 16px;
    border: 2px solid #000;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    font-size: 11px;
    font-weight: bold;
    font-family: Arial, sans-serif;
}

.mini-top-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 6px 0;
    border: none;
    margin: 0 0 4px;
    font-size: 8px;
    line-height: 1;
}

.mini-top-table td {
    height: 19px;
    padding: 0;
    border: none;
    background: #fff;
}

.mini-top-table td:first-child,
.mini-top-table td:last-child {
    width: 38px;
}

.mini-top-table td:first-child,
.mini-top-table td:last-child {
    background: #000;
    border: none;
}

.mini-top-table td:nth-child(2) {
    background: #FCE5E5;
    border: none;
    text-align: center;
    color: #E63946;
    font-size: 15px;
    font-weight: bold;
    vertical-align: middle;
    line-height: 1.2;
}

.mini-top-pattern {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
    height: 100%;
    padding: 0 2px;
    box-sizing: border-box;
}

.mini-pattern-item {
    display: inline-block;
    width: 12px;
    height: 12px;
    box-sizing: border-box;
    flex-shrink: 0;
}

.mini-pattern-circle {
    border: 1px solid #000;
    background: #fff;
    border-radius: 50%;
}

.mini-pattern-square {
    background: #000;
}

.mini-bottom-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 6px 0;
    border: none;
    margin: 12px 0 0;
    font-size: 8px;
    line-height: 1;
}

.mini-bottom-table td {
    height: 19px;
    padding: 0;
    border: none;
    background: #fff;
}

.mini-bottom-table td:first-child,
.mini-bottom-table td:last-child {
    width: 38px;
    background: #000;
    border: none;
}

.mini-bottom-table td:nth-child(2) {
    background: #FCE5E5;
    border: none;
    text-align: center;
    color: #E63946;
    font-size: 15px;
    font-weight: bold;
    vertical-align: middle;
    line-height: 1.2;
}

.school-header {
    text-align: center;
    margin: 0 0 12px;
    line-height: 1.5;
}

.school-header h1 {
    margin: 0;
    font-size: 30px;
    font-weight: bold;
    font-family: "Siliguri Hind", "Noto Sans Bengali", Arial, sans-serif;
}

.school-header h5 {
    margin: 0;
    font-size: 18px;
    font-weight: normal;
    font-family: "Siliguri Hind", "Noto Sans Bengali", Arial, sans-serif;
}

.footer {
    text-align: center;
    font-size: 12px;
    font-weight: bold;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid #000;
}

.instructions {
    margin: 16px 0 0;
    padding: 10px 14px;
    border: 1px solid #000;
    font-size: 11px;
    line-height: 1.6;
}

.instructions h3 {
    margin: 0 0 4px;
    text-align: center;
    font-size: 14px;
}

.instructions ol {
    margin: 0;
    padding: 0 20px 0 0;
}


/* ------------------------------------------------------------------ */
/* Print determinism.                                                   */
/* The page box is exactly 8.5x11in with zero printer margin, so the    */
/* four corner registration blocks land in the same place on every      */
/* print. A4 paper is 5mm narrower, so scale the whole sheet to fit —   */
/* uniform scaling is harmless because the scanner template stores      */
/* positions as fractions of the corner blocks, not millimetres.        */
/* ------------------------------------------------------------------ */

.page {
    margin: 24px auto;
    box-shadow: 0 2px 18px rgba(0, 0, 0, .14);
}

body.paper-a4 .page {
    transform: scale(0.9722);
    transform-origin: top left;
}

@media print {
    body {
        background: #fff;
    }

    .page {
        margin: 0;
        box-shadow: none;
    }

    .no-print {
        display: none !important;
    }
}

@page a4 {
    size: A4;
    margin: 0;
}

body.paper-a4 {
    page: a4;
}
