.r68-component,
.r68-print-portal,
.r68-merit-component {
    --r68-blue: #737fbd;
    --r68-blue-dark: #273a74;
    --r68-border: #202020;
    --r68-soft: #f5f7ff;
    --r68-text: #111827;
    --r68-green: #087f5b;
    --r68-amber: #b7791f;
    --r68-red: #b42318;
    font-family: "Noto Sans Bengali", "Hind Siliguri", "SolaimanLipi", Arial, sans-serif;
    color: var(--r68-text);
}

.r68-screen-scroll {
    width: 100%;
    overflow-x: auto;
    padding: 2px;
    -webkit-overflow-scrolling: touch;
}

.r68-report {
    width: 100%;
    min-width: 1040px;
    max-width: 1440px;
    margin: 0 auto;
    background: #fff;
    border: 1px solid var(--r68-border);
    box-sizing: border-box;
}

.r68-header {
    display: grid;
    grid-template-columns: 140px minmax(430px, 1fr) minmax(350px, 440px);
    align-items: center;
    min-height: 145px;
    background: var(--r68-blue);
    border-bottom: 1px solid var(--r68-border);
    padding: 12px 18px;
    box-sizing: border-box;
}

.r68-logo-cell {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    height: 100%;
}

.r68-logo-cell img {
    display: block;
    max-width: 105px;
    max-height: 105px;
    width: auto;
    height: auto;
    object-fit: contain;
}

.r68-school-cell {
    text-align: center;
    padding: 0 16px;
}

.r68-school-cell h1,
.r68-school-cell h2,
.r68-school-cell p {
    margin: 0;
    color: #050505;
}

.r68-school-cell h1 {
    font-size: 34px;
    line-height: 1.15;
    font-weight: 800;
}

.r68-school-cell p {
    margin-top: 3px;
    font-size: 16px;
    line-height: 1.35;
}

.r68-school-cell h2 {
    margin-top: 10px;
    font-size: 18px;
    line-height: 1.35;
    font-weight: 800;
    text-decoration: underline;
    text-underline-offset: 4px;
}

.r68-student-cell dl,
.r68-student-cell dd,
.r68-student-cell dt {
    margin: 0;
}

.r68-student-cell dl {
    display: grid;
    gap: 1px;
}

.r68-student-cell dl > div {
    display: grid;
    grid-template-columns: 98px 1fr;
    align-items: baseline;
    min-height: 24px;
    padding: 2px 0;
}

.r68-student-cell dl > div.r68-student-highlight {
    margin-top: 1px;
    border-radius: 5px;
}

.r68-student-cell dt,
.r68-student-cell dd {
    color: #0a0a0a;
    font-size: 16px;
    line-height: 1.25;
    font-weight: 700;
}

.r68-student-cell dd {
    overflow-wrap: anywhere;
}

.r68-table-wrap {
    width: 100%;
}

.r68-marks-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    font-size: 15px;
    line-height: 1.3;
}

.r68-marks-table th,
.r68-marks-table td {
    border: 1px solid var(--r68-border);
    padding: 8px 7px;
    text-align: center;
    vertical-align: middle;
    box-sizing: border-box;
}

.r68-marks-table thead th {
    background: #e9edff;
    font-size: 15px;
    font-weight: 800;
}

.r68-col-subject { width: 150px; }
.r68-col-exam { width: 112px; }
.r68-col-result { width: 310px; }

.r68-marks-table thead th:nth-child(3),
.r68-marks-table thead th:nth-child(4),
.r68-marks-table thead th:nth-child(5),
.r68-marks-table thead th:nth-child(6) { width: 86px; }
.r68-marks-table thead th:nth-child(7) { width: 90px; }

.r68-subject-group,
.r68-footer {
    break-inside: avoid;
    page-break-inside: avoid;
}

.r68-subject-group:nth-of-type(even) tr:not(.r68-combined-row) td,
.r68-subject-group:nth-of-type(even) .r68-part-name {
    background: #fbfcff;
}

.r68-part-name {
    font-size: 16px;
    font-weight: 800;
    background: #f2f5ff;
}

.r68-exam-label {
    text-align: left !important;
    font-weight: 650;
}

.r68-combined-row td,
.r68-combined-row .r68-exam-label {
    background: #eef2ff;
    font-weight: 800;
}

