/* تخطيط: شريط علوي أبيض فيه شعار الجامعة + خط بألوان الهوية + تبويبات حسب الصلاحية + محتوى بعرض 1100px.
   ألوان الهوية من شعار Université Senghor: أخضر، أحمر، أزرق، بنفسجي، أصفر على أسود. */
:root {
  --c-green: #8bbb0c; --c-red: #e32129; --c-blue: #009ee0; --c-purple: #ab35c6; --c-yellow: #febb01;
  --bg: #f4f5f6;
  --surface: #ffffff;
  --surface-2: #eef0f2;
  --fg: #15181b;
  --muted: #5d656c;
  --line: #d9dde1;
  --ink: #15181b;          /* أزرار رئيسية: أسود الشعار */
  --ink-fg: #ffffff;
  --accent: #007db3;       /* أزرق الهوية بدرجة أغمق للقراءة */
  --pass: #febb01;
  --ok: #2f7d10;   --ok-bg: #e9f4dc;
  --warn: #8a5a00; --warn-bg: #fff2cc;
  --bad: #c4161d;  --bad-bg: #fde6e6;
  --idle: #5d656c; --idle-bg: #eceef0;
  --info: #006f9f; --info-bg: #e0f3fb;
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 4px 16px rgba(0,0,0,.06);
  --font: "IBM Plex Sans Arabic", "IBM Plex Sans", "Segoe UI", Tahoma, Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
  --r: 10px;
  color-scheme: light;
}
:root[dir="ltr"] { --font: "IBM Plex Sans", "IBM Plex Sans Arabic", "Segoe UI", Arial, sans-serif; }
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1113; --surface: #181b1e; --surface-2: #202428; --fg: #e8eaec; --muted: #9aa2a9; --line: #2d3237;
    --ink: #f2f3f4; --ink-fg: #121416; --accent: #3fbcf0; --pass: #febb01;
    --ok: #a8d65a; --ok-bg: #1f2e12; --warn: #f5c84a; --warn-bg: #352a0c; --bad: #ff8a8e; --bad-bg: #3a1617;
    --idle: #a7aeb5; --idle-bg: #262b30; --info: #7fd0f5; --info-bg: #0f2a38;
    --shadow: 0 1px 2px rgba(0,0,0,.3);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--fg); font: 15px/1.6 var(--font); -webkit-font-smoothing: antialiased; }
img { max-width: 100%; }
[hidden] { display: none !important; }
h1, h2, h3 { margin: 0; line-height: 1.3; text-wrap: balance; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.02rem; }
a { color: var(--accent); }
.boot { padding: 40px 16px; text-align: center; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; justify-content: center; }
.mono { font-family: var(--mono); letter-spacing: .02em; direction: ltr; unicode-bidi: isolate; }
.num { font-variant-numeric: tabular-nums; }
.stack { display: grid; gap: 18px; }

/* ---------- brand ---------- */
.logo { display: inline-flex; align-items: center; padding: 4px 0; }
.logo img { height: 30px; width: auto; display: block; }
.logo .logo-dark { display: none; }
@media (prefers-color-scheme: dark) {
  .logo .logo-light { display: none; }
  .logo .logo-dark { display: block; }
}
.stripe { display: grid; grid-template-columns: repeat(5, 1fr); height: 4px; }
.stripe i:nth-child(1) { background: var(--c-green); }
.stripe i:nth-child(2) { background: var(--c-red); }
.stripe i:nth-child(3) { background: var(--c-blue); }
.stripe i:nth-child(4) { background: var(--c-purple); }
.stripe i:nth-child(5) { background: var(--c-yellow); }

