/* الشخصية الحديدية: الهوية البصرية مأخوذة من الشعار
   الألوان: برتقالي الأصابع، برتقالي الكف، أحمر الطوب، عنابي القاعدة، وحبر بني داكن على أرضية كريمية.
   التخطيط: قائمة جانبية بنية داكنة على الحاسوب، وشريط سفلي على الهاتف؛ المحتوى في عمود مقروء. */
:root {
  --bg: #FFF6EC;          /* كريمي الشعار */
  --surface: #FFFFFF;
  --surface-2: #FBEBDB;
  --ink: #1A0D09;         /* حبر الشعار */
  --muted: #6E564B;
  --line: #EEDCCB;
  --iron: #1F110C;        /* البني الداكن: القائمة */
  --iron-2: #36211A;
  --on-iron: #FFF6EC;
  --on-iron-muted: #CDB5A6;
  --hero: #962617;        /* عنابي القاعدة: الترويسات */
  --hero-2: #B23A1F;
  --accent: #CF3E1E;      /* أحمر الطوب: الأزرار */
  --accent-soft: #FCE3D8;
  --accent-ink: #962617;
  --amber: #F59A1F;       /* برتقالي الأصابع */
  --orange: #E5641C;      /* برتقالي الكف */
  --good: #2F6B4F;
  --good-soft: #DCEBE3;
  --bad: #8E1F14;
  --bad-soft: #F7DCD6;
  --warn: #F59A1F;
  --warn-ink: #3D1F05;
  --pre: #E2CDBC;
  --shadow: 0 1px 2px rgba(60, 25, 10, .06), 0 6px 18px rgba(60, 25, 10, .07);
  --font-body: "IBM Plex Sans Arabic", "Segoe UI", Tahoma, sans-serif;
  --font-display: "Noto Kufi Arabic", "IBM Plex Sans Arabic", "Segoe UI", sans-serif;
  --font-latin: "Oswald", "Arial Narrow", sans-serif;
  --radius: 16px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #160C08; --surface: #22140E; --surface-2: #2E1C14; --ink: #FBEFE3; --muted: #BFA596; --line: #3B261C;
    --iron: #0F0805; --iron-2: #2A1810; --on-iron: #FBEFE3; --on-iron-muted: #B59A8A;
    --hero: #6E1B10; --hero-2: #8C2A16;
    --accent: #EE5A30; --accent-soft: #3D1A10; --accent-ink: #FFB08F; --amber: #F7A83A; --orange: #F07A35;
    --good: #5BB287; --good-soft: #1C3328; --bad: #F07A68; --bad-soft: #3A1A15; --warn: #F7A83A; --warn-ink: #1A0D09;
    --pre: #4A3328; --shadow: 0 1px 2px rgba(0, 0, 0, .35); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #160C08; --surface: #22140E; --surface-2: #2E1C14; --ink: #FBEFE3; --muted: #BFA596; --line: #3B261C;
  --iron: #0F0805; --iron-2: #2A1810; --on-iron: #FBEFE3; --on-iron-muted: #B59A8A;
  --hero: #6E1B10; --hero-2: #8C2A16;
  --accent: #EE5A30; --accent-soft: #3D1A10; --accent-ink: #FFB08F; --amber: #F7A83A; --orange: #F07A35;
  --good: #5BB287; --good-soft: #1C3328; --bad: #F07A68; --bad-soft: #3A1A15; --warn: #F7A83A; --warn-ink: #1A0D09;
  --pre: #4A3328; --shadow: 0 1px 2px rgba(0, 0, 0, .35); color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font-body); font-size: 15px; line-height: 1.6; }
h1, h2, h3 { font-family: var(--font-display); text-wrap: balance; margin: 0; line-height: 1.35; }
h1 { font-size: 1.6rem; font-weight: 800; }
h2 { font-size: 1.1rem; font-weight: 700; }
h3 { font-size: 1rem; font-weight: 700; }
p { margin: 0; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); font-size: .87rem; }
.small { font-size: .8rem; }

