:root { --green: #0f4a33; --gold: #a8873a; --bg: #f4f1ea; --line: #e2dccb; --ink: #1d2a24; --muted: #55625b; --red: #b3261e; }
* { box-sizing: border-box; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: "Noto Kufi Arabic", "Segoe UI", Tahoma, sans-serif; font-size: 1rem; line-height: 1.6; }
.wrap { max-width: 960px; margin: 0 auto; padding: 16px; display: grid; gap: 14px; }
.header { display: flex; align-items: center; gap: 12px; border-bottom: 3px solid var(--green); padding-bottom: 10px; flex-wrap: wrap; }
.header h1 { margin: 0; font-size: 1.25rem; color: var(--green); }
.header p { margin: 2px 0 0; color: var(--muted); font-size: .9rem; }
.who { margin-inline-start: auto; display: flex; gap: 12px; align-items: center; font-size: .9rem; }
.who a, .link { color: var(--green); background: none; border: 0; font: inherit; cursor: pointer; text-decoration: underline; padding: 0; }
.steps { display: flex; gap: 8px; flex-wrap: wrap; }
.steps span { padding: 6px 14px; border-radius: 999px; border: 1px solid #cfc7b1; background: #fff; font-size: .9rem; }
.steps .on { background: var(--green); color: #fff; border-color: var(--green); }
.steps .done { background: #e3efe8; border-color: #9cc3ad; }
.card { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin: 0; }
.card h2 { margin: 0 0 12px; font-size: 1.05rem; color: var(--green); border-inline-start: 4px solid var(--gold); padding-inline-start: 8px; }
.narrow { max-width: 420px; width: 100%; margin: 24px auto; display: grid; gap: 12px; }
.center { text-align: center; justify-content: center; }
form > .card + .card, form > .card { margin-bottom: 14px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; margin: 0; }
.grid dd { margin: 2px 0 0; }
.field { display: grid; gap: 4px; font-size: .92rem; align-content: start; }
input, select, textarea { font-size: 16px; min-height: 44px; padding: 10px; border: 1px solid #cfc7b1; border-radius: 8px; font: inherit; background: #fff; min-width: 0; width: 100%; }
.field:has(.error) input, .field:has(.error) select { border-color: var(--red); }
.req { color: var(--red); font-weight: normal; }
.error { color: var(--red); font-size: .88rem; margin: 0; }
.hint { color: var(--muted); font-size: .86rem; margin: 0; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.spread { justify-content: space-between; }
.primary, .secondary, .danger { display: inline-flex; align-items: center; justify-content: center; gap: 4px; min-height: 44px; padding: 8px 16px; border-radius: 8px; font: inherit; cursor: pointer; border: 1px solid var(--green); text-decoration: none; }
.primary { background: var(--green); color: #fff; }
.primary:disabled { opacity: .5; cursor: default; }
.secondary { background: #fff; color: var(--green); }
.danger { background: #fff; color: var(--red); border-color: var(--red); }
.bar { position: sticky; bottom: 0; z-index: 5; background: var(--bg); padding: 10px 0; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: space-between; flex-wrap: wrap; }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.photo { border: 1px solid var(--line); border-radius: 10px; padding: 10px; display: grid; gap: 8px; background: #fbfaf6; margin: 0; }
.photo img, .photo .empty { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 6px; background: #ece7da; }
.photo .empty { display: grid; place-items: center; color: #8a8f88; font-size: .85rem; }
.progress { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; }
.progress span { display: block; height: 100%; width: 0; background: var(--green); }
.list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.item { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.item a { color: var(--ink); }
.item p { margin: 2px 0 0; }
.badge { padding: 4px 10px; border-radius: 999px; background: #fbe9e7; color: var(--red); font-size: .82rem; white-space: nowrap; }
.badge.good { background: #e3efe8; color: var(--green); }
.camera { position: fixed; inset: 0; background: rgba(10, 20, 15, .93); color: #fff; z-index: 50; padding: 16px; display: grid; gap: 10px; align-content: start; overflow: auto; }
.camera[hidden] { display: none; }
.camera-head { display: flex; justify-content: space-between; align-items: center; }
.camera .hint { color: #dfe7e2; text-align: center; }
.viewport { position: relative; width: 100%; max-width: 760px; margin: 0 auto; border-radius: 12px; overflow: hidden; background: #000; }
.viewport video { width: 100%; display: block; }
.mirror { transform: scaleX(-1); }
.guide-face, .guide-doc { position: absolute; border: 3px dashed rgba(255, 255, 255, .85); box-shadow: 0 0 0 9999px rgba(0, 0, 0, .35); pointer-events: none; }
.guide-face { inset: 10% 30%; border-radius: 50%; }
.guide-doc { inset: 15% 8%; border-radius: 12px; }
select#devices { width: auto; }
@media (max-width: 600px) { .guide-face { inset: 12% 18%; } .bar { position: static; } .who { margin-inline-start: 0; } }
@media print { .noprint, .header form, .bar { display: none; } body { background: #fff; } .card { break-inside: avoid; border-color: #ccc; } }

.note { background: #fff8e6; border-color: #ecd9a4; color: #6b5313; font-size: .9rem; }
.photos.one { grid-template-columns: minmax(200px, 320px); }
.pdf { display: grid; place-items: center; aspect-ratio: 4 / 3; border-radius: 6px; background: #eef3f0; color: var(--green); text-decoration: none; font-weight: bold; text-align: center; }
.bulk { margin-bottom: 14px; }
.drop { display: grid; gap: 4px; justify-items: center; text-align: center; border: 2px dashed #b9c9bf; border-radius: 12px; padding: 22px 12px; cursor: pointer; background: #f7faf8; }
.drop.over, .drop:hover { border-color: var(--green); background: #eaf3ee; }
.bulk-list { list-style: none; padding: 0; margin: 10px 0; display: grid; gap: 8px; }
.bulk-list li { display: flex; gap: 10px; align-items: center; border: 1px solid var(--line); border-radius: 10px; padding: 8px; background: #fff; }
.bulk-list li.ok { border-color: #9cc3ad; background: #f1f8f4; }
.bulk-list .thumb { width: 64px; height: 48px; object-fit: cover; border-radius: 6px; flex: none; }
.pdfthumb { display: grid; place-items: center; background: #eef3f0; color: var(--green); font-weight: bold; }
.bulk-list .grow { flex: 1; min-width: 0; display: grid; gap: 4px; }
.bulk-list .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bulk-list .state { width: 24px; text-align: center; font-size: 1.1rem; }
.photo .row > * { flex: 1 1 auto; }
@media (min-width: 900px) { .wrap { padding: 24px; } .card { padding: 20px 24px; } }
@media (max-width: 420px) { .wrap { padding: 10px; } .card { padding: 12px; } .header h1 { font-size: 1.1rem; } .photos { grid-template-columns: 1fr 1fr; gap: 8px; } .photo { padding: 8px; } .photo strong { font-size: .85rem; } }

/* حقل الملف مخفي بصرياً لكنه يبقى قابلاً للاستخدام (أثبت من hidden في بعض المتصفحات) */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); border: 0; }
.drop, .photo label { position: relative; }
.pair { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.pair .qr { background: #fff; padding: 6px; border: 1px solid var(--line); border-radius: 10px; line-height: 0; }
.pair > div:last-child { flex: 1 1 260px; }
.pair p { margin: 4px 0; }
.empty.done { background: #e3efe8; color: var(--green); font-weight: bold; }
@media (max-width: 600px) { .pair { display: none; } } /* على الموبايل نفسه لا حاجة للرمز */
.guide-card { border: 2px solid var(--green); background: #f3f8f5; text-align: center; }
.guide-card h2 { border: 0; padding: 0; font-size: 1.25rem; margin: 4px 0 14px; }
.guide-card .row { justify-content: center; }
.big { font-size: 1.1rem; min-height: 56px; min-width: 140px; }
/* ---------- تصوير الموبايل: الكاميرا بكامل الشاشة ---------- */
body.shoot { background: #000; color: #fff; overscroll-behavior: none; }
#shoot { position: fixed; inset: 0; display: grid; grid-template-rows: auto 1fr auto; }
#shoot[hidden] { display: none; }
.shoot-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 12px 14px; padding-top: max(12px, env(safe-area-inset-top)); background: rgba(15, 74, 51, .95); }
.shoot-top div { display: grid; }
.shoot-top strong { font-size: 1.2rem; line-height: 1.4; }
.shoot-top small { color: #cfe3d8; font-size: .8rem; }
.uploads { font-size: .8rem; padding: 4px 10px; border-radius: 999px; background: rgba(255, 255, 255, .15); white-space: nowrap; }
.uploads.good { background: #2e7d4f; } .uploads.bad { background: #b3261e; }
.shoot-view { position: relative; overflow: hidden; background: #000; }
.shoot-view video { width: 100%; height: 100%; object-fit: cover; display: block; }
.flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; }
.flash.on { animation: flash .35s ease-out; }
@keyframes flash { from { opacity: .8; } to { opacity: 0; } }
.start { position: absolute; inset: 0; display: grid; place-content: center; gap: 12px; text-align: center; padding: 20px; background: rgba(0, 0, 0, .7); }
.start[hidden] { display: none; }
.shoot-bar { display: flex; justify-content: space-around; align-items: center; padding: 14px; padding-bottom: max(14px, env(safe-area-inset-bottom)); background: #000; }
.shoot-bar .secondary { min-width: 84px; background: transparent; color: #fff; border-color: rgba(255, 255, 255, .6); }
.shutter { width: 74px; height: 74px; border-radius: 50%; border: 5px solid #fff; background: #fff; box-shadow: inset 0 0 0 4px #000; cursor: pointer; }
.shutter:disabled { opacity: .4; }
.shutter:active { transform: scale(.94); }
#summary { color: var(--ink); background: var(--bg); min-height: 100vh; }
.item.tap { cursor: pointer; }
#summary[hidden] { display: none; }

/* إطار التصوير بنسبة الوثيقة: ما خارجه معتم، وما داخله هو ما يُحفظ */
.shoot-view .frame { position: absolute; border: 3px solid #fff; border-radius: 10px; box-shadow: 0 0 0 9999px rgba(0, 0, 0, .55); pointer-events: none; }
.shoot-view .frame::before, .shoot-view .frame::after { content: ""; position: absolute; width: 28px; height: 28px; border-color: #a8873a; border-style: solid; }
.shoot-view .frame::before { top: -3px; right: -3px; border-width: 5px 5px 0 0; border-top-right-radius: 10px; }
.shoot-view .frame::after { bottom: -3px; left: -3px; border-width: 0 0 5px 5px; border-bottom-left-radius: 10px; }
.shoot-view .face-hint { display: none; position: absolute; left: 18%; right: 18%; top: 10%; height: 62%; border: 2px dashed rgba(255, 255, 255, .8); border-radius: 50%; }
.shoot-view .frame.face .face-hint { display: block; }
.shoot-hint { position: absolute; left: 0; right: 0; bottom: 10px; margin: 0; text-align: center; font-size: .9rem; color: #fff; text-shadow: 0 1px 3px #000; }
