/* نظام FP — erpmanag.com
   فكرة التصميم: ورق دفتر الحسابات والإيصال. حبرٌ كحليّ، وذهبيّ الشعار للتأكيد فقط،
   وخطّ كوفيّ للعناوين. لا تدرّجات ضبابيّة ولا بطاقات أيقونات متكرّرة. */

:root {
  --paper: #f4eee2;
  --paper-2: #ebe2d1;
  --card: #fffdf8;
  --ink: #10213a;
  --ink-2: #34425b;
  --muted: #6e695f;
  --line: rgba(16, 33, 58, .14);
  --rule: rgba(16, 33, 58, .07);
  --gold: #e8a317;
  --ok: #138a43;
  --bad: #c62828;
  --btn-bg: #10213a;
  --btn-fg: #ffffff;
  /* الإيصال ورقٌ أبيض في الوضعين */
  --r-paper: #fffdf8;
  --r-ink: #10213a;
  --r-muted: #6e695f;
  --kufi: 'Noto Kufi Arabic', 'IBM Plex Sans Arabic', Tahoma, sans-serif;
  --sans: 'IBM Plex Sans Arabic', 'Segoe UI', Tahoma, Arial, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, Menlo, monospace;
  --wrap: 1240px;
  --gutter: 24px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0d1625;
    --paper-2: #121e31;
    --card: #142238;
    --ink: #f1ebdf;
    --ink-2: #c8c0b1;
    --muted: #9b958a;
    --line: rgba(241, 235, 223, .16);
    --rule: rgba(241, 235, 223, .05);
    --btn-bg: #f1ebdf;
    --btn-fg: #10213a;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--sans); font-size: 17px; line-height: 1.8; -webkit-font-smoothing: antialiased; }
img, video { display: block; max-width: 100%; }
a { color: inherit; }
h1, h2, p { margin: 0; }
.ic { width: 1.2em; height: 1.2em; flex: none; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: var(--gutter); }
.skip { position: absolute; inset-inline-start: 12px; top: -60px; z-index: 100; background: var(--ink); color: var(--paper); padding: 8px 14px; border-radius: 10px; }
.skip:focus { top: 12px; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }

/* ── الأزرار: حبرٌ وخطٌّ ذهبيّ من الأسفل، مثل خطّ الشعار ── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .6em; font-family: var(--kufi); font-weight: 800; text-decoration: none; border: 0; cursor: pointer; transition: transform .15s, box-shadow .15s; }
.btn-ink { background: var(--btn-bg); color: var(--btn-fg); border-radius: 14px; padding: 14px 26px 16px; font-size: 18px; box-shadow: inset 0 -5px 0 var(--gold); }
.btn-ink:hover { transform: translateY(-2px); box-shadow: inset 0 -5px 0 var(--gold), 0 10px 24px -12px rgba(16, 33, 58, .6); }
.btn-ink:active { transform: translateY(0); }
.btn-sm { padding: 9px 16px 11px; font-size: 15px; border-radius: 11px; box-shadow: inset 0 -4px 0 var(--gold); }
.btn .ic { width: 20px; height: 20px; }

/* ── الترويسة ── */
.top { position: sticky; top: 0; z-index: 40; background: color-mix(in srgb, var(--paper) 88%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid transparent; transition: border-color .2s; }
.top.scrolled { border-bottom-color: var(--line); }
.top-row { display: flex; align-items: center; gap: 18px; height: 70px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; }
.brand b { font-family: var(--kufi); font-weight: 900; font-size: 20px; }
.top-wa { margin-inline-start: auto; display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 15px; text-decoration: none; color: var(--ink-2); padding: 8px 10px; border-radius: 10px; }
.top-wa:hover { background: var(--paper-2); }

/* ── الواجهة ── */
.hero { padding: 40px 0 46px; background-image: repeating-linear-gradient(0deg, transparent 0 43px, var(--rule) 43px 44px); }
.hero-h { font-family: var(--kufi); font-weight: 900; font-size: clamp(34px, 9vw, 92px); line-height: 1.22; letter-spacing: -.01em; }
.hero-h span:first-child { display: block; }
/* خطّ ذهبيّ تحت الكلمات نفسها، حتى لو انكسر السطر على الموبايل */
.hero-h .u { background-image: linear-gradient(var(--gold), var(--gold)); background-repeat: no-repeat; background-position: right 0 bottom .1em; background-size: 100% .14em; -webkit-box-decoration-break: clone; box-decoration-break: clone; animation: underline 1s .3s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes underline { from { background-size: 0 .14em; } }
.hero-sub { display: flex; align-items: flex-end; justify-content: space-between; gap: 22px 48px; margin-top: 26px; flex-wrap: wrap; }
.hero-sub p { max-width: 41em; font-size: clamp(17px, 1.6vw, 20px); color: var(--ink-2); }

/* الفيلم: كبير، بإطار حبر وظلّ ذهبيّ صلب */
.film { position: relative; margin: 38px 0 0; border: 2px solid var(--ink); border-radius: 22px; overflow: hidden; background: #f4eee2; box-shadow: -12px 12px 0 var(--gold); }
.film-v { width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; cursor: pointer; }
.film-ctl { position: absolute; left: 14px; bottom: 16px; display: flex; gap: 8px; }
.film-ctl button { width: 44px; height: 44px; border-radius: 12px; border: 0; background: rgba(16, 33, 58, .82); color: #fff; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.film-ctl button:hover { background: #10213a; }
.film-ctl .ic { width: 20px; height: 20px; }
.film-play .i-play { display: none; }
.film.paused .film-play .i-play { display: block; }
.film.paused .film-play .i-pause { display: none; }
.film-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: rgba(16, 33, 58, .12); }
.film-bar i { position: absolute; right: 0; top: 0; bottom: 0; width: 0; background: var(--gold); }
.facts { list-style: none; padding: 0; margin: 30px 0 0; display: flex; flex-wrap: wrap; gap: 10px 26px; font-weight: 600; color: var(--ink-2); }
.facts li { display: inline-flex; align-items: center; gap: 10px; }
.facts li::before { content: ""; width: 9px; height: 9px; border-radius: 2px; background: var(--gold); transform: rotate(45deg); }

/* ── شريط الإيصال المتحرّك ── */
.tape { overflow: hidden; background: var(--btn-bg); color: var(--btn-fg); border-block: 2px dashed color-mix(in srgb, var(--btn-fg) 35%, transparent); }
.tape-track { display: flex; width: max-content; animation: tape 40s linear infinite; }
.tape:hover .tape-track { animation-play-state: paused; }
.tape span { font-family: var(--kufi); font-weight: 700; font-size: 17px; padding: 14px 22px; white-space: nowrap; display: inline-flex; align-items: center; gap: 22px; }
.tape span::after { content: "✓"; color: var(--gold); font-family: var(--mono); }
@keyframes tape { to { transform: translateX(50%); } }

/* ── ركّب نظامك ── */
.build { padding: 84px 0 96px; }
.build-head { max-width: 760px; margin-bottom: 34px; }
.build-head h2 { font-family: var(--kufi); font-weight: 900; font-size: clamp(34px, 4.6vw, 58px); line-height: 1.25; }
.build-head p { margin-top: 10px; color: var(--ink-2); font-size: 18px; }
.build-grid { display: grid; grid-template-columns: 1fr 440px; gap: 40px; align-items: start; }

/* لوحة المفاتيح: صفوف لا بطاقات */
.board { display: grid; gap: 12px; }
.sw { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 16px; width: 100%; text-align: start; font: inherit; color: var(--ink); background: transparent; border: 2px solid var(--line); border-radius: 16px; padding: 14px 18px; cursor: pointer; transition: border-color .15s, background .15s, box-shadow .15s, transform .15s; }
.sw:hover { border-color: color-mix(in srgb, var(--ink) 45%, transparent); }
.sw:active { transform: scale(.995); }
.sw[aria-checked="true"] { border-color: var(--ink); background: var(--card); box-shadow: -6px 6px 0 var(--gold); }
.sw-ic { display: inline-flex; align-items: center; justify-content: center; width: 48px; height: 48px; border-radius: 13px; background: var(--paper-2); color: var(--ink); transition: background .15s, color .15s; }
.sw-ic .ic { width: 24px; height: 24px; }
.sw[aria-checked="true"] .sw-ic { background: var(--ink); color: var(--paper); }
.sw-t { display: flex; flex-direction: column; line-height: 1.45; min-width: 0; }
.sw-t b { font-family: var(--kufi); font-weight: 800; font-size: 19px; }
.sw-t small { color: var(--muted); font-size: 15px; }
.sw-k { position: relative; width: 58px; height: 32px; border-radius: 99px; background: var(--paper-2); border: 2px solid var(--line); transition: background .2s, border-color .2s; }
.sw-k::after { content: ""; position: absolute; top: 3px; right: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--card); box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .22s cubic-bezier(.3, 1.4, .5, 1); }
.sw[aria-checked="true"] .sw-k { background: var(--ok); border-color: var(--ok); }
.sw[aria-checked="true"] .sw-k::after { transform: translateX(-26px); background: #fff; }

/* الإيصال: ورقٌ بحوافّ مسنّنة */
.receipt { position: sticky; top: 92px; background: var(--r-paper); color: var(--r-ink); padding: 26px 26px 22px; filter: drop-shadow(0 22px 34px rgba(16, 33, 58, .22)); }
.receipt::before, .receipt::after { content: ""; position: absolute; left: 0; right: 0; height: 12px; background-size: 18px 12px; background-repeat: repeat-x; }
.receipt::before { top: -11px; background-image: conic-gradient(from 135deg at 50% 0, var(--r-paper) 90deg, transparent 0); }
.receipt::after { bottom: -11px; background-image: conic-gradient(from -45deg at 50% 100%, var(--r-paper) 90deg, transparent 0); }
.r-head { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; }
.r-head div { display: flex; flex-direction: column; line-height: 1.3; }
.r-head b { font-family: var(--kufi); font-weight: 900; font-size: 19px; }
.r-head small { color: var(--r-muted); font-size: 14px; }
.r-date { font-family: var(--mono); font-size: 14px; color: var(--r-muted); direction: ltr; }
.r-rule { height: 0; border-top: 2px dashed rgba(16, 33, 58, .25); margin: 16px 0; }
.r-items { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; min-height: 30px; }
.r-items li { display: flex; align-items: baseline; gap: 8px; font-weight: 600; font-size: 16px; }
.r-items li::after { content: ""; order: 2; flex: 1; border-bottom: 2px dotted rgba(16, 33, 58, .3); transform: translateY(-4px); }
.r-items li span { order: 1; }
.r-items li em { order: 3; font-style: normal; font-family: var(--kufi); font-weight: 700; font-size: 14px; color: var(--ok); }
.r-items li.new { animation: printed .45s ease-out; }
@keyframes printed { from { opacity: 0; transform: translateY(-8px); } }
.r-empty { color: var(--bad); font-weight: 600; font-size: 15px; }
.r-total { display: flex; justify-content: space-between; font-family: var(--kufi); font-weight: 800; font-size: 18px; }
.r-total b { color: var(--ok); }
.r-who { border: 0; padding: 0; margin: 0; min-width: 0; display: grid; gap: 4px; }
.r-who legend { font-family: var(--kufi); font-weight: 800; font-size: 16px; padding: 0; margin-bottom: 6px; }
.r-line { display: grid; grid-template-columns: 82px 1fr; align-items: end; gap: 10px; }
.r-line > span { font-weight: 600; font-size: 15px; color: var(--r-muted); padding-bottom: 8px; }
.r-line > span small { display: block; font-size: 12px; line-height: 1; }
.r-line input { width: 100%; font: inherit; font-size: 17px; color: var(--r-ink); background: transparent; border: 0; border-bottom: 2px dotted rgba(16, 33, 58, .35); border-radius: 0; padding: 8px 2px 6px; outline: none; transition: border-color .15s; }
.r-line input::placeholder { color: rgba(16, 33, 58, .35); }
.r-line input:focus { border-bottom: 2px solid var(--r-ink); }
.r-line input[dir="ltr"] { text-align: left; font-family: var(--mono); }
.r-line.bad input { border-bottom-color: var(--bad); }
.r-line .err { grid-column: 2; color: var(--bad); font-style: normal; font-size: 13.5px; font-weight: 600; }
.r-line .err:empty { display: none; }
.hp { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.form-err { margin-top: 14px; color: var(--bad); font-weight: 600; font-size: 15px; }
.r-send { width: 100%; margin-top: 18px; background: #10213a; color: #fff; }
.r-send .spin { display: none; width: 18px; height: 18px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, .4); border-top-color: #fff; animation: spin .8s linear infinite; }
.r-send.busy { pointer-events: none; opacity: .85; }
.r-send.busy .spin { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.r-note { margin-top: 10px; text-align: center; color: var(--r-muted); font-size: 13px; }
.r-bar { margin: 16px auto 0; width: 72%; height: 42px; background: repeating-linear-gradient(90deg, var(--r-ink) 0 2px, transparent 2px 5px, var(--r-ink) 5px 6px, transparent 6px 8px, var(--r-ink) 8px 11px, transparent 11px 13px); opacity: .85; }
/* الختم بعد الإرسال */
.stamp { position: absolute; top: 36%; left: 50%; width: 270px; margin-left: -135px; padding: 14px 10px; text-align: center; color: #1257c7; border: 5px double #1257c7; border-radius: 14px; background: rgba(255, 253, 248, .88); transform: rotate(-11deg); display: flex; flex-direction: column; gap: 2px; animation: stamp .45s cubic-bezier(.2, 1.6, .4, 1) both; }
.stamp[hidden] { display: none; }
.stamp b { font-family: var(--kufi); font-weight: 900; font-size: 34px; line-height: 1.3; }
.stamp span { font-family: var(--kufi); font-weight: 700; font-size: 19px; }
@keyframes stamp { from { opacity: 0; transform: rotate(-11deg) scale(1.9); } }
.receipt.sent .r-who, .receipt.sent .r-send, .receipt.sent .r-note { opacity: .4; }
.r-again { display: block; margin: 14px auto 0; font: inherit; font-weight: 700; color: var(--r-ink); background: transparent; border: 2px solid var(--r-ink); border-radius: 12px; padding: 6px 18px; cursor: pointer; }
.r-again[hidden] { display: none; }

/* ── التذييل ── */
.foot { border-top: 2px solid var(--ink); padding: 26px 0 30px; }
.foot-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 30px; font-weight: 600; color: var(--ink-2); }
.foot a { text-decoration: none; }
.foot a:hover { color: var(--ink); text-decoration: underline; }
.foot .copy { margin-inline-start: auto; color: var(--muted); font-weight: 500; }

.dock { display: none; }

.reveal { opacity: 0; transform: translateY(16px); transition: opacity .6s ease, transform .6s ease; }
.reveal.in { opacity: 1; transform: none; }

@media (max-width: 1000px) {
  .build-grid { grid-template-columns: 1fr; }
  .receipt { position: relative; top: 0; max-width: 520px; margin: 14px auto 0; width: 100%; }
}
@media (max-width: 640px) {
  :root { --gutter: 16px; }
  body { font-size: 16px; }
  .top-row { height: 60px; gap: 10px; }
  .top-wa span { display: none; }
  .top .btn-sm { display: none; }
  .hero { padding: 30px 0 34px; }
  .hero-sub { margin-top: 16px; }
  .hero-sub .btn { width: 100%; }
  .film { margin-top: 26px; border-radius: 16px; box-shadow: -7px 7px 0 var(--gold); }
  .film-ctl button { width: 38px; height: 38px; }
  .facts { gap: 8px 18px; font-size: 14.5px; }
  .build { padding: 56px 0 96px; }
  .sw { padding: 12px 14px; gap: 12px; }
  .sw-ic { width: 42px; height: 42px; }
  .sw-t b { font-size: 17px; }
  .sw-t small { font-size: 13.5px; }
  .sw-k { width: 50px; height: 28px; }
  .sw-k::after { width: 18px; height: 18px; }
  .sw[aria-checked="true"] .sw-k::after { transform: translateX(-22px); }
  .receipt { padding: 22px 18px 20px; }
  .r-line { grid-template-columns: 70px 1fr; }
  .foot .copy { margin-inline-start: 0; }
  .dock { display: block; position: fixed; z-index: 50; left: 16px; right: 16px; bottom: calc(14px + env(safe-area-inset-bottom)); text-align: center; text-decoration: none; font-family: var(--kufi); font-weight: 800; font-size: 17px; color: #fff; background: #10213a; border-radius: 14px; padding: 13px 16px 15px; box-shadow: inset 0 -5px 0 var(--gold), 0 14px 30px -12px rgba(16, 33, 58, .7); transform: translateY(160%); transition: transform .3s; }
  .dock.show { transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
}
