:root {
    --primary: #007c8a;
    --primary-dark: #005b78;
    --primary-soft: #e8f8fa;
    --ink: #071d3a;
    --muted: #64748b;
    --line: #dbe4ee;
    --card: #ffffff;
    --bg: #f5f8fb;
    --danger: #d61f2c;
    --danger-bg: #fff0f1;
    --blue: #0b72d9;
    --blue-bg: #eef6ff;
    --success: #0b7d38;
    --success-bg: #effaf3;
    --orange: #d97706;
    --orange-bg: #fff7ed;
    --shadow: 0 18px 45px rgba(9, 30, 66, .10);
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    background: radial-gradient(circle at top, #ffffff 0%, var(--bg) 48%, #edf4f8 100%);
    color: var(--ink);
    font-family: "Tajawal", "Cairo", "Segoe UI", Tahoma, Arial, sans-serif;
    direction: rtl;
}

a {
    text-decoration: none;
}

button,
input,
a {
    -webkit-tap-highlight-color: transparent;
}

/* Login */
.login-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.login-card {
    width: min(980px, 100%);
    min-height: 560px;
    display: grid;
    grid-template-columns: 1fr;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: var(--card);
    box-shadow: var(--shadow);
}

.login-brand-panel {
    display: none;
    position: relative;
    background: linear-gradient(135deg, rgba(0, 124, 138, .08), rgba(0, 91, 120, .18)), linear-gradient(135deg, #eef7fb, #ffffff);
    min-height: 100%;
}

.brand-overlay {
    position: absolute;
    inset: 0;
    opacity: .55;
    background: radial-gradient(circle at 18% 35%, rgba(0, 124, 138, .18), transparent 26%), radial-gradient(circle at 88% 82%, rgba(5, 105, 140, .16), transparent 28%);
}

.brand-content {
    position: relative;
    z-index: 1;
    height: 100%;
    padding: 48px 36px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.brand-mark,
.header-logo,
.pdf-fallback-logo {
    width: 72px;
    height: 72px;
    display: grid;
    place-items: center;
    border-radius: 24px;
    color: var(--primary);
    background: #ffffff;
    border: 1px solid #cceaf0;
    font-size: 38px;
    box-shadow: 0 12px 28px rgba(0, 124, 138, .12);
}

.brand-ar,
.header-brand {
    font-weight: 800;
    color: var(--primary-dark);
}

.brand-en {
    font-size: 11px;
    letter-spacing: .6px;
    color: var(--muted);
    font-weight: 700;
}

.brand-content h1 {
    margin: 36px 0 8px;
    font-size: 30px;
    font-weight: 900;
}

.brand-content p {
    color: var(--muted);
    max-width: 280px;
    line-height: 1.8;
}

.secure-note {
    margin-top: auto;
    display: grid;
    gap: 10px;
    color: var(--ink);
}

.login-form-panel {
    padding: 26px 18px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.portal-form {
    width: 100%;
    max-width: 430px;
}

.mobile-brand {
    display: grid;
    justify-items: center;
    gap: 4px;
    margin-bottom: 24px;
}

    .mobile-brand .brand-mark {
        width: 64px;
        height: 64px;
        font-size: 34px;
    }

.portal-form h2 {
    margin: 0 0 10px;
    text-align: center;
    font-size: 26px;
    font-weight: 900;
}

.form-subtitle {
    margin: 0 0 24px;
    text-align: center;
    color: var(--muted);
}

.input-wrap {
    position: relative;
    margin-top: 12px;
}

    .input-wrap input {
        width: 100%;
        height: 56px;
        border: 1px solid var(--line);
        border-radius: 12px;
        padding: 0 52px 0 14px;
        outline: none;
        background: #fff;
        color: var(--ink);
        font-size: 16px;
        transition: .18s ease;
    }

        .input-wrap input:focus {
            border-color: var(--primary);
            box-shadow: 0 0 0 4px rgba(0, 124, 138, .10);
        }

.input-icon {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
}

.field-error {
    display: block;
    min-height: 22px;
    padding-top: 4px;
    color: var(--danger);
    font-size: 13px;
}

.portal-alert {
    border-radius: 12px;
    font-size: 14px;
}

.primary-btn,
.pdf-btn,
.small-btn,
.back-btn,
.print-toolbar button {
    border: 0;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    color: #fff;
    font-weight: 800;
    cursor: pointer;
    transition: transform .16s ease, box-shadow .16s ease;
    box-shadow: 0 12px 24px rgba(0, 124, 138, .22);
}

.primary-btn {
    width: 100%;
    height: 56px;
    margin-top: 6px;
    font-size: 17px;
}

    .primary-btn:hover,
    .pdf-btn:hover,
    .small-btn:hover,
    .back-btn:hover,
    .print-toolbar button:hover {
        transform: translateY(-1px);
        color: #fff;
    }

.support-box {
    margin-top: 24px;
    padding: 20px;
    text-align: center;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: #fafcff;
    color: var(--muted);
}

    .support-box strong {
        display: block;
        margin-top: 8px;
        color: var(--ink);
        font-size: 18px;
    }

/* Portal pages */
.portal-page {
    min-height: 100vh;
}

.portal-header {
    position: sticky;
    top: 0;
    z-index: 10;
    height: 64px;
    padding: 0 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: #fff;
    background: linear-gradient(135deg, #004d78, var(--primary));
    box-shadow: 0 12px 30px rgba(0, 65, 100, .18);
}

    .portal-header h1 {
        margin: 0;
        font-size: 18px;
        font-weight: 900;
    }

.header-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #fff;
    font-size: 13px;
}

.header-logo {
    width: 34px;
    height: 34px;
    border-radius: 12px;
    font-size: 20px;
    box-shadow: none;
}

.menu-btn {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 12px;
    color: #fff;
    background: rgba(255, 255, 255, .14);
    font-size: 22px;
}

.logout-form {
    margin: 0;
}

.portal-container {
    width: 100%;
    max-width: 1180px;
    margin: 0 auto;
    padding: 16px;
}

.patient-summary {
    position: relative;
    display: grid;
    grid-template-columns: 56px 1fr;
    gap: 14px;
    align-items: center;
    padding: 16px;
    border-radius: 16px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, .86);
    box-shadow: 0 14px 35px rgba(9, 30, 66, .06);
}

.avatar {
    width: 56px;
    height: 56px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: #edf2f7;
    font-size: 28px;
}

.patient-main h2 {
    margin: 0 0 10px;
    color: var(--primary-dark);
    font-size: 18px;
    font-weight: 900;
}

.patient-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 18px;
    color: var(--muted);
    font-size: 13px;
}

    .patient-meta b {
        color: var(--ink);
    }

.section-card,
.result-section {
    margin-top: 16px;
    padding: 16px;
    border-radius: 16px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, .92);
    box-shadow: 0 14px 35px rgba(9, 30, 66, .06);
}

.section-title {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
}

    .section-title h3,
    .result-section h3 {
        margin: 0;
        font-size: 17px;
        font-weight: 900;
    }

.portal-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
}

    .portal-table th,
    .portal-table td {
        padding: 13px 12px;
        border-bottom: 1px solid var(--line);
        text-align: center;
        vertical-align: middle;
        font-size: 14px;
    }

    .portal-table th {
        background: #f7fafc;
        color: var(--ink);
        font-weight: 900;
    }

    .portal-table tr:last-child td {
        border-bottom: 0;
    }

