/* التقرير (A4) وبطاقة العاملة — ألوان ثابتة فاتحة دائماً للطباعة والمشاركة */

.a4, .wcard {
  --d-ink: #16201c; --d-ink2: #3b4642; --d-muted: #6d7773; --d-line: #dfe4e1; --d-soft: #f4f7f5;
  --d-brand: #0e6b5c; --d-brand2: #0a5246; --d-brand-soft: #e3f1ed;
  --d-ok: #1d7f47; --d-ok-soft: #e4f4ea; --d-bad: #b8322a; --d-bad-soft: #fbe7e5; --d-warn: #a8660b; --d-warn-soft: #fcf0dc; --d-info: #3a5bb8; --d-info-soft: #e7ecfa;
  font-family: 'Plex', system-ui, sans-serif; color: var(--d-ink); background: #fff; direction: rtl;
  -webkit-font-smoothing: antialiased;
}
.a4 .num, .wcard .num { font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; display: inline-block; }

/* ---------- صفحة A4 ---------- */
.a4 { width: 794px; height: 1123px; position: relative; box-shadow: 0 4px 24px rgba(0,0,0,.12); display: flex; flex-direction: column; overflow: hidden; }
.a4::before { content: ''; position: absolute; top: 0; inset-inline: 0; height: 6px; background: linear-gradient(90deg, var(--d-brand2), var(--d-brand)); }
.a4-body { flex: 1; padding: 34px 44px 10px; overflow: hidden; display: flex; flex-direction: column; gap: 14px; font-size: 11.5px; line-height: 1.55; }
.a4-body > * { flex-shrink: 0; }
.a4-foot { height: 40px; margin: 0 44px; border-top: 1px solid var(--d-line); display: flex; align-items: center; justify-content: space-between; font-size: 9.5px; color: var(--d-muted); }

.r-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; }
.r-brand { display: flex; align-items: center; gap: 12px; }
.r-mark { width: 44px; height: 44px; border-radius: 12px; background: var(--d-brand); display: grid; place-items: center; }
.r-mark svg { width: 26px; height: 26px; }
.r-title { font-size: 21px; font-weight: 700; line-height: 1.25; }
.r-sub { font-size: 12px; color: var(--d-muted); }
.r-meta { text-align: left; direction: ltr; font-size: 10.5px; color: var(--d-muted); line-height: 1.7; }
.r-meta b { color: var(--d-ink); font-weight: 600; }
.r-cont { font-size: 12px; color: var(--d-muted); font-weight: 600; }

.r-parties { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--d-line); border-radius: 10px; overflow: hidden; }
.r-parties > div { padding: 8px 12px; border-inline-start: 1px solid var(--d-line); border-top: 1px solid var(--d-line); }
.r-parties > div:nth-child(3n+1) { border-inline-start: 0; }
.r-parties > div:nth-child(-n+3) { border-top: 0; }
.r-parties .k { font-size: 9.5px; color: var(--d-muted); }
.r-parties .v { font-size: 12.5px; font-weight: 600; }

