/* بوابة فاحص الارتكاز — نفس ألوان التطبيق (SPEC البند 14) */
:root {
  --page:#EDF1EF; --card:#FFFFFF; --ink:#0F2830; --inkLine:#2B4750; --onInk:#F1F6F4; --onInkMuted:#C9D8DA; --onInkFaint:#A9BDBF; --inkChip:#22414A;
  --text:#132A30; --secondary:#3F5358; --muted:#5B6E72; --border:#D3DDD9; --divider:#E4EAE7; --track:#E1E8E5;
  --primary:#0F2830; --onPrimary:#F1F6F4;
  --goSoft:#E2F1EB; --goText:#145F47; --goSolid:#17795A;
  --waitSoft:#FBF0DD; --waitText:#8F5408; --waitRing:#C98A2E;
  --stopSoft:#F8E4E0; --stopText:#A33A28;
  --editSoft:#E7EEF5; --editBorder:#C5D4E3; --editText:#2A5580; --editHeading:#1D3F63; --editSub:#3F5A75;
  --up:#17795A; --down:#B23E2C; --ma20:#C28A2C; --ma50:#6F8FA0; --dot:#3DB38A; --dotText:#062019;
  color-scheme: light;
}
[data-theme="black"] {
  --page:#000000; --card:#111315; --ink:#15191C; --inkLine:#262C30; --onInk:#F2F4F5; --onInkMuted:#A3ACB1; --onInkFaint:#8E989D; --inkChip:#262C30;
  --text:#ECEFF0; --secondary:#B7C0C3; --muted:#9AA4A8; --border:#2A2F33; --divider:#1F2326; --track:#1C1F22;
  --primary:#ECEFF0; --onPrimary:#0B0C0D;
  --goSoft:#0F2E23; --goText:#4CC79A; --goSolid:#2FA877;
  --waitSoft:#33260E; --waitText:#F0B45A; --waitRing:#F0B45A;
  --stopSoft:#3A1612; --stopText:#F07A66;
  --editSoft:#0F1E2E; --editBorder:#22384F; --editText:#7FB2E5; --editHeading:#A9CBEF; --editSub:#8FAAC4;
  --up:#2FA877; --down:#E0735F; --ma20:#E0A44A; --ma50:#8FB0C2; --dot:#3DB38A; --dotText:#04150F;
  color-scheme: dark;
}
[data-theme="blue"] {
  --page:#0A1628; --card:#102038; --ink:#13305A; --inkLine:#24457A; --onInk:#EEF3FA; --onInkMuted:#A9BCD6; --onInkFaint:#8FA6C4; --inkChip:#1E3D6B;
  --text:#E8EEF6; --secondary:#B4C3D6; --muted:#93A6BF; --border:#243B5E; --divider:#1A2E4D; --track:#16294A;
  --primary:#E6EEF8; --onPrimary:#0B1426;
  --goSoft:#0E3130; --goText:#45C79A; --goSolid:#2DA878;
  --waitSoft:#362A14; --waitText:#F2B55C; --waitRing:#F2B55C;
  --stopSoft:#3B1B20; --stopText:#F2806C;
  --editSoft:#12294A; --editBorder:#2A4C7A; --editText:#8CC0F2; --editHeading:#B5D5F6; --editSub:#93AFCF;
  --up:#2DA878; --down:#E8735F; --ma20:#E6A94E; --ma50:#9FBBD6; --dot:#45C79A; --dotText:#04150F;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--page); color: var(--text); }
body { font-family: 'IBM Plex Sans Arabic', 'SF Arabic', 'Geeza Pro', Tahoma, sans-serif; -webkit-font-smoothing: antialiased; }
#app { max-width: 560px; margin: 0 auto; padding: 18px 16px 32px; display: flex; flex-direction: column; gap: 14px; }
a { color: var(--editText); }
button { font-family: inherit; cursor: pointer; }
button:disabled { opacity: .45; cursor: default; }
input, textarea, select { font-family: inherit; color: var(--text); }
.n { direction: ltr; unicode-bidi: isolate; }
.ltr { direction: ltr; text-align: right; }
.muted { color: var(--muted); }
.hidden { display: none !important; }
:focus-visible { outline: 2px solid var(--editText); outline-offset: 2px; }

/* عام */
.card { background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.card h2 { margin: 0; font-size: 17px; }
.card .sub { font-size: 13px; color: var(--muted); margin-top: -8px; }
.row { display: flex; align-items: center; gap: 8px; }
.between { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.pill { display: inline-block; font-size: 12.5px; font-weight: 700; border-radius: 999px; padding: 2px 10px; white-space: nowrap; }
.tag { display: inline-block; font-size: 11px; font-weight: 500; border-radius: 6px; padding: 1px 7px; white-space: nowrap; }
.t-green { background: var(--goSoft); color: var(--goText); }
.t-amber { background: var(--waitSoft); color: var(--waitText); }
.t-red { background: var(--stopSoft); color: var(--stopText); }
.t-edit { background: var(--editSoft); color: var(--editText); }
.c-green { color: var(--goText); } .c-amber { color: var(--waitText); } .c-red { color: var(--stopText); }
.box { border-radius: 10px; padding: 10px 12px; font-size: 14px; line-height: 1.6; }
.btn { height: 48px; padding: 0 18px; border: 0; border-radius: 14px; background: var(--primary); color: var(--onPrimary); font-size: 15px; font-weight: 700; }
.btn-outline { height: 48px; padding: 0 16px; border: 1.5px solid var(--border); border-radius: 14px; background: var(--card); color: var(--text); font-size: 15px; font-weight: 700; display: inline-flex; align-items: center; text-decoration: none; }
.btn-link { border: 0; background: none; padding: 0; color: var(--editText); font-size: 13.5px; font-weight: 700; text-decoration: underline; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--secondary); }
.input { height: 46px; border-radius: 12px; border: 1.5px solid var(--border); background: var(--page); padding: 0 12px; font-size: 16px; width: 100%; }
textarea.input { height: auto; min-height: 90px; padding: 10px 12px; line-height: 1.6; }
.disclaimer { font-size: 12px; color: var(--muted); text-align: center; line-height: 1.7; }
.err { background: var(--stopSoft); color: var(--stopText); }
.spinner { width: 22px; height: 22px; border: 3px solid var(--track); border-top-color: var(--muted); border-radius: 50%; animation: spin .8s linear infinite; margin: 30px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* الدخول */
.login-title { font-size: 30px; font-weight: 700; margin: 60px 0 0; }

/* الرأس */
.top h1 { font-size: 24px; margin: 0; line-height: 1.2; }
.top .sub { font-size: 13px; color: var(--muted); }
.chip-user { display: flex; align-items: center; gap: 8px; height: 44px; padding: 0 6px 0 12px; border: 1px solid var(--border); background: var(--card); border-radius: 22px; color: var(--text); }
.avatar { width: 32px; height: 32px; border-radius: 16px; background: var(--primary); color: var(--onPrimary); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 15px; }
.chip-user .nm { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.15; }
.chip-user .nm b { font-size: 13px; } .chip-user .nm small { font-size: 11px; color: var(--muted); }
.icon-btn { width: 44px; height: 44px; border-radius: 22px; border: 1px solid var(--border); background: var(--card); color: var(--text); display: flex; align-items: center; justify-content: center; font-size: 18px; }
.scanbar { display: flex; justify-content: space-between; align-items: center; background: var(--ink); color: var(--onInk); border-radius: 16px; padding: 12px 16px; }
.scanbar .l { font-size: 13px; color: var(--onInkMuted); } .scanbar b { font-size: 15px; }
.scanbar .dot { width: 8px; height: 8px; border-radius: 4px; background: var(--dot); display: inline-block; }
.seg { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; background: var(--track); border-radius: 14px; padding: 4px; }
.seg button { height: 44px; border: 0; border-radius: 11px; background: transparent; font-size: 15px; font-weight: 500; color: var(--secondary); display: flex; align-items: center; justify-content: center; gap: 6px; }
.seg button[aria-pressed="true"] { background: var(--card); font-weight: 700; color: var(--text); }
.counts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.counts div { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 10px 12px; display: flex; flex-direction: column; }
.counts b { font-size: 26px; line-height: 1.1; } .counts span { font-size: 13px; color: var(--secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search { display: flex; gap: 8px; }
.search label { flex: 1; display: flex; align-items: center; gap: 8px; height: 48px; background: var(--card); border: 1.5px solid var(--border); border-radius: 14px; padding: 0 14px; }
.search input { flex: 1; border: 0; outline: none; background: transparent; font-size: 15px; min-width: 0; }
.search .btn { display: flex; align-items: center; gap: 8px; padding: 0 16px; }
.badge { min-width: 20px; height: 20px; border-radius: 10px; background: var(--dot); color: var(--dotText); font-size: 12px; display: inline-flex; align-items: center; justify-content: center; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chips button { height: 34px; padding: 0 12px; border: 1px solid var(--border); background: var(--card); border-radius: 17px; font-size: 13px; color: var(--text); }
.chips button span { color: var(--muted); margin-inline-start: 4px; }
.listhead { display: flex; justify-content: space-between; align-items: baseline; padding: 0 4px; }
.listhead b { font-size: 15px; }
.listhead select { border: 0; background: transparent; color: var(--secondary); font-size: 13px; }
.list { background: var(--card); border: 1px solid var(--border); border-radius: 18px; overflow: hidden; }
.item { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 16px; min-height: 88px; color: var(--text); text-decoration: none; }
.item + .item { border-top: 1px solid var(--divider); }
.item:hover { background: color-mix(in srgb, var(--track) 40%, transparent); }
.item .l { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1; }
.item .tick { font-size: 18px; font-weight: 700; direction: ltr; unicode-bidi: isolate; }
.item .name { font-size: 13px; color: var(--muted); direction: ltr; text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .dist { font-size: 12.5px; color: var(--secondary); } .item .dist b { color: var(--text); }
.item .r { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; flex-shrink: 0; }
.item .score { display: flex; align-items: baseline; gap: 2px; direction: ltr; }
.item .score b { font-size: 26px; line-height: 1; } .item .score small { font-size: 12px; color: var(--muted); }
.item .price { font-size: 14px; font-weight: 500; direction: ltr; }
.flag { width: 22px; height: 15px; border-radius: 2px; flex-shrink: 0; display: block; }

/* صفحة السهم */
.back { display: flex; align-items: center; gap: 4px; height: 44px; padding: 0 4px; font-size: 16px; font-weight: 500; color: var(--text); text-decoration: none; border: 0; background: none; }
.edit-btn { height: 40px; padding: 0 14px; border: 1.5px solid var(--editText); background: var(--card); color: var(--editText); border-radius: 12px; font-size: 14px; font-weight: 700; }
.hero { background: var(--ink); color: var(--onInk); border-radius: 20px; padding: 20px 20px 0; display: flex; flex-direction: column; }
.hero .sym { font-size: 44px; font-weight: 700; line-height: 1; direction: ltr; text-align: right; }
.hero .country { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 500; }
.hero .cname { font-size: 14px; color: var(--onInkMuted); direction: ltr; text-align: right; }
.hero .ex { font-size: 12.5px; color: var(--onInkFaint); }
.metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 20px; border-top: 1px solid var(--inkLine); }
.metrics > div { padding: 14px 0 16px; display: flex; flex-direction: column; gap: 2px; }
.metrics > div + div { padding-inline-start: 14px; border-inline-start: 1px solid var(--inkLine); }
.metrics span { font-size: 12.5px; color: var(--onInkMuted); }
.metrics b { font-size: 24px; direction: ltr; text-align: right; }
.metrics .mini { display: flex; gap: 8px; align-items: center; }
.metrics .mini i { font-style: normal; font-size: 11px; background: var(--inkChip); border-radius: 6px; padding: 0 6px; }
.metrics .mini button { border: 0; background: none; color: var(--onInk); text-decoration: underline; font-size: 12.5px; padding: 0; }
.hero .asof { font-size: 12px; color: var(--onInkFaint); padding-bottom: 14px; line-height: 1.6; }
.ovr { background: var(--editSoft); border: 1px solid var(--editBorder); border-radius: 16px; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.ovr .who { display: flex; align-items: center; gap: 10px; }
.ovr .av { width: 36px; height: 36px; border-radius: 18px; background: var(--editText); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 16px; flex-shrink: 0; }
.ovr .who b { font-size: 15px; color: var(--editHeading); display: block; } .ovr .who small { font-size: 12.5px; color: var(--editSub); }
.ovr .chg { display: flex; justify-content: space-between; font-size: 13.5px; color: var(--editHeading); }
.ovr .note { background: var(--card); border-radius: 12px; padding: 10px 12px; font-size: 14px; color: var(--text); line-height: 1.6; white-space: pre-wrap; }
.outside { background: var(--editSoft); border: 1px solid var(--editBorder); border-radius: 14px; padding: 14px; color: var(--editSub); font-size: 13.5px; }
.outside b { color: var(--editHeading); font-size: 15px; display: block; margin-bottom: 4px; }
.frames { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.frames button { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; background: var(--card); border: 1.5px solid var(--border); border-radius: 14px; padding: 10px 12px; color: var(--text); text-align: right; }
.frames button[aria-pressed="true"] { border: 2px solid var(--text); }
.frames b { font-size: 15px; } .frames .st { font-size: 12.5px; font-weight: 500; } .frames .sc { font-size: 12px; color: var(--muted); direction: ltr; }
.frames .foot { display: flex; justify-content: space-between; align-items: center; width: 100%; }
.sum .big { font-size: 30px; font-weight: 700; line-height: 1.2; }
.sum .scorebox { display: flex; flex-direction: column; align-items: center; }
.sum .scorebox b { font-size: 34px; line-height: 1; direction: ltr; } .sum .scorebox small { font-size: 12px; color: var(--muted); direction: ltr; }
.sum .scorebox s { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.sum p { margin: 0; font-size: 16px; line-height: 1.6; }
.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tags span { background: var(--waitSoft); color: var(--waitText); border-radius: 10px; padding: 6px 12px; font-size: 14px; font-weight: 500; }
.sum .foot { display: flex; flex-wrap: wrap; gap: 6px 20px; border-top: 1px solid var(--divider); padding-top: 12px; font-size: 13px; color: var(--muted); }
.sum .foot b { color: var(--text); }
.cycle .stations { position: relative; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); margin-top: 14px; }
.cycle .trackbar { position: absolute; top: 21px; right: 10%; left: 10%; height: 6px; border-radius: 3px; background: var(--track); }
.cycle .trackbar i { position: absolute; top: 0; right: 0; height: 6px; border-radius: 3px; background: var(--goSolid); }
.cycle .st { position: relative; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.cycle .st span { width: 48px; height: 48px; border-radius: 24px; display: flex; align-items: center; justify-content: center; font-size: 17px; font-weight: 700; background: var(--card); color: var(--muted); border: 3px solid var(--track); }
.cycle .st.done span { background: var(--goSolid); color: #fff; border-color: var(--goSolid); }
.cycle .st.now span { color: var(--waitText); border-color: var(--waitRing); box-shadow: 0 0 0 5px var(--waitSoft); }
.cycle .st small { font-size: 12.5px; font-weight: 500; color: var(--muted); white-space: nowrap; }
.cycle .st.done small, .cycle .st.now small { color: var(--text); }
.bar { height: 10px; border-radius: 5px; background: var(--track); overflow: hidden; }
.bar i { display: block; height: 10px; border-radius: 5px; background: var(--goSolid); }
.chart svg { display: block; width: 100%; height: auto; direction: ltr; }
.legend { display: flex; gap: 16px; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 14px; height: 3px; border-radius: 2px; margin-inline-end: 6px; vertical-align: middle; }
.cond { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 10px; align-items: start; padding: 12px 0; }
.cond + .cond { border-top: 1px solid var(--divider); }
.cond .mk { width: 26px; height: 26px; border-radius: 13px; display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 700; }
.cond .tt { font-size: 15px; font-weight: 500; } .cond .dd { font-size: 13px; color: var(--muted); line-height: 1.5; }
.cond .w { font-size: 12px; color: var(--muted); padding-top: 3px; }
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 16px; }
.facts div { display: flex; flex-direction: column; padding: 10px 0; }
.facts div:nth-child(n+3) { border-top: 1px solid var(--divider); }
.facts span { font-size: 13px; color: var(--muted); } .facts b { font-size: 16px; } .facts small { font-size: 12px; color: var(--muted); min-height: 1em; }
.news a { display: flex; flex-direction: column; gap: 3px; padding: 12px 0; text-decoration: none; color: var(--text); }
.news a + a { border-top: 1px solid var(--divider); }
.news .h { font-size: 15px; font-weight: 500; } .news .h.en { direction: ltr; text-align: right; font-size: 14.5px; }
.news .s { font-size: 13px; color: var(--secondary); line-height: 1.6; } .news .m { font-size: 12px; color: var(--muted); display: flex; gap: 12px; }
details.card summary { font-size: 17px; font-weight: 700; cursor: pointer; }
details.card ul { margin: 0; padding-inline-start: 18px; color: var(--secondary); font-size: 13.5px; line-height: 1.8; }
.audit .e { padding: 10px 0; font-size: 13.5px; display: flex; flex-direction: column; gap: 4px; }
.audit .e + .e { border-top: 1px solid var(--divider); }

/* النوافذ */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: flex-end; justify-content: center; z-index: 10; }
.modal { background: var(--page); width: 100%; max-width: 560px; max-height: 92vh; overflow: auto; border-radius: 20px 20px 0 0; padding: 16px 16px 28px; display: flex; flex-direction: column; gap: 14px; }
@media (min-width: 640px) { .modal-bg { align-items: center; } .modal { border-radius: 20px; } }
.modal .mh { display: flex; justify-content: space-between; align-items: center; position: sticky; top: -16px; background: var(--page); padding: 6px 0; z-index: 1; }
.modal .mh b { font-size: 17px; }
.opts { display: flex; flex-wrap: wrap; gap: 8px; }
.opts button { height: 38px; padding: 0 12px; border-radius: 19px; border: 1px solid var(--border); background: var(--card); color: var(--text); font-size: 13.5px; }
.opts button[aria-pressed="true"] { font-weight: 700; border-width: 2px; }
.tri { display: inline-flex; background: var(--track); border-radius: 9px; padding: 2px; }
.tri button { width: 42px; height: 32px; border: 0; border-radius: 7px; background: transparent; color: var(--text); font-size: 15px; }
.tri button[aria-pressed="true"] { background: var(--card); box-shadow: 0 1px 2px rgba(0,0,0,.15); font-weight: 700; }
.switch { display: flex; justify-content: space-between; align-items: center; font-size: 15px; }
input[type="range"] { width: 100%; direction: ltr; accent-color: var(--editText); }
input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--goSolid); }
table.users { width: 100%; border-collapse: collapse; font-size: 14px; }
table.users td { padding: 10px 4px; border-top: 1px solid var(--divider); vertical-align: middle; }
