/* app.css — تطبيق سبأ للجوال. نفس هوية النظام: أخضر سبأ الغامق والذهبي، وخط IBM Plex Sans Arabic. */
@font-face { font-family: Plex; src: url(/fonts/plex-arabic-400.woff2) format('woff2'); font-weight: 400; unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF; font-display: swap; }
@font-face { font-family: Plex; src: url(/fonts/plex-arabic-600.woff2) format('woff2'); font-weight: 600; unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF; font-display: swap; }
@font-face { font-family: Plex; src: url(/fonts/plex-arabic-700.woff2) format('woff2'); font-weight: 700; unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF; font-display: swap; }
@font-face { font-family: Plex; src: url(/fonts/plex-latin-400.woff2) format('woff2'); font-weight: 400; unicode-range: U+0000-00FF, U+2000-206F, U+20AC; font-display: swap; }
@font-face { font-family: Plex; src: url(/fonts/plex-latin-600.woff2) format('woff2'); font-weight: 600; unicode-range: U+0000-00FF, U+2000-206F, U+20AC; font-display: swap; }
@font-face { font-family: Plex; src: url(/fonts/plex-latin-700.woff2) format('woff2'); font-weight: 700; unicode-range: U+0000-00FF, U+2000-206F, U+20AC; font-display: swap; }

:root {
  --deep: #0c3a36; --brand: #0e5a55; --brand-2: #127a72; --brand-soft: #e3f0ee;
  --gold: #c99a2e; --gold-ink: #9a6f16; --gold-soft: #f6ecd8;
  --bg: #f4f2ee; --panel: #fff; --ink: #1c2321; --muted: #6b7470; --line: #e8e4dc;
  --ok: #1d7a46; --ok-soft: #e3f3e9; --err: #b3261e; --err-soft: #fbe6e4; --warn: #a5650a; --warn-soft: #fbefd9;
  --r: 14px; --nav: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: Plex, system-ui, sans-serif; font-size: 15px; line-height: 1.5; }
body { min-height: 100vh; overscroll-behavior-y: contain; }
button, input, select { font: inherit; color: inherit; }
a { color: var(--brand-2); text-decoration: none; }
.num, .ltr { direction: ltr; unicode-bidi: isolate; font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.tiny { font-size: 11.5px; }
.ok { color: var(--ok); } .err { color: var(--err); } .goldt { color: var(--gold-ink); }
.hidden { display: none !important; }

.boot { height: 100vh; display: grid; place-items: center; background: var(--deep); }
.boot img { width: 72px; opacity: .9; animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(.92); opacity: .6; } }

