@font-face {
    font-family: 'Cairo';
    src: url('../../fonts/Cairo/static/Cairo-ExtraLight.ttf') format('truetype');
    font-style: normal;
    font-weight: 200;
    font-display: swap;
}

@font-face {
    font-family: 'Cairo';
    src: url('../../fonts/Cairo/static/Cairo-Light.ttf') format('truetype');
    font-style: normal;
    font-weight: 300;
    font-display: swap;
}

@font-face {
    font-family: 'Cairo';
    src: url('../../fonts/Cairo/static/Cairo-Regular.ttf') format('truetype');
    font-style: normal;
    font-weight: 400;
    font-display: swap;
}

@font-face {
    font-family: 'Cairo';
    src: url('../../fonts/Cairo/static/Cairo-Medium.ttf') format('truetype');
    font-style: normal;
    font-weight: 500;
    font-display: swap;
}

@font-face {
    font-family: 'Cairo';
    src: url('../../fonts/Cairo/static/Cairo-SemiBold.ttf') format('truetype');
    font-style: normal;
    font-weight: 600;
    font-display: swap;
}

@font-face {
    font-family: 'Cairo';
    src: url('../../fonts/Cairo/static/Cairo-Bold.ttf') format('truetype');
    font-style: normal;
    font-weight: 700;
    font-display: swap;
}

@font-face {
    font-family: 'Cairo';
    src: url('../../fonts/Cairo/static/Cairo-ExtraBold.ttf') format('truetype');
    font-style: normal;
    font-weight: 800;
    font-display: swap;
}

@font-face {
    font-family: 'Cairo';
    src: url('../../fonts/Cairo/static/Cairo-Black.ttf') format('truetype');
    font-style: normal;
    font-weight: 900;
    font-display: swap;
}

@font-face {
    font-family: 'Nunito';
    src: url('../../fonts/Cairo/Cairo-VariableFont_slnt,wght.ttf') format('truetype');
    font-style: normal;
    font-weight: 200 1000;
    font-display: swap;
}

:root {
    --pes-font-family: 'Cairo', 'Segoe UI', Tahoma, Arial, sans-serif;
    --portal-print-font-family: 'Cairo', 'Segoe UI', Tahoma, Arial, sans-serif;
}

html,
body,
button,
input,
select,
textarea,
.tooltip,
.popover,
.dropdown-menu,
.modal,
.dataTables_wrapper {
    font-family: var(--pes-font-family) !important;
}

/* Credential slips use Cairo to match the rest of PES while keeping the
   stronger print-specific sizing and weights below. */
body[class*="paper-"] .sheet,
body[class*="paper-"] .sheet * {
    font-family: var(--portal-print-font-family) !important;
}

/* A4 credential printing has been removed. Hide stale links that may remain
   in a cached Blade view. The backend also falls back to receipt mode. */
a.paper-option[href*="paper=a4"] {
    display: none !important;
}

/* The second QR contains account data as text. Keep only the short title and
   give the QR as much physical space as possible for reliable camera scans. */
body[class*="paper-"] .qr-card:nth-child(2) .qr-title {
    font-size: 0 !important;
}

body[class*="paper-"] .qr-card:nth-child(2) .qr-title::after {
    content: 'QR بيانات الحساب';
    font-size: 12px;
    font-weight: 800;
}

body[class*="paper-"] .qr-note,
body[class*="paper-"] .qr-note::after {
    display: none !important;
    content: none !important;
}

/* --------------------------------------------------------------------------
   80mm receipt preview
   -------------------------------------------------------------------------- */