/* ---------- buttons & forms ---------- */
button, .btn {
  font: inherit; font-weight: 600; cursor: pointer; border-radius: 8px; border: 1px solid var(--line);
  background: var(--surface); color: var(--fg); padding: 9px 16px; text-decoration: none; display: inline-flex;
  align-items: center; justify-content: center; gap: 6px; min-height: 42px;
}
button:hover, .btn:hover { border-color: var(--muted); }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, .btn:focus-visible, a:focus-visible {
  outline: 2px solid var(--c-blue); outline-offset: 2px;
}
button:disabled { opacity: .55; cursor: wait; }
.primary { background: var(--ink); color: var(--ink-fg); border-color: var(--ink); }
.primary:hover { opacity: .88; border-color: var(--ink); }
.good { background: var(--ok); color: #fff; border-color: var(--ok); }
@media (prefers-color-scheme: dark) { .good { color: #10170a; } }
.danger { background: var(--surface); color: var(--bad); border-color: var(--bad); }
.ghost { background: transparent; border-color: transparent; }
.big { min-height: 52px; font-size: 1.05rem; padding-inline: 22px; }

label { display: grid; gap: 4px; font-weight: 500; font-size: .9rem; }
label .hint { font-weight: 400; color: var(--muted); font-size: .8rem; }
input, select, textarea {
  font: inherit; color: var(--fg); background: var(--surface); border: 1px solid var(--line); border-radius: 8px;
  padding: 9px 11px; width: 100%; min-height: 42px;
}
textarea { min-height: 80px; resize: vertical; }
select.lang { width: auto; min-height: 36px; padding: 4px 8px; font-size: .88rem; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.full { grid-column: 1 / -1; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row.end { justify-content: flex-end; }
.spacer { flex: 1; }
.req::after { content: " *"; color: var(--bad); }
fieldset { margin: 0; }

/* ---------- auth ---------- */
/* شاشة الدخول: نص الشاشة صورة الحرم الجامعي (public/campus.jpg) ونصها الفورم */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(380px, 1fr); background: var(--bg); }
.auth-hero {
  position: relative; overflow: hidden; color: #fff; text-shadow: 0 1px 12px rgba(0,0,0,.35);
  background-color: #0d2a47; isolation: isolate;
}
.auth-hero::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background-image: linear-gradient(180deg, rgba(6,18,36,.05) 0%, rgba(6,18,36,.25) 50%, rgba(6,18,36,.8) 100%), var(--campus, url('/campus.jpg'));
  background-size: cover; background-position: 30% center; background-repeat: no-repeat;
  animation: kenburns 24s ease-in-out infinite alternate; transform-origin: 30% 40%;
}
@keyframes kenburns { from { transform: scale(1); } to { transform: scale(1.09) translate3d(-1%, -1%, 0); } }
.hero-rotator { position: relative; height: 1.5em; margin-top: 12px; font-size: clamp(1.15rem, 2vw, 1.5rem); font-weight: 600; overflow: hidden; }
.hero-rotator span {
  position: absolute; inset-inline-start: 0; top: 0; white-space: nowrap; opacity: 0; transform: translateY(100%); filter: blur(6px);
  transition: opacity .6s ease, transform .6s cubic-bezier(.2,.8,.2,1), filter .6s ease; padding-inline-start: 14px;
}
.hero-rotator span::before { content: ""; position: absolute; inset-inline-start: 0; top: .25em; bottom: .2em; width: 4px; border-radius: 2px; background: var(--c); }
.hero-rotator span.on { opacity: 1; transform: none; filter: none; }
.hero-rotator span.off { opacity: 0; transform: translateY(-100%); filter: blur(6px); }
.hero-title { animation: rise .9s cubic-bezier(.2,.8,.2,1) both; }
.hero-kicker { animation: rise .9s .1s cubic-bezier(.2,.8,.2,1) both; }
.hero-rotator, .hero-text p { animation: rise .9s .25s cubic-bezier(.2,.8,.2,1) both; }
.auth-body { animation: rise .7s .15s cubic-bezier(.2,.8,.2,1) both; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .auth-hero::before, .hero-title, .hero-kicker, .hero-rotator, .hero-text p, .auth-body { animation: none; }
}

.hero-bands { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .1; mix-blend-mode: screen; }
.hero-inner { position: relative; height: 100%; display: flex; flex-direction: column; justify-content: space-between; padding: 40px 48px; gap: 40px; }
.hero-logo { width: min(210px, 55%); height: auto; }
.hero-text { max-width: 30rem; }
.hero-kicker { font-size: .9rem; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--c-yellow); margin-bottom: 10px; }
:root[lang="ar"] .hero-kicker { letter-spacing: 0; font-size: .95rem; }
.hero-title { font-size: clamp(2.2rem, 4.5vw, 3.6rem); font-weight: 700; line-height: 1.05; letter-spacing: -.01em; }
.hero-text p { margin: 14px 0 0; font-size: 1.05rem; line-height: 1.6; opacity: .88; }
.hero-stripe { height: 5px; max-width: 220px; border-radius: 3px; overflow: hidden; }
.auth-side { display: grid; place-items: center; padding: 32px 24px; }
.auth-card { width: min(420px, 100%); display: grid; gap: 18px; }
.auth-top { display: flex; align-items: center; gap: 10px; }
.auth-top .logo img { height: 34px; }
.auth-body { display: grid; gap: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 26px 24px; box-shadow: var(--shadow); }
.auth-body h2 { font-size: 1.45rem; }
.auth-body .primary { margin-top: 4px; }
.switch { text-align: center; font-size: .9rem; }
.switch button { min-height: auto; padding: 0; border: 0; background: none; color: var(--accent); text-decoration: underline; }
@media (max-width: 860px) {
  .auth { grid-template-columns: 1fr; }
  .auth-hero { min-height: 260px; }
  .hero-inner { padding: 24px 20px; gap: 24px; }
  .hero-logo { width: 160px; }
  .hero-text p { display: none; }
  .auth-side { padding: 20px 16px 32px; align-items: start; }
  .auth-top .logo { display: none; }
}

/* ---------- shell ---------- */
.top { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 10; background: var(--surface); border-bottom: 1px solid var(--line); }
.top-inner { max-width: 1100px; margin: 0 auto; padding: 10px 16px 0; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.app-title { font-weight: 700; font-size: 1rem; padding-inline-start: 4px; border-inline-start: 1px solid var(--line); padding-inline-start: 12px; }
.who { font-size: .85rem; text-align: end; line-height: 1.3; }
.top button { min-height: 36px; padding: 5px 12px; font-weight: 500; }
.bell { position: relative; }
.bell .dot { position: absolute; top: -7px; inset-inline-end: -7px; background: var(--c-red); color: #fff; border-radius: 999px; font-size: .7rem; min-width: 18px; height: 18px; display: grid; place-items: center; padding: 0 4px; }
.tabs { max-width: 1100px; margin: 6px auto 0; padding: 0 16px; display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.tabs a { color: var(--muted); text-decoration: none; padding: 10px 12px; white-space: nowrap; font-weight: 500; border-bottom: 3px solid transparent; }
.tabs a:hover { color: var(--fg); }
.tabs a[aria-current="page"] { color: var(--fg); font-weight: 700; border-bottom-color: var(--ink); }
main { max-width: 1100px; margin: 0 auto; padding: 20px 16px 60px; display: grid; gap: 18px; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; display: grid; gap: 14px; min-width: 0; }
.panel-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; }
.toolbar label { min-width: 140px; flex: 1 1 140px; }
.toolbar button { flex: 0 0 auto; }

/* ---------- chips ---------- */
.chip { display: inline-flex; align-items: center; gap: 5px; border-radius: 999px; padding: 2px 10px; font-size: .8rem; font-weight: 600; white-space: nowrap; }
.chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.s-pending { color: var(--warn); background: var(--warn-bg); }
.s-approved { color: var(--ok); background: var(--ok-bg); }
.s-rejected { color: var(--bad); background: var(--bad-bg); }
.s-cancelled { color: var(--idle); background: var(--idle-bg); }
.g-waiting { color: var(--idle); background: var(--idle-bg); }
.g-in { color: var(--ok); background: var(--ok-bg); }
.g-out { color: var(--info); background: var(--info-bg); }
.filters { display: flex; gap: 6px; flex-wrap: wrap; }
.filters button { min-height: 34px; padding: 4px 14px; border-radius: 999px; font-weight: 500; }
.filters button[aria-pressed="true"] { background: var(--ink); color: var(--ink-fg); border-color: var(--ink); }
.alert { border-radius: 8px; padding: 10px 12px; background: var(--warn-bg); color: var(--warn); font-weight: 600; }
.alert.info { background: var(--info-bg); color: var(--info); }

/* ---------- request cards ---------- */
.list { display: grid; gap: 10px; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px;
  display: grid; gap: 6px; text-align: start; width: 100%; font-weight: 400; min-height: 0;
}
button.card:hover { border-color: var(--fg); }
.card-top { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.card-title { font-weight: 600; font-size: 1rem; }
.meta { display: flex; gap: 4px 16px; flex-wrap: wrap; color: var(--muted); font-size: .88rem; }
.empty { text-align: center; color: var(--muted); padding: 30px 10px; border: 1px dashed var(--line); border-radius: var(--r); }

/* رقم الزيارة بشكل تذكرة مثقوبة بلون الهوية الأصفر */
.pass {
  display: inline-flex; align-items: center; gap: 10px; border: 1.5px dashed var(--pass); border-radius: 8px;
  padding: 6px 12px; background: color-mix(in srgb, var(--pass) 10%, var(--surface)); justify-self: start;
}
.pass .mono { font-size: 1.05rem; font-weight: 500; color: var(--fg); white-space: nowrap; }
.pass { flex-wrap: wrap; }
.pass small { color: var(--muted); }

/* ---------- visitor blocks in form ---------- */
.visitor { border: 1px solid var(--line); border-radius: var(--r); padding: 14px; display: grid; gap: 12px; background: var(--surface-2); }
.visitor-head { display: flex; align-items: center; gap: 8px; }
.visitor-head h3 { flex: 1; }
.file-pick { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.file-pick input { flex: 1 1 200px; }
.file-pick img { width: 72px; height: 52px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); }

/* ---------- gate ---------- */
.gate-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; }
.stat b { display: block; font-size: 1.7rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: .85rem; }
.gate-stats .stat:nth-child(1) { border-top: 3px solid var(--c-blue); }
.gate-stats .stat:nth-child(2) { border-top: 3px solid var(--c-green); }
.gate-stats .stat:nth-child(3) { border-top: 3px solid var(--c-purple); }
.gate-list { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); }
.gcard { display: grid; grid-template-columns: 64px 1fr; gap: 12px; align-items: center; }
.gcard .thumb { width: 64px; height: 64px; border-radius: 8px; object-fit: cover; background: var(--surface-2); border: 1px solid var(--line); display: grid; place-items: center; color: var(--muted); font-size: .7rem; }
.gcard.in { border-inline-start: 4px solid var(--ok); }
.gcard.out { opacity: .7; }

/* ---------- Excel import ---------- */
.import-box { display: grid; gap: 10px; padding: 14px; border: 1px dashed var(--c-blue); border-radius: var(--r); background: var(--info-bg); }
.file-btn { cursor: pointer; }
.hint.ok { color: var(--ok); font-weight: 500; }
.hint.warn { color: var(--warn); font-weight: 500; }

/* ---------- permits ---------- */
.permit-layout { display: grid; gap: 18px; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); align-items: start; }
@media (max-width: 900px) { .permit-layout { grid-template-columns: 1fr; } .permit-preview { order: -1; } }
.permit-preview { display: grid; gap: 6px; position: sticky; top: 120px; }
.permit-preview canvas { width: 100%; height: auto; border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); background: #fff; }
.bld-pick { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(190px, 100%), 1fr)); gap: 6px 12px; }
.bld-pick legend { font-weight: 500; font-size: .9rem; padding: 0 4px; }
.chk { display: flex; align-items: center; gap: 8px; font-weight: 400; font-size: .88rem; min-width: 0; }
.chk input { width: 18px; height: 18px; min-height: 0; flex: none; }
.chk b { min-width: 22px; }
.chk span { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chk.all { grid-column: 1 / -1; font-weight: 600; }
.verdict { padding: 14px 16px; border-radius: 10px; font-weight: 700; font-size: 1.05rem; text-align: center; }
.verdict.valid { background: var(--ok-bg); color: var(--ok); }
.verdict.expired, .verdict.revoked { background: var(--bad-bg); color: var(--bad); }
.permit-scan { display: flex; gap: 14px; align-items: center; }
.permit-photo { width: 96px; height: 120px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); flex: none; }

