        :root {
            --primary-navy: #0e2439;
            --secondary-navy: #163654;
            --accent-gold: #cba135;
            --accent-gold-light: #f7e8b6;
            --accent-gold-dark: #a07a1e;
            --card-bg: #ffffff;
            --card-border: #e2e8f0;
            --text-dark: #1e293b;
            --text-muted: #64748b;
            --light-blue-bg: #f3f8fc;
            --success-green: #10b981;
        }

        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: 'Cairo', 'Tajawal', sans-serif;
        }

        body {
            background: linear-gradient(135deg, #0b1828 0%, #172a3a 50%, #0f172a 100%);
            min-height: 100vh;
            color: var(--text-dark);
            padding: 30px 15px;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: flex-start;
        }

        /* Top Actions Bar */
        .actions-top-bar {
            width: 100%;
            max-width: 820px;
            display: flex;
            align-items: center;
            justify-content: space-between;
            margin-bottom: 20px;
            gap: 12px;
            flex-wrap: wrap;
        }

        .btn-action-top {
            display: inline-flex;
            align-items: center;
            gap: 8px;
            padding: 10px 20px;
            border-radius: 12px;
            font-size: 14px;
            font-weight: 700;
            text-decoration: none;
            cursor: pointer;
            transition: all 0.3s ease;
            border: none;
        }

        .btn-home {
            background: rgba(255, 255, 255, 0.12);
            color: #ffffff;
            backdrop-filter: blur(10px);
            border: 1px solid rgba(255, 255, 255, 0.2);
        }

        .btn-home:hover {
            background: rgba(255, 255, 255, 0.25);
            color: #ffffff;
            transform: translateY(-2px);
        }

        .btn-download-img {
            background: linear-gradient(135deg, #cba135, #e6b840);
            color: #0e2439;
            box-shadow: 0 4px 15px rgba(203, 161, 53, 0.35);
        }

        .btn-download-img:hover {
            transform: translateY(-2px);
            box-shadow: 0 6px 20px rgba(203, 161, 53, 0.5);
            background: linear-gradient(135deg, #e6b840, #ffd056);
        }

        .btn-print {
            background: rgba(255, 255, 255, 0.95);
            color: #0e2439;
        }

        .btn-print:hover {
            background: #ffffff;
            transform: translateY(-2px);
        }

        /* Certificate Container Card */
        .certificate-wrapper {
            width: 100%;
            max-width: 860px;
            background: #ffffff;
            border-radius: 24px;
            box-shadow: 0 25px 60px rgba(0, 0, 0, 0.45);
            overflow: hidden;
            position: relative;
            display: flex;
            flex-direction: column;
            border: 1.5px solid rgba(255, 255, 255, 0.15);
        }

        /* Main Content Layout (Sidebar + Body) */
        .cert-main-grid {
            display: grid;
            grid-template-columns: 235px 1fr;
            min-height: 540px;
            position: relative;
            align-items: stretch;
        }

        /* Left Curved Sidebar */
        .cert-sidebar {
            background: #082635;
            color: #ffffff;
            padding: 22px 18px 18px 18px;
            display: flex;
            flex-direction: column;
            align-items: center;
            position: relative;
            height: 100%;
            box-sizing: border-box;
        }

        .cert-sidebar::after {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: radial-gradient(circle at top right, rgba(255, 255, 255, 0.03), transparent 70%);
            pointer-events: none;
        }

        /* Gold curved accent on sidebar border - removed */
        .sidebar-gold-accent {
            display: none;
        }

        .sidebar-badge {
            background: rgba(255, 255, 255, 0.06);
            border: 1px solid rgba(203, 161, 53, 0.45);
            color: #ffffff;
            padding: 5px 16px;
            border-radius: 20px;
            font-size: 13px;
            font-weight: 700;
            display: flex;
            align-items: center;
            gap: 8px;
            margin-bottom: 20px;
            letter-spacing: 0.3px;
        }

        .sidebar-badge i {
            color: #d8aa35;
        }

        .sidebar-logo-box {
            text-align: center;
            margin-bottom: 20px;
            display: flex;
            flex-direction: column;
            align-items: center;
            width: 100%;
        }

        /* Rounded square box for the emblem matching reference image */
        .sidebar-emblem-box {
            width: 104px;
            height: 104px;
            border: 1.5px solid rgba(255, 255, 255, 0.16);
            border-radius: 18px;
            background: rgba(255, 255, 255, 0.04);
            display: flex;
            align-items: center;
            justify-content: center;
            margin-bottom: 12px;
            box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
        }

        .sidebar-emblem-img {
            width: 76px;
            height: 76px;
            object-fit: contain;
            filter: brightness(0) invert(1);
            display: block;
        }

        .sidebar-logo-title {
            font-size: 14px;
            font-weight: 800;
            color: #ffffff;
            line-height: 1.35;
        }

        .sidebar-logo-sub {
            font-size: 10.5px;
            font-weight: 600;
            color: #8da2b5;
            margin-top: 3px;
        }

        /* Sidebar Meta Details */
        .sidebar-meta-list {
            width: 100%;
            display: flex;
            flex-direction: column;
            gap: 12px;
            margin-top: 6px;
        }

        .sidebar-meta-item {
            display: flex;
            flex-direction: row;
            align-items: center;
            justify-content: flex-start;
            gap: 12px;
            padding-bottom: 9px;
            border-bottom: 1px solid rgba(255, 255, 255, 0.07);
            width: 100%;
            box-sizing: border-box;
        }

        .sidebar-meta-item:last-child {
            border-bottom: none;
            padding-bottom: 0;
        }

        .sidebar-meta-icon {
            width: 32px;
            height: 32px;
            min-width: 32px;
            background: rgba(255, 255, 255, 0.05);
            border: 1px solid rgba(203, 161, 53, 0.35);
            border-radius: 8px;
            display: flex;
            align-items: center;
            justify-content: center;
            color: #d8aa35;
            font-size: 14px;
            flex-shrink: 0;
        }

        .sidebar-meta-info {
            display: flex;
            flex-direction: column;
            align-items: flex-start;
            text-align: right;
            flex: 1;
            min-width: 0;
        }

        .sidebar-meta-label {
            font-size: 11px;
            font-weight: 600;
            color: #8da2b5;
            margin-bottom: 2px;
            display: block;
            line-height: 1.2;
        }

        .sidebar-meta-val {
            font-size: 13px;
            font-weight: 800;
            color: #ffffff;
            line-height: 1.3;
            width: 100%;
        }

        /* Sidebar Bottom Architecture Decoration */
        .sidebar-arch-deco {
            margin-top: auto;
            padding-top: 7px;
            width: 100%;
            display: flex;
            flex-direction: column;
            align-items: center;
            text-align: center;
        }

        .sidebar-arch-svg {
            width: 120px;
            height: auto;
            margin-bottom: 5px;
        }

        .sidebar-footer-tagline {
            font-size: 10.5px;
            font-weight: 700;
            color: #7994a9;
            letter-spacing: 0.3px;
        }

        /* Main Certificate Body */
        .cert-body {
            padding: 24px 28px 20px 28px;
            display: flex;
            flex-direction: column;
            justify-content: space-between;
            position: relative;
            background: #ffffff;
            height: 100%;
            box-sizing: border-box;
        }

        /* Top Header Layout:
           In RTL flex:
           Child 1 (cert-header-main) renders on the RIGHT (adjacent to sidebar).
           Child 2 (cert-header-left-col) renders on the LEFT (outer edge).
           Matches reference image exactly!
        */
        .cert-header-layout {
            display: flex;
            align-items: flex-start;
            justify-content: space-between;
            gap: 20px;
            margin-bottom: 16px;
        }

        .cert-header-main {
            flex: 1;
            min-width: 0;
            text-align: right;
        }

        .cert-header-left-col {
            display: flex;
            flex-direction: column;
            align-items: flex-start;
            gap: 10px;
            flex-shrink: 0;
        }

        .cert-header-motto {
            display: inline-flex;
            align-items: center;
            gap: 8px;
        }

        .motto-accent-line {
            width: 26px;
            height: 2px;
            background: #cba135;
            position: relative;
            border-radius: 2px;
        }

        .motto-accent-line::after {
            content: '';
            position: absolute;
            right: -3px;
            top: -2px;
            width: 6px;
            height: 6px;
            background: #cba135;
            border-radius: 50%;
        }

        .motto-text-wrap {
            display: flex;
            flex-direction: column;
            text-align: right;
        }

        .motto-ar {
            font-size: 11.5px;
            font-weight: 800;
            color: #0e2439;
            line-height: 1.2;
        }

        .motto-en {
            font-size: 9px;
            font-weight: 700;
            color: #8c733e;
            letter-spacing: 0.3px;
        }

        /* Top "موثق ومعتمد" Badge */
        .verified-stamp-top {
            background: #fefdfa;
            border: 1.5px solid #d8b858;
            padding: 6px 12px;
            border-radius: 12px;
            display: inline-flex;
            align-items: center;
            gap: 8px;
            box-shadow: 0 3px 10px rgba(203, 161, 53, 0.08);
        }

        .verified-stamp-top i {
            font-size: 15px;
            color: #cba135;
        }

        .verified-stamp-top-text {
            display: flex;
            flex-direction: column;
            text-align: right;
        }

        .verified-stamp-top-text span:first-child {
            font-size: 11px;
            font-weight: 900;
            color: #3b2c05;
            line-height: 1.2;
        }

        .verified-stamp-top-text span:last-child {
            font-size: 8.5px;
            font-weight: 700;
            color: #8c6a1b;
        }

        /* Header / Title Area */
        .cert-type-tag {
            font-size: 12px;
            font-weight: 700;
            color: #64748b;
            margin-bottom: 6px;
            display: inline-flex;
            align-items: center;
            gap: 6px;
        }

        .cert-type-tag i {
            color: #b48516;
            font-size: 13px;
        }

        .cert-book-title {
            font-size: 20px;
            font-weight: 900;
            color: #0c2a38;
            line-height: 1.4;
            margin-bottom: 8px;
        }

        .cert-author-box {
            display: flex;
            align-items: center;
            gap: 8px;
            font-size: 13.5px;
            font-weight: 800;
            color: #cba135;
            margin-bottom: 4px;
        }

        .cert-author-box i {
            font-size: 13.5px;
        }

        .cert-author-sub {
            font-size: 12px;
            font-weight: 600;
            color: #64748b;
        }

        /* Deposit & Barcode Box (Side by side) */
        .cert-barcode-container {
            background: #ffffff;
            border: 1.5px solid #e5edf5;
            border-radius: 18px;
            padding: 18px 24px;
            margin-bottom: 18px;
            display: grid;
            grid-template-columns: 1fr 140px;
            gap: 20px;
            align-items: center;
            box-shadow: 0 4px 15px rgba(0, 0, 0, 0.02);
        }

        .deposit-code-section {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            text-align: center;
            border-left: 1.5px solid #e8eff6;
            padding-left: 20px;
        }

        .deposit-code-title {
            font-size: 12.5px;
            font-weight: 700;
            color: #64748b;
            margin-bottom: 6px;
        }

        .deposit-code-value {
            font-size: 21px;
            font-weight: 900;
            color: #0c2a38;
            letter-spacing: 1px;
            margin-bottom: 10px;
            direction: ltr;
            font-family: 'Tajawal', sans-serif;
        }

        /* 1D Barcode Graphic */
        .barcode-graphic {
            width: 100%;
            max-width: 250px;
            height: 44px;
            display: flex;
            align-items: flex-end;
            justify-content: center;
            gap: 2.5px;
        }

        .barcode-bar {
            background: #0c2a38;
            height: 100%;
            border-radius: 1px;
        }

        /* 2D QR Code Section */
        .qr-code-section {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            text-align: center;
        }

        .qr-title {
            font-size: 12.5px;
            font-weight: 800;
            color: #0c2a38;
            margin-bottom: 8px;
        }

        .qr-box-inner {
            background: #ffffff;
            padding: 6px;
            border: 1.5px solid #0c2a38;
            border-radius: 12px;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
            display: flex;
            align-items: center;
            justify-content: center;
            width: 98px;
            height: 98px;
            box-sizing: border-box;
            overflow: hidden;
        }

        .qr-box-inner img,
        .qr-box-inner canvas {
            display: block;
            width: 86px;
            height: 86px;
            object-fit: contain;
        }

        .qr-subtext {
            font-size: 10px;
            font-weight: 700;
            color: #64748b;
            margin-top: 6px;
            display: flex;
            align-items: center;
            gap: 4px;
        }

        /* Trust & Official Stamp Banner */
        .cert-trust-banner {
            background: #edf5fb;
            border: 1.5px solid #dbe9f5;
            border-radius: 18px;
            padding: 16px 20px;
            display: flex;
            flex-direction: row;
            justify-content: space-between;
            align-items: center;
            gap: 16px;
            margin-bottom: 0;
        }

        .seal-emblem-img {
            position: absolute;
            width: 42px;
            height: 42px;
            object-fit: contain;
            inset: 50% auto auto 50%;
            transform: translate(-50%, -50%);
        }

        .trust-text-box {
            flex: 1;
            display: flex;
            align-items: flex-start;
            gap: 12px;
            text-align: right;
        }

        .trust-icon-shield {
            width: 38px;
            height: 38px;
            min-width: 38px;
            background: #082635;
            color: #d8aa35;
            border-radius: 10px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 18px;
            box-shadow: 0 3px 8px rgba(8, 38, 53, 0.2);
        }

        .trust-heading {
            font-size: 14px;
            font-weight: 900;
            color: #082635;
            margin-bottom: 4px;
        }

        .trust-desc {
            font-size: 11.5px;
            font-weight: 600;
            color: #475569;
            line-height: 1.55;
        }

        .trust-footer-sub {
            display: flex;
            align-items: center;
            gap: 8px;
            margin-top: 8px;
            font-size: 10px;
            font-weight: 700;
            color: #64748b;
        }

        .trust-sub-line {
            flex: 1;
            max-width: 30px;
            height: 1px;
            background: #cbd5e1;
        }

        /* Circular Official Rubber Stamp with Platform Emblem and Verified Badge */
        .official-seal-stamp {
            width: 104px;
            height: 104px;
            min-width: 104px;
            display: flex;
            align-items: center;
            justify-content: center;
            position: relative;
            background: #ffffff;
            border-radius: 50%;
            box-shadow: 0 4px 15px rgba(12, 42, 56, 0.08);
            padding: 2px;
        }

        .seal-svg {
            width: 100%;
            height: 100%;
            display: block;
            overflow: visible;
        }

        .seal-verified-badge {
            position: absolute;
            bottom: -2px;
            right: -2px;
            width: 24px;
            height: 24px;
            background: #d8aa35;
            color: #ffffff;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 11px;
            border: 2px solid #ffffff;
            box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
            z-index: 2;
        }

        /* 4 Quick Specs Grid */
        .cert-specs-grid {
            display: grid;
            grid-template-columns: repeat(4, 1fr);
            gap: 12px;
            margin-bottom: 25px;
            padding: 0 35px;
        }

        .spec-item {
            background: #ffffff;
            border: 1.5px solid #e2e8f0;
            border-radius: 16px;
            padding: 14px 10px;
            text-align: center;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            transition: transform 0.2s ease;
        }

        .spec-icon {
            width: 36px;
            height: 36px;
            border-radius: 10px;
            background: var(--light-blue-bg);
            color: #0e2439;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 15px;
            margin-bottom: 8px;
        }

        .spec-label {
            font-size: 11px;
            font-weight: 700;
            color: #64748b;
            margin-bottom: 4px;
        }

        .spec-value {
            font-size: 13px;
            font-weight: 800;
            color: #0e2439;
        }

        /* Social Share Section */
        .cert-share-section {
            padding: 0 35px 25px 35px;
            text-align: center;
        }

        .share-section-title {
            font-size: 14px;
            font-weight: 800;
            color: #475569;
            margin-bottom: 14px;
            position: relative;
            display: inline-block;
        }

        .share-section-title::before,
        .share-section-title::after {
            content: '';
            position: absolute;
            top: 50%;
            width: 40px;
            height: 1px;
            background: #cbd5e1;
        }

        .share-section-title::before {
            right: -50px;
        }

        .share-section-title::after {
            left: -50px;
        }

        .share-buttons-grid {
            display: grid;
            grid-template-columns: repeat(5, 1fr);
            gap: 10px;
        }

        .btn-share {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 6px;
            padding: 10px 8px;
            border-radius: 12px;
            font-size: 12px;
            font-weight: 800;
            text-decoration: none;
            cursor: pointer;
            transition: all 0.2s ease;
            border: 1.5px solid #e2e8f0;
            background: #ffffff;
            color: #1e293b;
        }

        .btn-share:hover {
            transform: translateY(-2px);
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
        }

        .btn-share.linkedin {
            color: #0077b5;
            border-color: #bee3f8;
            background: #ebf8ff;
        }

        .btn-share.twitter {
            color: #0f1419;
            border-color: #e2e8f0;
            background: #f8fafc;
        }

        .btn-share.facebook {
            color: #1877f2;
            border-color: #c3dafe;
            background: #ebf4ff;
        }

        .btn-share.whatsapp {
            color: #25d366;
            border-color: #c6f6d5;
            background: #f0fff4;
        }

        .btn-share.copy {
            color: #0e2439;
            border-color: #fed7aa;
            background: #fffaf0;
        }

        /* Stats Section */
        .cert-stats-section {
            padding: 0 35px 25px 35px;
        }

        .stats-section-title {
            font-size: 14px;
            font-weight: 800;
            color: #475569;
            text-align: center;
            margin-bottom: 14px;
        }

        .stats-grid {
            display: grid;
            grid-template-columns: repeat(4, 1fr);
            gap: 12px;
        }

        .stat-card {
            background: #ffffff;
            border: 1.5px solid #e2e8f0;
            border-radius: 16px;
            padding: 12px 10px;
            text-align: center;
            display: flex;
            flex-direction: column;
            align-items: center;
        }

        .stat-icon {
            font-size: 18px;
            color: #0e2439;
            margin-bottom: 6px;
        }

        .stat-label {
            font-size: 10px;
            font-weight: 700;
            color: #64748b;
            margin-bottom: 4px;
        }

        .stat-value {
            font-size: 16px;
            font-weight: 900;
            color: #0e2439;
            font-family: 'Tajawal', sans-serif;
        }

        /* Certificate Footer Bar */
        .cert-footer-bar {
            background: #0b1828;
            color: #ffffff;
            padding: 16px 35px;
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 15px;
            border-top: 1px solid rgba(255, 255, 255, 0.1);
        }

        .footer-verify-link {
            display: flex;
            align-items: center;
            gap: 8px;
            color: #93c5fd;
            font-size: 13px;
            font-weight: 700;
            text-decoration: none;
            direction: ltr;
            font-family: 'Tajawal', sans-serif;
            background: rgba(255, 255, 255, 0.05);
            padding: 6px 14px;
            border-radius: 8px;
            border: 1px solid rgba(255, 255, 255, 0.1);
        }

        .footer-verify-link i {
            color: var(--accent-gold);
        }

        .footer-copyright {
            font-size: 11px;
            font-weight: 600;
            color: #94a3b8;
            text-align: center;
        }

        .footer-qr-mini {
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .footer-qr-mini span {
            font-size: 10px;
            font-weight: 700;
            color: #cbd5e1;
            line-height: 1.2;
            text-align: right;
        }

        .footer-qr-img {
            width: 36px;
            height: 36px;
            background: #ffffff;
            padding: 2px;
            border-radius: 6px;
        }

        /* Toast notification */
        .toast-copy {
            position: fixed;
            bottom: 30px;
            left: 50%;
            transform: translateX(-50%) translateY(100px);
            background: #0e2439;
            color: #ffffff;
            padding: 12px 24px;
            border-radius: 30px;
            font-size: 14px;
            font-weight: 700;
            display: flex;
            align-items: center;
            gap: 10px;
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
            border: 1px solid var(--accent-gold);
            opacity: 0;
            transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
            z-index: 9999;
        }

        .toast-copy.show {
            transform: translateX(-50%) translateY(0);
            opacity: 1;
        }

        /* ================= PRINT MEDIA STYLES (A4 Landscape Perfect Fit & Exact Colors) ================= */
        @media print {
            @page {
                size: A4 landscape;
                margin: 6mm 10mm;
            }

            *,
            *::before,
            *::after {
                -webkit-print-color-adjust: exact !important;
                print-color-adjust: exact !important;
                color-adjust: exact !important;
                box-sizing: border-box !important;
            }

            html,
            body {
                background: #ffffff !important;
                padding: 0 !important;
                margin: 0 !important;
                width: 100% !important;
                height: 100% !important;
                display: flex !important;
                align-items: center !important;
                justify-content: center !important;
            }

            .actions-top-bar,
            .toast-copy,
            .cert-share-section,
            .cert-stats-section,
            .cert-specs-grid,
            .cert-footer-bar {
                display: none !important;
            }

            .certificate-wrapper {
                box-shadow: none !important;
                border: 1.5px solid #082635 !important;
                width: 100% !important;
                max-width: 860px !important;
                margin: auto !important;
                border-radius: 24px !important;
                overflow: hidden !important;
                page-break-inside: avoid !important;
                break-inside: avoid !important;
                background: #ffffff !important;
                display: flex !important;
                flex-direction: column !important;
            }

            .cert-main-grid {
                display: grid !important;
                grid-template-columns: 235px 1fr !important;
                min-height: 540px !important;
                align-items: stretch !important;
            }

            .cert-sidebar {
                background: #082635 !important;
                color: #ffffff !important;
                padding: 22px 18px 18px 18px !important;
                display: flex !important;
                flex-direction: column !important;
                align-items: center !important;
                height: 100% !important;
            }

            .sidebar-badge {
                background: rgba(255, 255, 255, 0.06) !important;
                border: 1px solid rgba(203, 161, 53, 0.45) !important;
                color: #ffffff !important;
            }

            .sidebar-badge i {
                color: #d8aa35 !important;
            }

            .sidebar-emblem-box {
                width: 104px !important;
                height: 104px !important;
                border: 1.5px solid rgba(255, 255, 255, 0.16) !important;
                border-radius: 18px !important;
                background: rgba(255, 255, 255, 0.04) !important;
                display: flex !important;
                align-items: center !important;
                justify-content: center !important;
            }

            .sidebar-emblem-img {
                width: 76px !important;
                height: 76px !important;
                object-fit: contain !important;
                filter: brightness(0) invert(1) !important;
                -webkit-filter: brightness(0) invert(1) !important;
                display: block !important;
            }

            .sidebar-logo-title {
                color: #ffffff !important;
            }

            .sidebar-logo-sub {
                color: #8da2b5 !important;
            }

            .sidebar-meta-label {
                color: #8da2b5 !important;
            }

            .sidebar-meta-label i {
                color: #d8aa35 !important;
            }

            .sidebar-meta-val {
                color: #ffffff !important;
            }

            .sidebar-footer-tagline {
                color: #7994a9 !important;
            }

            .cert-body {
                background: #ffffff !important;
                padding: 24px 28px 20px 28px !important;
                display: flex !important;
                flex-direction: column !important;
                justify-content: space-between !important;
                height: 100% !important;
            }

            .cert-header-layout {
                display: flex !important;
                align-items: flex-start !important;
                justify-content: space-between !important;
                gap: 20px !important;
                margin-bottom: 16px !important;
            }

            .cert-header-main {
                flex: 1 !important;
                text-align: right !important;
            }

            .cert-header-left-col {
                display: flex !important;
                flex-direction: column !important;
                align-items: flex-start !important;
                gap: 10px !important;
            }

            .verified-stamp-top {
                position: static !important;
                background: #fefdfa !important;
                border: 1.5px solid #d8b858 !important;
                padding: 6px 12px !important;
                border-radius: 12px !important;
                display: inline-flex !important;
                align-items: center !important;
                gap: 8px !important;
            }

            .cert-book-title {
                font-size: 20px !important;
                color: #0c2a38 !important;
            }

            .cert-author-box {
                color: #cba135 !important;
            }

            .cert-barcode-container {
                display: grid !important;
                grid-template-columns: 1fr 140px !important;
                background: #ffffff !important;
                border: 1.5px solid #e5edf5 !important;
                border-radius: 18px !important;
                padding: 18px 24px !important;
                margin-bottom: 18px !important;
            }

            .deposit-code-section {
                border-left: 1.5px solid #e8eff6 !important;
                padding-left: 20px !important;
            }

            .deposit-code-value {
                color: #0c2a38 !important;
            }

            .barcode-bar {
                background: #0c2a38 !important;
            }

            .qr-box-inner {
                background: #ffffff !important;
                border: 1.5px solid #0c2a38 !important;
                padding: 6px !important;
            }

            .qr-box-inner canvas,
            .qr-box-inner img {
                width: 86px !important;
                height: 86px !important;
            }

            .cert-trust-banner {
                background: #edf5fb !important;
                border: 1.5px solid #dbe9f5 !important;
                border-radius: 18px !important;
                padding: 16px 20px !important;
                display: flex !important;
                flex-direction: row !important;
                justify-content: space-between !important;
                align-items: center !important;
                gap: 16px !important;
            }

            .trust-icon-shield {
                background: #082635 !important;
                color: #d8aa35 !important;
            }

            .trust-heading {
                color: #082635 !important;
            }

            .sidebar-meta-item {
                display: flex !important;
                flex-direction: row !important;
                align-items: center !important;
                justify-content: flex-start !important;
                gap: 12px !important;
            }

            .sidebar-meta-icon {
                background: rgba(255, 255, 255, 0.06) !important;
                border: 1px solid rgba(203, 161, 53, 0.4) !important;
                color: #d8aa35 !important;
            }

            .official-seal-stamp {
                width: 104px !important;
                height: 104px !important;
                background: #ffffff !important;
            }

            .seal-verified-badge {
                background: #d8aa35 !important;
                color: #ffffff !important;
            }
        }

        /* Responsive on Screen Only (does not affect print) */
        @media screen and (max-width: 768px) {
            .cert-main-grid {
                grid-template-columns: 1fr;
            }

            .cert-sidebar {
                border-bottom-left-radius: 0;
                border-bottom: 4px solid var(--accent-gold);
                height: auto;
                padding: 20px 16px;
                text-align: center;
            }

            .sidebar-logo-box {
                display: grid;
                grid-template-columns: max-content 72px;
                grid-template-rows: auto auto;
                direction: ltr;
                align-items: center;
                justify-items: center;
                column-gap: 14px;
                row-gap: 3px;
                width: fit-content;
                max-width: 100%;
                margin: 0 0 18px;
                margin-inline: auto;
            }

            .sidebar-emblem-box {
                grid-column: 2;
                grid-row: 1 / span 2;
                width: 72px;
                height: 72px;
                border-radius: 15px;
                margin: 0;
            }

            .sidebar-emblem-img { width: 54px; height: 54px; }
            .sidebar-logo-title, .sidebar-logo-sub {
                grid-column: 1;
                width: 100%;
                text-align: center;
                white-space: normal;
            }
            .sidebar-logo-title { grid-row: 1; font-size: 16px; }
            .sidebar-logo-sub { grid-row: 2; font-size: 12px; }

            .sidebar-meta-list {
                display: grid;
                grid-template-columns: repeat(2, minmax(0, 1fr));
                gap: 10px;
                margin-top: 0;
            }

            .sidebar-meta-item {
                flex-direction: column;
                justify-content: center;
                align-items: center;
                gap: 8px;
                min-width: 0;
                min-height: 112px;
                padding: 12px 8px;
                border: 1px solid rgba(255, 255, 255, 0.1);
                border-radius: 14px;
                background: rgba(255, 255, 255, 0.035);
                text-align: center;
            }

            .sidebar-meta-info {
                align-items: center;
                text-align: center;
                width: 100%;
            }
            .sidebar-meta-label, .sidebar-meta-val { text-align: center; }
            .sidebar-meta-val { overflow-wrap: anywhere; }
            .sidebar-arch-deco { padding-top: 18px; gap: 8px; }
            .sidebar-arch-svg { width: 110px; }
            .sidebar-footer-tagline {
                text-align: center;
                font-size: 13px;
            }
            .sidebar-badge { margin-bottom: 16px; }

            .cert-body { height: auto; }
            .cert-header-layout {
                flex-direction: column;
                align-items: center;
                gap: 14px;
            }
            .cert-header-main, .cert-header-left-col {
                width: 100%;
                align-items: center;
                text-align: center;
            }
            .trust-heading, .trust-desc, .trust-footer-sub,
            .qr-title, .qr-subtext, .deposit-code-title,
            .cert-author-sub, .cert-type-tag {
                text-align: center;
                justify-content: center;
            }
            .trust-heading { font-size: 16px; }
            .trust-desc { font-size: 13px; line-height: 1.7; }
            .trust-footer-sub { font-size: 11px; line-height: 1.5; }
            .cert-book-title, .cert-author-box, .cert-author-sub,
            .cert-type-tag, .motto-text-wrap, .verified-stamp-top-text {
                text-align: center;
                justify-content: center;
            }

            .cert-header {
                padding-left: 0;
                margin-top: 0;
            }

            .verified-stamp-top {
                top: auto;
                left: auto;
                align-self: center;
            }

            .cert-barcode-container {
                grid-template-columns: 1fr;
            }

            .deposit-code-section {
                border-left: none;
                border-bottom: 1.5px dashed #cbd5e1;
                padding-left: 0;
                padding-bottom: 15px;
            }

            .cert-trust-banner {
                flex-direction: column;
                text-align: center;
                padding: 16px;
            }

            .trust-text-box {
                flex-direction: column;
                align-items: center;
                width: 100%;
            }

            .trust-footer-sub {
                justify-content: center;
            }

            .official-seal-stamp {
                margin: 0 auto;
            }

            .cert-specs-grid,
            .stats-grid,
            .share-buttons-grid {
                grid-template-columns: repeat(2, 1fr);
            }

            .cert-footer-bar {
                flex-direction: column;
                text-align: center;
            }

            .cert-footer-bar *, .footer-verify-link, .footer-qr-mini,
            .cert-specs-grid *, .stats-grid *, .cert-share-section * {
                text-align: center;
            }
        }

        @media screen and (max-width: 420px) {
            body {
                padding: 16px 10px;
            }

            .cert-trust-banner {
                gap: 14px;
            }

            .trust-desc {
                font-size: 12px;
            }

            .official-seal-stamp {
                width: 96px;
                height: 96px;
                min-width: 96px;
            }
        }

        /* Keep downloaded PNG in the same landscape layout as the printable certificate. */
        #certificateCard.export-image {
            width: 860px !important;
            max-width: none !important;
            margin: 0 !important;
            border-radius: 24px !important;
        }

        #certificateCard.export-image .cert-main-grid {
            grid-template-columns: 235px 1fr !important;
            min-height: 540px !important;
        }

        #certificateCard.export-image .cert-sidebar {
            height: 100% !important;
            padding: 22px 18px 18px !important;
            border-bottom: 0 !important;
        }
        #certificateCard.export-image .sidebar-logo-box {
            display: flex !important;
            flex-direction: column !important;
            width: 100% !important;
            max-width: none !important;
            margin: 0 0 20px !important;
        }
        #certificateCard.export-image .sidebar-emblem-box {
            width: 104px !important;
            height: 104px !important;
            margin: 0 0 12px !important;
        }
        #certificateCard.export-image .sidebar-emblem-img {
            width: 76px !important;
            height: 76px !important;
        }
        #certificateCard.export-image .sidebar-logo-title { font-size: 14px !important; }
        #certificateCard.export-image .sidebar-logo-sub { font-size: 10.5px !important; }
        #certificateCard.export-image .sidebar-meta-list {
            display: flex !important;
            flex-direction: column !important;
            gap: 12px !important;
            margin-top: 6px !important;
        }
        #certificateCard.export-image .sidebar-meta-item {
            min-height: 0 !important;
            flex-direction: row !important;
            align-items: center !important;
            justify-content: flex-start !important;
            gap: 12px !important;
            padding: 0 0 9px !important;
            border: 0 !important;
            border-bottom: 1px solid rgba(255, 255, 255, 0.07) !important;
            border-radius: 0 !important;
            background: transparent !important;
        }
        #certificateCard.export-image .sidebar-meta-info {
            align-items: flex-start !important;
            text-align: right !important;
            width: auto !important;
        }
        #certificateCard.export-image .sidebar-meta-label,
        #certificateCard.export-image .sidebar-meta-val { text-align: right !important; }
        #certificateCard.export-image .sidebar-arch-deco {
            margin-top: auto !important;
            padding-top: 14px !important;
            gap: 0 !important;
        }
        #certificateCard.export-image .sidebar-arch-svg { width: 95px !important; }
        #certificateCard.export-image .sidebar-footer-tagline {
            font-size: 10.5px !important;
            text-align: center !important;
        }

        #certificateCard.export-image .sidebar-badge {
            flex-shrink: 0 !important;
            white-space: nowrap !important;
            gap: 8px !important;
            padding-right: 12px !important;
            padding-left: 12px !important;
            letter-spacing: 0 !important;
        }

        #certificateCard.export-image .sidebar-badge span,
        #certificateCard.export-image .sidebar-footer-tagline {
            white-space: nowrap !important;
            direction: rtl !important;
            unicode-bidi: plaintext !important;
            letter-spacing: 0 !important;
        }

        #certificateCard.export-image .sidebar-footer-tagline {
            width: 100% !important;
            font-size: 10px !important;
            text-align: center !important;
        }

        #certificateCard.export-image .cert-body {
            padding: 24px 28px 20px !important;
            height: 100% !important;
        }

        #certificateCard.export-image .cert-header-layout {
            flex-direction: row !important;
            align-items: flex-start !important;
            justify-content: space-between !important;
            margin: 0 0 16px !important;
        }

        #certificateCard.export-image .cert-header-main {
            width: auto !important;
            text-align: right !important;
            margin-top: 0 !important;
        }
        #certificateCard.export-image .cert-header-left-col {
            width: auto !important;
            align-items: flex-start !important;
        }
        #certificateCard.export-image .cert-type-tag,
        #certificateCard.export-image .cert-book-title,
        #certificateCard.export-image .cert-author-box,
        #certificateCard.export-image .cert-author-sub,
        #certificateCard.export-image .motto-text-wrap,
        #certificateCard.export-image .verified-stamp-top-text {
            text-align: right !important;
        }

        #certificateCard.export-image .verified-stamp-top {
            position: static !important;
        }

        #certificateCard.export-image .cert-barcode-container {
            grid-template-columns: 1fr 140px !important;
        }

        #certificateCard.export-image .deposit-code-section {
            border-left: 1.5px solid #e8eff6 !important;
            border-bottom: 0 !important;
            padding: 0 0 0 20px !important;
        }

        #certificateCard.export-image .cert-trust-banner {
            flex-direction: row !important;
            text-align: initial !important;
        }

        #certificateCard.export-image .trust-text-box {
            flex-direction: row !important;
            align-items: flex-start !important;
            width: auto !important;
        }

        #certificateCard.export-image .trust-heading {
            font-size: 14px !important;
            text-align: right !important;
        }
        #certificateCard.export-image .trust-desc {
            font-size: 11.5px !important;
            text-align: right !important;
        }
        #certificateCard.export-image .trust-footer-sub {
            font-size: 10px !important;
            justify-content: flex-start !important;
            text-align: right !important;
        }

        .toast-copy {
            position: fixed;
            bottom: 30px;
            left: 50%;
            transform: translateX(-50%) translateY(100px);
            background: #002633;
            color: #fff;
            padding: 12px 24px;
            border-radius: 50px;
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
            border: 1px solid #c5a059;
            display: flex;
            align-items: center;
            gap: 10px;
            font-size: 13px;
            font-weight: 700;
            opacity: 0;
            pointer-events: none;
            transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
            z-index: 99999;
        }

        .toast-copy.show {
            transform: translateX(-50%) translateY(0);
            opacity: 1;
        }