/* ---- الرأس ---- */
.top { background: var(--deep); color: #fff; padding: calc(10px + var(--safe-t)) 16px 14px; position: sticky; top: 0; z-index: 5; }
.top .bar { display: flex; align-items: center; gap: 10px; }
.top .logo { height: 26px; }
.top .shop { flex: 1; min-width: 0; }
.top .shop b { display: block; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top .shop span { font-size: 12px; opacity: .8; display: flex; align-items: center; gap: 6px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #9aa6a2; display: inline-block; flex: none; }
.dot.on { background: #4cd28a; box-shadow: 0 0 0 3px rgba(76,210,138,.25); }
.icon-btn { background: rgba(255,255,255,.1); border: 0; color: #fff; width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; cursor: pointer; }
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn.spin svg { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(-360deg); } }
.top h1 { font-size: 20px; margin: 10px 0 0; }

/* ---- المحتوى ---- */
main { padding: 14px 14px calc(var(--nav) + 24px + var(--safe-b)); max-width: 640px; margin: 0 auto; }
.card { background: var(--panel); border-radius: var(--r); padding: 14px; margin-bottom: 12px; box-shadow: 0 1px 2px rgba(28,35,33,.05); }
.card h3 { font-size: 14px; margin: 0 0 8px; color: var(--muted); font-weight: 600; display: flex; align-items: center; gap: 8px; }
.card h3 .grow { flex: 1; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 0; }
.row + .row { border-top: 1px solid var(--line); }
.row > span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.row b { white-space: nowrap; }
.banner { border-radius: var(--r); padding: 12px 14px; margin-bottom: 12px; display: flex; gap: 10px; align-items: center; }
.banner.warn { background: var(--warn-soft); color: var(--warn); }
.banner.err { background: var(--err-soft); color: var(--err); }
.banner.gold { background: var(--gold-soft); color: var(--gold-ink); font-weight: 600; }
.banner.info { background: var(--brand-soft); color: var(--brand); }
.banner .grow { flex: 1; }

.chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; margin-bottom: 12px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { border: 1px solid var(--line); background: var(--panel); border-radius: 999px; padding: 6px 14px; white-space: nowrap; cursor: pointer; font-size: 14px; }
.chip.on { background: var(--deep); color: #fff; border-color: var(--deep); }

.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.kpi { background: var(--panel); border-radius: var(--r); padding: 12px 14px; box-shadow: 0 1px 2px rgba(28,35,33,.05); }
.kpi.main { padding-inline-end: 30px; grid-column: span 2; background: linear-gradient(135deg, var(--deep), var(--brand)); color: #fff; position: relative; overflow: hidden; }
.kpi.main::after { content: ''; position: absolute; inset-inline-end: 16px; bottom: 0; width: 6px; height: 46%; background: var(--gold); border-radius: 3px 3px 0 0; }
.kpi span { font-size: 13px; opacity: .8; display: block; }
.kpi b { font-size: 22px; display: block; margin-top: 2px; }
.kpi.main b { font-size: 30px; }
.kpi small { font-size: 12px; display: block; margin-top: 2px; }
.kpi small.up { color: var(--ok); } .kpi small.down { color: var(--err); }
.kpi.main small.up { color: #9ff0c3; } .kpi.main small.down { color: #ffc2bc; }

/* أعمدة بسيطة */
.bars, .bars-x { direction: ltr; }
.bars { display: flex; align-items: flex-end; gap: 3px; height: 110px; padding-top: 6px; }
.bars div { flex: 1; background: var(--brand-soft); border-radius: 4px 4px 0 0; min-height: 2px; position: relative; }
.bars div.on { background: var(--brand); }
.bars div.neg { background: var(--err-soft); }
.bars-x { display: flex; gap: 3px; margin-top: 4px; }
.bars-x span { flex: 1; text-align: center; font-size: 10px; color: var(--muted); direction: ltr; }

/* القوائم */
.search { width: 100%; border: 1px solid var(--line); background: var(--panel); border-radius: 12px; padding: 11px 14px; margin-bottom: 10px; font-size: 16px; }
.search:focus { outline: 2px solid var(--brand-2); outline-offset: -1px; }
.list .it { background: var(--panel); border-radius: 12px; padding: 12px 14px; margin-bottom: 8px; box-shadow: 0 1px 2px rgba(28,35,33,.04); }
.it .l1 { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.it .l1 b { font-size: 15px; }
.it .l2 { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; color: var(--muted); margin-top: 2px; }
.it .acts { display: flex; gap: 8px; margin-top: 10px; }
.badge { display: inline-block; font-size: 11.5px; padding: 1px 8px; border-radius: 999px; background: var(--line); color: var(--muted); font-weight: 600; }
.badge.err { background: var(--err-soft); color: var(--err); } .badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); } .badge.gold { background: var(--gold-soft); color: var(--gold-ink); }

.btn { border: 0; border-radius: 12px; padding: 11px 16px; font-weight: 600; cursor: pointer; background: var(--brand-soft); color: var(--brand); display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.btn.primary { background: var(--brand); color: #fff; }
.btn.ok { background: var(--ok); color: #fff; } .btn.no { background: var(--err-soft); color: var(--err); }
.btn.wa { background: #1fa855; color: #fff; }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn.block { width: 100%; }
.btn.grow { flex: 1; }
.btn:disabled { opacity: .5; }
.btn.sm { padding: 7px 12px; font-size: 13.5px; border-radius: 10px; }

table.t { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.t th { text-align: start; color: var(--muted); font-weight: 600; font-size: 12px; padding: 6px 4px; border-bottom: 1px solid var(--line); }
table.t td { padding: 8px 4px; border-bottom: 1px solid var(--line); }
table.t td.n, table.t th.n { text-align: end; direction: ltr; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.t tr.tot td { font-weight: 700; border-bottom: 0; }
.scroll-x { overflow-x: auto; }

.empty { text-align: center; color: var(--muted); padding: 30px 10px; }
.empty .big { font-size: 36px; display: block; margin-bottom: 6px; }

/* شريط التنقل */
nav.tabs { position: fixed; bottom: 0; inset-inline: 0; background: var(--panel); border-top: 1px solid var(--line); display: flex; padding-bottom: var(--safe-b); z-index: 6; }
nav.tabs a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; height: var(--nav); color: var(--muted); font-size: 11.5px; gap: 2px; position: relative; }
nav.tabs a svg { width: 23px; height: 23px; }
nav.tabs a.on { color: var(--brand); font-weight: 700; }
nav.tabs a.on::before { content: ''; position: absolute; top: 0; width: 28px; height: 3px; border-radius: 0 0 3px 3px; background: var(--gold); }
nav.tabs .cnt { position: absolute; top: 7px; inset-inline-end: calc(50% - 22px); background: var(--err); color: #fff; font-size: 10.5px; min-width: 17px; height: 17px; border-radius: 9px; display: grid; place-items: center; padding: 0 4px; font-weight: 700; }

/* الربط */
.pair { min-height: 100vh; background: var(--deep); color: #fff; padding: calc(40px + var(--safe-t)) 24px 40px; display: flex; flex-direction: column; align-items: center; text-align: center; }
.pair .logo { width: 170px; margin-bottom: 22px; }
.pair h2 { font-size: 21px; margin: 0 0 6px; }
.pair p { opacity: .85; margin: 0 0 18px; }
.pair ol { text-align: start; background: rgba(255,255,255,.07); border-radius: var(--r); padding: 14px 34px 14px 16px; margin: 0 0 20px; width: 100%; max-width: 380px; }
.pair ol li { margin: 4px 0; }
.pair input { width: 100%; max-width: 380px; text-align: center; letter-spacing: 3px; font-size: 22px; padding: 12px; border-radius: 12px; border: 0; margin-bottom: 12px; direction: ltr; text-transform: uppercase; color: var(--ink); }
.pair .btn { width: 100%; max-width: 380px; background: var(--gold); color: var(--deep); font-size: 16px; }
.pair .msg { margin-top: 14px; min-height: 22px; color: #ffd3cd; }

.toast { position: fixed; bottom: calc(var(--nav) + 16px + var(--safe-b)); inset-inline: 16px; background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 12px; z-index: 20; text-align: center; animation: up .2s ease-out; }
.toast.err { background: var(--err); } .toast.ok { background: var(--ok); }
@keyframes up { from { transform: translateY(12px); opacity: 0; } }
.foot { text-align: center; color: var(--muted); font-size: 12px; margin: 16px 0 4px; }
.reasons { margin: 8px 0 0; padding: 0; list-style: none; }
.reasons li { background: var(--warn-soft); color: var(--warn); border-radius: 8px; padding: 5px 10px; margin-top: 5px; font-size: 13.5px; font-weight: 600; }
