/* ElAdham design system v8: shared by the shop and the admin. Tokens first, then small reusable pieces. */
/* v12n16O10n: Cairo as three static faces per subset (400/600/700), instanced from the same variable font. A static
   face is what the PDF writer embeds as a real font; the variable file went into the PDF as shapes instead. */
@font-face { font-family: "Cairo"; src: url("/fonts/cairo-ar-400.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFF; }
@font-face { font-family: "Cairo"; src: url("/fonts/cairo-ar-600.woff2") format("woff2"); font-weight: 600; font-style: normal; font-display: swap; unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFF; }
@font-face { font-family: "Cairo"; src: url("/fonts/cairo-ar-700.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: swap; unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFF; }
@font-face { font-family: "Cairo"; src: url("/fonts/cairo-lat-400.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; unicode-range: U+0000-00FF, U+2000-206F; }
@font-face { font-family: "Cairo"; src: url("/fonts/cairo-lat-600.woff2") format("woff2"); font-weight: 600; font-style: normal; font-display: swap; unicode-range: U+0000-00FF, U+2000-206F; }
@font-face { font-family: "Cairo"; src: url("/fonts/cairo-lat-700.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: swap; unicode-range: U+0000-00FF, U+2000-206F; }
:root {
  --navy: #072a62; --navy-2: #051d45; --gold: #e8b23a; --red: #dc0a17; --bg: #f6f4ef; --card: #fff; --ink: #1c1c1c; --muted: #5b5b5b;
  --ok: #1e7d32; --warn: #6b5400; --warn-bg: #fdf3d7; --bad: #b3261e; --line: #e2ded5;
  --r: 12px; --r-sm: 8px; --sh: 0 1px 3px rgba(0,0,0,.08);
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px;
  --t-sm: 13px; --t-md: 15px; --t-lg: 18px; --t-xl: 22px;
}
body { font-family: "Cairo", "Segoe UI", Tahoma, sans-serif; }
:focus-visible { outline: 3px solid var(--navy); outline-offset: 2px; box-shadow: 0 0 0 5px var(--gold); border-radius: 6px; }
button, a.btn { min-height: 44px; }
input:not([type=checkbox]):not([type=radio]), select, textarea { min-height: 44px; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
/* feedback: toast, offline bar, empty and error states, skeleton */
#inv-extra { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 0; }
#inv-extra:empty { display: none; }
#toasts { position: fixed; inset: 0; z-index: 60; pointer-events: none; }
/* v12n16O10p: one pill, centred, never wider than the screen, and the script lifts it above any button it would cover. */
.toast { position: fixed; left: 0; right: 0; margin-inline: auto; width: max-content; max-width: min(92vw, 440px); bottom: 84px; background: var(--navy-2); color: #fff; border-radius: var(--r); padding: 10px 16px; font-size: var(--t-md); box-shadow: 0 4px 14px rgba(0,0,0,.25); pointer-events: none; text-align: center; }
.toast.ok { background: var(--ok); } .toast.bad, .toast.err { background: var(--bad); }
/* v12n16O10p: a field's own message, the confirm-screen money summary, and the pending-activation bar */
.ferr { display: block; color: var(--bad); font-size: var(--t-sm); font-weight: 600; margin-top: 4px; }
[aria-invalid="true"] { border-color: var(--bad) !important; }
.osum { display: flex; flex-direction: column; gap: 3px; margin: 8px 0 2px; font-size: var(--t-sm); }
.osum span { display: flex; justify-content: space-between; gap: 10px; }
.osum .net { border-top: 1px solid var(--line); padding-top: 4px; font-weight: 700; }
#offer-nudge { margin: 6px 0 0; font-size: var(--t-sm); color: var(--warn); background: var(--warn-bg); border-radius: var(--r-sm); padding: 8px 10px; }
#offer-nudge.ntop { color: var(--ok); background: #e8f5e9; }
#pendbar { background: var(--warn-bg); border: 1px solid #e6cf8f; color: var(--warn); border-radius: var(--r); padding: 10px 12px; margin: 10px 0; font-size: var(--t-sm); font-weight: 600; }
#offline { display: none; position: sticky; top: 0; z-index: 60; background: var(--bad); color: #fff; text-align: center; padding: 6px; font-size: var(--t-sm); }
.empty, .errbox { text-align: center; color: var(--muted); padding: var(--s5) var(--s4); background: var(--card); border-radius: var(--r); margin: var(--s3); }
.errbox { color: var(--bad); border: 1px solid #f0c4c0; }
.errbox button { margin-top: var(--s2); background: var(--navy); color: #fff; border: 0; border-radius: var(--r-sm); padding: 8px 16px; font-weight: 700; }
.skel { background: linear-gradient(90deg, #ece8df 25%, #f6f3ec 37%, #ece8df 63%); background-size: 400% 100%; animation: sk 1.3s ease infinite; border-radius: var(--r); min-height: 120px; }
@keyframes sk { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
/* brand header (logo drops in from /assets/logo.svg or /assets/logo.png) */
.brandimg { width: 48px; height: 48px; object-fit: contain; border-radius: 50%; background: transparent; padding: 0; box-shadow: 0 0 0 2px rgba(255,255,255,.85); }
.authlogo { display:block; width:72px; height:72px; margin:0 auto 6px; border-radius:50%; }
[aria-invalid="true"] { border-color: #b3261e !important; background: #fff6f5; }

/* ===== v12n16O10n: the printed sheet (invoice, request, credit note) =====
   One typography for screen and print, in pt/mm, because the page boxes are measured on screen and printed at the same
   size. assets/sheet.js builds the boxes; everything here styles them. Numbers are 700 with tabular figures so a column
   of money lines up and reads at a glance on paper. */
#inv-body { font-size: 11.5pt; line-height: 1.55; color: #000; }
#inv-body h2 { font-size: 16pt; margin: 0 0 3mm; }
#inv-body p { margin: 1.5mm 0; }
/* v12n16O10s: same lockup, same navy, same font — the logo and the company name are simply read at a size that looks like a
   company letterhead, the contact lines get room to breathe, and the rule under the header separates it from the document. */
#inv-body .inv-head { display: flex; justify-content: space-between; gap: 14px; align-items: center; flex-wrap: wrap; border-bottom: 1.5pt solid #072a62; padding-bottom: 3mm; margin-bottom: 3.5mm; }
#inv-body .inv-head .co { flex: 1 1 100%; min-width: 0; display: flex; gap: 14px; align-items: center; font-weight: 700; color: #072a62; }
#inv-body .inv-head .co-logo { height: 18mm; width: auto; flex: 0 0 auto; }
#inv-body .inv-head .co-txt { min-width: 0; flex: 1 1 auto; }
/* v12n16O10s: the name is the strongest element and wraps in two even lines instead of dropping one word on its own. */
#inv-body .inv-head .co-name { display: block; font-size: 17pt; line-height: 1.22; font-weight: 700; color: #072a62; text-wrap: balance; }
#inv-body .inv-head .co small { display: block; font-size: 9.5pt; font-weight: 400; color: #222; line-height: 1.4; margin-top: 1mm; }
#inv-body .inv-head .co small:first-of-type { margin-top: 1.6mm; }
#inv-body .inv-head .doc { flex: 1 1 100%; white-space: nowrap; text-align: start; font-size: 11pt; color: #222; line-height: 1.5; padding-top: 2.6mm; border-top: .6pt solid #c9d3e4; margin-top: 2.6mm; }
#inv-body .inv-head .doc b { display: block; font-size: 15pt; font-weight: 700; color: #111; margin-bottom: .6mm; }
/* v12n16O10s: one label per section so the document reads in order: customer, items, totals, notes, signature. */
#inv-body .sec { font-size: 9.5pt; font-weight: 700; color: #072a62; margin: 1.8mm 0 .8mm; padding-bottom: .6mm; border-bottom: .6pt solid #c9d3e4; }
#inv-body .sign { font-size: 9.5pt; color: #222; margin: 5mm 0 0; }
#inv-body .invt { width: 100%; border-collapse: collapse; font-size: 11pt; margin: 4mm 0; }
#inv-body .invt th, #inv-body .invt td { border: .6pt solid #444; padding: 1.7mm 2mm; vertical-align: middle; }
#inv-body .invt th { background: #eef2f8; font-weight: 700; color: #072a62; }
#inv-body .invt td:nth-child(2), #inv-body .invt th:nth-child(2) { width: auto; }
/* Mahmoud, 2026-12-06: the «الإجمالي» column printed as «00.00» — the money cells had no minimum width, the name column
   took 100% of the sheet, and a total wider than the cell was clipped by the page box (overflow:hidden) on its left edge
   in RTL. The two money columns now keep a minimum width; the name column takes what is left. */
#inv-body .invt td:nth-last-child(-n+2), #inv-body .invt th:nth-last-child(-n+2) { min-width: 24mm; }
#inv-body .invt td:first-child, #inv-body .invt th:first-child { width: 26mm; white-space: nowrap; }
#inv-body .invt td:not(:nth-child(2)), #inv-body .invt th:not(:nth-child(2)) { white-space: nowrap; text-align: center; }
#inv-body .invt td:not(:nth-child(2)) { font-weight: 700; font-variant-numeric: tabular-nums; }
/* v12n16O10p: the part-number line under the item name: smaller, darker, wraps in full, never an ellipsis */
/* v12n16O10s: a cancelled invoice keeps its title; the cancellation sits under it as one small line */
.doc-note { display: block; font-size: 8.5pt; color: #8a1c1c; margin: 1mm 0 0; }
/* v12n16O10s: the part number is the line the owner asked for by name — 9.5pt, semibold and dark, on its own line under
   the item name, never truncated. */
.pl { display: block; font-size: 9.5pt; color: #111; font-weight: 600; margin-top: 1.5px; overflow-wrap: anywhere; word-break: break-word; text-overflow: clip; }
.pl bdi { unicode-bidi: isolate; font-variant-numeric: tabular-nums; }
@media print { .pl { font-size: 9.5pt; } }
#inv-body .inv-tot { margin: 4mm 0 0 auto; width: 82mm; max-width: 100%; border-collapse: collapse; font-size: 12pt; }
#inv-body .inv-tot td { border: 0; padding: 1mm 0; white-space: nowrap; }
#inv-body .inv-tot td:last-child { text-align: start; font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
#inv-body .inv-tot tr.net td { border-top: 1.2pt solid #072a62; padding-top: 2mm; font-size: 13.5pt; font-weight: 700; }
#inv-body .inv-disc { font-size: 10pt; color: #222; }
/* the page boxes */
#inv-body.paged { padding: 0; background: #e9e6df; }
#inv-body.paged > .pg-sheet { width: 210mm; height: 296.5mm; box-sizing: border-box; padding: 12mm 11mm 14mm; margin: 0 auto 6mm; background: #fff; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
#inv-body.paged .pg-top { flex: 0 0 auto; }
#inv-body.paged .pg-main { flex: 1 1 auto; min-height: 0; overflow: hidden; }
#inv-body.paged .pg-main > *:last-child { margin-bottom: 0; }   /* a trailing margin is not content: measure only ink */
#inv-body.paged .pg-head { display: flex; align-items: baseline; justify-content: space-between; gap: 6mm; border-bottom: .6pt solid #999; padding-bottom: 1.5mm; margin-bottom: 3mm; font-size: 9.5pt; color: #222; }
#inv-body.paged .pg-head .pg-co { font-weight: 700; }
#inv-body.paged .pg-head .pg-doc { white-space: nowrap; }
#inv-body.paged .pg-foot { flex: 0 0 auto; display: flex; justify-content: space-between; gap: 4mm; align-items: baseline; border-top: .6pt solid #999; padding-top: 1.5mm; margin-top: 3mm; font-size: 8.5pt; color: #222; }
#inv-body.paged .pg-foot .pg-bits { flex: 1 1 0; min-width: 0; overflow-wrap: anywhere; }
#inv-body.paged .pg-foot .pg-tail { flex: 0 0 auto; display: flex; gap: 5mm; align-items: baseline; white-space: nowrap; }
#inv-body.paged .pg-foot .pg-no { white-space: nowrap; font-weight: 700; }

/* GAP-20: profile block inside the data dialog */
#prof{border:0;padding:0;margin:0 0 4px}
#prof legend{font-weight:700;padding:0;margin-bottom:6px}
#prof label{display:block;margin:8px 0}
#prof label[hidden]{display:none}

/* ===== v12n16O11: خطوات الطلب + عمود رقم القطعة على الورق ===== */
#inv-body .steps { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; margin: 0 0 3.5mm; font-size: 8.6pt; }
#inv-body .steps .stp { border: .6pt solid #c9d3e4; color: #4a5568; border-radius: 99px; padding: .8mm 2.4mm; background: #f7f9fd; white-space: nowrap; }
#inv-body .steps .stp.done { background: #e7f6ef; border-color: #9fd6bb; color: #14603f; }
#inv-body .steps .stp.cur { background: #072a62; border-color: #072a62; color: #fff; font-weight: 700; }
#inv-body .steps.off .stp { opacity: .55; }
#inv-body .steps .stp.off { background: #fdeceb; border-color: #f3b7b2; color: #8d1a12; opacity: 1; font-weight: 700; }
#inv-body .invt td.pcol { white-space: nowrap; font-variant-numeric: tabular-nums; }
#inv-body .invt td .attrs { display: flex; flex-wrap: wrap; gap: 2px; margin-top: 1mm; }
#inv-body .invt td .at { font-size: 7.6pt; padding: 0 1.6mm; border: .5pt solid #c9d3e4; border-radius: 99px; background: #f7f9fd; color: #12386f; }
#inv-body .invt { font-size: 12px; }
#inv-body .inv-head .co-logo { height: 22mm; }
#inv-body .inv-head .co-name { font-size: 20pt; }
