/* =========================================================
   TRADE AI — style.css
   التصميم: Dark premium — Mobile First
   الجزء 1: الألوان، الأساسيات، الهيكل العام
   ========================================================= */

/* ---------- 1. الألوان والمقاسات ---------- */
:root {
  --bg: #080b12;
  --bg-2: #0d111a;
  --surface: rgba(21, 26, 38, 0.72);
  --surface-2: rgba(255, 255, 255, 0.035);
  --surface-3: rgba(255, 255, 255, 0.06);
  --border: rgba(255, 255, 255, 0.07);
  --border-2: rgba(255, 255, 255, 0.13);

  --text: #e7eaf0;
  --text-2: #9ca4b4;
  --text-3: #687184;

  --accent: #5b8cff;
  --accent-soft: rgba(91, 140, 255, 0.14);
  --buy: #19c37d;
  --buy-soft: rgba(25, 195, 125, 0.13);
  --sell: #f0445c;
  --sell-soft: rgba(240, 68, 92, 0.13);
  --wait: #f2b544;
  --wait-soft: rgba(242, 181, 68, 0.13);

  --radius: 16px;
  --radius-sm: 10px;
  --gap: 12px;
  --side-w: 244px;
  --top-h: 60px;
  --bottom-h: 64px;

  --font: 'IBM Plex Sans Arabic', system-ui, -apple-system, 'Segoe UI', Tahoma, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  --ease: cubic-bezier(.2, .7, .2, 1);

  color-scheme: dark;
}

/* ---------- 2. الأساسيات ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background:
    radial-gradient(900px 500px at 85% -10%, rgba(91, 140, 255, 0.10), transparent 60%),
    radial-gradient(700px 400px at 0% 110%, rgba(25, 195, 125, 0.05), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1, h2, h3, p { margin: 0; }
ul { list-style: none; margin: 0; padding: 0; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
input, select { font: inherit; color: inherit; }

.icon { width: 20px; height: 20px; flex-shrink: 0; }
.icon-lg { width: 32px; height: 32px; }
.icon-xl { width: 44px; height: 44px; }

.mono {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  direction: ltr;
  unicode-bidi: isolate;
}
/* الأرقام تُكتب من اليسار لليمين، لكن تبقى محاذاة الخانة مع اتجاه الصفحة */
[dir="rtl"] div.mono, [dir="rtl"] .level b.mono { text-align: right; }
.muted { color: var(--text-3); }
.up { color: var(--buy); }
.down { color: var(--sell); }
.center { text-align: center; justify-content: center; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* ---------- 3. الهيكل العام ---------- */
.app { min-height: 100dvh; }

.main {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding-bottom: calc(var(--bottom-h) + env(safe-area-inset-bottom));
}

.content {
  flex: 1;
  width: 100%;
  max-width: 1600px;
  margin: 0 auto;
  padding: 16px;
  outline: none;
}
.content.enter { animation: pageIn .35s var(--ease); }

@keyframes pageIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

/* ---------- 4. الشعار ---------- */
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 6px 20px; }
.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 34px; height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, #5b8cff, #19c37d);
  color: #fff;
  box-shadow: 0 6px 18px rgba(91, 140, 255, 0.35);
  flex-shrink: 0;
}
.brand-mark .icon { width: 20px; height: 20px; stroke-width: 2.2; }
.brand-name {
  font-size: 18px; font-weight: 700; letter-spacing: .06em;
  direction: ltr; unicode-bidi: isolate;
}
.brand-name b { color: var(--accent); }

/* ---------- 5. القائمة الجانبية (كمبيوتر) ---------- */
.sidebar { display: none; }

.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-link {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-weight: 500;
  transition: background .2s, color .2s;
}
.side-link:hover { background: var(--surface-2); color: var(--text); }
.side-link.active { background: var(--accent-soft); color: var(--text); }
.side-link.active .icon { color: var(--accent); }
.sidebar-foot { margin-top: auto; padding: 12px 6px 0; }
.version { font-size: 12px; color: var(--text-3); font-family: var(--mono); }

/* ---------- 6. الشريط العلوي ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  height: var(--top-h);
  padding: 0 16px;
  padding-top: env(safe-area-inset-top);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: rgba(8, 11, 18, 0.78);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.topbar-start, .topbar-end { display: flex; align-items: center; gap: 10px; min-width: 0; }
.page-title { font-size: 17px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.status-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 12px; color: var(--text-2);
  white-space: nowrap;
}
.status-pill .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--wait); box-shadow: 0 0 8px var(--wait); }
.status-pill.live .dot { background: var(--buy); box-shadow: 0 0 8px var(--buy); }
.status-pill.error .dot { background: var(--sell); box-shadow: 0 0 8px var(--sell); }
.status-pill.loading .dot { background: var(--accent); box-shadow: 0 0 8px var(--accent); animation: blink 1s infinite; }
.status-pill.live { color: var(--text); }
.status-pill.limit .dot { background: var(--wait); box-shadow: 0 0 8px var(--wait); }
.status-pill.limit { color: var(--wait); }
@keyframes blink { 50% { opacity: .3; } }
.clock { display: none; font-size: 13px; color: var(--text-2); }

/* ---------- 7. شريط التنقل السفلي (هاتف) ---------- */
.bottom-nav {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 30;
  height: calc(var(--bottom-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: rgba(10, 13, 20, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border);
}
.bottom-link {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--text-3);
  font-size: 11px; font-weight: 500;
  position: relative;
  transition: color .2s;
  -webkit-tap-highlight-color: transparent;
}
.bottom-link span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; padding: 0 2px; }
.bottom-link.active { color: var(--text); }
.bottom-link.active .icon { color: var(--accent); }
.bottom-link.active::before {
  content: ''; position: absolute; top: 0;
  width: 28px; height: 3px; border-radius: 0 0 3px 3px;
  background: var(--accent);
}