html body.paper-receipt .school-name {
    font-size: 20px !important;
    font-weight: 800 !important;
    letter-spacing: 0 !important;
}
html body.paper-receipt .slip-title {
    font-size: 15px !important;
    font-weight: 800 !important;
    line-height: 1.35 !important;
}
html body.paper-receipt .document-meta,
html body.paper-receipt .document-meta-label {
    font-size: 10px !important;
    font-weight: 700 !important;
}
html body.paper-receipt .summary-item {
    padding: 7px 8px !important;
}
html body.paper-receipt .summary-label {
    margin-bottom: 2px !important;
    font-size: 12px !important;
    font-weight: 800 !important;
}
html body.paper-receipt .summary-value {
    font-size: 14px !important;
    font-weight: 800 !important;
    line-height: 1.35 !important;
}
html body.paper-receipt .status-pill {
    padding: 3px 9px !important;
    font-size: 11px !important;
    font-weight: 800 !important;
}
html body.paper-receipt .credentials-title {
    padding: 7px 8px !important;
    font-size: 13px !important;
    font-weight: 800 !important;
}
html body.paper-receipt .credential-item {
    padding: 7px 8px !important;
}
html body.paper-receipt .credential-label {
    margin-bottom: 3px !important;
    font-size: 11px !important;
    font-weight: 800 !important;
}
html body.paper-receipt .credential-value {
    font-size: 13px !important;
    font-weight: 800 !important;
    line-height: 1.35 !important;
}
html body.paper-receipt .credential-item:first-child .credential-label {
    font-size: 12.5px !important;
    font-weight: 900 !important;
}
html body.paper-receipt .credential-item:first-child .credential-value {
    font-size: 15px !important;
    font-weight: 900 !important;
    color: #001d33 !important;
    line-height: 1.4 !important;
    letter-spacing: .15px !important;
    word-break: break-all !important;
}
html body.paper-receipt .credential-value.password {
    font-size: 24px !important;
    font-weight: 900 !important;
    line-height: 1.18 !important;
    letter-spacing: .4px !important;
}
html body.paper-receipt .password-hint {
    padding: 5px 7px !important;
    font-size: 10px !important;
    font-weight: 700 !important;
    line-height: 1.35 !important;
}
html body.paper-receipt .qr-section {
    gap: 8px !important;
    margin-top: 9px !important;
}
html body.paper-receipt .qr-card {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 7px 5px !important;
}
html body.paper-receipt .qr-card img {
    width: 116px !important;
    height: 116px !important;
    margin: 0 auto 5px !important;
}
html body.paper-receipt .qr-card:nth-child(2) img {
    width: 124px !important;
    height: 124px !important;
}
html body.paper-receipt .qr-title {
    font-size: 12px !important;
    font-weight: 800 !important;
    line-height: 1.25 !important;
}
html body.paper-receipt .qr-card:nth-child(2) .qr-title::after {
    font-size: 12px !important;
}
html body.paper-receipt .login-url-label {
    font-size: 10px !important;
    font-weight: 800 !important;
}
html body.paper-receipt .login-url {
    font-size: 9.5px !important;
    font-weight: 700 !important;
    line-height: 1.3 !important;
}
html body.paper-receipt .notice {
    font-size: 10px !important;
    font-weight: 800 !important;
    line-height: 1.45 !important;
}
html body.paper-receipt .document-footer {
    font-size: 9.5px !important;
    font-weight: 700 !important;
}

/* --------------------------------------------------------------------------
   A5 landscape preview
   -------------------------------------------------------------------------- */