.r-tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.r-tile { background: var(--d-soft); border-radius: 10px; padding: 9px 12px; }
.r-tile .k { font-size: 9.5px; color: var(--d-muted); }
.r-tile .v { font-size: 17px; font-weight: 700; line-height: 1.35; }
.r-tile .h { font-size: 9.5px; color: var(--d-muted); }
.r-tile.brand { background: var(--d-brand); color: #fff; }
.r-tile.brand .k, .r-tile.brand .h { color: rgba(255,255,255,.8); }

.r-progress { display: flex; gap: 2.5px; }
.r-progress i { flex: 1; height: 7px; border-radius: 2px; background: var(--d-line); }
.r-progress i.paid { background: var(--d-ok); }
.r-progress i.due { background: var(--d-bad); }
.r-progress i.next { background: var(--d-warn); }
.r-progress i.deferred { background: var(--d-info); }
.r-legend { display: flex; gap: 14px; font-size: 9.5px; color: var(--d-muted); margin-top: 4px; }
.r-legend span::before { content: ''; display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-inline-end: 4px; vertical-align: -1px; background: var(--c); }

.r-h2 { font-size: 13px; font-weight: 700; display: flex; align-items: center; gap: 8px; margin-bottom: -6px; }
.r-h2::before { content: ''; width: 4px; height: 14px; border-radius: 2px; background: var(--d-brand); }
.r-h2 .cont { font-size: 10px; color: var(--d-muted); font-weight: 500; }

.r-table { width: 100%; border-collapse: collapse; font-size: 10.5px; }
.r-table th { background: var(--d-brand); color: #fff; font-weight: 600; text-align: start; padding: 6px 8px; font-size: 9.5px; white-space: nowrap; }
.r-table th:first-child { border-start-start-radius: 7px; }
.r-table th:last-child { border-start-end-radius: 7px; }
.r-table td { padding: 5px 8px; border-bottom: 1px solid var(--d-line); vertical-align: top; }
.r-table tr:nth-child(even) td { background: #fafbfa; }
.r-table tr.total td { background: var(--d-brand-soft); font-weight: 700; border-bottom: 0; }
.r-table .muted { color: var(--d-muted); }
.r-table .mono { font-family: ui-monospace, Menlo, monospace; font-size: 9.5px; direction: ltr; unicode-bidi: isolate; }
.r-st { display: inline-block; padding: 0 7px; border-radius: 99px; font-size: 9.5px; font-weight: 600; white-space: nowrap; }
.r-st.paid { background: var(--d-ok-soft); color: var(--d-ok); }
.r-st.due { background: var(--d-bad-soft); color: var(--d-bad); }
.r-st.next { background: var(--d-warn-soft); color: var(--d-warn); }
.r-st.deferred { background: var(--d-info-soft); color: var(--d-info); }
.r-st.upcoming { background: var(--d-soft); color: var(--d-muted); }

.r-notes { display: grid; gap: 5px; }
.r-note { display: flex; gap: 10px; padding: 6px 10px; background: var(--d-soft); border-radius: 8px; }
.r-note b { white-space: nowrap; min-width: 90px; }

.r-sign { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; margin-top: 10px; }
.r-sign > div { border-top: 1px solid var(--d-ink2); padding-top: 6px; font-size: 10.5px; color: var(--d-muted); }
.r-sign b { color: var(--d-ink); display: block; font-size: 11.5px; }
.r-disc { font-size: 9.5px; color: var(--d-muted); background: var(--d-soft); border-radius: 8px; padding: 7px 10px; }

.r-receipt { display: grid; gap: 6px; justify-items: center; }
.r-receipt .cap { font-size: 11px; font-weight: 600; justify-self: stretch; display: flex; justify-content: space-between; }
.r-receipt img { max-width: 100%; max-height: 900px; border: 1px solid var(--d-line); border-radius: 6px; object-fit: contain; }

/* ---------- بطاقة العاملة (صورة) ---------- */
.wcard { width: 1080px; padding: 0 0 36px; }
.wc-top { background: linear-gradient(135deg, var(--d-brand2), var(--d-brand)); color: #fff; padding: 46px 60px 90px; }
.wc-top .t1 { font-size: 44px; font-weight: 700; line-height: 1.25; }
.wc-top .t2 { font-size: 26px; opacity: .85; direction: ltr; text-align: right; }
.wc-top .t3 { font-size: 26px; opacity: .85; }
.wc-who { display: flex; justify-content: space-between; align-items: flex-end; margin-top: 24px; gap: 20px; }
.wc-who .name { font-size: 40px; font-weight: 700; line-height: 1.2; }
.wc-who .name small { display: block; font-size: 24px; font-weight: 500; opacity: .85; direction: ltr; text-align: right; }
.wc-who .date { text-align: left; font-size: 22px; opacity: .9; }
.wc-who .date b { display: block; font-size: 30px; }

.wc-amount { margin: -56px 44px 0; background: #fff; border-radius: 26px; box-shadow: 0 12px 40px rgba(10,40,30,.14); padding: 30px 40px; display: flex; justify-content: space-between; align-items: center; gap: 20px; }
.wc-amount .big { font-size: 78px; font-weight: 700; line-height: 1; color: var(--d-brand2); }
.wc-amount .cur { font-size: 28px; font-weight: 600; color: var(--d-muted); margin-inline-start: 10px; }
.wc-amount .for { text-align: left; }
.wc-lbl { font-size: 21px; color: var(--d-muted); line-height: 1.35; }
.wc-lbl .en { direction: ltr; display: block; font-size: 18px; opacity: .85; }
.wc-months { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; margin-top: 10px; }
.wc-months span { background: var(--d-brand-soft); color: var(--d-brand2); border-radius: 99px; padding: 6px 20px; font-size: 26px; font-weight: 700; }
.wc-months span small { font-size: 18px; font-weight: 500; margin-inline-start: 6px; direction: ltr; }

.wc-body { padding: 26px 44px 0; display: grid; gap: 18px; }
.wc-row { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.wc-box { background: var(--d-soft); border-radius: 22px; padding: 22px 28px; }
.wc-box .v { font-size: 34px; font-weight: 700; line-height: 1.3; margin-top: 4px; }
.wc-box .v small { font-size: 22px; color: var(--d-muted); font-weight: 500; }
.wc-box .acc { font-family: ui-monospace, Menlo, monospace; font-size: 26px; direction: ltr; unicode-bidi: isolate; letter-spacing: .5px; }
.wc-box.full { grid-column: 1 / -1; }
.wc-box.warn { background: var(--d-warn-soft); }
.wc-ded { display: flex; justify-content: space-between; font-size: 26px; font-weight: 600; margin-top: 8px; gap: 20px; }
.wc-prog { display: flex; gap: 6px; margin: 14px 0 10px; }
.wc-prog i { flex: 1; height: 22px; border-radius: 6px; background: var(--d-line); }
.wc-prog i.paid { background: var(--d-ok); }
.wc-prog i.now { background: var(--d-brand); outline: 3px solid #fff; box-shadow: 0 0 0 5px var(--d-brand); }
.wc-stats { display: flex; justify-content: space-between; gap: 20px; }
.wc-stats .v { font-size: 38px; }
.wc-sign { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; padding: 30px 44px 0; }
.wc-sign > div { border-top: 3px solid var(--d-ink2); padding-top: 10px; font-size: 21px; color: var(--d-muted); line-height: 1.35; }
.wc-sign .en { direction: ltr; display: block; font-size: 18px; }
.wc-foot { padding: 26px 44px 0; font-size: 17px; color: var(--d-muted); display: flex; justify-content: space-between; direction: rtl; }