.date-cell,
.result-value,
.test-name {
    font-weight: 900;
    color: var(--ink);
}

.small-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 36px;
    padding: 8px 14px;
    font-size: 13px;
}

.days-cards {
    display: none;
}

.day-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 14px;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: #fff;
}

    .day-card + .day-card {
        margin-top: 10px;
    }

    .day-card strong {
        display: block;
        font-size: 18px;
    }

    .day-card span {
        color: var(--muted);
        font-size: 13px;
    }

.hint-text {
    margin: 14px 0 0;
    color: var(--muted);
    text-align: left;
    font-size: 13px;
}

.empty-state {
    display: grid;
    gap: 6px;
    text-align: center;
    padding: 32px 16px;
    color: var(--muted);
}

    .empty-state strong {
        color: var(--ink);
    }

.results-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.back-btn {
    padding: 10px 16px;
    background: #fff;
    color: var(--ink);
    border: 1px solid var(--line);
    box-shadow: none;
}

    .back-btn:hover {
        color: var(--ink);
    }

.selected-date {
    min-width: 150px;
    padding: 12px 16px;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: #fff;
    text-align: center;
}

    .selected-date span {
        display: block;
        color: var(--muted);
        font-size: 12px;
    }

    .selected-date strong {
        display: block;
        font-size: 17px;
    }

.actions-row {
    margin: 14px 0;
    display: flex;
    justify-content: flex-start;
}

.pdf-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 10px 18px;
    background: #fff;
    color: var(--primary-dark);
    border: 1px solid var(--primary);
    box-shadow: none;
}

    .pdf-btn:hover {
        color: var(--primary-dark);
    }

.result-section h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    color: var(--ink);
}

.range-cell {
    white-space: pre-line;
}

.flag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 66px;
    padding: 5px 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 900;
}

.flag-high {
    color: var(--danger);
    background: var(--danger-bg);
}

.flag-low {
    color: var(--blue);
    background: var(--blue-bg);
}

.flag-normal {
    color: var(--success);
    background: var(--success-bg);
}

.flag-neutral {
    color: var(--orange);
    background: var(--orange-bg);
}

.result-cards {
    display: none;
}

.result-card {
    padding: 14px;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: #fff;
}

    .result-card + .result-card {
        margin-top: 10px;
    }

.result-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.result-big {
    margin: 10px 0;
    font-size: 25px;
    font-weight: 900;
    direction: ltr;
    text-align: right;
}

    .result-big small {
        color: var(--muted);
        font-size: 13px;
    }

.result-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    color: var(--muted);
    font-size: 13px;
}

    .result-line b {
        color: var(--ink);
        white-space: pre-line;
    }

.legend {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 18px;
    margin: 22px 0;
    color: var(--muted);
    font-weight: 700;
}

.dot {
    width: 10px;
    height: 10px;
    display: inline-block;
    margin-left: 6px;
    border-radius: 50%;
}

    .dot.normal {
        background: var(--success);
    }

    .dot.low {
        background: var(--blue);
    }

    .dot.high {
        background: var(--danger);
    }

    .dot.neutral {
        background: var(--orange);
    }

/* PDF / print page */
.pdf-body {
    background: #e9eef3;
    padding: 18px;
}

.print-toolbar {
    max-width: 980px;
    margin: 0 auto 14px;
    display: flex;
    gap: 10px;
    justify-content: flex-start;
}

    .print-toolbar button {
        padding: 10px 18px;
    }

.pdf-page {
    width: min(980px, 100%);
    min-height: 1320px;
    margin: 0 auto;
    padding: 34px;
    background: #fff;
    color: #071d3a;
    box-shadow: 0 20px 55px rgba(9, 30, 66, .16);
}

.pdf-header {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 22px;
    direction: ltr;
}

.pdf-logo-box img,
.pdf-fallback-logo {
    width: 90px;
    height: 90px;
    object-fit: contain;
}

.pdf-company {
    direction: ltr;
    text-align: left;
}

    .pdf-company h1 {
        margin: 0 0 6px;
        font-size: 24px;
        font-weight: 900;
    }

    .pdf-company p {
        margin: 2px 0;
        font-size: 13px;
        font-weight: 700;
    }

.pdf-line {
    height: 2px;
    margin: 18px 0 16px;
    background: #1d3557;
}

.pdf-title,
.pdf-date {
    text-align: center;
    font-weight: 900;
}

.pdf-title {
    margin: 0 0 18px;
    font-size: 25px;
}

.pdf-patient-box {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px 26px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 12px;
}

    .pdf-patient-box div {
        display: flex;
        justify-content: space-between;
        gap: 12px;
        border-bottom: 1px dashed #edf2f7;
        padding-bottom: 7px;
    }

    .pdf-patient-box span {
        color: var(--muted);
    }

    .pdf-patient-box strong {
        color: var(--ink);
    }

.pdf-date {
    margin: 20px 0;
    font-size: 18px;
    text-decoration: underline;
}

.pdf-section {
    margin-top: 16px;
    break-inside: avoid;
}

    .pdf-section h4 {
        margin: 0 0 8px;
        font-size: 15px;
        font-weight: 900;
    }

.pdf-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

    .pdf-table th,
    .pdf-table td {
        padding: 9px 8px;
        border: 1px solid var(--line);
        text-align: center;
        font-size: 12px;
        vertical-align: middle;
        white-space: pre-line;
    }

    .pdf-table th {
        background: #f7fafc;
        font-weight: 900;
    }