/* ---------- 8. قائمة "المزيد" ---------- */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(0, 0, 0, 0.5);
  opacity: 0; transition: opacity .25s;
}
.sheet-backdrop.open { opacity: 1; }
.sheet {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 41;
  padding: 10px 16px calc(20px + env(safe-area-inset-bottom));
  background: #121723;
  border-top: 1px solid var(--border-2);
  border-radius: 22px 22px 0 0;
  transform: translateY(100%);
  transition: transform .28s var(--ease);
}
.sheet.open { transform: none; }
.sheet-handle { width: 40px; height: 4px; border-radius: 4px; background: var(--border-2); margin: 0 auto 16px; }
.sheet-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.sheet-link {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 16px 6px;
  border-radius: 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 13px; color: var(--text-2); text-align: center;
}
.sheet-link .icon { width: 24px; height: 24px; }
.sheet-link.active { color: var(--text); border-color: var(--accent); background: var(--accent-soft); }
.sheet-link.active .icon { color: var(--accent); }

/* ---------- 9. التنبيه القانوني ---------- */
.disclaimer-bar {
  display: flex; align-items: flex-start; gap: 8px;
  max-width: 1600px; width: 100%; margin: 0 auto;
  padding: 12px 16px 16px;
  font-size: 12px; line-height: 1.6; color: var(--text-3);
}
.disclaimer-bar .icon { width: 16px; height: 16px; margin-top: 2px; color: var(--wait); }