/* ---------- الهيكل ---------- */
#app { min-height: 100%; display: flex; flex-direction: column; }
.shell { flex: 1; display: grid; grid-template-columns: 250px minmax(0, 1fr); min-height: 100%; }
.side { background: var(--iron); color: var(--on-iron); padding: 24px 16px; display: flex; flex-direction: column; gap: 20px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; flex-direction: column; gap: 2px; padding-inline: 8px; }
.brand b { font-family: var(--font-display); font-size: 1.25rem; font-weight: 800; }
.brand span { color: var(--on-iron-muted); font-size: .8rem; }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; color: var(--on-iron-muted); text-decoration: none; font-weight: 500; min-height: 44px; }
.nav a:hover { background: var(--iron-2); color: var(--on-iron); }
.nav a[aria-current="page"] { background: var(--iron-2); color: var(--on-iron); box-shadow: inset -3px 0 0 var(--accent); }
.side .me { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 12px; background: var(--iron-2); color: var(--on-iron); text-decoration: none; }
.side .me small { display: block; color: var(--on-iron-muted); }
.topbar, .tabbar { display: none; }
.main { min-width: 0; padding: 28px 32px 48px; }
.page { max-width: 980px; margin-inline: auto; display: flex; flex-direction: column; gap: 20px; }

@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { display: none; }
  .topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--iron); color: var(--on-iron); padding: calc(10px + env(safe-area-inset-top, 0px)) 16px 10px; position: sticky; top: 0; z-index: 5; }
  .topbar b { font-family: var(--font-display); font-weight: 800; }
  .tabbar { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; position: fixed; inset-inline: 0; bottom: 0; background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom, 0px); z-index: 5; }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 2px; min-height: 56px; color: var(--muted); text-decoration: none; font-size: .72rem; }
  .tabbar a[aria-current="page"] { color: var(--accent); font-weight: 700; }
  .main { padding: 18px 16px 96px; }
}

/* ---------- عناصر ---------- */
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.head .eyebrow { color: var(--muted); font-size: .85rem; }
.hero { background: var(--iron); color: var(--on-iron); border-radius: 20px; padding: 24px; display: flex; flex-direction: column; gap: 6px; }
.hero .eyebrow { color: var(--on-iron-muted); font-size: .85rem; }
.card { background: var(--surface); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.card.flat { box-shadow: none; border: 1px solid var(--line); }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); align-items: start; }
.stats { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); }
.stat { background: var(--surface); border-radius: 12px; padding: 14px; box-shadow: var(--shadow); }
.stat .k { color: var(--muted); font-size: .8rem; }
.stat .v { font-size: 1.6rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.3; }
.stat .v small { font-size: .85rem; color: var(--muted); font-weight: 500; }
.hero .stat { background: var(--iron-2); box-shadow: none; }
.stats.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 480px) { .stats.three .stat { padding: 10px; } .stats.three .stat .v { font-size: 1.3rem; } }
.hero .stat .k, .hero .stat .v small { color: var(--on-iron-muted); }
.row { display: flex; align-items: center; gap: 12px; min-width: 0; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.list { display: flex; flex-direction: column; }
.list > .item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); min-height: 56px; }
.list > .item:last-child { border-bottom: 0; }
button.item, a.item { background: none; border: 0; text-align: start; cursor: pointer; width: 100%; color: inherit; text-decoration: none; }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--line); display: grid; place-items: center; font-weight: 700; flex: none; }
.avatar.dark { background: var(--iron); color: var(--on-iron); border: 0; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 12px; border: 1px solid transparent; background: var(--accent); color: #fff; font-weight: 700; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { filter: brightness(1.06); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.secondary { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn.green { background: var(--good); }
.btn.dark { background: var(--iron); color: var(--on-iron); }
.btn.danger { background: var(--bad); }
.btn.ghost { background: transparent; color: var(--accent); padding: 0 8px; }
.btn.small { min-height: 36px; padding: 0 12px; font-size: .85rem; }
.btn.block { width: 100%; }
.icon-btn { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--ink); display: inline-grid; place-items: center; cursor: pointer; flex: none; }
.topbar .icon-btn { background: transparent; border-color: var(--iron-2); color: var(--on-iron); }

.chip { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 99px; font-size: .78rem; font-weight: 600; background: var(--surface-2); color: var(--ink); white-space: nowrap; }
.chip.accent { background: var(--accent-soft); color: var(--accent-ink); }
.chip.good { background: var(--good-soft); color: var(--good); }
.chip.bad { background: var(--bad-soft); color: var(--bad); }
.chip.warn { background: var(--warn); color: var(--warn-ink); }
.chip.dark { background: var(--iron-2); color: var(--on-iron); }