.pdf-signatures {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 70px;
    margin: 46px auto 28px;
    width: 72%;
    direction: ltr;
}

    .pdf-signatures div {
        text-align: center;
    }

    .pdf-signatures span {
        display: block;
        height: 34px;
        border-bottom: 1px solid #1d3557;
    }

.pdf-footer {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    border-top: 1px solid #1d3557;
    padding-top: 12px;
    font-size: 12px;
    font-weight: 800;
    direction: ltr;
}


/* =========================================================
   Lab Day Results - Test Group Cards
   يخلّي كل تحليل يظهر ككارت مستقل وتحته البنود التابعة له
   ========================================================= */

.result-section {
    margin-top: 22px;
}

    .result-section > h3 {
        display: flex;
        align-items: center;
        gap: 8px;
        color: #052f4f;
        font-size: 16px;
        font-weight: 900;
        margin: 0 0 12px;
    }

.test-card {
    background: #fff;
    border: 1px solid #dbe7ef;
    border-radius: 16px;
    margin-bottom: 18px;
    overflow: hidden;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.045);
}

.test-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 14px 16px;
    background: linear-gradient(90deg, #f8fbfd, #eef8fb);
    border-bottom: 1px solid #dbe7ef;
}

    .test-title strong,
    .test-card-header strong {
        display: block;
        color: #073b4c;
        font-size: 15px;
        font-weight: 900;
    }

    .test-title small,
    .test-card-header small {
        display: block;
        color: #64748b;
        font-size: 12px;
        font-weight: 700;
        margin-top: 4px;
        direction: ltr;
        text-align: right;
    }

.test-count {
    background: #e8f7f8;
    color: #087987;
    border: 1px solid #bfe7ea;
    padding: 5px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}

.test-card .results-table-wrap {
    margin: 0;
    border-radius: 0;
    box-shadow: none;
}

.test-card .portal-table {
    margin: 0;
    border-radius: 0;
    border-left: 0;
    border-right: 0;
    border-bottom: 0;
}

    .test-card .portal-table th {
        background: #f8fafc;
    }

    .test-card .portal-table tr:last-child td {
        border-bottom: none;
    }

/* Mobile test cards */
@media (max-width: 640px) {
    .result-section {
        margin-top: 18px;
    }

        .result-section > h3 {
            font-size: 15px;
            margin-bottom: 10px;
        }

    .test-card {
        border-radius: 14px;
        margin-bottom: 14px;
    }

    .test-card-header {
        align-items: flex-start;
        flex-direction: column;
        padding: 12px;
        gap: 8px;
    }

        .test-title strong,
        .test-card-header strong {
            font-size: 14px;
            line-height: 1.6;
        }

        .test-title small,
        .test-card-header small {
            font-size: 11px;
            line-height: 1.5;
        }

    .test-count {
        font-size: 11px;
        padding: 4px 9px;
    }
}

/* Responsive */
@media (min-width: 860px) {
    .login-card {
        grid-template-columns: 1fr 1.2fr;
    }

    .login-brand-panel {
        display: block;
    }

    .mobile-brand {
        display: none;
    }

    .login-form-panel {
        padding: 42px;
    }

    .portal-header {
        height: 72px;
        padding: 0 28px;
    }

        .portal-header h1 {
            font-size: 22px;
        }

    .portal-container {
        padding: 28px;
    }
}

@media (max-width: 700px) {
    .login-shell {
        align-items: stretch;
        padding: 0;
        background: #fff;
    }

    .login-card {
        min-height: 100vh;
        border: 0;
        border-radius: 0;
        box-shadow: none;
    }

    .login-form-panel {
        padding: 24px 18px;
    }

    .portal-header {
        height: 58px;
    }

    .header-brand span:last-child {
        display: none;
    }

    .portal-header h1 {
        font-size: 16px;
    }

    .portal-container {
        padding: 12px;
    }

    .patient-summary {
        grid-template-columns: 48px 1fr;
        padding: 14px;
    }

    .avatar {
        width: 48px;
        height: 48px;
        font-size: 24px;
    }

    .patient-main h2 {
        font-size: 16px;
    }

    .patient-meta {
        gap: 7px 12px;
        font-size: 12px;
    }

    .days-table-wrap {
        display: none;
    }

    .days-cards {
        display: block;
    }

    .section-card,
    .result-section {
        padding: 12px;
    }

    .results-topbar {
        align-items: stretch;
    }

    .selected-date {
        flex: 1;
    }

    .actions-row {
        position: sticky;
        top: 66px;
        z-index: 8;
        margin: 10px 0;
    }

    .pdf-btn {
        width: 100%;
        background: linear-gradient(135deg, var(--primary-dark), var(--primary));
        color: #fff;
        border: 0;
        box-shadow: 0 12px 24px rgba(0, 124, 138, .20);
    }

    .results-table-wrap {
        display: none;
    }

    .result-cards {
        display: block;
    }

    .legend {
        justify-content: space-around;
        gap: 10px;
        font-size: 12px;
    }

    .pdf-body {
        padding: 0;
        background: #fff;
    }

    .pdf-page {
        min-height: auto;
        padding: 18px 12px;
        box-shadow: none;
    }

    .pdf-header {
        align-items: flex-start;
        gap: 12px;
    }

    .pdf-company h1 {
        font-size: 16px;
    }

    .pdf-company p {
        font-size: 10px;
    }

    .pdf-logo-box img,
    .pdf-fallback-logo {
        width: 58px;
        height: 58px;
    }

    .pdf-patient-box {
        grid-template-columns: 1fr;
        padding: 12px;
    }

    .pdf-table th,
    .pdf-table td {
        padding: 7px 5px;
        font-size: 10px;
    }

    .pdf-signatures {
        width: 100%;
        gap: 24px;
    }

    .pdf-footer {
        flex-wrap: wrap;
    }
}

@media print {
    @page {
        size: A4;
        margin: 10mm;
    }

    body {
        background: #fff !important;
    }

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

    .pdf-page {
        width: 100%;
        min-height: auto;
        margin: 0;
        padding: 0;
        box-shadow: none;
    }

    .pdf-table th,
    .pdf-table td {
        font-size: 10px;
        padding: 6px;
    }

    .flag {
        background: transparent !important;
        padding: 0;
    }
}