.modal-backdrop {
  position: fixed; inset: 0; z-index: 60;
  display: grid; place-items: center;
  padding: 20px;
  background: rgba(3, 5, 10, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0; transition: opacity .2s;
}
.modal-backdrop.open { opacity: 1; }
.modal {
  width: 100%; max-width: 420px;
  padding: 28px 22px 22px;
  background: #121723;
  border: 1px solid var(--border-2);
  border-radius: 20px;
  text-align: center;
  transform: scale(.96); transition: transform .25s var(--ease);
}
.modal-backdrop.open .modal { transform: none; }
.modal-icon {
  display: inline-grid; place-items: center;
  width: 56px; height: 56px; border-radius: 16px;
  background: var(--wait-soft); color: var(--wait);
  margin-bottom: 14px;
}
.modal-icon .icon { width: 28px; height: 28px; }
.modal h2 { font-size: 19px; margin-bottom: 10px; }
.modal p { color: var(--text-2); font-size: 14px; line-height: 1.8; margin-bottom: 20px; }

/* ---------- 10. الإشعارات ---------- */
.toasts {
  position: fixed; top: calc(var(--top-h) + 10px + env(safe-area-inset-top)); inset-inline: 0; z-index: 70;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  pointer-events: none; padding: 0 16px;
}
.toast {
  display: flex; align-items: center; gap: 8px;
  max-width: 420px;
  padding: 10px 14px;
  border-radius: 12px;
  background: #1a2030;
  border: 1px solid var(--border-2);
  font-size: 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  opacity: 0; transform: translateY(-8px);
  transition: opacity .25s, transform .25s var(--ease);
}
.toast.show { opacity: 1; transform: none; }
.toast .icon { width: 18px; height: 18px; }
.toast-success .icon { color: var(--buy); }
.toast-error .icon { color: var(--sell); }
.toast-info .icon { color: var(--accent); }

/* =========================================================
   الجزء 2: المكونات (البطاقات، الأزرار، الحقول…)
   ========================================================= */

/* ---------- 11. البطاقات ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  min-width: 0;
}
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  margin-bottom: 14px;
}
.card-head h3 { font-size: 15px; font-weight: 600; }
.label { font-size: 12px; color: var(--text-2); }
.hint { font-size: 13px; color: var(--text-2); margin: 10px 0; }
.fine {
  display: flex; align-items: center; gap: 6px;
  margin-top: 14px;
  font-size: 12px; color: var(--text-3);
}
.fine .icon { width: 14px; height: 14px; }
.count {
  font-size: 12px; color: var(--text-3);
  padding: 2px 8px; border-radius: 999px; background: var(--surface-3);
}

.phase-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11px; font-weight: 500; white-space: nowrap;
}
.phase-badge .icon { width: 12px; height: 12px; }

/* ---------- 12. التخطيط ---------- */
.grid { display: grid; gap: var(--gap); grid-template-columns: minmax(0, 1fr); }
.stack { display: flex; flex-direction: column; gap: var(--gap); }
.stack.narrow { max-width: 680px; }
.span-all { grid-column: 1 / -1; }

/* ---------- 13. الأزرار ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-weight: 600; font-size: 14px;
  transition: background .2s, opacity .2s, transform .1s;
  white-space: nowrap;
}
.btn:active:not(:disabled) { transform: scale(.98); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn .icon { width: 18px; height: 18px; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: #6f9bff; }
.btn-ghost { background: var(--surface-3); color: var(--text); border: 1px solid var(--border); }
.btn-danger { background: var(--sell-soft); color: var(--sell); }
.btn-sm { min-height: 36px; padding: 6px 12px; font-size: 13px; }
.btn-block { width: 100%; }
.card .btn-block { margin-top: 16px; }

.icon-btn {
  display: inline-grid; place-items: center;
  width: 40px; height: 40px; border-radius: var(--radius-sm);
  color: var(--text-3); flex-shrink: 0;
  transition: background .2s, color .2s;
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn.danger:hover { background: var(--sell-soft); color: var(--sell); }

/* ---------- 14. الحقول ---------- */
input[type="text"], input[type="search"], input[type="number"] {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 16px;            /* 16px يمنع التكبير التلقائي في iPhone */
  outline: none;
  transition: border-color .2s, background .2s;
}
input:focus { border-color: var(--accent); background: var(--surface-3); }
input::placeholder { color: var(--text-3); }
input[type="number"] { font-family: var(--mono); direction: ltr; text-align: start; }

.search-box { position: relative; }
.search-box .icon { position: absolute; inset-inline-start: 12px; top: 50%; transform: translateY(-50%); color: var(--text-3); width: 18px; height: 18px; }
.search-box input { padding-inline-start: 40px; }

.add-row { display: flex; gap: 8px; margin-top: 10px; }
.add-row input { flex: 1; min-width: 0; }

.form { display: grid; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field span { font-size: 13px; color: var(--text-2); }

/* ---------- 15. أزرار الاختيار (Chips) ---------- */
.chips {
  display: flex; gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 2px;
}
.chips::-webkit-scrollbar { display: none; }
.chips.wrap, .chips[data-group="settings-tf"] { flex-wrap: wrap; overflow: visible; }
.chip {
  flex-shrink: 0;
  min-height: 34px;
  padding: 6px 12px;
  border-radius: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-2);
  font-family: var(--mono); font-size: 13px; font-weight: 500;
  transition: all .2s;
}
.chip:hover { color: var(--text); border-color: var(--border-2); }
.chip.active { background: var(--accent-soft); border-color: var(--accent); color: var(--text); }
.chip.toggle { font-family: var(--font); }

.segmented {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px;
  padding: 4px; border-radius: 12px;
  background: var(--surface-2); border: 1px solid var(--border);
}
.seg { min-height: 40px; border-radius: 8px; font-size: 14px; color: var(--text-2); transition: all .2s; }
.seg.active { background: var(--accent); color: #fff; font-weight: 600; }

/* ---------- 16. رموز الأصول ---------- */
.avatar {
  display: inline-grid; place-items: center;
  width: 38px; height: 38px; border-radius: 12px;
  font-family: var(--mono); font-size: 11px; font-weight: 600;
  flex-shrink: 0;
  background: var(--surface-3); color: var(--text-2);
}
.avatar-crypto { background: rgba(247, 147, 26, 0.14); color: #f7a23b; }
.avatar-forex  { background: rgba(91, 140, 255, 0.14); color: #7ea4ff; }
.avatar-metal  { background: rgba(230, 190, 90, 0.15); color: #e6c15a; }
.avatar-index,
.avatar-us     { background: rgba(170, 120, 255, 0.14); color: #b894ff; }

.asset-list li + li { border-top: 1px solid var(--border); }
.asset-row {
  display: flex; align-items: center; gap: 12px;
  width: 100%;
  padding: 10px 2px;
  text-align: start;
  border-radius: 8px;
  transition: background .2s;
}
.asset-row:hover { background: var(--surface-2); }
.asset-name { flex: 1; font-weight: 600; min-width: 0; direction: ltr; text-align: end; unicode-bidi: isolate; }
[dir="rtl"] .asset-name { text-align: right; }
[dir="ltr"] .asset-name { text-align: left; }
.asset-name small { display: block; font-weight: 400; font-size: 12px; color: var(--text-3); }
.wl-item { display: flex; align-items: center; gap: 4px; }
.wl-item .asset-row { flex: 1; min-width: 0; }
.empty-row { padding: 28px 0; text-align: center; color: var(--text-3); }
.card > .btn-ghost { margin-top: 12px; }

/* ---------- 17. الإشارات BUY / SELL / WAIT ---------- */
.signal-trio { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.sig {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 12px 6px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  opacity: .55;
  transition: all .3s var(--ease);
}
.sig b { font-size: 15px; letter-spacing: .06em; font-family: var(--mono); }
.sig small { font-size: 11px; color: var(--text-3); }
.sig .icon { width: 20px; height: 20px; }
.sig-buy  { color: var(--buy); }
.sig-sell { color: var(--sell); }
.sig-wait { color: var(--wait); }
/* ستُستعمل في PHASE 6 لإضاءة الإشارة الفعلية */
.sig.active { opacity: 1; transform: translateY(-2px); }
.sig-buy.active  { background: var(--buy-soft);  border-color: var(--buy); }
.sig-sell.active { background: var(--sell-soft); border-color: var(--sell); }
.sig-wait.active { background: var(--wait-soft); border-color: var(--wait); }

.meter-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 16px; }
.meter .label { margin-bottom: 6px; }
.meter-val { font-size: 14px; margin-top: 6px; }
.bar { position: relative; height: 6px; border-radius: 6px; background: var(--surface-3); overflow: hidden; }
.bar > span { position: absolute; inset-block: 0; inset-inline-start: 0; border-radius: 6px; background: var(--accent); transition: width .5s var(--ease); }
.bar-center::after { content: ''; position: absolute; top: -2px; bottom: -2px; left: 50%; width: 1px; background: var(--border-2); }

/* =========================================================
   الجزء 3: الصفحات
   ========================================================= */

/* ---------- 18. لوحة التحكم ---------- */
.asset-head { display: flex; align-items: center; gap: 12px; }
.asset-head > div { flex: 1; min-width: 0; }
.asset-symbol { font-size: 19px; font-weight: 700; direction: ltr; unicode-bidi: isolate; }
.tf-current {
  padding: 4px 10px; border-radius: 8px;
  background: var(--accent-soft); color: var(--accent);
  font-size: 13px;
}
.price-row {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  margin-top: 18px;
}
.price { font-size: 34px; font-weight: 600; line-height: 1.2; color: var(--text); }
.change-box { text-align: end; }
[dir="rtl"] .change-box .change { text-align: left; }
.change { font-size: 18px; }
.price.muted, .change.muted { color: var(--text-3); }
.waiting-note {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-top: 16px; padding-top: 14px;
  border-top: 1px dashed var(--border);
  font-size: 12px; color: var(--text-2);
}
.pulse-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--wait);
  animation: pulse 1.8s infinite;
  flex-shrink: 0;
}
.pulse-dot.live { background: var(--buy); animation-name: pulseGreen; }
.pulse-dot.error { background: var(--sell); animation: none; }
@keyframes pulseGreen {
  0%   { box-shadow: 0 0 0 0 rgba(25, 195, 125, .5); }
  70%  { box-shadow: 0 0 0 8px rgba(25, 195, 125, 0); }
  100% { box-shadow: 0 0 0 0 rgba(25, 195, 125, 0); }
}

/* وميض السعر عند تغيّره */
.flash-up   { animation: flashUp 1s var(--ease); }
.flash-down { animation: flashDown 1s var(--ease); }
@keyframes flashUp   { 0% { color: var(--buy);  text-shadow: 0 0 14px rgba(25, 195, 125, .6); } 100% { color: var(--text); } }
@keyframes flashDown { 0% { color: var(--sell); text-shadow: 0 0 14px rgba(240, 68, 92, .6); } 100% { color: var(--text); } }

.note-error {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--sell-soft);
  color: var(--text);
  font-size: 13px; line-height: 1.6;
}
.note-error > .icon { color: var(--sell); width: 18px; height: 18px; }
.note-error.warn { background: var(--wait-soft); }
.note-error.warn > .icon { color: var(--wait); }

/* وصف الأصل + "السوق مغلق" */
.asset-desc { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.market-closed {
  display: inline-flex; align-items: center;
  padding: 2px 8px; border-radius: 999px;
  background: var(--wait-soft); color: var(--wait);
  font-family: var(--font); font-size: 11px; font-weight: 500;
  vertical-align: middle;
  direction: rtl;
}
.chart-note { margin-top: 12px; }

/* الإعدادات: نتائج الفحص */
.src-title {
  margin: 14px 0 2px; padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 12px; font-weight: 600; color: var(--accent);
}
.src-title:first-of-type { margin-top: 0; padding-top: 0; border-top: 0; }
.check-out {
  margin: 4px 0 8px; padding: 10px 12px; border-radius: 10px;
  background: var(--surface-2); font-size: 13px; line-height: 1.7; color: var(--text-2);
}
.check-out.good { background: var(--buy-soft); color: var(--text); }
.check-out.bad { background: var(--sell-soft); color: var(--text); }
.check-list { margin: 4px 0 8px; display: flex; flex-direction: column; gap: 6px; }
.check-list li {
  display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap;
  padding: 8px 12px; border-radius: 10px;
  background: var(--surface-2); font-size: 13px; line-height: 1.6; color: var(--text-2);
}
.check-list li b { min-width: 72px; color: var(--text); }
.check-list li span { flex: 1; min-width: 160px; }
.check-list li.good { background: var(--buy-soft); }
.check-list li.warn { background: var(--wait-soft); }
.check-list li.bad { background: var(--sell-soft); }
.note-error > span { flex: 1; min-width: 180px; }

.mini-stats {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px;
  margin-top: 16px;
}
.mini-stats > div {
  display: flex; flex-direction: column; gap: 2px;
  padding: 8px 10px; border-radius: 10px;
  background: var(--surface-2);
  min-width: 0;
}
.mini-stats b { font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
[dir="rtl"] .mini-stats b { text-align: right; }

/* خانة السعر في القوائم */
.px-cell { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; min-width: 88px; }
.px-cell b { font-size: 14px; font-weight: 600; }
.px-cell small { font-size: 12px; }
[dir="rtl"] .px-cell { align-items: flex-start; }
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(242, 181, 68, .5); }
  70%  { box-shadow: 0 0 0 8px rgba(242, 181, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(242, 181, 68, 0); }
}

.stat-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap); }
.stat { padding: 14px; }
.stat-val { font-size: 18px; font-weight: 600; margin-top: 4px; }

.chart-card .chips { margin-bottom: 12px; }

/* ---------- 19. الشارت ---------- */
.chart-box {
  position: relative;
  display: flex; flex-direction: column;
  margin-top: 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.22);
  overflow: hidden;
  direction: ltr;              /* الشارت دائماً من اليسار لليمين مثل كل منصات التداول */
}
.chart-main { position: relative; height: 300px; }
.chart-box.tall .chart-main { height: 52vh; min-height: 320px; max-height: 640px; }
.chart-host { position: absolute; inset: 0; }

/* نوافذ RSI و MACD أسفل الشارت */
.chart-pane {
  position: relative;
  height: 120px;
  border-top: 1px solid var(--border);
}
.pane-host { position: absolute; inset: 0; }
.pane-label {
  position: absolute; top: 6px; left: 10px; right: 70px; z-index: 3;
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px;
  font-size: 11px; color: var(--text-3);
  pointer-events: none;
}
.pane-label b { font-weight: 500; color: var(--text-2); }

/* لوحة OHLC وقيم المؤشرات أعلى يسار الشارت */
.chart-legend {
  position: absolute; top: 8px; left: 10px; right: 70px; z-index: 3;
  display: flex; flex-direction: column; gap: 2px;
  font-size: 11px; color: var(--text-3);
  pointer-events: none;
}
.chart-legend .lg-row { display: flex; flex-wrap: wrap; gap: 2px 10px; }
.chart-legend b { font-weight: 500; }
.lg-row b:not(.up):not(.down) { color: var(--text-2); }
@media (max-width: 599px) { .lg-bb { display: none; } }   /* الهاتف: نخفي قيم BB من اللوحة لتوفير المساحة */

/* علامة لون المؤشر (النص يبقى بلون محايد) */
.sw {
  display: inline-block;
  width: 12px; height: 3px;
  margin-inline-end: 4px;
  border-radius: 2px;
  background: var(--c);
  vertical-align: middle;
}
.chip .sw { margin-inline-end: 6px; }

/* طبقة الرسائل: تحميل / خطأ / المرحلة 3 */
.chart-overlay {
  position: absolute; inset: 0; z-index: 5;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  padding: 20px;
  text-align: center;
  direction: rtl;
  background: rgba(8, 11, 18, 0.82);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  color: var(--text-3);
}
[dir="ltr"] .chart-overlay { direction: ltr; }
.chart-overlay p { max-width: 340px; font-size: 14px; color: var(--text-2); line-height: 1.7; }
.chart-overlay h4 { margin: 0; font-size: 15px; color: var(--text); }
.chart-overlay[data-state="error"] .icon-lg { color: var(--sell); }
.chart-overlay[data-state="blocked"] .icon-lg,
.chart-overlay[data-state="limit"] .icon-lg,
.chart-overlay[data-state="setup"] .icon-lg { color: var(--wait); }
.chart-overlay[data-state="unsupported"] .icon-lg { color: var(--text-3); }
.chart-overlay .btn { margin-top: 4px; }

.spinner {
  width: 30px; height: 30px; border-radius: 50%;
  border: 3px solid var(--surface-3);
  border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* شريط أدوات صفحة الشارت */
.chart-toolbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-bottom: 12px;
}
.tb-asset { display: flex; align-items: center; gap: 10px; }
.tb-price { display: flex; align-items: baseline; gap: 10px; flex: 1; min-width: 150px; }
.tb-price b { font-size: 20px; font-weight: 600; }
.tb-price span { font-size: 13px; }
.tb-actions { display: flex; gap: 4px; }
.tb-actions .icon-btn { border: 1px solid var(--border); background: var(--surface-2); color: var(--text-2); }

.select {
  min-height: 40px;
  padding: 6px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 15px; font-weight: 600;
  color: var(--text);
  cursor: pointer;
}
.select option { background: #121723; color: var(--text); }

.link-btn {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--accent);
  padding: 4px 8px; border-radius: 8px;
}
.link-btn:hover { background: var(--accent-soft); }
.link-btn .icon { width: 16px; height: 16px; }

.chip.ready:not(.active) { border-color: rgba(91, 140, 255, 0.4); }

/* ---------- 20. التحليل ---------- */
.mtf-list li { display: flex; align-items: center; gap: 10px; padding: 10px 0; }
.mtf-list li + li { border-top: 1px solid var(--border); }
.tf-tag { min-width: 44px; font-size: 13px; color: var(--text-2); }
.mtf-line { flex: 1; height: 1px; border-top: 1px dashed var(--border-2); }
.mtf-val { min-width: 70px; text-align: end; font-weight: 600; white-space: nowrap; }
.mtf-val small { font-weight: 500; margin-inline-start: 4px; opacity: .85; }
.mtf-val.stale { opacity: .5; }
.mtf-bias-wrap { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.mtf-bias .tag { font-size: 13px; padding: 3px 10px; }
.mtf-count { font-size: 12px; font-weight: 400; }
.mtf-foot {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-top: 12px; font-size: 12px; color: var(--text-3); line-height: 1.6;
}
.spinner.sm { width: 14px; height: 14px; border-width: 2px; }
.warn-text { color: var(--wait); }
.err-text { color: var(--sell); }
.stat-sub { font-size: 12px; margin-top: 2px; }

/* تفاصيل Score: عامل في كل سطر + شريط من الوسط */
.factor-list li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr) 72px;
  grid-template-areas: "name bar pts" "note note note";
  align-items: center; gap: 4px 12px;
  padding: 10px 0; font-size: 14px;
}
.factor-list li + li { border-top: 1px solid var(--border); }
.f-name { grid-area: name; font-weight: 500; }
.f-bar { grid-area: bar; }
.f-pts { grid-area: pts; text-align: end; font-weight: 600; }
.f-pts small { font-weight: 400; color: var(--text-3); }
.f-note { grid-area: note; margin: 0; font-size: 12px; color: var(--text-3); line-height: 1.6; }
.factor.na .f-name { color: var(--text-3); }