.r68-mark-cell,
.r68-total-cell {
    font-variant-numeric: tabular-nums;
    font-weight: 650;
}

.r68-na {
    color: #6b7280;
    background-image: none !important;
}

.r68-result-cell {
    padding: 12px 14px !important;
    text-align: left !important;
    background: #fffef8;
}

.r68-result-box {
    display: grid;
    gap: 10px;
}

.r68-result-title {
    display: inline-block;
    font-size: 17px;
    text-decoration: underline;
    text-underline-offset: 4px;
}

.r68-result-box p {
    margin: 0;
    font-size: 15px;
    line-height: 1.55;
}

.r68-incomplete {
    color: #9b1c1c;
    font-weight: 700;
}

.r68-footer {
    display: grid;
    grid-template-columns: repeat(3, 1fr) 0.9fr;
    gap: 26px;
    align-items: end;
    min-height: 145px;
    padding: 44px 28px 20px;
    box-sizing: border-box;
}

.r68-signature,
.r68-publication {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    text-align: center;
    font-size: 14px;
    line-height: 1.25;
}

.r68-signature strong {
    font-size: 13px;
    min-height: 18px;
}

.r68-signature-image-wrap {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    width: 100%;
    height: 52px;
}

.r68-signature-image {
    display: block;
    max-width: 150px;
    max-height: 48px;
    width: auto;
    height: auto;
    object-fit: contain;
}

.r68-sign-line {
    width: 100%;
    max-width: 190px;
    border-top: 1px solid #111;
}

.r68-publication {
    align-items: flex-start;
    text-align: left;
    border: 1px solid #aeb7d7;
    border-radius: 8px;
    padding: 10px 12px;
    background: var(--r68-soft);
}

.r68-print-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    justify-content: center;
    gap: 14px;
    margin: 22px 0 6px;
}

.r68-print-controls label {
    display: grid;
    gap: 5px;
    font-weight: 700;
}

.r68-paper-size,
.r68-paper-orientation,
.r68-print-button {
    min-height: 46px;
    border-radius: 7px;
    font: inherit;
}

.r68-paper-size,
.r68-paper-orientation {
    min-width: 190px;
    border: 1px solid #b8c2d9;
    padding: 8px 38px 8px 12px;
    background: #fff;
}

.r68-print-button {
    border: 0;
    padding: 10px 24px;
    background: #1555c0;
    color: #fff;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(21, 85, 192, 0.2);
}