/* =========================================================
   Portal bilingual + final visual fixes
   ========================================================= */

.lang-switch {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 6px 11px;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,.38);
    color: #fff;
    background: rgba(255,255,255,.14);
    font-size: 12px;
    font-weight: 900;
    line-height: 1;
}

    .lang-switch:hover {
        color: #fff;
        background: rgba(255,255,255,.22);
    }

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.login-lang-row {
    display: flex;
    justify-content: center;
    margin-bottom: 14px;
}

.login-lang-switch {
    color: var(--primary-dark);
    border-color: #c9e5eb;
    background: #f3fbfd;
    min-width: 86px;
}

    .login-lang-switch:hover {
        color: var(--primary-dark);
        background: #e8f8fa;
    }

/* Balanced login brand panel */
.brand-content-balanced {
    justify-content: space-between;
    gap: 24px;
}

.hero-top-logo {
    width: 100%;
    display: flex;
    justify-content: center;
}

.hero-middle-content {
    margin: auto 0;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

    .hero-middle-content h2 {
        margin: 0;
        color: var(--ink);
        font-size: 32px;
        line-height: 1.35;
        font-weight: 950;
    }

    .hero-middle-content p {
        margin: 0;
        max-width: 320px;
        color: var(--muted);
        font-size: 16px;
        line-height: 1.9;
    }

.hero-bottom-security {
    width: 100%;
    margin-top: auto;
    text-align: center;
    display: grid;
    justify-items: center;
    gap: 8px;
    color: var(--ink);
}

.security-icon {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: #fff;
    border: 1px solid #d7e8ef;
    box-shadow: 0 8px 20px rgba(9,30,66,.07);
}

.portal-logo-img {
    max-width: 165px;
    width: 100%;
    height: auto;
    object-fit: contain;
}

.mobile-logo {
    max-width: 110px;
    margin-bottom: 6px;
}

/* Remove test count badge */
.test-count {
    display: none !important;
}

.test-card-header {
    justify-content: flex-end;
}

.test-title {
    width: 100%;
    text-align: right;
}

.is-en .test-title {
    text-align: left;
}

.is-en {
    direction: ltr;
}

    .is-en .portal-header,
    .is-en .results-topbar,
    .is-en .patient-summary,
    .is-en .patient-meta,
    .is-en .test-card-header,
    .is-en .result-card-head,
    .is-en .result-line {
        direction: ltr;
    }

        .is-en .test-title small,
        .is-en .test-card-header small {
            text-align: left;
        }

    .is-en .back-btn {
        direction: ltr;
    }

.number-cell,
.result-value,
.unit-cell,
.range-cell {
    direction: ltr;
    unicode-bidi: plaintext;
    text-align: center;
}

.preserve-lines,
.range-cell {
    white-space: pre-line;
}

.unit-cell {
    white-space: nowrap;
}

.range-cell {
    font-family: "Segoe UI", Tahoma, Arial, sans-serif;
    line-height: 1.65;
}

.result-big.number-cell {
    text-align: inherit;
}

.flag:empty {
    display: none;
}

.flag-neutral {
    color: var(--orange);
    background: var(--orange-bg);
}

/* Better mobile language/header spacing */
@media (max-width: 700px) {
    .header-actions {
        gap: 6px;
    }

    .lang-switch {
        min-height: 32px;
        padding: 6px 9px;
        font-size: 11px;
    }

    .hero-middle-content h2 {
        font-size: 26px;
    }

    .hero-middle-content p {
        font-size: 14px;
    }

    .portal-logo-img {
        max-width: 132px;
    }

    .mobile-logo {
        max-width: 96px;
    }
}

@media (min-width: 860px) {
    .brand-content-balanced {
        padding-top: 52px;
        padding-bottom: 52px;
    }
}

/* =========================================================
   Final portal refinements: bilingual UI, clean ranges, logo
   ========================================================= */
.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.lang-switch {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 64px;
    min-height: 34px;
    padding: 7px 12px;
    border: 1px solid rgba(0, 124, 138, .28);
    border-radius: 999px;
    background: #ffffff;
    color: var(--primary-dark);
    font-weight: 900;
    font-size: 13px;
}

.portal-logo-img {
    width: 118px;
    max-width: 100%;
    height: auto;
    object-fit: contain;
    display: block;
    margin: 0 auto 10px;
}

.mobile-logo {
    width: 92px;
}

.brand-content-balanced {
    justify-content: initial;
}

.hero-top-logo {
    margin-top: 10px;
    text-align: center;
}

.hero-middle-content {
    margin: auto 0;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

    .hero-middle-content h2 {
        margin: 0;
        font-size: 30px;
        font-weight: 900;
        color: var(--ink);
    }

    .hero-middle-content p {
        margin: 0;
        color: var(--muted);
        line-height: 1.9;
        max-width: 300px;
    }

.hero-bottom-security {
    margin-top: auto;
    padding-bottom: 8px;
    text-align: center;
    display: grid;
    justify-items: center;
    gap: 8px;
}

.security-icon {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: #fff;
    border: 1px solid var(--line);
}

.alt-name,
.bilingual-name small,
.bilingual-title small {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    line-height: 1.5;
}

.bilingual-name span {
    display: block;
    font-weight: 900;
}

.test-count {
    display: none !important;
}

.test-card-header {
    justify-content: flex-end;
}

.test-title {
    width: 100%;
    text-align: right;
}

.is-en .test-title,
.is-en .bilingual-name,
.is-en .patient-main,
.is-en .section-card,
.is-en .result-section {
    text-align: left;
}

.is-ar .test-title,
.is-ar .bilingual-name,
.is-ar .patient-main {
    text-align: right;
}

.number-cell,
.result-value,
.unit-cell,
.range-cell {
    direction: ltr;
    unicode-bidi: isolate;
    text-align: center;
}

.preserve-lines,
.range-cell {
    white-space: pre-line;
}

.unit-cell {
    white-space: nowrap;
}

.flag-neutral:empty {
    display: none;
}

.portal-table td.test-name {
    min-width: 230px;
}

.result-line b {
    direction: ltr;
    unicode-bidi: isolate;
    text-align: left;
}

@media (max-width: 700px) {
    .portal-logo-img {
        width: 94px;
    }

    .hero-middle-content h2 {
        font-size: 24px;
    }

    .portal-table td.test-name {
        min-width: auto;
    }

    .result-card-head {
        align-items: flex-start;
    }
}

.pdf-test-title {
    margin: 10px 0 6px;
    color: var(--primary-dark);
    font-size: 13px;
    font-weight: 900;
}


/* =========================================================
   Final requested fixes: patient name source, header logo, login logo layout
   ========================================================= */
.header-logo-img {
    width: 38px;
    height: 38px;
    object-fit: contain;
    display: block;
    border-radius: 10px;
    background: #fff;
    padding: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .08);
}

.header-brand {
    gap: 10px;
}

.hero-top-logo {
    width: 100%;
    margin-top: 0;
    display: flex !important;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    text-align: center;
    gap: 3px;
}

.login-brand-panel .portal-logo-img {
    width: 104px;
    max-width: 104px;
    margin: 0 auto 8px;
}

.mobile-brand .portal-logo-img,
.mobile-logo {
    width: 82px;
    max-width: 82px;
    margin: 0 auto 6px;
}

.hero-top-logo .brand-ar,
.mobile-brand .brand-ar {
    color: var(--primary-dark);
    font-size: 15px;
    font-weight: 900;
    line-height: 1.35;
}

.hero-top-logo .brand-en,
.mobile-brand .brand-en {
    color: #547085;
    font-size: 10px;
    font-weight: 900;
    letter-spacing: .7px;
    line-height: 1.3;
}

.brand-content-balanced {
    min-height: 100%;
    justify-content: space-between !important;
    padding-top: 44px;
    padding-bottom: 44px;
}

.hero-middle-content {
    margin: auto 0 !important;
}

.hero-bottom-security {
    margin-top: 0 !important;
}

.patient-main h2 {
    color: var(--primary-dark);
    font-weight: 950;
}

.patient-main .alt-name {
    display: none !important;
}

@media (max-width: 700px) {
    .header-logo-img {
        width: 34px;
        height: 34px;
        padding: 3px;
    }

    .login-brand-panel .portal-logo-img,
    .mobile-brand .portal-logo-img,
    .mobile-logo {
        width: 74px;
        max-width: 74px;
    }
}

/* =========================================================
   PDF Report V2 - A4 printable report with audit footer
   ========================================================= */
.pdf-report-v2 {
    background: #eef3f7;
    color: #071d3a;
}

.pdf-a4-report {
    width: 210mm;
    min-height: 297mm;
    max-width: 100%;
    margin: 0 auto;
    padding: 12mm 10mm 22mm;
    background: #fff;
    box-shadow: 0 20px 55px rgba(9, 30, 66, .16);
    position: relative;
}

.report-header {
    display: grid;
    grid-template-columns: 92px 1fr;
    gap: 18px;
    align-items: center;
    direction: ltr;
    border-bottom: 2px solid #102a43;
    padding-bottom: 10px;
    break-after: avoid;
}

.report-logo-side img {
    width: 82px;
    height: 82px;
    object-fit: contain;
    display: block;
}

.report-company-side {
    text-align: left;
    direction: ltr;
}

    .report-company-side h1 {
        margin: 0 0 3px;
        font-size: 19px;
        font-weight: 900;
        color: #071d3a;
        letter-spacing: .2px;
    }

    .report-company-side h2 {
        margin: 0 0 4px;
        font-size: 15px;
        font-weight: 900;
        color: #005b78;
    }

    .report-company-side p {
        margin: 2px 0;
        font-size: 11px;
        font-weight: 700;
        color: #334155;
    }

.report-sep {
    color: #94a3b8;
    margin: 0 8px;
}

.report-title-strip {
    margin: 10px 0 10px;
    padding: 8px 10px;
    border: 1px solid #dbe4ee;
    background: #f8fafc;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    break-inside: avoid;
}

    .report-title-strip h3 {
        margin: 0;
        font-size: 18px;
        font-weight: 900;
        color: #071d3a;
    }

    .report-title-strip span {
        font-size: 10px;
        font-weight: 800;
        color: #64748b;
    }

.report-patient-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px 16px;
    padding: 10px;
    border: 1px solid #dbe4ee;
    border-radius: 8px;
    break-inside: avoid;
}

    .report-patient-grid div {
        display: flex;
        justify-content: space-between;
        gap: 10px;
        border-bottom: 1px dashed #e5edf5;
        padding-bottom: 4px;
        font-size: 11px;
    }

    .report-patient-grid span {
        color: #64748b;
        font-weight: 800;
        white-space: nowrap;
    }

    .report-patient-grid strong {
        color: #071d3a;
        font-weight: 900;
        text-align: end;
    }