html body.paper-a5 .document-header {
    padding-bottom: 8px !important;
    margin-bottom: 8px !important;
}
html body.paper-a5 .document-logo img {
    width: 56px !important;
    height: 56px !important;
}
html body.paper-a5 .school-name {
    font-size: 20px !important;
    font-weight: 800 !important;
}
html body.paper-a5 .slip-title {
    font-size: 15px !important;
    font-weight: 800 !important;
}
html body.paper-a5 .document-meta,
html body.paper-a5 .document-meta-label {
    font-size: 10px !important;
    font-weight: 700 !important;
}
html body.paper-a5 .account-summary {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    gap: 7px !important;
    margin-bottom: 8px !important;
}
html body.paper-a5 .summary-item {
    padding: 7px 9px !important;
    min-height: 55px !important;
}
html body.paper-a5 .summary-label {
    margin-bottom: 2px !important;
    font-size: 12px !important;
    font-weight: 800 !important;
}
html body.paper-a5 .summary-value {
    font-size: 15px !important;
    font-weight: 800 !important;
    line-height: 1.3 !important;
}
html body.paper-a5 .status-pill {
    padding: 3px 8px !important;
    font-size: 11px !important;
    font-weight: 800 !important;
}
html body.paper-a5 .credentials-title {
    padding: 6px 9px !important;
    font-size: 13px !important;
    font-weight: 800 !important;
}
html body.paper-a5 .credential-item {
    padding: 7px 10px !important;
}
html body.paper-a5 .credential-label {
    margin-bottom: 2px !important;
    font-size: 11px !important;
    font-weight: 800 !important;
}
html body.paper-a5 .credential-value {
    font-size: 15px !important;
    font-weight: 800 !important;
    line-height: 1.3 !important;
}
html body.paper-a5 .credential-item:first-child .credential-label {
    font-size: 12.5px !important;
    font-weight: 900 !important;
}
html body.paper-a5 .credential-item:first-child .credential-value {
    font-size: 17px !important;
    font-weight: 900 !important;
    color: #001d33 !important;
    line-height: 1.35 !important;
    letter-spacing: .15px !important;
    word-break: break-all !important;
}
html body.paper-a5 .credential-value.password {
    font-size: 23px !important;
    font-weight: 900 !important;
    line-height: 1.15 !important;
}
html body.paper-a5 .password-hint {
    padding: 5px 8px !important;
    font-size: 10.5px !important;
    font-weight: 700 !important;
}
html body.paper-a5 .qr-section {
    gap: 8px !important;
    margin-top: 8px !important;
}
html body.paper-a5 .qr-card {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0 !important;
    padding: 7px !important;
    text-align: center !important;
}
html body.paper-a5 .qr-card img {
    width: 118px !important;
    height: 118px !important;
    margin: 0 auto 4px !important;
}
html body.paper-a5 .qr-card:nth-child(2) img {
    width: 128px !important;
    height: 128px !important;
}
html body.paper-a5 .qr-title {
    font-size: 12px !important;
    font-weight: 800 !important;
    line-height: 1.2 !important;
}
html body.paper-a5 .qr-card:nth-child(2) .qr-title::after {
    font-size: 12px !important;
}
html body.paper-a5 .login-url-box {
    margin-top: 7px !important;
    padding: 5px 8px !important;
}
html body.paper-a5 .login-url-label {
    margin-bottom: 2px !important;
    font-size: 10px !important;
    font-weight: 800 !important;
}
html body.paper-a5 .login-url {
    font-size: 9.5px !important;
    font-weight: 700 !important;
    line-height: 1.25 !important;
}
html body.paper-a5 .notice {
    margin-top: 7px !important;
    padding: 6px 8px !important;
    font-size: 10.5px !important;
    font-weight: 800 !important;
    line-height: 1.35 !important;
}
html body.paper-a5 .document-footer {
    margin-top: 7px !important;
    padding-top: 5px !important;
    font-size: 9.5px !important;
    font-weight: 700 !important;
}