/* ---------- machine translation ---------- */
.orig { display: block; margin-top: 4px; font-size: .8rem; font-weight: 400; color: var(--muted); line-height: 1.45; }
.orig .mt { display: inline-block; font-size: .68rem; font-weight: 600; padding: 0 6px; border-radius: 4px; background: var(--info-bg); color: var(--info); margin-inline-end: 4px; vertical-align: 1px; }

/* ---------- sections ---------- */
h3.sec { font-size: .82rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding-bottom: 6px; border-bottom: 1px solid var(--line); margin-top: 6px; }
:root[lang="ar"] h3.sec { text-transform: none; letter-spacing: 0; font-size: .95rem; }

/* ---------- QR ---------- */
.pass-view { justify-items: center; text-align: center; }
.qr { width: min(280px, 100%); aspect-ratio: 1; background: #fff; color: #15181b; padding: 10px; border-radius: 12px; border: 1px solid var(--line); }
.qr svg { width: 100%; height: 100%; display: block; }
.qr .mono { overflow-wrap: anywhere; font-size: .8rem; }
.pass-view > * { max-width: 100%; min-width: 0; }
.pass-name { font-size: 1.2rem; font-weight: 700; }
.pass-sections { display: grid; gap: 0; width: 100%; text-align: start; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.pass-sections section { padding: 14px 16px; display: grid; gap: 8px; }
.pass-sections section + section { border-top: 1px dashed var(--line); }
.pass-sections h4 { margin: 0; font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
:root[lang="ar"] .pass-sections h4 { letter-spacing: 0; font-size: .85rem; }
.pass-sections section:nth-child(1) { border-inline-start: 4px solid var(--c-blue); }
.pass-sections section:nth-child(2) { border-inline-start: 4px solid var(--c-green); }
.pass-sections section:nth-child(3) { border-inline-start: 4px solid var(--c-purple); }
.pass-title { font-size: 1.15rem; font-weight: 700; line-height: 1.35; }
.pass-purpose { margin: 0; color: var(--muted); }
.pass-sections dl.kv { grid-template-columns: max-content 1fr; gap: 6px 16px; }
.pass-sections dl.kv dd { margin-bottom: 0; }
.copy-row { display: flex; gap: 8px; width: 100%; }
.copy-row input { flex: 1; min-width: 0; }
.scan-box { position: relative; width: 100%; aspect-ratio: 1; max-height: 60vh; background: #000; border-radius: 12px; overflow: hidden; }
.scan-box video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scan-frame { position: absolute; inset: 18%; border: 3px solid var(--c-yellow); border-radius: 14px; box-shadow: 0 0 0 999px rgba(0,0,0,.35); }

/* ---------- detail modal ---------- */
dialog { border: 0; border-radius: 14px; padding: 0; width: min(760px, calc(100% - 24px)); max-height: calc(100% - 24px); background: var(--surface); color: var(--fg); box-shadow: 0 20px 60px rgba(0,0,0,.3); }
dialog::backdrop { background: rgba(10, 12, 14, .55); }
.m-head { position: sticky; top: 0; background: var(--surface); padding: 16px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; z-index: 1; }
.m-head h2 { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.m-body { padding: 18px; display: grid; gap: 16px; }
.m-foot { position: sticky; bottom: 0; background: var(--surface); padding: 14px 18px; border-top: 1px solid var(--line); display: grid; gap: 10px; }
dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
dl.kv dt { color: var(--muted); font-size: .88rem; }
dl.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.doc { display: grid; gap: 10px; border: 1px solid var(--line); border-radius: var(--r); padding: 12px; }
.doc-img { width: 100%; max-height: 420px; object-fit: contain; background: var(--surface-2); border-radius: 8px; cursor: zoom-in; }
.doc-img.zoom { max-height: none; cursor: zoom-out; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r); }
table { border-collapse: collapse; width: 100%; font-size: .88rem; }
th, td { padding: 9px 12px; text-align: start; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { background: var(--surface-2); font-weight: 600; color: var(--muted); font-size: .8rem; position: sticky; top: 0; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--surface-2); }

/* ---------- stats ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.bars { display: flex; align-items: flex-end; gap: 4px; height: 180px; padding-top: 18px; overflow-x: auto; }
.bar { flex: 1 0 18px; display: grid; grid-template-rows: 1fr auto; gap: 4px; height: 100%; text-align: center; }
.bar .col { align-self: end; background: var(--c-blue); border-radius: 4px 4px 0 0; position: relative; min-height: 2px; }
.bar .col .arr { position: absolute; bottom: 0; inset-inline: 0; background: var(--c-green); border-radius: 4px 4px 0 0; }
.bar .col span { position: absolute; top: -18px; inset-inline: 0; font-size: .7rem; color: var(--muted); }
.bar small { font-size: .65rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.legend { display: flex; gap: 14px; font-size: .82rem; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-inline-end: 5px; vertical-align: -1px; }
.legend .l-a { background: var(--c-blue); }
.legend .l-b { background: var(--c-green); }
.rank { display: grid; gap: 8px; }
.rank div { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; font-size: .9rem; }
.rank .track { grid-column: 1 / -1; height: 6px; background: var(--surface-2); border-radius: 3px; overflow: hidden; }
.rank .track i { display: block; height: 100%; background: var(--fg); }
.two { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr)); }

/* ---------- notifications ---------- */
.notif-list { display: grid; gap: 8px; }
.notif { padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; }
.notif.unread { border-color: var(--c-blue); background: var(--info-bg); }

#toast {
  position: fixed; bottom: calc(env(safe-area-inset-bottom, 0px) + 18px); inset-inline: 16px; margin: 0 auto; max-width: 460px; z-index: 100;
  background: var(--fg); color: var(--bg); padding: 12px 16px; border-radius: 10px; box-shadow: var(--shadow); text-align: center; font-weight: 500;
}
#toast.bad { background: var(--bad); color: #fff; }

@media (max-width: 640px) {
  .top { position: static; }
  .who, .app-title { display: none; }
  .logo img { height: 24px; }
  .gate-stats .stat b { font-size: 1.35rem; }
  dl.kv { grid-template-columns: 1fr; gap: 0; }
  dl.kv dd { margin-bottom: 8px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- مؤشر الماوس بشكل ماك ---------- */
html, body { cursor: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%20width%3D%2728%27%20height%3D%2728%27%20viewBox%3D%270%200%2028%2028%27%3E%3Cpath%20d%3D%27M7%204.5v18.2l4.6-4.5%203%207%203.2-1.4-3-6.9h6.5z%27%20fill%3D%27rgba%280%2C0%2C0%2C.25%29%27%20transform%3D%27translate%28.6%20.9%29%27/%3E%3Cpath%20d%3D%27M6.5%203.5v18.2l4.6-4.5%203%207%203.2-1.4-3-6.9h6.5z%27%20fill%3D%27%23111%27%20stroke%3D%27%23fff%27%20stroke-width%3D%271.5%27%20stroke-linejoin%3D%27round%27/%3E%3C/svg%3E") 6 3, default; }
a, button, select, summary, label.btn, label.chk, .card, [role=button], input[type=checkbox], input[type=file], input[type=date], input[type=time] { cursor: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%20width%3D%2728%27%20height%3D%2728%27%20viewBox%3D%270%200%2028%2028%27%3E%3Cpath%20d%3D%27M11%203.2c-1%200-1.8.8-1.8%201.8v9.6l-1.5-1.5a1.8%201.8%200%200%200-2.6%202.6l5.2%205.4c1.1%201.2%202.6%201.9%204.3%201.9h3.4c3%200%205.4-2.4%205.4-5.4v-5.4a1.8%201.8%200%200%200-3.6%200v-.6a1.8%201.8%200%200%200-3.6%200v-.4a1.8%201.8%200%200%200-3.6%200V5c0-1-.8-1.8-1.6-1.8z%27%20fill%3D%27%23fff%27%20stroke%3D%27%23111%27%20stroke-width%3D%271.4%27%20stroke-linejoin%3D%27round%27/%3E%3Cpath%20d%3D%27M14.6%2014.8v4M18.2%2015.4v3.4M21.8%2016v2.6%27%20stroke%3D%27%23111%27%20stroke-width%3D%271.1%27%20stroke-linecap%3D%27round%27/%3E%3C/svg%3E") 10 3, pointer; }
input:not([type=checkbox]):not([type=file]):not([type=date]):not([type=time]), textarea { cursor: text; }
button:disabled { cursor: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%20width%3D%2728%27%20height%3D%2728%27%20viewBox%3D%270%200%2028%2028%27%3E%3Cpath%20d%3D%27M7%204.5v18.2l4.6-4.5%203%207%203.2-1.4-3-6.9h6.5z%27%20fill%3D%27rgba%280%2C0%2C0%2C.25%29%27%20transform%3D%27translate%28.6%20.9%29%27/%3E%3Cpath%20d%3D%27M6.5%203.5v18.2l4.6-4.5%203%207%203.2-1.4-3-6.9h6.5z%27%20fill%3D%27%23111%27%20stroke%3D%27%23fff%27%20stroke-width%3D%271.5%27%20stroke-linejoin%3D%27round%27/%3E%3C/svg%3E") 6 3, not-allowed; }

.auto-approve { padding: 12px 14px; border: 1px solid var(--ok); background: var(--ok-bg); border-radius: 8px; font-weight: 600; color: var(--fg); }