.report-security-note {
    margin: 9px 0 12px;
    padding: 7px 9px;
    border: 1px solid #cfe8ef;
    background: #f0fbfd;
    color: #334155;
    border-radius: 8px;
    font-size: 10px;
    line-height: 1.6;
    break-inside: avoid;
}

    .report-security-note strong {
        color: #005b78;
    }

.report-results-area {
    padding-bottom: 12mm;
}

.report-section-block {
    margin-top: 12px;
    padding: 0;
    border: 0;
    box-shadow: none;
    background: transparent;
    break-inside: auto;
}

    .report-section-block > h4 {
        margin: 0 0 8px;
        padding: 5px 8px;
        border-right: 4px solid #007c8a;
        background: #f1f8fb;
        color: #073b4c;
        font-size: 13px;
        font-weight: 900;
        break-after: avoid;
    }

.pdf-test-block {
    margin: 0 0 11px;
    break-inside: avoid;
    page-break-inside: avoid;
}

    .pdf-test-block.large-test {
        break-inside: auto;
        page-break-inside: auto;
    }

.pdf-test-title {
    margin: 0 0 5px;
    color: #005b78;
    font-size: 12px;
    font-weight: 900;
    text-align: end;
    break-after: avoid;
}

    .pdf-test-title span {
        display: block;
    }

    .pdf-test-title small {
        display: block;
        margin-top: 2px;
        color: #475569;
        font-size: 9.5px;
        font-weight: 800;
        direction: ltr;
    }