@media print {
    /* 80mm account receipt: strong, readable typography while keeping one page. */
    html body.paper-receipt .school-name { font-size: 11.8pt !important; font-weight: 800 !important; }
    html body.paper-receipt .slip-title { font-size: 9.6pt !important; font-weight: 800 !important; }
    html body.paper-receipt .document-meta,
    html body.paper-receipt .document-meta-label { font-size: 7pt !important; font-weight: 700 !important; }
    html body.paper-receipt .summary-label { font-size: 7.2pt !important; font-weight: 800 !important; }
    html body.paper-receipt .summary-value { font-size: 9.2pt !important; font-weight: 800 !important; line-height: 1.25 !important; }
    html body.paper-receipt .status-pill { font-size: 7pt !important; }
    html body.paper-receipt .credentials-title { font-size: 8pt !important; font-weight: 800 !important; }
    html body.paper-receipt .credential-label { font-size: 7pt !important; font-weight: 800 !important; }
    html body.paper-receipt .credential-value { font-size: 8.8pt !important; font-weight: 800 !important; line-height: 1.25 !important; }
    html body.paper-receipt .credential-item:first-child .credential-label { font-size: 7.7pt !important; font-weight: 900 !important; }
    html body.paper-receipt .credential-item:first-child .credential-value { font-size: 10.2pt !important; font-weight: 900 !important; line-height: 1.22 !important; }
    html body.paper-receipt .credential-value.password { font-size: 14.5pt !important; font-weight: 900 !important; }
    html body.paper-receipt .password-hint { font-size: 6.5pt !important; }

    html body.paper-receipt .qr-section { gap: 1.2mm !important; margin-top: 1.3mm !important; }
    html body.paper-receipt .qr-card {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        padding: .7mm .45mm !important;
        text-align: center !important;
    }
    html body.paper-receipt .qr-card img { width: 31mm !important; height: 31mm !important; margin: 0 auto .6mm !important; }
    html body.paper-receipt .qr-card:nth-child(2) img { width: 32mm !important; height: 32mm !important; }
    html body.paper-receipt .qr-title { font-size: 7.4pt !important; font-weight: 800 !important; line-height: 1.15 !important; }
    html body.paper-receipt .qr-card:nth-child(2) .qr-title::after { font-size: 7.4pt !important; }
    html body.paper-receipt .login-url-label { font-size: 6.3pt !important; }
    html body.paper-receipt .login-url { font-size: 6pt !important; line-height: 1.16 !important; }
    html body.paper-receipt .notice { font-size: 6.5pt !important; line-height: 1.24 !important; }
    html body.paper-receipt .document-footer { font-size: 6pt !important; }

    /* A5 landscape: larger type without wasting vertical space. */
    html body.paper-a5 .document-header {
        grid-template-columns: minmax(28mm,1fr) minmax(65mm,auto) minmax(28mm,1fr) !important;
        padding-bottom: 1.2mm !important;
        margin-bottom: 1.2mm !important;
    }
    html body.paper-a5 .document-logo img { width: 13mm !important; height: 13mm !important; }
    html body.paper-a5 .school-name { font-size: 11.5pt !important; font-weight: 800 !important; }
    html body.paper-a5 .slip-title { font-size: 9pt !important; font-weight: 800 !important; }
    html body.paper-a5 .document-meta,
    html body.paper-a5 .document-meta-label { font-size: 6.8pt !important; }
    html body.paper-a5 .account-summary {
        grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
        gap: 1mm !important;
        margin-bottom: 1mm !important;
    }
    html body.paper-a5 .summary-item { min-height: 12mm !important; padding: .75mm 1.05mm !important; }
    html body.paper-a5 .summary-label { margin-bottom: .12mm !important; font-size: 7.3pt !important; font-weight: 800 !important; }
    html body.paper-a5 .summary-value { font-size: 9.4pt !important; font-weight: 800 !important; line-height: 1.2 !important; }
    html body.paper-a5 .status-pill { padding: .28mm .85mm !important; font-size: 7pt !important; }
    html body.paper-a5 .credentials-title { padding: .65mm 1.05mm !important; font-size: 7.7pt !important; font-weight: 800 !important; }
    html body.paper-a5 .credential-item { padding: .75mm 1.1mm !important; }
    html body.paper-a5 .credential-label { margin-bottom: .12mm !important; font-size: 7.1pt !important; font-weight: 800 !important; }
    html body.paper-a5 .credential-value { font-size: 9.2pt !important; font-weight: 800 !important; line-height: 1.18 !important; }
    html body.paper-a5 .credential-item:first-child .credential-label { font-size: 7.8pt !important; font-weight: 900 !important; }
    html body.paper-a5 .credential-item:first-child .credential-value { font-size: 10.8pt !important; font-weight: 900 !important; line-height: 1.18 !important; }
    html body.paper-a5 .credential-value.password { font-size: 13.5pt !important; font-weight: 900 !important; line-height: 1.12 !important; }
    html body.paper-a5 .password-hint { padding: .5mm .75mm !important; font-size: 6.5pt !important; }
    html body.paper-a5 .qr-section { gap: 1.2mm !important; margin-top: 1mm !important; }
    html body.paper-a5 .qr-card {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        padding: .65mm !important;
        text-align: center !important;
    }
    html body.paper-a5 .qr-card img { width: 26mm !important; height: 26mm !important; margin: 0 auto .4mm !important; }
    html body.paper-a5 .qr-card:nth-child(2) img { width: 29mm !important; height: 29mm !important; }
    html body.paper-a5 .qr-title { font-size: 7.6pt !important; font-weight: 800 !important; line-height: 1.12 !important; }
    html body.paper-a5 .qr-card:nth-child(2) .qr-title::after { font-size: 7.6pt !important; }
    html body.paper-a5 .login-url-box { margin-top: .9mm !important; padding: .5mm .85mm !important; }
    html body.paper-a5 .login-url-label { margin-bottom: .08mm !important; font-size: 6.4pt !important; }
    html body.paper-a5 .login-url { font-size: 6.2pt !important; line-height: 1.12 !important; }
    html body.paper-a5 .notice { margin-top: .8mm !important; padding: .55mm .85mm !important; font-size: 6.6pt !important; line-height: 1.2 !important; }
    html body.paper-a5 .document-footer { margin-top: .7mm !important; padding-top: .45mm !important; font-size: 6.2pt !important; }
}