.f-bar, .score-bar {
  position: relative; height: 8px; border-radius: 8px;
  background: var(--surface-3); overflow: hidden;
}
.f-bar i, .score-bar i {
  position: absolute; top: -2px; bottom: -2px; left: 50%; width: 1px;
  background: var(--border-2);
}
.f-bar .fill, .score-bar .fill {
  position: absolute; top: 0; bottom: 0; border-radius: 8px;
  transition: left .4s var(--ease), width .4s var(--ease);
}
.fill.pos { background: var(--buy); }
.fill.neg { background: var(--sell); }

/* بطاقة Score */
.score-card .chips { margin: 4px 0 14px; }
.score-wrap {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  margin-bottom: 14px;
}
.score-big { display: flex; flex-direction: column; gap: 2px; }
.score-big b { font-size: 44px; font-weight: 600; line-height: 1.1; }
.score-big small { font-size: 15px; }
.score-meta { display: grid; grid-template-columns: repeat(3, auto); gap: 6px 22px; }
.score-meta > div { display: flex; flex-direction: column; gap: 2px; }
.score-meta b { font-size: 15px; font-weight: 600; }
.score-bar { height: 12px; }
.score-scale {
  display: flex; justify-content: space-between;
  margin-top: 6px; font-size: 11px; color: var(--text-3);
}
#aPartial { margin-top: 10px; }
@media (max-width: 479px) {
  .score-meta { grid-template-columns: 1fr 1fr; }
  .factor-list li { grid-template-columns: minmax(0, 1fr) 90px 64px; }
}
.score-total {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 12px; padding-top: 12px;
  border-top: 1px solid var(--border);
  font-weight: 600;
}
.score-total b { font-size: 18px; }