.report-result-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    background: #fff;
}

    .report-result-table th,
    .report-result-table td {
        border: 1px solid #d7e1ea;
        padding: 5px 6px;
        font-size: 10.5px;
        line-height: 1.55;
        vertical-align: middle;
        text-align: center;
        white-space: pre-line;
    }

    .report-result-table th {
        background: #f8fafc;
        color: #071d3a;
        font-weight: 900;
    }

        .report-result-table th:nth-child(1),
        .report-result-table td:nth-child(1) {
            width: 34%;
        }

        .report-result-table th:nth-child(2),
        .report-result-table td:nth-child(2) {
            width: 13%;
        }

        .report-result-table th:nth-child(3),
        .report-result-table td:nth-child(3) {
            width: 14%;
        }

        .report-result-table th:nth-child(4),
        .report-result-table td:nth-child(4) {
            width: 23%;
        }

        .report-result-table th:nth-child(5),
        .report-result-table td:nth-child(5) {
            width: 16%;
        }

.pdf-final-approval {
    margin-top: 18px;
    padding-top: 10px;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
    break-inside: avoid;
    page-break-inside: avoid;
}

.approval-card {
    min-height: 105px;
    text-align: center;
    border-top: 1px solid #1d3557;
    padding-top: 8px;
    position: relative;
}

    .approval-card strong,
    .approval-card span,
    .approval-card small {
        display: block;
    }

    .approval-card strong {
        font-size: 12px;
        font-weight: 900;
        color: #071d3a;
    }

    .approval-card span {
        margin-top: 5px;
        font-size: 12px;
        font-weight: 900;
        color: #071d3a;
    }

    .approval-card small {
        margin-top: 3px;
        color: #64748b;
        font-size: 10px;
        font-weight: 800;
    }

.lab-stamp-img {
    width: 145px;
    max-height: 62px;
    object-fit: contain;
    margin: 8px auto 0;
    opacity: .92;
    display: block;
}

.pdf-security-footer {
    margin-top: 12px;
    border-top: 1px solid #1d3557;
    padding-top: 6px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
    color: #475569;
    font-size: 9.5px;
    font-weight: 800;
    direction: ltr;
    line-height: 1.55;
    background: #fff;
}

    .pdf-security-footer div:last-child {
        display: flex;
        gap: 12px;
        flex-wrap: wrap;
        justify-content: flex-end;
    }

    .pdf-security-footer span {
        white-space: nowrap;
    }

.pdf-report-v2 .bilingual-name span {
    display: block;
    font-weight: 900;
}

.pdf-report-v2 .bilingual-name small {
    display: block;
    margin-top: 2px;
    color: #334155;
    font-size: 9px;
    font-weight: 800;
    line-height: 1.4;
}

@media screen and (max-width: 800px) {
    .pdf-a4-report {
        width: 100%;
        padding: 16px 12px 70px;
        min-height: auto;
    }

    .report-header {
        grid-template-columns: 70px 1fr;
        gap: 12px;
    }

    .report-logo-side img {
        width: 64px;
        height: 64px;
    }

    .report-patient-grid,
    .pdf-final-approval {
        grid-template-columns: 1fr;
    }

    .report-title-strip {
        align-items: flex-start;
        flex-direction: column;
    }
}