/* --------------------------------------------------------------------------
   Credential layout refinement: identity pair + clearer credentials and QR
   -------------------------------------------------------------------------- */
html body.paper-receipt .account-summary,
html body.paper-a5 .account-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
}

/* Keep identity/linked-person rows full width; only code + account status share
   the final row. This also works for guardian slips that have one extra row. */
html body.paper-receipt .account-summary .summary-item:not(:nth-last-child(-n+2)),
html body.paper-a5 .account-summary .summary-item:not(:nth-last-child(-n+2)) {
    grid-column: 1 / -1 !important;
}
html body.paper-receipt .account-summary .summary-item:nth-last-child(-n+2),
html body.paper-a5 .account-summary .summary-item:nth-last-child(-n+2) {
    grid-column: auto !important;
}

html body.paper-receipt .account-summary {
    gap: 5px !important;
    margin-bottom: 4px !important;
}
html body.paper-a5 .account-summary {
    gap: 6px !important;
    margin-bottom: 5px !important;
}

html body.paper-receipt .credentials-title {
    font-size: 14px !important;
}
html body.paper-a5 .credentials-title {
    font-size: 14px !important;
}

/* Username is the primary handoff value; make it unmistakable and printable. */
html body.paper-receipt .credential-item:first-child .credential-label {
    font-size: 13px !important;
}
html body.paper-receipt .credential-item:first-child .credential-value {
    font-size: 16px !important;
    font-weight: 900 !important;
    line-height: 1.25 !important;
    color: #000 !important;
}
html body.paper-a5 .credential-item:first-child .credential-label {
    font-size: 13.5px !important;
}
html body.paper-a5 .credential-item:first-child .credential-value {
    font-size: 18px !important;
    font-weight: 900 !important;
    line-height: 1.25 !important;
    color: #000 !important;
}

/* Larger QR blocks while retaining enough white quiet-zone space for cameras. */
html body.paper-receipt .qr-card {
    padding: 7px 4px !important;
}
html body.paper-receipt .qr-card img {
    width: 132px !important;
    height: 132px !important;
    margin: 0 auto 5px !important;
}
html body.paper-receipt .qr-card:nth-child(2) img {
    width: 138px !important;
    height: 138px !important;
}
html body.paper-receipt .qr-title,
html body.paper-receipt .qr-card:nth-child(2) .qr-title::after {
    font-size: 13px !important;
}