.levels { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.level {
  display: flex; flex-direction: column; gap: 4px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--surface-2);
  border-inline-start: 3px solid var(--border-2);
}
.level b { font-size: 16px; }
.level-entry { border-inline-start-color: var(--accent); }
.level-sl    { border-inline-start-color: var(--sell); }
.level-tp1, .level-tp2, .level-tp3 { border-inline-start-color: var(--buy); }
.level-rr    { border-inline-start-color: var(--wait); }

/* ---------- 21. التنبيهات ---------- */
.empty-state { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 36px 16px; text-align: center; color: var(--text-3); }
.empty-state h3 { font-size: 16px; color: var(--text-2); }
.example-list li { display: flex; align-items: center; gap: 10px; padding: 10px 0; color: var(--text-2); font-size: 14px; }
.example-list li + li { border-top: 1px solid var(--border); }
.example-list .icon { width: 16px; height: 16px; color: var(--text-3); }

/* ---------- 22. حاسبة المخاطر ---------- */
.results .result { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; }
.results .result + .result { border-top: 1px solid var(--border); }
.results b { font-size: 16px; }

/* ---------- 23. السجل ---------- */
.table-wrap { overflow-x: auto; margin: 0 -16px; padding: 0 16px; }
.table { width: 100%; min-width: 760px; border-collapse: collapse; font-size: 14px; }
.table th {
  padding: 10px 8px; text-align: start;
  font-size: 12px; font-weight: 500; color: var(--text-3);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table td { padding: 12px 8px; border-bottom: 1px solid var(--border); }
.table .empty-row { border: 0; }
.table .empty-row .icon { display: block; margin: 0 auto 8px; width: 28px; height: 28px; }

/* ---------- 24. الإعدادات ---------- */
.kv { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; font-size: 14px; }
.kv + .kv { border-top: 1px solid var(--border); }
.kv > span { color: var(--text-2); }
.kv b { font-weight: 500; text-align: end; word-break: break-all; }

/* ---------- 25. بطاقة قيم المؤشرات (PHASE 4) ---------- */
.iv-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.iv-block {
  padding: 12px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  min-width: 0;
}
.iv-block h4 { margin: 0 0 8px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.iv-row {
  display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px;
  padding: 6px 0;
  font-size: 13px;
}
.iv-row + .iv-row { border-top: 1px solid var(--border); }
.iv-label { flex: 1; min-width: 110px; color: var(--text-2); display: inline-flex; align-items: center; }
.iv-row > b { font-size: 14px; font-weight: 500; color: var(--text); }
.iv-extra { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.iv-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.iv-note { font-size: 13px; color: var(--text-3); line-height: 1.7; margin: 2px 0 6px; }
.tag {
  display: inline-flex; align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px; font-weight: 500;
  background: var(--surface-3); color: var(--text-2);
  white-space: nowrap;
}
.tag.up { background: var(--buy-soft); color: var(--buy); }
.tag.down { background: var(--sell-soft); color: var(--sell); }
.tag.warn { background: var(--wait-soft); color: var(--wait); }
.iv-row.sr .sr-name { font-family: var(--mono); font-size: 12px; min-width: 26px; }
.iv-row.sr.res .sr-name { color: var(--sell); }
.iv-row.sr.sup .sr-name { color: var(--buy); }
.iv-row.sr.now { background: var(--accent-soft); border-radius: 8px; padding: 6px 8px; margin: 4px 0; }
.iv-row.sr.now + .iv-row { border-top: 0; }

/* =========================================================
   الجزء 4: الشاشات الأكبر (Responsive)
   ========================================================= */

@media (min-width: 480px) {
  .clock { display: inline; }
}

@media (max-width: 359px) {
  .status-pill .status-text { display: none; }
  .price { font-size: 28px; }
}

/* تابلت */
@media (min-width: 768px) {
  :root { --gap: 16px; }
  .content { padding: 20px 24px; }
  .topbar { padding-inline: 24px; }
  .disclaimer-bar { padding-inline: 24px; }
  .dash-grid { grid-template-columns: 1fr 1fr; }
  .dash-grid .stat-row, .dash-grid .chart-card, .dash-grid .mtf-card { grid-column: 1 / -1; }
  .stat-row { grid-template-columns: repeat(4, 1fr); }
  .chart-main { height: 360px; }
  .chart-pane { height: 130px; }
  .two-col, .analysis-grid { grid-template-columns: 1fr 1fr; }
  .iv-grid { grid-template-columns: 1fr 1fr; }
  .iv-wide { grid-column: 1 / -1; }
  .toasts { align-items: flex-end; }
}

/* كمبيوتر */
@media (min-width: 1024px) {
  .sidebar {
    display: flex; flex-direction: column;
    position: fixed; top: 0; bottom: 0; inset-inline-start: 0; z-index: 25;
    width: var(--side-w);
    padding: 18px 14px;
    background: rgba(10, 13, 20, 0.85);
    border-inline-end: 1px solid var(--border);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
  }
  .main { margin-inline-start: var(--side-w); padding-bottom: 0; }
  .bottom-nav, .mobile-only { display: none !important; }
  .sheet, .sheet-backdrop { display: none !important; }
  .page-title { font-size: 20px; }
  .chart-main { height: 400px; }
  .chart-pane { height: 140px; }
}

@media (min-width: 1200px) {
  .dash-grid { grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); }
  .dash-grid .stat-row { grid-column: 1 / -1; }
  .dash-grid .chart-card { grid-column: 1; }
  .dash-grid .mtf-card { grid-column: 2; }
}

/* احترام إعداد "تقليل الحركة" */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- PHASE 5.1: التسميات الموحّدة + تنظيف الشموع ---------- */
.split-line { margin-top: 6px; color: var(--text-2); }
.factor .f-name .st {
  font-style: normal; display: inline-block; min-width: 1.1em; text-align: center;
  margin-inline-end: 6px; font-size: .85em; font-weight: 700;
}
.factor .f-name .st.with { color: var(--buy); }
.factor .f-name .st.against { color: var(--sell); }
.factor .f-name .st.flat { color: var(--text-3); }
.rules { margin-top: 10px; font-size: .86rem; color: var(--text-2); }
.rules summary {
  cursor: pointer; list-style: none; display: inline-flex; align-items: center; gap: 6px;
  color: var(--text); font-weight: 600;
}
.rules summary::-webkit-details-marker { display: none; }
.rules summary .icon { width: 16px; height: 16px; }
.rules[open] summary { margin-bottom: 8px; }
.rules-list { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 6px; }
.rules-list li { display: grid; grid-template-columns: 7.5em 1fr; gap: 8px; align-items: center; }
.rules-list .tag { justify-self: start; white-space: nowrap; }
.rules p { margin: 6px 0 0; line-height: 1.7; }
.closed-note { color: var(--wait); }
@media (max-width: 520px) {
  .rules-list li { grid-template-columns: 1fr; gap: 3px; }
}
.agree-w { display: block; font-size: .72rem; font-weight: 500; color: var(--text-2); margin-top: 2px; }
.mtf-bias .tag { gap: 5px; }
#dScore bdi { white-space: nowrap; }

/* ---------- PHASE 6: الإشارة BUY / SELL / WAIT + الشرح ---------- */
.wait-text { color: var(--wait); }
.sig-reason { margin: 12px 0 0; font-size: 13px; font-weight: 600; text-align: center; line-height: 1.6; }
.bar > span.fill-up { background: var(--buy); }
.bar > span.fill-down { background: var(--sell); }
.bar > span.fill-muted { background: var(--text-3); }
.bar > span.fill-wait-text { background: var(--wait); }
.meter-val { font-size: 13px; }

.explain-card .ex-title { margin: 0 0 8px; font-size: 16px; }
.ex-sum { margin: 0 0 6px; line-height: 1.8; color: var(--text); }
.ex-groups { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; }
.ex-group, .ex-block {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 12px 14px;
}
.ex-group h5, .ex-block h5 { margin: 0 0 8px; font-size: 13px; color: var(--text-2); font-weight: 600; }
.ex-group.pro h5::before { content: '✓ '; color: var(--buy); }
.ex-group.con h5::before { content: '✗ '; color: var(--sell); }
.ex-group ul, .ex-block ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.ex-group p { margin: 0; }
.ex-row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.ex-row b { font-size: 13px; font-weight: 600; }
.ex-row .mono { font-size: 12px; }
.ex-group small { display: block; color: var(--text-3); font-size: 12px; line-height: 1.6; margin-top: 2px; }
.ex-block { margin-top: 12px; }
.ex-block li { position: relative; padding-inline-start: 16px; line-height: 1.7; font-size: 13px; }
.ex-block li::before { content: '•'; position: absolute; inset-inline-start: 2px; color: var(--text-3); }
.ex-cancel h5 { color: var(--sell); }
.ex-watch h5 { color: var(--wait); }
.ex-warn h5 { color: var(--wait); }
.explain-card .fine { margin-top: 14px; }
@media (max-width: 640px) {
  .ex-groups { grid-template-columns: 1fr; }
}
@media (min-width: 900px) { .span-all .levels { grid-template-columns: repeat(3, 1fr); } }

/* ---------- PHASE 7: مستويات الصفقة ---------- */
.lv-sub { display: block; margin-top: 4px; font-size: 11.5px; color: var(--text-3); line-height: 1.5; }
.level b.mono.up { color: var(--buy); }
.level b.mono.down { color: var(--sell); }
.lv-note { margin-top: 12px; }
.lv-strip {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 12px;
  padding: 10px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--border);
}
.lv-strip > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.lv-strip .label { font-size: 11px; }
.lv-strip b { font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lv-strip [data-lvx="sl"] { color: var(--sell); }
.lv-strip [data-lvx="tp1"], .lv-strip [data-lvx="rr"] { color: var(--buy); }
.sig-tag {
  display: inline-flex; align-items: center; padding: 2px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; border: 1px solid var(--border-2);
}
.sig-tag.buy { color: var(--buy); background: var(--buy-soft); border-color: var(--buy); }
.sig-tag.sell { color: var(--sell); background: var(--sell-soft); border-color: var(--sell); }
.sig-tag.wait { color: var(--wait); background: var(--wait-soft); border-color: var(--wait); }
@media (max-width: 420px) {
  .lv-strip { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- PHASE 8: حاسبة المخاطر ---------- */
.pct-row { display: flex; gap: 8px; align-items: center; }
.pct-row input { flex: 1; min-width: 0; }
.pct-row .chips { flex-shrink: 0; }
input.warn { border-color: var(--wait) !important; box-shadow: 0 0 0 3px var(--wait-soft); }
input.danger { border-color: var(--sell) !important; box-shadow: 0 0 0 3px var(--sell-soft); }
.btn-row { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.btn-row .btn-primary { flex: 1; }
.risk-src {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 10px 12px; margin-bottom: 12px; border-radius: var(--radius-sm);
  font-size: 13px; line-height: 1.6; border: 1px solid var(--border-2); background: var(--surface-2);
}
.risk-src span { flex: 1; min-width: 180px; color: var(--text); }
.risk-src.up { border-color: var(--buy); background: var(--buy-soft); }
.risk-src.down { border-color: var(--sell); background: var(--sell-soft); }
.risk-src .icon { width: 16px; height: 16px; }
.risk-msg p { font-size: 13px; line-height: 1.7; margin-bottom: 8px; }
.results .rv { display: flex; flex-direction: column; align-items: flex-end; text-align: end; min-width: 0; }
.rv-sub { font-size: 11.5px; color: var(--text-3); margin-top: 2px; }
.results b.up { color: var(--buy); }
.results b.down { color: var(--sell); }
.results b.wait-text { color: var(--wait); }
.risk-warn { display: grid; gap: 8px; margin-top: 12px; }
.risk-warn li {
  display: flex; gap: 8px; align-items: flex-start; padding: 10px 12px; border-radius: var(--radius-sm);
  font-size: 13px; line-height: 1.6;
}
.risk-warn li .icon { width: 16px; height: 16px; margin-top: 3px; flex-shrink: 0; }
.risk-warn li.warn { background: var(--wait-soft); color: var(--wait); }
.risk-warn li.danger { background: var(--sell-soft); color: var(--sell); }
.lv-use { margin-top: 12px; }

/* ---------- PHASE 8.1: خانات الأرقام ---------- */
.num-input { font-family: var(--mono); direction: ltr; text-align: start; }
.num-hint { font-size: 11.5px; color: var(--text-3); min-height: 0; }
.num-hint:empty { display: none; }

/* ---------- PHASE 9: التنبيهات والسجل ---------- */
.al-list, .al-log { display: grid; gap: 0; }
.al-list li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 0; flex-wrap: wrap; }
.al-list li + li, .al-log li + li { border-top: 1px solid var(--border); }
.al-list li.off { opacity: .55; }
.al-main { display: flex; gap: 10px; align-items: flex-start; min-width: 0; flex: 1; }
.al-main .icon { width: 18px; height: 18px; color: var(--accent); margin-top: 3px; }
.al-main b { display: block; font-size: 14px; font-weight: 600; }
.al-main small, .al-log small { display: block; font-size: 12px; color: var(--text-3); margin-top: 2px; line-height: 1.5; }
.al-actions { display: flex; gap: 6px; }
.btn.icon-only { padding-inline: 8px; }
.al-log li { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; font-size: 13px; }
.al-log li > .mono { color: var(--text-3); font-size: 12px; white-space: nowrap; margin-top: 2px; }
.al-log li.up b { color: var(--buy); }
.al-log li.down b { color: var(--sell); }
.al-list .empty-row, .al-log .empty-row { justify-content: center; color: var(--text-3); padding: 20px 0; }
.toggle-list { display: grid; gap: 10px; margin-bottom: 12px; }
.switch-row { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; color: var(--text-2); cursor: pointer; line-height: 1.6; margin-top: 10px; }
.switch-row input { width: 18px; height: 18px; accent-color: var(--accent); margin-top: 3px; flex-shrink: 0; }
.notify-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.notify-row small { font-size: 12px; line-height: 1.6; }
.hist-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.hs-box { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; }
.hs-box b { font-size: 18px; }
.hs-box small { font-size: 11px; }
.hist-tools { display: grid; gap: 10px; margin-bottom: 12px; }
.hist-table td { vertical-align: top; }
.hist-table td .hit { text-decoration: underline; text-underline-offset: 3px; }
.hist-table small { font-size: 11px; }
.danger-text { color: var(--sell); }
#aSave { margin-top: 12px; }

/* ---------- PHASE 10: الإعدادات (رمز الدخول، النسخ الاحتياطي، الفحص) ---------- */
.token-row { display: flex; gap: 8px; margin-top: 10px; }
.token-row input { flex: 1; min-width: 0; }
.import-box { margin-top: 12px; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--border-2); font-size: 13px; line-height: 1.7; }
.import-box.bad { background: var(--sell-soft); border-color: var(--sell); }
.import-box.good { background: var(--buy-soft); border-color: var(--buy); }
.imp-sum { display: grid; gap: 4px; margin: 8px 0; }
.imp-sum li { display: flex; justify-content: space-between; gap: 10px; }
.imp-sum li span { color: var(--text-2); }
.status-pill.idle .dot { background: var(--text-3); box-shadow: none; }