@media print {
    @page {
        size: A4;
        margin: 10mm 8mm 16mm;
    }

    body.pdf-report-v2 {
        background: #fff !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

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

    .pdf-a4-report {
        width: 100%;
        min-height: auto;
        margin: 0;
        padding: 0 0 15mm;
        box-shadow: none;
    }

    .report-header,
    .report-title-strip,
    .report-patient-grid,
    .report-security-note,
    .pdf-final-approval {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .pdf-test-block {
        break-inside: avoid;
        page-break-inside: avoid;
    }

        .pdf-test-block.large-test {
            break-inside: auto;
            page-break-inside: auto;
        }

    .report-result-table thead {
        display: table-header-group;
    }

    .report-result-table tr {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .report-result-table th,
    .report-result-table td {
        font-size: 9.2px;
        padding: 4px 5px;
    }

    .flag {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .pdf-security-footer {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        padding-top: 5px;
        font-size: 8.7px;
    }
}

/* =========================================================
   FINAL REPORT PRINT FIXES - 2026-07-08
   1) Footer audit data direction fixed to English/LTR
   2) Results can start on first page after patient info
   3) Better A4 pagination without wasting first page
   ========================================================= */

.pdf-security-footer,
.pdf-security-footer * {
    direction: ltr !important;
    unicode-bidi: embed;
    text-align: left;
    font-family: "Tajawal", "Cairo", "Segoe UI", Tahoma, Arial, sans-serif;
}

.pdf-security-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    flex-wrap: nowrap;
}

    .pdf-security-footer .footer-audit,
    .pdf-security-footer div:first-child {
        flex: 1 1 auto;
        white-space: nowrap;
    }

    .pdf-security-footer .footer-contact,
    .pdf-security-footer div:last-child {
        flex: 0 0 auto;
        white-space: nowrap;
    }

.report-results-area,
.pdf-results,
.pdf-results-start,
.report-section-block:first-child,
.report-section-block:first-of-type {
    break-before: auto !important;
    page-break-before: auto !important;
    margin-top: 8px !important;
}

.report-title-strip {
    margin-bottom: 8px !important;
}

.report-patient-grid {
    margin-bottom: 8px !important;
}

.report-security-note {
    margin: 7px 0 8px !important;
    padding: 6px 9px !important;
}

@media print {
    @page {
        size: A4;
        margin: 9mm 8mm 15mm;
    }

    body.pdf-report-v2 {
        background: #fff !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

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

    .pdf-a4-report {
        width: 100% !important;
        min-height: auto !important;
        height: auto !important;
        margin: 0 !important;
        padding: 0 0 14mm !important;
        box-shadow: none !important;
    }

    .report-header {
        padding-bottom: 7px !important;
        margin-bottom: 7px !important;
        break-after: avoid;
        page-break-after: avoid;
    }

    .report-logo-side img {
        width: 70px !important;
        height: 70px !important;
    }

    .report-company-side h1 {
        font-size: 17px !important;
        margin-bottom: 2px !important;
    }

    .report-company-side h2 {
        font-size: 13px !important;
        margin-bottom: 2px !important;
    }

    .report-company-side p {
        font-size: 9.8px !important;
        margin: 1px 0 !important;
    }

    .report-title-strip {
        margin: 7px 0 7px !important;
        padding: 6px 8px !important;
        break-inside: avoid;
        page-break-inside: avoid;
    }

        .report-title-strip h3 {
            font-size: 16px !important;
        }

        .report-title-strip span {
            font-size: 9px !important;
        }

    .report-patient-grid {
        gap: 4px 12px !important;
        padding: 7px 9px !important;
        margin-bottom: 6px !important;
        break-inside: avoid;
        page-break-inside: avoid;
    }

        .report-patient-grid div {
            padding-bottom: 3px !important;
            font-size: 9.7px !important;
        }

    .report-security-note {
        margin: 6px 0 7px !important;
        padding: 5px 8px !important;
        font-size: 9px !important;
        line-height: 1.45 !important;
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .report-results-area {
        margin-top: 0 !important;
        padding-bottom: 11mm !important;
        break-before: auto !important;
        page-break-before: auto !important;
    }

    .report-section-block {
        margin-top: 8px !important;
        break-before: auto !important;
        page-break-before: auto !important;
        break-inside: auto;
        page-break-inside: auto;
    }

        .report-section-block > h4 {
            margin: 0 0 5px !important;
            padding: 4px 7px !important;
            font-size: 11.5px !important;
            break-after: avoid;
            page-break-after: avoid;
        }

    /* Let the first/large test start on page 1 instead of being pushed to page 2. */
    .pdf-test-block,
    .pdf-test-block.large-test {
        margin-bottom: 8px !important;
        break-inside: auto !important;
        page-break-inside: auto !important;
        break-before: auto !important;
        page-break-before: auto !important;
    }

    .pdf-test-title {
        margin: 0 0 4px !important;
        font-size: 10.8px !important;
        break-after: avoid;
        page-break-after: avoid;
    }

        .pdf-test-title small {
            font-size: 8.5px !important;
        }

    .report-result-table {
        page-break-inside: auto;
    }

        .report-result-table thead {
            display: table-header-group;
        }

        .report-result-table tr {
            break-inside: avoid;
            page-break-inside: avoid;
        }

        .report-result-table th,
        .report-result-table td {
            font-size: 8.8px !important;
            padding: 3.4px 4px !important;
            line-height: 1.35 !important;
        }

            .report-result-table th:nth-child(1),
            .report-result-table td:nth-child(1) {
                width: 35% !important;
            }

            .report-result-table th:nth-child(2),
            .report-result-table td:nth-child(2) {
                width: 12% !important;
            }

            .report-result-table th:nth-child(3),
            .report-result-table td:nth-child(3) {
                width: 13% !important;
            }

            .report-result-table th:nth-child(4),
            .report-result-table td:nth-child(4) {
                width: 24% !important;
            }

            .report-result-table th:nth-child(5),
            .report-result-table td:nth-child(5) {
                width: 16% !important;
            }

    .flag {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .pdf-final-approval {
        break-inside: avoid;
        page-break-inside: avoid;
        margin-top: 18px !important;
        padding-top: 8px !important;
    }

    .approval-card {
        min-height: 88px !important;
    }

    .lab-stamp-img {
        width: 120px !important;
        max-height: 52px !important;
    }

    .pdf-security-footer {
        position: fixed !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        margin: 0 !important;
        padding-top: 4px !important;
        border-top: 1px solid #1d3557 !important;
        background: #fff !important;
        color: #475569 !important;
        font-size: 7.8px !important;
        line-height: 1.35 !important;
        direction: ltr !important;
        text-align: left !important;
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        gap: 8px !important;
        white-space: nowrap !important;
    }

        .pdf-security-footer *,
        .pdf-security-footer strong,
        .pdf-security-footer span {
            direction: ltr !important;
            unicode-bidi: embed !important;
            text-align: left !important;
            white-space: nowrap !important;
        }

        .pdf-security-footer div:first-child {
            flex: 1 1 auto !important;
            overflow: hidden !important;
            text-overflow: ellipsis !important;
        }

        .pdf-security-footer div:last-child {
            flex: 0 0 auto !important;
            display: flex !important;
            gap: 8px !important;
            justify-content: flex-end !important;
            flex-wrap: nowrap !important;
        }
}

/* =========================================================
   Compact PDF Report Rows - Final Override
   تقليل ارتفاع صفوف تقرير الطباعة وتقليل عدد الصفحات
   ========================================================= */

.pdf-table th,
.pdf-table td,
.report-result-table th,
.report-result-table td {
    padding: 5px 6px !important;
    font-size: 10.5px !important;
    line-height: 1.35 !important;
}

.pdf-table .result-value,
.report-result-table .result-value {
    font-size: 10.5px !important;
    font-weight: 800 !important;
}

.pdf-table .flag,
.report-result-table .flag,
.flag {
    min-width: 46px !important;
    padding: 2px 6px !important;
    font-size: 10px !important;
    line-height: 1.2 !important;
}

.pdf-test-block {
    margin-bottom: 7px !important;
}

    .pdf-test-title,
    .pdf-test-block h4,
    .pdf-section h4 {
        margin: 5px 0 4px !important;
        font-size: 12px !important;
        line-height: 1.25 !important;
    }

.pdf-section {
    margin-top: 8px !important;
}

.pdf-section-title {
    padding: 5px 8px !important;
    margin: 6px 0 6px !important;
    font-size: 13px !important;
    line-height: 1.25 !important;
}

.pdf-result-name-en,
.pdf-result-name-ar,
.pdf-table small,
.report-result-table small {
    font-size: 9.5px !important;
    line-height: 1.25 !important;
}

.pdf-patient-box {
    padding: 9px 12px !important;
    gap: 5px 14px !important;
}

    .pdf-patient-box div {
        padding-bottom: 4px !important;
        font-size: 11px !important;
    }

.pdf-title {
    font-size: 20px !important;
    margin-bottom: 8px !important;
}

.pdf-security-note {
    margin: 6px 0 7px !important;
    padding: 6px 10px !important;
    font-size: 10.5px !important;
}

.pdf-line {
    margin: 8px 0 8px !important;
}

.pdf-header {
    margin-bottom: 6px !important;
}

.pdf-company h1 {
    font-size: 19px !important;
    margin-bottom: 3px !important;
}

.pdf-company p {
    font-size: 10.5px !important;
    margin: 1px 0 !important;
}

.pdf-logo-box img,
.pdf-fallback-logo {
    width: 68px !important;
    height: 68px !important;
}

.pdf-final-approval,
.pdf-signature-area {
    margin-top: 20px !important;
}

.stamp-img,
.pdf-stamp,
.lab-stamp-img {
    max-width: 135px !important;
    width: 135px !important;
}

@media print {
    .pdf-table th,
    .pdf-table td,
    .report-result-table th,
    .report-result-table td {
        padding: 4px 5px !important;
        font-size: 9.8px !important;
        line-height: 1.28 !important;
    }

    .pdf-test-block {
        margin-bottom: 6px !important;
    }

    .pdf-table .flag,
    .report-result-table .flag,
    .flag {
        font-size: 9.5px !important;
        padding: 1px 5px !important;
    }

    .pdf-result-name-en,
    .pdf-result-name-ar,
    .pdf-table small,
    .report-result-table small {
        font-size: 9px !important;
        line-height: 1.2 !important;
    }

    .pdf-section-title {
        padding: 4px 7px !important;
        margin: 5px 0 !important;
    }

    .pdf-security-footer {
        direction: ltr !important;
        text-align: left !important;
        font-size: 7.8px !important;
    }

        .pdf-security-footer *,
        .pdf-security-footer strong,
        .pdf-security-footer span {
            direction: ltr !important;
            unicode-bidi: embed !important;
            text-align: left !important;
        }
}

/* =========================================================
   Secure File Number Lookup Popup
   ========================================================= */
.portal-form-wrap {
    width: 100%;
    max-width: 430px;
}

.lookup-link {
    margin: 12px auto 0;
    display: block;
    border: 0;
    background: transparent;
    color: var(--primary-dark);
    font-weight: 900;
    cursor: pointer;
    font-size: 14px;
}

.lookup-link:hover {
    text-decoration: underline;
}

.lookup-link:disabled,
.primary-btn:disabled,
.input-wrap input:disabled {
    cursor: not-allowed;
    opacity: .62;
}

.lookup-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 9999;
    padding: 16px;
    display: grid;
    place-items: center;
    background: rgba(7, 29, 58, .46);
    backdrop-filter: blur(6px);
}

.lookup-modal-backdrop[hidden] {
    display: none !important;
}

.lookup-modal {
    position: relative;
    width: min(470px, 100%);
    padding: 26px 24px 24px;
    border-radius: 22px;
    background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
    border: 1px solid rgba(219, 228, 238, .95);
    box-shadow: 0 28px 80px rgba(7, 29, 58, .28);
    overflow: hidden;
}

.lookup-modal::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 6px;
    background: linear-gradient(90deg, var(--primary-dark), var(--primary));
}

.lookup-close {
    position: absolute;
    top: 14px;
    left: 14px;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 12px;
    background: #f1f5f9;
    color: var(--ink);
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
}

.lookup-modal.is-en .lookup-close,
.lookup-modal-backdrop.is-en .lookup-close {
    left: auto;
    right: 14px;
}

.lookup-modal-icon {
    width: 62px;
    height: 62px;
    display: grid;
    place-items: center;
    margin: 0 auto 12px;
    border-radius: 20px;
    color: var(--primary-dark);
    background: var(--primary-soft);
    border: 1px solid #cceaf0;
    font-size: 30px;
}

.lookup-modal h3 {
    margin: 0 0 8px;
    color: var(--ink);
    font-size: 22px;
    font-weight: 900;
    text-align: center;
}

.lookup-modal p {
    margin: 0 0 16px;
    color: var(--muted);
    text-align: center;
    line-height: 1.75;
    font-size: 14px;
}

.lookup-security-note {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    padding: 11px 12px;
    margin-bottom: 16px;
    border-radius: 14px;
    background: #f0fbfc;
    border: 1px solid #cceef2;
    color: var(--primary-dark);
    font-size: 12.5px;
    line-height: 1.6;
}

.lookup-security-note span {
    flex: 0 0 auto;
}

.lookup-submit {
    margin-top: 12px;
}

.lookup-result {
    margin-top: 16px;
}

.lookup-loading,
.lookup-error {
    padding: 12px;
    border-radius: 13px;
    text-align: center;
    font-weight: 800;
    line-height: 1.7;
}

.lookup-loading {
    background: var(--primary-soft);
    color: var(--primary-dark);
}

.lookup-error {
    background: var(--danger-bg);
    color: var(--danger);
}

.lookup-file-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: #f8fafc;
}

.lookup-file-card + .lookup-file-card {
    margin-top: 10px;
}

.lookup-file-info strong,
.lookup-file-info span,
.lookup-file-info small {
    display: block;
}

.lookup-file-info strong {
    color: var(--primary-dark);
    font-weight: 900;
}

.lookup-file-info span {
    margin-top: 4px;
    color: var(--ink);
}

.lookup-file-info small {
    margin-top: 3px;
    color: var(--muted);
}

.use-file-btn {
    border: 0;
    border-radius: 12px;
    padding: 9px 14px;
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    color: #fff;
    font-weight: 900;
    cursor: pointer;
    white-space: nowrap;
    box-shadow: 0 10px 20px rgba(0, 124, 138, .18);
}

@media (max-width: 520px) {
    .lookup-modal {
        padding: 24px 16px 18px;
        border-radius: 18px;
    }

    .lookup-file-card {
        align-items: stretch;
        flex-direction: column;
    }

    .use-file-btn {
        width: 100%;
    }
}


/* =========================================================
   Global Copyright Footer
   ========================================================= */
.portal-copyright {
    width: min(1120px, calc(100% - 24px));
    margin: 14px auto 18px;
    padding: 10px 14px;
    border: 1px solid rgba(219, 228, 238, .85);
    border-radius: 14px;
    background: rgba(255, 255, 255, .72);
    color: #64748b;
    font-size: 12px;
    font-weight: 700;
    text-align: center;
    line-height: 1.7;
    backdrop-filter: blur(8px);
}

.portal-copyright span {
    display: inline-block;
    vertical-align: middle;
}

.copyright-separator {
    margin: 0 8px;
    color: #94a3b8;
}

.login-shell + .portal-copyright,
body:has(.login-shell) .portal-copyright {
    margin-top: -4px;
}

@media (max-width: 520px) {
    .portal-copyright {
        width: calc(100% - 20px);
        margin: 10px auto 14px;
        padding: 9px 10px;
        font-size: 11px;
    }

    .copyright-separator {
        display: none !important;
    }

    .portal-copyright span {
        display: block;
    }
}

@media print {
    .portal-copyright,
    .no-print {
        display: none !important;
    }
}


.pdf-copyright-line {
    direction: ltr;
    unicode-bidi: embed;
    font-size: 8.8px;
    color: #64748b;
    margin-top: 2px;
    text-align: center;
}
