﻿:root {
    --je-bg: #ffffff;
    --je-ink: #0b172a;
    --je-muted: #5b6b7a;
    --je-line: #e8eef6;
    --je-accent: #1d7fa3;
    --je-head: #f5f9fe;
}

/* Container */
.je-doc {
    max-width: 900px;
    margin: 24px auto;
    background: var(--je-bg);
    color: var(--je-ink);
    padding: 24px 28px;
    border-radius: 14px;
    box-shadow: 0 12px 32px rgba(8, 90, 155, .08);
}

/* Header */
.je-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    border-bottom: 1px solid var(--je-line);
    padding-bottom: 12px;
    margin-bottom: 16px;
}

.je-brand-name {
    font-weight: 800;
    font-size: 22px;
    letter-spacing: .2px;
}

.je-meta {
    color: var(--je-muted);
    margin-top: 6px;
    display: grid;
    gap: 2px;
}

.je-logo img {
    max-height: 64px;
    max-width: 220px;
    object-fit: contain;
}

/* Title */
.je-title {
    text-align: center;
    margin: 10px 0 14px;
}

    .je-title h1 {
        font-size: 22px;
        font-weight: 800;
        margin: 0;
        color: var(--je-accent);
    }

/* Sections */
.je-section {
    margin: 16px 0;
}

.je-section-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--je-accent);
    margin: 0 0 10px;
}

/* Key-Value Table */
.je-kv, .je-ledger {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: #fff;
    border: 1px solid var(--je-line);
    border-radius: 12px;
    overflow: hidden;
}

    .je-kv thead th,
    .je-ledger thead th {
        background: var(--je-head);
        color: #0c2746;
        font-weight: 700;
        padding: 10px 12px;
        border-bottom: 1px solid var(--je-line);
        text-align: start;
    }

    .je-kv tbody td,
    .je-ledger tbody td {
        padding: 10px 12px;
        border-bottom: 1px solid var(--je-line);
        vertical-align: top;
    }

    .je-kv tbody tr:last-child td,
    .je-ledger tbody tr:last-child td {
        border-bottom: none;
    }

    .je-ledger tfoot td {
        padding: 10px 12px;
        background: #f8fbff;
        border-top: 1px solid var(--je-line);
    }

.je-num-col {
    width: 140px;
}

.je-num {
    text-align: end;
    font-variant-numeric: tabular-nums;
}

.je-strong {
    font-weight: 800;
}

/* Notes */
.je-notes {
    padding: 12px;
    border: 1px dashed var(--je-line);
    border-radius: 10px;
    color: var(--je-muted);
    line-height: 1.7;
    min-height: 40px;
}

/* Footer */
.je-footer {
    margin-top: 18px;
    padding-top: 10px;
    border-top: 1px solid var(--je-line);
    color: var(--je-muted);
    font-size: 13px;
    text-align: center;
}

/* Actions (screen only) */
.je-actions {
    display: flex;
    justify-content: center;
    margin: 16px 0 32px;
}

.je-print-btn {
    display: inline-flex;
    align-items: center;
    gap: .6rem;
    background: linear-gradient(180deg, #fff, #f7fbff);
    border: 1px solid #e6eef7;
    color: #0b172a;
    padding: .6rem 1rem;
    border-radius: 12px;
    box-shadow: 0 8px 22px rgba(8, 90, 155, .10);
    transition: transform .12s ease, box-shadow .18s ease, border-color .2s ease;
    cursor: pointer;
}

    .je-print-btn:hover {
        transform: translateY(-1px);
        box-shadow: 0 10px 26px rgba(8, 90, 155, .14);
        border-color: rgba(29,127,163,.35);
    }

/* Loading */
.je-loading {
    max-width: 900px;
    margin: 24px auto;
    text-align: center;
    color: var(--je-muted);
}

/* Responsive */
@media (max-width: 768px) {
    .je-doc {
        padding: 18px;
        margin: 12px;
        border-radius: 12px;
    }

    .je-header {
        flex-direction: column;
        align-items: stretch;
    }

    .je-logo {
        display: flex;
        justify-content: center;
    }

    .je-num-col {
        width: 110px;
    }
}

/* اطبع بنفس ألوان وخلفيات الشاشة */
* {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    color-adjust: exact !important; /* لبعض المتصفحات القديمة */
}

/* طباعة بنفس تصميم الشاشة */
@media print {
    @page {
        size: A4 portrait;
        margin: 12mm;
    }
    /* عدّل الهوامش لو حابب */

    /* سيب كل الستايلات كما هي – بس اخفِ أزرار الشاشة */
    .je-actions {
        display: none !important;
    }

    /* خليك محافظ على ترويسة/تذييل الجدول عبر الصفحات */
    thead {
        display: table-header-group;
    }

    tfoot {
        display: table-footer-group;
    }

    /* منع كسر الصفوف/الصور */
    tr, img {
        break-inside: avoid;
        page-break-inside: avoid;
    }
}
