/* إشهاد — هوية مستوحاة من حبر الختم البنفسجي ونقش الأوراق الرسمية */
:root {
  --paper: #f4f3f8;
  --sheet: #ffffff;
  --ink: #1b1c2e;
  --muted: #5d5f78;
  --line: #dddbe8;
  --stamp: #3e3fa8;
  --stamp-soft: #e7e7f8;
  --brass: #94762c;
  --ok: #1f7a4d;
  --ok-soft: #e1f2e9;
  --warn: #a35c00;
  --warn-soft: #fbefdc;
  --bad: #b3263a;
  --bad-soft: #fbe3e7;
  --shadow: 0 1px 2px rgba(27, 28, 46, .06), 0 8px 24px rgba(27, 28, 46, .06);
  --f-display: "Alexandria", "Noto Sans Arabic", Tahoma, sans-serif;
  --f-body: "Noto Sans Arabic", "Segoe UI", Tahoma, sans-serif;
  --r: 10px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #12121c; --sheet: #1b1b29; --ink: #ecebf6; --muted: #a3a4bd; --line: #2e2e44;
    --stamp: #9a9bf3; --stamp-soft: #26264a; --brass: #d0b46a;
    --ok: #5fd39a; --ok-soft: #173326; --warn: #f0b25a; --warn-soft: #3a2a12; --bad: #f2798a; --bad-soft: #3d1a22;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--paper); color: var(--ink); font-family: var(--f-body); font-size: 16px; line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}
/* نقش الأمان الرسمي — خطوط موجية خفيفة في خلفية الصفحة */
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: -1; opacity: .5;
  background-image: repeating-radial-gradient(circle at 110% -10%, transparent 0 22px, var(--stamp-soft) 22px 23px);
}
a { color: var(--stamp); }
h1, h2, h3 { font-family: var(--f-display); font-weight: 600; line-height: 1.35; text-wrap: balance; margin: 0; }
h1 { font-size: clamp(1.6rem, 4vw, 2.3rem); }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.05rem; }
p { margin: 0; }
.wrap {
  max-width: 1080px; margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 24px 64px;
}
.narrow { max-width: 620px; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.num { font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; }

/* الشريط العلوي */
.bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 28px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand b { font-family: var(--f-display); font-size: 1.35rem; font-weight: 700; }
.seal {
  width: 38px; height: 38px; border-radius: 50%; border: 2px solid var(--stamp); color: var(--stamp);
  display: grid; place-items: center; font-family: var(--f-display); font-weight: 700; font-size: .95rem;
  box-shadow: inset 0 0 0 3px var(--sheet), inset 0 0 0 4px var(--stamp); transform: rotate(-12deg);
}

/* الأسطح */
.sheet { background: var(--sheet); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: 22px; }
.stack { display: grid; gap: 16px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.spacer { flex: 1; }

/* الحقول */
label.f { display: grid; gap: 6px; font-weight: 600; font-size: .95rem; }
label.f small { font-weight: 400; color: var(--muted); }
input, select, textarea {
  font: inherit; color: var(--ink); background: var(--sheet); border: 1.5px solid var(--line); border-radius: 8px;
  padding: 11px 12px; width: 100%; min-width: 0;
}
textarea { min-height: 110px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--stamp); box-shadow: 0 0 0 3px var(--stamp-soft); }
input[dir="ltr"] { text-align: left; }

/* الأزرار */
.btn {
  font: 600 .95rem var(--f-display); border: 1.5px solid var(--stamp); background: var(--stamp); color: #fff;
  border-radius: 8px; padding: 10px 16px; cursor: pointer; display: inline-flex; align-items: center; gap: 8px;
  text-decoration: none; white-space: nowrap;
}
@media (prefers-color-scheme: dark) { .btn { color: #12121c; } }
.btn.ghost { background: transparent; color: var(--stamp); }
.btn.quiet { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.danger { background: transparent; color: var(--bad); border-color: var(--bad); }
.btn.ok { background: var(--ok); border-color: var(--ok); }
.btn.big { padding: 14px 22px; font-size: 1.05rem; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn:focus-visible, a:focus-visible, button:focus-visible { outline: 3px solid var(--stamp-soft); outline-offset: 2px; }

/* الشارات */
.pill { display: inline-flex; align-items: center; gap: 6px; border-radius: 99px; padding: 2px 10px; font-size: .8rem; font-weight: 600; white-space: nowrap; }
.pill.pending { background: var(--warn-soft); color: var(--warn); }
.pill.approved { background: var(--ok-soft); color: var(--ok); }
.pill.rejected { background: var(--bad-soft); color: var(--bad); }
.pill.sent { background: var(--stamp-soft); color: var(--stamp); }
.pill.kind { background: transparent; border: 1px solid var(--brass); color: var(--brass); }

.note { border-radius: 8px; padding: 12px 14px; font-size: .92rem; }
.note.warn { background: var(--warn-soft); color: var(--warn); }
.note.bad { background: var(--bad-soft); color: var(--bad); }
.note.ok { background: var(--ok-soft); color: var(--ok); }
.note.info { background: var(--stamp-soft); color: var(--stamp); }

/* التبويبات */
.tabs { display: flex; gap: 4px; border-bottom: 1.5px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs button {
  font: 600 .95rem var(--f-display); background: none; border: 0; padding: 10px 14px; color: var(--muted); cursor: pointer;
  border-bottom: 3px solid transparent; margin-bottom: -1.5px; white-space: nowrap;
}
.tabs button[aria-selected="true"] { color: var(--stamp); border-bottom-color: var(--stamp); }

/* نوافذ داخل الصفحة */
.overlay { position: fixed; inset: 0; background: rgba(18, 18, 28, .55); display: grid; place-items: center; z-index: 50; padding: 16px; }
.overlay .sheet { width: min(560px, 100%); max-height: 90vh; overflow: auto; }

.toast {
  position: fixed; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); left: 50%; transform: translateX(-50%);
  background: var(--ink); color: var(--paper); padding: 10px 18px; border-radius: 8px; z-index: 60; font-weight: 600; box-shadow: var(--shadow);
}
.progress { height: 10px; background: var(--line); border-radius: 99px; overflow: hidden; }
.progress i { display: block; height: 100%; width: 0; background: var(--stamp); transition: width .2s; }
.empty { text-align: center; padding: 40px 16px; color: var(--muted); }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