html body.paper-a5 .qr-card img {
    width: 140px !important;
    height: 140px !important;
}
html body.paper-a5 .qr-card:nth-child(2) img {
    width: 148px !important;
    height: 148px !important;
}
html body.paper-a5 .qr-title,
html body.paper-a5 .qr-card:nth-child(2) .qr-title::after {
    font-size: 13px !important;
}

html body.paper-receipt .login-url-box {
    margin-top: 6px !important;
    padding: 6px 7px !important;
}
html body.paper-receipt .login-url-label {
    font-size: 11.5px !important;
}
html body.paper-receipt .login-url {
    font-family: var(--portal-print-font-family) !important;
    font-size: 11px !important;
    font-weight: 900 !important;
    line-height: 1.25 !important;
}
html body.paper-a5 .login-url-label {
    font-size: 11.5px !important;
}
html body.paper-a5 .login-url {
    font-family: var(--portal-print-font-family) !important;
    font-size: 11px !important;
    font-weight: 900 !important;
    line-height: 1.25 !important;
}

@media print {
    html body.paper-receipt .account-summary,
    html body.paper-a5 .account-summary {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }
    html body.paper-receipt .account-summary .summary-item:not(:nth-last-child(-n+2)),
    html body.paper-a5 .account-summary .summary-item:not(:nth-last-child(-n+2)) {
        grid-column: 1 / -1 !important;
    }
    html body.paper-receipt .account-summary .summary-item:nth-last-child(-n+2),
    html body.paper-a5 .account-summary .summary-item:nth-last-child(-n+2) {
        grid-column: auto !important;
    }
    html body.paper-receipt .account-summary {
        gap: .8mm !important;
        margin-bottom: .6mm !important;
    }
    html body.paper-a5 .account-summary {
        gap: .9mm !important;
        margin-bottom: .7mm !important;
    }

    html body.paper-receipt .credential-item:first-child .credential-label {
        font-size: 8.2pt !important;
    }
    html body.paper-receipt .credential-item:first-child .credential-value {
        font-size: 11.5pt !important;
        font-weight: 900 !important;
        line-height: 1.16 !important;
    }
    html body.paper-a5 .credential-item:first-child .credential-label {
        font-size: 8.3pt !important;
    }
    html body.paper-a5 .credential-item:first-child .credential-value {
        font-size: 11.5pt !important;
        font-weight: 900 !important;
        line-height: 1.16 !important;
    }

    html body.paper-receipt .qr-card {
        padding: .55mm .25mm !important;
    }
    html body.paper-receipt .qr-card img {
        width: 32.5mm !important;
        height: 32.5mm !important;
    }
    html body.paper-receipt .qr-card:nth-child(2) img {
        width: 33.5mm !important;
        height: 33.5mm !important;
    }
    html body.paper-receipt .qr-title,
    html body.paper-receipt .qr-card:nth-child(2) .qr-title::after {
        font-size: 8pt !important;
    }
    html body.paper-receipt .login-url-label {
        font-size: 6.9pt !important;
    }
    html body.paper-receipt .login-url {
        font-size: 6.9pt !important;
        font-weight: 900 !important;
        line-height: 1.12 !important;
    }

    html body.paper-a5 .qr-card img {
        width: 30mm !important;
        height: 30mm !important;
    }
    html body.paper-a5 .qr-card:nth-child(2) img {
        width: 32mm !important;
        height: 32mm !important;
    }
    html body.paper-a5 .login-url-label {
        font-size: 6.9pt !important;
    }
    html body.paper-a5 .login-url {
        font-size: 6.9pt !important;
        font-weight: 900 !important;
        line-height: 1.12 !important;
    }
}