.r68-print-button:hover,
.r68-print-button:focus { background: #0e4299; }
.r68-print-button:disabled { opacity: 0.65; cursor: wait; }

.r68-message {
    padding: 12px 14px;
    border-left: 4px solid #d63638;
    background: #fff1f1;
}

.r68-print-portal { display: none; }

/* Merit list */
.r68-merit-component {
    max-width: 1180px;
    margin: 0 auto;
    padding: 18px;
    border: 1px solid #dbe2f3;
    border-radius: 18px;
    background: linear-gradient(180deg, #f7f9ff 0%, #ffffff 42%);
    box-shadow: 0 18px 45px rgba(39, 58, 116, 0.09);
    box-sizing: border-box;
}

.r68-merit-hero {
    display: grid;
    grid-template-columns: 92px 1fr 92px;
    align-items: center;
    gap: 18px;
    padding: 22px 24px;
    border-radius: 14px;
    background: linear-gradient(135deg, #273a74 0%, #5668ae 100%);
    color: #fff;
}

.r68-merit-logo img {
    display: block;
    max-width: 82px;
    max-height: 82px;
    width: auto;
    height: auto;
    object-fit: contain;
}

.r68-merit-heading {
    grid-column: 2;
    text-align: center;
}

.r68-merit-heading h2,
.r68-merit-heading h3,
.r68-merit-heading p { margin: 0; color: #fff; }
.r68-merit-heading h2 { font-size: 30px; line-height: 1.15; }
.r68-merit-heading p { margin-top: 4px; opacity: 0.9; }
.r68-merit-heading h3 { margin-top: 10px; font-size: 18px; }

.r68-merit-filter {
    display: grid;
    grid-template-columns: minmax(180px, 1fr) minmax(160px, 0.8fr) auto;
    gap: 14px;
    align-items: end;
    margin: 20px 0 12px;
    padding: 16px;
    border: 1px solid #d7def0;
    border-radius: 12px;
    background: #fff;
}

.r68-merit-filter label { display: grid; gap: 6px; font-weight: 800; }
.r68-merit-filter select,
.r68-merit-filter button {
    width: 100%;
    min-height: 46px;
    border-radius: 8px;
    font: inherit;
}
.r68-merit-filter select { border: 1px solid #bac5df; padding: 8px 12px; background: #fff; }
.r68-merit-filter button { border: 0; padding: 9px 20px; background: #273a74; color: #fff; font-weight: 800; cursor: pointer; }
.r68-merit-filter button:hover { background: #1c2b59; }

.r68-merit-print-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    justify-content: center;
    gap: 14px;
    margin: 0 0 16px;
    padding: 14px;
    border: 1px solid #d7def0;
    border-radius: 12px;
    background: #fff;
}

.r68-merit-print-controls label {
    display: grid;
    gap: 5px;
    font-weight: 800;
}

.r68-merit-paper-size,
.r68-merit-orientation,
.r68-merit-print-button {
    min-height: 44px;
    border-radius: 8px;
    font: inherit;
}

.r68-merit-paper-size,
.r68-merit-orientation {
    min-width: 190px;
    border: 1px solid #bac5df;
    padding: 8px 38px 8px 12px;
    background: #fff;
}

.r68-merit-print-button {
    border: 0;
    padding: 9px 22px;
    background: #0b7a53;
    color: #fff;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(11, 122, 83, 0.2);
}

.r68-merit-print-button:hover,
.r68-merit-print-button:focus { background: #086442; }
.r68-merit-print-button:disabled { opacity: 0.65; cursor: wait; }

.r68-merit-context {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-bottom: 14px;
}
.r68-merit-context > * {
    padding: 7px 12px;
    border-radius: 999px;
    background: #eef2ff;
    color: #273a74;
}

.r68-merit-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin: 14px 0 22px;
}
.r68-merit-stats > div {
    display: grid;
    gap: 4px;
    min-height: 88px;
    align-content: center;
    text-align: center;
    border: 1px solid #d9e0f2;
    border-radius: 12px;
    background: #fff;
}
.r68-merit-stats strong { font-size: 28px; color: #273a74; }
.r68-merit-stats span { font-size: 14px; font-weight: 700; }

.r68-merit-section {
    margin-top: 18px;
    overflow: hidden;
    border: 1px solid #d8dfef;
    border-radius: 14px;
    background: #fff;
}
.r68-merit-section > header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 13px 16px;
    background: #eef2ff;
    border-bottom: 1px solid #d8dfef;
}
.r68-merit-section > header h3 { margin: 0; font-size: 18px; }
.r68-merit-section > header span { white-space: nowrap; padding: 4px 9px; border-radius: 999px; background: #fff; font-weight: 800; }
.r68-merit-pass > header { background: #e8f7f1; color: #086645; }
.r68-merit-fail-one > header { background: #fff7e6; color: #8a5a00; }
.r68-merit-fail-two > header { background: #fff0e6; color: #9c3d10; }
.r68-merit-fail-three > header { background: #fff0f0; color: #a61b1b; }

.r68-merit-table-wrap { width: 100%; overflow-x: auto; }
.r68-merit-table { width: 100%; min-width: 700px; border-collapse: collapse; }
.r68-merit-table th,
.r68-merit-table td { padding: 11px 12px; border-bottom: 1px solid #e6eaf3; text-align: center; }
.r68-merit-table th { background: #fafbff; font-weight: 800; }
.r68-merit-table tbody tr:hover { background: #f8faff; }
.r68-merit-name { text-align: left !important; font-weight: 700; }
.r68-merit-name a { color: #223b82; text-decoration: none; }
.r68-merit-name a:hover { text-decoration: underline; }
.r68-merit-rank {
    display: inline-grid;
    place-items: center;
    min-width: 34px;
    min-height: 34px;
    border-radius: 50%;
    background: #273a74;
    color: #fff;
    font-weight: 800;
}
.r68-merit-pass tbody tr:nth-child(1) .r68-merit-rank { background: #c68b00; }
.r68-merit-pass tbody tr:nth-child(2) .r68-merit-rank { background: #718096; }
.r68-merit-pass tbody tr:nth-child(3) .r68-merit-rank { background: #a85d28; }
.r68-merit-empty { margin: 0; padding: 18px; text-align: center; color: #667085; }
.r68-merit-incomplete { margin-top: 18px; padding: 13px 15px; border-left: 4px solid #d97706; background: #fff8e7; border-radius: 8px; }

@media (max-width: 760px) {
    .r68-screen-scroll { border: 1px solid #d6dbea; border-radius: 10px; }
    .r68-report { min-width: 980px; }
    .r68-print-controls { align-items: stretch; padding: 0 12px; }
    .r68-print-controls label,
    .r68-paper-size,
    .r68-paper-orientation,
    .r68-print-button { width: 100%; }

    .r68-merit-component { padding: 10px; border-radius: 12px; }
    .r68-merit-hero { grid-template-columns: 58px 1fr; padding: 16px 12px; gap: 10px; }
    .r68-merit-logo img { max-width: 54px; max-height: 54px; }
    .r68-merit-heading { grid-column: 2; text-align: left; }
    .r68-merit-heading h2 { font-size: 21px; }
    .r68-merit-heading h3 { font-size: 15px; }
    .r68-merit-heading p { font-size: 13px; }
    .r68-merit-filter { grid-template-columns: 1fr; }
    .r68-merit-print-controls { align-items: stretch; }
    .r68-merit-print-controls label,
    .r68-merit-paper-size,
    .r68-merit-print-button { width: 100%; }
    .r68-merit-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .r68-merit-section > header { align-items: flex-start; }
}

@media print {
    html,
    body {
        margin: 0 !important;
        padding: 0 !important;
        background: #fff !important;
    }

    body.r68-is-printing > *:not(.r68-print-portal) { display: none !important; }
    body.r68-is-printing .r68-print-portal { display: block !important; }

    .r68-print-portal .r68-report {
        width: 100% !important;
        min-width: 0 !important;
        max-width: none !important;
        margin: 0 !important;
        border: 1px solid #000 !important;
        box-shadow: none !important;
        transform: none !important;
    }

    /* Portrait: the fixed-layout table gets proportional columns so it
       reflows to the narrower sheet at the same font size. */
    .r68-print-portal .r68-print-portrait .r68-marks-table thead th:nth-child(1) { width: 15% !important; }
    .r68-print-portal .r68-print-portrait .r68-marks-table thead th:nth-child(2) { width: 11% !important; }
    .r68-print-portal .r68-print-portrait .r68-marks-table thead th:nth-child(3),
    .r68-print-portal .r68-print-portrait .r68-marks-table thead th:nth-child(4),
    .r68-print-portal .r68-print-portrait .r68-marks-table thead th:nth-child(5),
    .r68-print-portal .r68-print-portrait .r68-marks-table thead th:nth-child(6),
    .r68-print-portal .r68-print-portrait .r68-marks-table thead th:nth-child(7) { width: 8% !important; }
    .r68-print-portal .r68-print-portrait .r68-marks-table thead th:nth-child(8) { width: 34% !important; }

    /* Landscape: compact spacing so the full-width sheet still fits one page. */
    .r68-print-portal .r68-print-landscape .r68-header { min-height: 26mm; padding: 2mm 3mm; }
    .r68-print-portal .r68-print-landscape .r68-marks-table th,
    .r68-print-portal .r68-print-landscape .r68-marks-table td { padding: 0.6mm 0.7mm; }
    .r68-print-portal .r68-print-landscape .r68-footer { min-height: 20mm; padding: 6mm 4mm 2.5mm; }

    .r68-print-portal .r68-header,
    .r68-print-portal .r68-footer,
    .r68-print-portal .r68-subject-group,
    .r68-print-portal .r68-subject-group tr,
    .r68-print-portal .r68-result-cell {
        break-inside: avoid !important;
        page-break-inside: avoid !important;
    }

    .r68-print-portal .r68-header {
        grid-template-columns: 12% 55% 33%;
        min-height: 29mm;
        padding: 2.4mm 3.5mm;
        print-color-adjust: exact;
        -webkit-print-color-adjust: exact;
    }

    .r68-print-portal .r68-logo-cell img { max-width: 20mm; max-height: 20mm; }
    .r68-print-portal .r68-school-cell { padding: 0 2.5mm; }
    .r68-print-portal .r68-school-cell h1 { font-size: 19pt; }
    .r68-print-portal .r68-school-cell p { font-size: 9pt; }
    .r68-print-portal .r68-school-cell h2 { margin-top: 1.4mm; font-size: 10pt; }

    .r68-print-portal .r68-student-cell dl > div {
        grid-template-columns: 21mm 1fr;
        min-height: 4.4mm;
        padding: 0.25mm 0;
        border-bottom: none !important;
    }
    .r68-print-portal .r68-student-cell dl > div.r68-student-highlight { padding: 0.35mm 1mm; }
    .r68-print-portal .r68-student-cell dt,
    .r68-print-portal .r68-student-cell dd { font-size: 8.4pt; }

    .r68-print-portal .r68-marks-table { width: 100% !important; table-layout: fixed !important; font-size: 7.7pt; }
    .r68-print-portal .r68-marks-table thead { display: table-header-group; }
    .r68-print-portal .r68-marks-table th,
    .r68-print-portal .r68-marks-table td { padding: 0.9mm 0.8mm; }
    .r68-print-portal .r68-marks-table thead th,
    .r68-print-portal .r68-part-name,
    .r68-print-portal .r68-result-title { font-size: 8pt; }
    .r68-print-portal .r68-result-box { gap: 0.8mm; }
    .r68-print-portal .r68-result-box p { font-size: 7.5pt; line-height: 1.25; }

    .r68-print-portal .r68-footer {
        min-height: 23mm;
        gap: 6mm;
        padding: 8mm 5mm 3mm;
    }
    .r68-print-portal .r68-signature,
    .r68-print-portal .r68-publication { font-size: 7.4pt; }
    .r68-print-portal .r68-signature-image-wrap { height: 9mm; }
    .r68-print-portal .r68-signature-image { max-width: 34mm; max-height: 8.5mm; }
    .r68-print-portal .r68-publication { padding: 1.5mm; border-radius: 0; }
}
@media print {
    .r68-print-portal .r68-merit-name a,
    .r68-print-portal .r68-merit-print-name {
        color: inherit !important;
        text-decoration: none !important;
        font-weight: inherit;
    }

    .r68-print-portal .r68-merit-name a::after {
        content: none !important;
        display: none !important;
    }
}

/* v1.4.1: Compact student attendance block above the signature area. */
.r68-attendance {
    width: 100%;
    box-sizing: border-box;
    break-inside: avoid;
    page-break-inside: avoid;
	margin-top: -15px;
}

.r68-attendance-row {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(0, 0.55fr) minmax(0, 1.55fr) minmax(0, 0.55fr);
}

.r68-attendance-cell {
    min-height: 38px;
    padding: 6px 8px;
    border: 1px solid var(--r68-border);
    border-top: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    box-sizing: border-box;
    font-size: 14px;
    line-height: 1.12;
    font-weight: 700;
}

.r68-attendance-value {
    font-variant-numeric: tabular-nums;
    font-size: 15px;
    font-weight: 800;
}

@media print {
    .r68-print-portal .r68-attendance {
        width: 100% !important;
        break-inside: avoid !important;
        page-break-inside: avoid !important;
    }

    .r68-print-portal .r68-attendance-row {
        display: grid !important;
        grid-template-columns: minmax(0, 1.35fr) minmax(0, 0.55fr) minmax(0, 1.55fr) minmax(0, 0.55fr) !important;
    }

    .r68-print-portal .r68-attendance-cell {
        min-height: 5.8mm !important;
        padding: 0.55mm 0.7mm !important;
        border: 1px solid #111 !important;
        border-top: 0 !important;
        font-size: 6.9pt !important;
        line-height: 1.03 !important;
        font-weight: 700 !important;
    }

    .r68-print-portal .r68-attendance-value {
        font-size: 7.2pt !important;
        font-weight: 800 !important;
    }

    /* The new block is compact; reduce only the signature area spacing so
       the existing single-page print behavior remains intact. */
    .r68-print-portal .r68-footer {
        min-height: 20mm !important;
        padding-top: 5.5mm !important;
    }
}