.bar { height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; flex: 1; min-width: 40px; }
.bar > i { display: block; height: 100%; border-radius: 4px; background: var(--good); }
.bar.thick { height: 12px; }
.bar.warn > i { background: var(--accent); }
.stages { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.stages i { height: 8px; border-radius: 4px; background: var(--surface-2); }
.stages i.done { background: var(--good); }
.stages i.now { background: var(--accent); }
.stages span { font-size: .78rem; color: var(--muted); }
.stages span.now { color: var(--ink); font-weight: 700; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label, .label { font-weight: 700; font-size: .9rem; }
.input, select.input, textarea.input { width: 100%; min-height: 46px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); }
textarea.input { min-height: 90px; resize: vertical; }
.input.code { text-align: center; font-size: 1.4rem; letter-spacing: .3em; font-variant-numeric: tabular-nums; }
.form { display: flex; flex-direction: column; gap: 14px; }
.form-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); }
.check { display: flex; align-items: center; gap: 12px; min-height: 48px; border-bottom: 1px solid var(--line); cursor: pointer; }
.check:last-child { border-bottom: 0; }
.check input { width: 22px; height: 22px; accent-color: var(--good); }

.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pills label, .pill { position: relative; }
.pills input { position: absolute; opacity: 0; pointer-events: none; }
.pills span, .pill { display: inline-flex; align-items: center; min-height: 40px; padding: 0 14px; border-radius: 20px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-size: .9rem; }
.pills input:checked + span, .pill[aria-pressed="true"], .pill[aria-selected="true"] { background: var(--iron); color: var(--on-iron); border-color: var(--iron); font-weight: 700; }
.pills input:focus-visible + span { outline: 3px solid var(--accent); }
.scroll-x { overflow-x: auto; display: flex; gap: 8px; padding-bottom: 4px; }
.rating { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.rating:last-of-type { border-bottom: 0; }
.rating .pills span { width: 40px; justify-content: center; padding: 0; border-radius: 10px; }

.seg { display: inline-flex; background: var(--surface-2); border-radius: 12px; padding: 4px; gap: 4px; }
.seg button { border: 0; background: transparent; min-height: 38px; padding: 0 16px; border-radius: 9px; cursor: pointer; }
.seg button[aria-selected="true"] { background: var(--surface); font-weight: 700; box-shadow: var(--shadow); }

.att { min-width: 84px; min-height: 40px; border-radius: 20px; border: 1px solid var(--line); background: var(--surface); font-weight: 700; cursor: pointer; }
.att.present { background: var(--good); border-color: var(--good); color: #fff; }
.att.absent { background: var(--bad); border-color: var(--bad); color: #fff; }
.att.excused { background: var(--warn); border-color: var(--warn); color: var(--warn-ink); }
.att.none { color: var(--muted); }
.cells { display: flex; gap: 4px; overflow-x: auto; padding-bottom: 4px; }
.cell { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: .68rem; color: var(--muted); }
.cell i { width: 26px; height: 26px; border-radius: 6px; display: grid; place-items: center; font-style: normal; font-weight: 700; font-size: .78rem; }
.cell i.present { background: var(--good); color: #fff; }
.cell i.absent { background: var(--bad); color: #fff; }
.cell i.excused { background: var(--warn); color: var(--warn-ink); }
.legend { display: flex; flex-wrap: wrap; gap: 14px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; font-size: .8rem; color: var(--muted); }
.legend i { width: 14px; height: 14px; border-radius: 4px; display: inline-block; }
.legend i.present { background: var(--good); }
.legend i.absent { background: var(--bad); }
.legend i.excused { background: var(--warn); }

.vals { display: flex; flex-direction: column; gap: 10px; }
.val { display: grid; grid-template-columns: 76px minmax(0, 1fr) 32px; align-items: center; gap: 8px; font-size: .88rem; }
.val .track { position: relative; height: 14px; border-radius: 7px; background: var(--surface-2); }
.val .track .p { position: absolute; inset-block: 0; inset-inline-start: 0; border-radius: 7px; background: var(--pre); }
.val .track .n { position: absolute; top: 4px; height: 6px; inset-inline-start: 0; border-radius: 3px; background: var(--ink); }
.val b { text-align: end; font-variant-numeric: tabular-nums; }
.badges { display: flex; flex-wrap: wrap; gap: 16px; }
.badge { display: flex; flex-direction: column; align-items: center; gap: 6px; width: 76px; text-align: center; font-size: .8rem; }
.badge i { width: 48px; height: 48px; border-radius: 50%; background: var(--good); color: #fff; display: grid; place-items: center; }

.date { width: 60px; height: 60px; border-radius: 14px; background: var(--iron); color: var(--on-iron); display: grid; place-content: center; text-align: center; line-height: 1.1; flex: none; }
.date small { font-size: .7rem; color: var(--on-iron-muted); }
.date b { font-size: 1.3rem; }
.proof { width: 100%; max-height: 260px; object-fit: cover; border-radius: 12px; background: var(--surface-2); }
.notice { border-radius: 12px; padding: 12px 14px; background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.notice.good { background: var(--good-soft); color: var(--good); }
.notice.bad { background: var(--bad-soft); color: var(--bad); }
.empty { text-align: center; color: var(--muted); padding: 28px 12px; }
.err { color: var(--bad); font-weight: 600; }
details.card > summary { cursor: pointer; list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 12px; font-weight: 700; }
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary::after { content: "+ إضافة"; color: var(--accent); font-size: .9rem; }
details.card[open] > summary::after { content: "إغلاق"; }

/* ---------- الدخول ---------- */
.login { flex: 1; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); }
.login .art { background: var(--iron); color: var(--on-iron); padding: 48px; display: flex; flex-direction: column; justify-content: flex-end; gap: 14px; position: relative; overflow: hidden; }
.login .art::before { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(135deg, transparent 0 22px, rgba(255, 255, 255, .025) 22px 23px); }
.login .art > * { position: relative; }
.login .art .kicker { color: var(--warn); font-weight: 600; }
.login .art h1 { font-size: clamp(2rem, 5vw, 3.2rem); }
.login .art p { color: var(--on-iron-muted); max-width: 46ch; }
.login .stages-line { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.login .stages-line span { border: 1px solid var(--iron-2); border-radius: 99px; padding: 4px 12px; font-size: .8rem; color: var(--on-iron-muted); }
.login .panel { display: flex; align-items: center; justify-content: center; padding: 32px 16px; }
.login .panel > div { width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 16px; }
@media (max-width: 860px) {
  .login { grid-template-columns: minmax(0, 1fr); }
  .login .art { padding: 32px 20px 28px; }
}

/* ---------- نوافذ الحوار والتنبيهات ---------- */
.overlay { position: fixed; inset: 0; background: rgba(10, 13, 16, .55); display: grid; place-items: center; padding: 16px; z-index: 50; }
.dialog { background: var(--surface); color: var(--ink); border-radius: 18px; padding: 22px; width: 100%; max-width: 440px; max-height: 90vh; overflow: auto; display: flex; flex-direction: column; gap: 14px; box-shadow: 0 20px 60px rgba(0, 0, 0, .35); }
.dialog .actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.dialog pre { white-space: pre-wrap; font-family: inherit; margin: 0; background: var(--surface-2); padding: 12px; border-radius: 10px; }
.qr { display: grid; place-items: center; padding: 12px; background: #fff; border-radius: 12px; }
.bigcode { font-size: 2rem; font-weight: 800; letter-spacing: .25em; text-align: center; font-variant-numeric: tabular-nums; }
.toast { position: fixed; bottom: calc(90px + env(safe-area-inset-bottom, 0px)); inset-inline: 0; margin-inline: auto; width: max-content; max-width: calc(100% - 32px); background: var(--iron); color: var(--on-iron); padding: 10px 18px; border-radius: 12px; z-index: 60; box-shadow: var(--shadow); }
.loading { display: grid; place-items: center; padding: 60px 0; color: var(--muted); }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } }

/* ---------- إضافات: عريف الطليعة، الشعارات، اللجان، الإحصائيات ---------- */
:root { --arif: #1F4E8C; --arif-soft: #DCE6F5; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --arif: #8DB4EA; --arif-soft: #1C2A3D; } }
:root[data-theme="dark"] { --arif: #8DB4EA; --arif-soft: #1C2A3D; }
.chip.arif { background: var(--arif-soft); color: var(--arif); border: 1px solid var(--arif); }
.logo { width: 52px; height: 52px; border-radius: 14px; object-fit: cover; background: var(--surface-2); border: 1px solid var(--line); flex: none; display: grid; place-items: center; font-weight: 800; font-family: var(--font-display); color: var(--muted); overflow: hidden; }
.logo.sm { width: 32px; height: 32px; border-radius: 9px; font-size: .8rem; }
.logo.lg { width: 72px; height: 72px; border-radius: 18px; font-size: 1.4rem; }
.hero .logo { background: var(--iron-2); border-color: var(--iron-2); color: var(--on-iron); }
.gallery { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 140px), 1fr)); }
.gallery button { padding: 0; border: 0; background: var(--surface-2); border-radius: 12px; overflow: hidden; cursor: pointer; aspect-ratio: 1; max-width: 100%; }
.gallery img { width: 100%; height: 100%; object-fit: cover; display: block; }
.committee-card { text-align: start; border: 0; cursor: pointer; color: inherit; font: inherit; width: 100%; }
.committee-card:hover { box-shadow: 0 0 0 2px var(--accent); }
.kv { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px 12px; align-items: center; font-size: .9rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; min-width: 0; }
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: .9rem; font-variant-numeric: tabular-nums; }
table.data th { text-align: start; color: var(--muted); font-weight: 600; font-size: .8rem; padding: 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.data td { padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data tr:last-child td { border-bottom: 0; }
table.data tr.click { cursor: pointer; }
table.data tr.click:hover td { background: var(--surface-2); }
.meter { display: flex; align-items: center; gap: 8px; min-width: 140px; }
.meter b { width: 42px; text-align: end; }
.cols { display: flex; align-items: flex-end; gap: 4px; height: 160px; padding-top: 18px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.cols .c { flex: 1 0 22px; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; }
.cols .c i { width: 100%; max-width: 30px; border-radius: 4px 4px 0 0; background: var(--good); display: block; min-height: 2px; }
.cols .c i.low { background: var(--accent); }
.cols .c span { font-size: .68rem; color: var(--muted); }
.cols-x { display: flex; gap: 4px; overflow-x: auto; }
.cols-x span { flex: 1 0 22px; text-align: center; font-size: .68rem; color: var(--muted); }
.big-num { font-size: 2.4rem; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.1; }
@media (max-width: 860px) {
  .tabbar { grid-auto-columns: minmax(62px, 1fr); overflow-x: auto; }
}


/* ---------- الهوية البصرية من الشعار ---------- */
.brand { flex-direction: column; align-items: flex-start; gap: 10px; }
.brand img { width: 52px; height: auto; flex: none; }
.brand b { color: var(--on-iron); line-height: 1.3; white-space: nowrap; display: block; }
.brand b em { font-style: normal; color: var(--amber); }
.brand span { font-family: var(--font-latin); letter-spacing: .14em; font-size: .7rem; text-transform: uppercase; white-space: nowrap; display: block; direction: ltr; text-align: end; }
.topbar .tb-brand { display: flex; align-items: center; gap: 10px; }
.topbar .tb-brand img { width: 30px; height: auto; }
.topbar .tb-brand em { font-style: normal; color: var(--amber); }
.nav a[aria-current="page"] { box-shadow: inset -4px 0 0 var(--amber); color: var(--on-iron); }
.nav a[aria-current="page"] svg { color: var(--amber); }
.tabbar a[aria-current="page"] { color: var(--accent); }
/* الترويسة: عنابي مع صف طوب في الأسفل مثل قاعدة القبضة */
.hero { background: var(--hero); color: var(--on-iron); position: relative; overflow: hidden; padding-bottom: 34px; }
.hero::after { content: ""; position: absolute; inset-inline: 24px; bottom: 12px; height: 10px; border-radius: 5px;
  background: repeating-linear-gradient(to left, var(--amber) 0 54px, transparent 54px 62px, var(--orange) 62px 116px, transparent 116px 124px, var(--accent) 124px 178px, transparent 178px 186px); opacity: .9; }
.hero .stat { background: rgba(255, 246, 236, .12); }
.hero .eyebrow, .hero .stat .k, .hero .stat .v small { color: #F6D9C8; }
.hero .logo { background: rgba(255, 246, 236, .14); border-color: transparent; }
.hero .btn.secondary { background: rgba(255, 246, 236, .14); color: var(--on-iron); border-color: rgba(255, 246, 236, .3); }
.hero .chip.dark { background: rgba(255, 246, 236, .16); color: var(--on-iron); }
.btn { border-radius: 14px; }
.btn.dark { background: var(--iron); }
.stages i.done { background: var(--amber); }
.stages i.now { background: var(--accent); }
.bar > i { background: var(--good); }
.bar.warn > i { background: var(--orange); }
.cols .c i.low { background: var(--orange); }
.chip.warn { background: var(--amber); color: var(--warn-ink); }
.att.excused, .cell i.excused, .legend i.excused { background: var(--amber); border-color: var(--amber); color: var(--warn-ink); }
.avatar.dark { background: var(--hero); }
.date { background: var(--hero); }
.badge i { background: var(--orange); }
h1, h2 { color: inherit; }
.head h1 { color: var(--ink); }
/* صفحة الدخول */
.login .art { background: var(--iron); }
.login .art::before { background:
  repeating-linear-gradient(0deg, transparent 0 46px, rgba(255, 246, 236, .022) 46px 50px),
  repeating-linear-gradient(90deg, transparent 0 96px, rgba(255, 246, 236, .022) 96px 100px); }
.login .art .mark { width: clamp(110px, 18vw, 170px); height: auto; }
.login .art h1 { color: var(--on-iron); }
.login .art h1 em { font-style: normal; color: var(--amber); }
/* */
.login .art .latin { direction: ltr; text-align: end; font-family: var(--font-latin); letter-spacing: .32em; font-size: .9rem; color: var(--on-iron-muted); }
.login .art .latin b { color: var(--accent); font-weight: 700; }
.login .art .kicker { color: var(--amber); }
.login .stages-line span { border-color: rgba(255, 246, 236, .18); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- الحوافز والأوسمة ---------- */
.medal { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; color: #fff; vertical-align: middle; flex: none; box-shadow: inset 0 -2px 0 rgba(0,0,0,.18); }
.medal.lg { width: 56px; height: 56px; }
.medal.silver, .avatar.medal.silver { background: linear-gradient(145deg, #D9DCE1, #8E949C); color: #2B2E33; }
.medal.gold, .avatar.medal.gold { background: linear-gradient(145deg, #F6CF57, #B9860F); color: #3A2600; }
.medal.diamond, .avatar.medal.diamond { background: linear-gradient(145deg, #8FE3F5, #2C8DB8); color: #06283A; }
.medal.elite, .avatar.medal.elite { background: linear-gradient(145deg, #2A1712, #5B2B1E); color: var(--amber); border: 2px solid var(--amber); }
.medal.legend, .avatar.medal.legend { background: linear-gradient(145deg, var(--amber), var(--accent) 55%, var(--hero)); color: #fff; box-shadow: 0 0 0 3px rgba(245,154,31,.35); }
.medal.none { background: var(--surface-2); color: var(--muted); box-shadow: none; }
.medal-chip.silver { background: #E6E8EB; color: #3B3F45; }
.medal-chip.gold { background: #FBE7A6; color: #5A3E00; }
.medal-chip.diamond { background: #CDEFF8; color: #0C4560; }
.medal-chip.elite { background: var(--iron); color: var(--amber); }
.medal-chip.legend { background: var(--accent); color: #fff; }
.champions .champ { display: flex; flex-direction: column; gap: 8px; padding: 14px; border-radius: 12px; background: var(--surface-2); border: 1px dashed var(--line); }
.champions .champ.won { background: linear-gradient(160deg, rgba(245,154,31,.18), rgba(207,62,30,.10)); border: 1px solid var(--amber); }
.champ-name { font-size: 1.15rem; }
.champions h2 svg, .card h2 svg { vertical-align: -3px; }
.rank { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.rank li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; background: var(--surface-2); }
.rank .pos { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: .85rem; background: var(--surface); color: var(--muted); flex: none; }
.rank .pos.p1 { background: #E8B42A; color: #3A2600; }
.rank .pos.p2 { background: #B9BEC5; color: #2B2E33; }
.rank .pos.p3 { background: #C9824A; color: #2E1606; }
.ladder { display: flex; flex-direction: column; gap: 10px; }
.ladder .rung { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 12px; border: 1px solid var(--line); }
.nav a, .tabbar a { position: relative; }
.nbadge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; background: var(--accent); color: #fff; font-size: .7rem; font-style: normal; font-weight: 700; display: inline-grid; place-items: center; margin-inline-start: auto; }
.nbadge[hidden] { display: none; }
.tabbar .nbadge { position: absolute; top: 4px; inset-inline-end: calc(50% - 22px); margin: 0; }
.my-inc:hover { border-color: var(--amber); }
.item .avatar.medal { width: 40px; height: 40px; }

/* ---------- المساعد ---------- */
.help-fab { position: fixed; inset-inline-end: 18px; bottom: 18px; z-index: 30; display: inline-flex; align-items: center; gap: 8px; padding: 12px 16px; border: 0; border-radius: 99px; background: var(--accent); color: #fff; font: inherit; font-weight: 700; cursor: pointer; box-shadow: 0 6px 20px rgba(31,17,12,.28); min-height: 48px; }
.help-fab:hover { filter: brightness(1.08); }
.help-fab.on { background: var(--iron); }
.help-panel { position: fixed; inset-inline-end: 18px; bottom: 80px; z-index: 31; width: min(390px, calc(100vw - 32px)); height: min(560px, calc(100vh - 120px)); display: flex; flex-direction: column; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 16px 48px rgba(31,17,12,.3); overflow: hidden; }
.help-panel[hidden] { display: none; }
.help-panel header { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; background: var(--iron); color: var(--on-iron); }
.help-panel header small { color: var(--on-iron-muted); }
.help-panel header .icon-btn { color: var(--on-iron); }
.help-log { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 10px; background: var(--bg); }
.help-log .msg { max-width: 90%; padding: 10px 12px; border-radius: 14px; line-height: 1.7; font-size: .93rem; }
.help-log .msg p { margin: 4px 0; }
.help-log .msg.bot { align-self: flex-start; background: var(--surface); border: 1px solid var(--line); border-start-start-radius: 4px; }
.help-log .msg.me { align-self: flex-end; background: var(--accent); color: #fff; border-start-end-radius: 4px; }
.help-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.help-chips button { font: inherit; font-size: .82rem; padding: 6px 10px; border-radius: 99px; border: 1px solid var(--accent); background: transparent; color: var(--accent-ink, var(--accent)); cursor: pointer; text-align: start; }
.help-chips button:hover { background: var(--accent-soft); }
.btn.sm { padding: 6px 12px; min-height: 34px; font-size: .85rem; margin-top: 4px; }
.help-input { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--line); background: var(--surface); }
.help-input .input { flex: 1; min-width: 0; }
.help-input .btn { flex: none; padding-inline: 14px; }
@media (max-width: 860px) {
  .help-fab { bottom: calc(68px + env(safe-area-inset-bottom, 0px)); padding: 12px; }
  .help-fab span { display: none; }
  .help-panel { bottom: calc(126px + env(safe-area-inset-bottom, 0px)); height: min(520px, calc(100vh - 190px)); }
}
.page { padding-bottom: 64px; }
.help-panel header .icon-btn { background: transparent; border: 1px solid rgba(255,255,255,.35); color: #fff; }

/* ---------- المؤسسات ---------- */
.org-logo { width: 44px; height: 44px; border-radius: 12px; object-fit: contain; background: #fff; border: 1px solid var(--line); flex: none; display: inline-grid; place-items: center; }
.org-logo.ph { background: var(--iron); color: var(--amber); font-weight: 800; font-size: 1.1rem; border: 0; }
.org-logo.lg { width: 72px; height: 72px; border-radius: 16px; font-size: 1.6rem; }
.org-logo.sm { width: 30px; height: 30px; border-radius: 8px; font-size: .85rem; }
.org-head { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); }
.org-list { display: flex; flex-direction: column; gap: 10px; }
.org-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-size: 1.05rem; cursor: pointer; text-align: start; min-height: 64px; }
.org-item:hover, .org-item:focus-visible { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.org-tag { display: flex; align-items: center; gap: 10px; margin: 6px 8px 4px; padding: 8px 10px; border-radius: 10px; background: var(--iron-2); color: var(--on-iron); text-decoration: none; font-weight: 600; font-size: .9rem; }
.tb-brand .org-logo.sm { width: 28px; height: 28px; }
pre.creds { white-space: pre-wrap; direction: rtl; font: inherit; font-size: .9rem; background: var(--surface-2); padding: 12px; border-radius: 10px; margin: 8px 0; }

/* ---------- مشهد الافتتاح: مبنى DEA ---------- */
#intro { position: fixed; inset: 0; z-index: 100; background: #140A07; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 16px; animation: introIn .5s ease both; overflow: hidden; }
#intro.out { animation: introOut .6s ease forwards; }
@keyframes introIn { from { opacity: 0; } }
@keyframes introOut { to { opacity: 0; transform: scale(1.04); } }
.intro-svg { width: min(100%, 520px); max-height: 74vh; height: auto; display: block; overflow: visible; }
.intro-cap { position: relative; z-index: 1; }
.intro-svg * { transform-box: fill-box; }
.intro-svg .stars circle { fill: #FFF3DF; animation: twinkle 2.6s ease-in-out infinite; }
@keyframes twinkle { 50% { opacity: .25; } }
.intro-svg .moon { fill: #FBE3B8; filter: drop-shadow(0 0 10px rgba(251,227,184,.6)); }
.intro-svg .ground { fill: #140A07; }
.intro-svg .halo { animation: fadeIn 1.2s 2.6s ease both; }
.intro-svg .body { fill: #1F110C; stroke: #3A2219; stroke-width: 1; animation: fadeIn .8s 1.2s ease both; }
.intro-svg .win { fill: #2E1A12; animation: winOn .5s ease both; }
.intro-svg .win.lit { animation-name: winLit; }
@keyframes winOn { from { opacity: 0; } }
@keyframes winLit { 0% { fill: #2E1A12; opacity: 0; } 60% { fill: #FFD27A; } 100% { fill: #F5A53A; opacity: .92; } }
.intro-svg .col { fill: url(#colg); }
.intro-svg .col-hi { fill: rgba(255,214,150,.18); }
.intro-svg .base { fill: #CF3E1E; }
.intro-svg .pillar { transform-origin: 50% 100%; animation: rise .9s cubic-bezier(.2,.9,.25,1.1) both; }
@keyframes rise { from { transform: scaleY(0); } }
.intro-svg .plabel { animation: fadeUp .5s ease both; }
.intro-svg .pname { fill: #FFE7C4; text-anchor: middle; font-family: 'IBM Plex Sans Arabic', sans-serif; font-weight: 700; }
.intro-svg .lphold { fill: #E5641C; }
.intro-svg .linit { fill: #fff; text-anchor: middle; font-size: 9px; font-weight: 800; font-family: 'IBM Plex Sans Arabic', sans-serif; }
.intro-svg .floor { animation: drop .55s cubic-bezier(.3,1.4,.5,1) both; }
@keyframes drop { from { transform: translateY(-140px); opacity: 0; } 70% { opacity: 1; } }
.intro-svg .slab { fill: #4A2A1D; stroke: #F59A1F; stroke-width: .8; }
.intro-svg .fnum { fill: #F59A1F; font: 700 11px 'Oswald', sans-serif; opacity: .8; }
.intro-svg .stadium { animation: fadeIn .7s 2.55s ease both; }
.intro-svg .stadium-bg { fill: #0F2318; }
.intro-svg .grass { fill: #1E7A45; }
.intro-svg .stripe { fill: #23894F; }
.intro-svg .line { fill: none; stroke: #EAF7EE; stroke-width: 1.1; opacity: .9; }
.intro-svg .goal { stroke-width: 1.4; }
.intro-svg .ball { fill: #fff; filter: drop-shadow(0 0 3px #fff); animation: ball 3.2s 3.1s ease-in-out infinite; }
@keyframes ball { 0%,100% { transform: translate(0,0); } 20% { transform: translate(-52px,6px); } 45% { transform: translate(34px,-7px); } 70% { transform: translate(92px,3px); } 85% { transform: translate(20px,8px); } }
.intro-svg .player { animation: run 2.4s 3.1s ease-in-out infinite alternate; }
.intro-svg .p1, .intro-svg .p3 { fill: #F59A1F; }
.intro-svg .p2, .intro-svg .p4 { fill: #CF3E1E; stroke: #fff; stroke-width: .6; }
.intro-svg .p2, .intro-svg .p3 { animation-duration: 1.9s; animation-direction: alternate-reverse; }
@keyframes run { to { transform: translate(18px, -4px); } }
.intro-svg .flood line { stroke: #9B8A7F; stroke-width: 1.5; }
.intro-svg .flood circle { fill: #FFF6D6; animation: flood 1s 2.9s steps(2) 2 both; filter: drop-shadow(0 0 6px #FFF3C2); }
@keyframes flood { 0% { opacity: 0; } 100% { opacity: 1; } }
.intro-svg .beam { fill: rgba(255,246,214,.10); animation: fadeIn .4s 3.3s both; }
.intro-svg .roof { animation: fadeUp .7s 3.1s ease both; }
.intro-svg .sign { fill: #CF3E1E; stroke: #F59A1F; stroke-width: 1.5; filter: drop-shadow(0 0 12px rgba(245,154,31,.55)); }
.intro-svg .sign-t { fill: #fff; text-anchor: middle; font: 700 19px 'Oswald', 'IBM Plex Sans Arabic', sans-serif; letter-spacing: 1.5px; }
.intro-svg .leg, .intro-svg .mast { stroke: #9B8A7F; stroke-width: 2; }
.intro-svg .flag { fill: #F59A1F; transform-origin: 0 50%; animation: wave 1.6s 3.4s ease-in-out infinite alternate; }
@keyframes wave { to { transform: skewY(-6deg) scaleX(.92); } }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } }
.intro-cap { text-align: center; color: #FFF3DF; display: flex; flex-direction: column; align-items: center; gap: 4px; animation: fadeUp .8s 3.6s ease both; }
.intro-cap .k { color: #F59A1F; font: 700 .85rem 'Oswald', sans-serif; letter-spacing: 3px; }
.intro-cap h1 { font-size: clamp(1.5rem, 5vw, 2.2rem); margin: 0; color: #FFF3DF; }
.intro-cap h1 em { font-style: normal; color: #F59A1F; }
.intro-cap p { margin: 0 0 8px; color: #D9BFA8; }
.intro-cap .btn { min-width: 160px; }
@media (prefers-reduced-motion: reduce) {
  .intro-svg *, #intro, .intro-cap { animation-duration: .01s !important; animation-delay: 0s !important; animation-iteration-count: 1 !important; }
}
