/* ============================================================
   ستوك — مسارات الحرارية v3 — نظام تصميم مستقل (v3)
   جدار المرشحين: نتائج «مرشحو الإشارة — فوق 50» مربعات جانبية
   يمين ويسار، كل مربع يحمل رقم رتبته وإحصاءاته فوقه وشارت شموع
   حقيقي بداخله كعينة التصميم المرفقة (شموع وأحجام وأهداف خضراء).
   هوية بصرية جديدة: كربون أعمق بلمسة كهرمانية-ذهبية للرتب
   تميزها عن غرفة عمليات v2 الفيروزية — تعتمد أساس الخطوط
   والتنقل من stock.css وتبني فوقه مستقلاً، ولا تلمس أي نمط
   قائم في أي صفحة أخرى، ولا تعرف أي صنف tr2 إطلاقاً.
   ============================================================ */

:root {
  --tr3-bg: #06080d;
  --tr3-panel: #0b111a;
  --tr3-panel2: #0e1520;
  --tr3-line: rgba(148, 163, 184, 0.14);
  --tr3-line2: rgba(148, 163, 184, 0.26);
  --tr3-txt: #e8edf5;
  --tr3-dim: #a7b1c7;
  --tr3-faint: #67718a;
  --tr3-teal: #2dd4bf;
  --tr3-lime: #a3e635;
  --tr3-amber: #fbbf24;
  --tr3-gold: #ffd166;
  --tr3-up: #22c55e;
  --tr3-dn: #ef4444;
  --tr3-tgt: #4ade80;
}

/* جسم أغمق بوهج كهرماني علوي وحبيبات شبكة */
body.tr3-body {
  background:
    radial-gradient(1100px 320px at 50% -120px, rgba(251, 191, 36, 0.07), transparent 70%),
    linear-gradient(rgba(148, 163, 184, 0.028) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.028) 1px, transparent 1px),
    var(--tr3-bg);
  background-size: auto, 44px 44px, 44px 44px, auto;
}

.tr3-shell {
  max-width: 1180px;
  width: 100%;
  min-width: 0;
  margin: 0 auto;
  padding: 16px 14px 44px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ============ شريط التحكم اللاصق ============ */
.tr3-bar {
  position: sticky;
  top: 0;
  z-index: 6;
  background: rgba(6, 8, 13, 0.93);
  backdrop-filter: blur(9px);
  -webkit-backdrop-filter: blur(9px);
  border: 1px solid var(--tr3-line);
  border-radius: 14px;
  padding: 10px 12px 8px;
}
.tr3-bar-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
}
.tr3-bar-hint {
  margin: 7px 0 0;
  font-size: 11px;
  color: var(--tr3-faint);
  line-height: 1.7;
}

.tr3-tfs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 5px;
  min-width: 210px;
}
.tr3-tfs button {
  appearance: none;
  border: 1px solid var(--tr3-line2);
  background: rgba(148, 163, 184, 0.05);
  color: var(--tr3-dim);
  border-radius: 9px;
  padding: 7px 4px;
  font: inherit;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.tr3-tfs button:hover { color: var(--tr3-txt); border-color: rgba(251, 191, 36, 0.45); }
.tr3-tfs button.on {
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.16), rgba(45, 212, 191, 0.10));
  border-color: rgba(251, 191, 36, 0.55);
  color: var(--tr3-txt);
}

.tr3-bar-group {
  display: flex;
  align-items: center;
  gap: 7px;
}
.tr3-mini {
  font-size: 11.5px;
  color: var(--tr3-dim);
  font-weight: 600;
  white-space: nowrap;
}
.tr3-select, .tr3-input {
  appearance: none;
  background: rgba(6, 8, 13, 0.75);
  border: 1px solid var(--tr3-line2);
  color: var(--tr3-txt);
  border-radius: 9px;
  padding: 6px 9px;
  font: inherit;
  font-size: 12.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  min-width: 0;
}
.tr3-input { width: 64px; text-align: center; }
.tr3-select:focus-visible, .tr3-input:focus-visible,
.tr3-tfs button:focus-visible, .tr3-btn:focus-visible,
.tr3-sigchip:focus-visible, .tr3-tile:focus-visible {
  outline: 2px solid rgba(251, 191, 36, 0.6);
  outline-offset: 1px;
}

.tr3-bar-toggles {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.tr3-switch-row {
  display: flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  user-select: none;
}
.tr3-switch-row > span:first-child {
  font-size: 11.5px;
  color: var(--tr3-dim);
  font-weight: 600;
  white-space: nowrap;
}
.tr3-switch {
  position: relative;
  width: 34px;
  height: 19px;
  border-radius: 19px;
  border: 1px solid var(--tr3-line2);
  background: rgba(6, 8, 13, 0.8);
  transition: background 0.15s, border-color 0.15s;
  flex: none;
}
.tr3-switch::after {
  content: "";
  position: absolute;
  top: 2px;
  inset-inline-end: 2px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--tr3-faint);
  transition: transform 0.18s, background 0.18s;
}
.tr3-switch-row.on .tr3-switch {
  background: rgba(251, 191, 36, 0.22);
  border-color: rgba(251, 191, 36, 0.6);
}
.tr3-switch-row.on .tr3-switch::after {
  background: var(--tr3-amber);
  transform: translateX(-15px);
}
/* قائمة موقع السعر من رادار الصناديق (المهمة 51) — تحت مفتاحها في عمود
   شريط المفاتيح بحجم نص المفاتيح، ومطفأة البهت والفلتر مطفأ */
.tr3-boxpos {
  font-size: 11.5px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 8px;
  margin-inline-start: 2px;
  color: var(--tr3-dim);
}
.tr3-boxpos:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.tr3-scanbox {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-inline-start: auto;
  min-width: 200px;
  flex-direction: column;
  align-items: stretch;
}
.tr3-scanline {
  font-size: 11px;
  color: var(--tr3-dim);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
}
.tr3-scanbar {
  height: 4px;
  border-radius: 4px;
  background: rgba(148, 163, 184, 0.12);
  overflow: hidden;
}
.tr3-scanbar i {
  display: block;
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--tr3-teal), var(--tr3-amber));
  transition: width 0.3s;
}
.tr3-btn {
  appearance: none;
  border: 1px solid rgba(251, 191, 36, 0.45);
  background: rgba(251, 191, 36, 0.10);
  color: var(--tr3-amber);
  border-radius: 9px;
  padding: 6px 14px;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.tr3-btn:hover { background: rgba(251, 191, 36, 0.18); border-color: rgba(251, 191, 36, 0.7); }

/* ============ حالة السوق ============ */
.tr3-status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 16px;
  border: 1px solid var(--tr3-line);
  background: linear-gradient(180deg, var(--tr3-panel2), var(--tr3-panel));
  border-radius: 12px;
  padding: 9px 14px;
  font-size: 12.5px;
  color: var(--tr3-dim);
}
.tr3-live {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--tr3-txt);
  font-weight: 800;
}
.tr3-pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--tr3-up);
  box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.5);
  animation: tr3beat 1.8s ease-out infinite;
  flex: none;
}
@keyframes tr3beat {
  0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.5); }
  70% { box-shadow: 0 0 0 7px rgba(34, 197, 94, 0); }
  100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}
@media (prefers-reduced-motion: reduce) {
  .tr3-pulse { animation: none; }
}
.tr3-stat b { color: var(--tr3-txt); font-variant-numeric: tabular-nums; }

/* ============ بطاقة الإشارة ============ */
.tr3-hero {
  border: 1px solid var(--tr3-line);
  border-radius: 14px;
  background:
    radial-gradient(600px 160px at 100% 0%, rgba(251, 191, 36, 0.07), transparent 70%),
    linear-gradient(180deg, var(--tr3-panel2), var(--tr3-panel));
  padding: 14px 16px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
}
.tr3-hero-kicker {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 10.5px;
  letter-spacing: 1.6px;
  font-weight: 800;
  color: var(--tr3-amber);
}
.tr3-hero-title {
  margin: 6px 0 4px;
  font-size: 17px;
  line-height: 1.6;
  color: var(--tr3-txt);
}
.tr3-hero-sub {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.9;
  color: var(--tr3-dim);
}
.tr3-hero-sub b { color: var(--tr3-txt); }
.tr3-hero-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
}
.tr3-metric {
  border: 1px solid var(--tr3-line);
  border-radius: 10px;
  background: rgba(6, 8, 13, 0.55);
  padding: 8px 10px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}
.tr3-metric i {
  font-style: normal;
  font-size: 11px;
  color: var(--tr3-faint);
  font-weight: 600;
}
.tr3-metric b {
  font-size: 15px;
  color: var(--tr3-txt);
  font-variant-numeric: tabular-nums;
}
.tr3-metric b.up { color: var(--tr3-up); }
.tr3-metric b.tl { color: var(--tr3-teal); }

/* ============ شريط الإشارات ============ */
.tr3-sigwrap { display: flex; flex-direction: column; gap: 8px; }
.tr3-sig-title {
  margin: 0;
  font-size: 13px;
  color: var(--tr3-dim);
  font-weight: 800;
}
.tr3-sigchips {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: thin;
}
.tr3-sigchip {
  appearance: none;
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--tr3-line2);
  background: rgba(148, 163, 184, 0.05);
  color: var(--tr3-dim);
  border-radius: 999px;
  padding: 5px 12px;
  font: inherit;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  font-variant-numeric: tabular-nums;
}
.tr3-sigchip:hover { color: var(--tr3-txt); border-color: rgba(45, 212, 191, 0.5); }
.tr3-sigchip.on {
  background: linear-gradient(135deg, rgba(45, 212, 191, 0.2), rgba(251, 191, 36, 0.12));
  border-color: rgba(45, 212, 191, 0.65);
  color: var(--tr3-txt);
}
.tr3-sigchip-pct { color: var(--tr3-lime); font-weight: 800; }

/* ============ جدار المرشحين: الشبكة ============ */
.tr3-wall {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.tr3-wall-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.tr3-wall-head h2 {
  margin: 0;
  font-size: 19px;
  color: var(--tr3-txt);
}
.tr3-wall-head p {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--tr3-faint);
  line-height: 1.8;
}
.tr3-chip {
  flex: none;
  border: 1px solid rgba(45, 212, 191, 0.4);
  background: rgba(45, 212, 191, 0.10);
  color: var(--tr3-teal);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 11.5px;
  font-weight: 800;
}
.tr3-wall-note {
  margin: 2px 0 0;
  font-size: 11.5px;
  color: var(--tr3-faint);
  line-height: 1.9;
}

/* الشبكة: مربع يمين ومربع يسار — عمودان بلا أرضية محتوى على العرض الواسع
   وعمود واحد تحت 980 — minmax(0,1fr) يمنع أي أرضية داخلية تفيض على أي عرض */
.tr3-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  align-items: stretch;
}
@media (min-width: 980px) {
  .tr3-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ============ المربع: رتبة وإحصاءات وشارت ============ */
.tr3-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--tr3-line);
  border-radius: 14px;
  background: linear-gradient(180deg, var(--tr3-panel2), var(--tr3-panel));
  padding: 11px 12px 10px;
  cursor: pointer;
  transition: border-color 0.18s, transform 0.18s, box-shadow 0.18s;
  min-width: 0;
}
.tr3-tile:hover {
  border-color: rgba(251, 191, 36, 0.5);
  transform: translateY(-2px);
  box-shadow: 0 10px 26px -14px rgba(251, 191, 36, 0.35);
}
.tr3-tile.first { border-color: rgba(255, 209, 102, 0.45); }
.tr3-tile.second { border-color: rgba(148, 163, 184, 0.4); }
.tr3-tile.third { border-color: rgba(205, 127, 50, 0.4); }

.tr3-tile-head {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

/* الرقم: شارة مربعة بوسط المربع الأعلى */
.tr3-rank {
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  background: rgba(148, 163, 184, 0.10);
  border: 1px solid var(--tr3-line2);
  color: var(--tr3-dim);
}
.tr3-tile.first .tr3-rank {
  background: linear-gradient(135deg, #ffd166, #f59e0b);
  border-color: rgba(255, 209, 102, 0.8);
  color: #241a02;
}
.tr3-tile.second .tr3-rank {
  background: linear-gradient(135deg, #cbd5e1, #94a3b8);
  border-color: rgba(203, 213, 225, 0.7);
  color: #10151f;
}
.tr3-tile.third .tr3-rank {
  background: linear-gradient(135deg, #d9a06b, #b0713a);
  border-color: rgba(217, 160, 107, 0.7);
  color: #1e1206;
}

.tr3-id {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}
.tr3-sym {
  font-size: 14.5px;
  font-weight: 900;
  color: var(--tr3-txt);
  letter-spacing: 0.2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tr3-name {
  font-size: 11.5px;
  color: var(--tr3-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tr3-score {
  flex: none;
  min-width: 40px;
  text-align: center;
  border-radius: 9px;
  padding: 5px 8px;
  font-size: 14px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  border: 1px solid var(--tr3-line2);
  background: rgba(148, 163, 184, 0.07);
  color: var(--tr3-dim);
}
.tr3-score.hi {
  background: rgba(163, 230, 53, 0.14);
  border-color: rgba(163, 230, 53, 0.5);
  color: var(--tr3-lime);
}
.tr3-score.mid2 {
  background: rgba(45, 212, 191, 0.12);
  border-color: rgba(45, 212, 191, 0.45);
  color: var(--tr3-teal);
}
.tr3-score.mid {
  background: rgba(251, 191, 36, 0.10);
  border-color: rgba(251, 191, 36, 0.4);
  color: var(--tr3-amber);
}
.tr3-score.lo {
  background: rgba(240, 132, 110, 0.10);
  border-color: rgba(240, 132, 110, 0.4);
  color: #f0846e;
}
.tr3-score.none { color: var(--tr3-faint); }

/* الإحصاءات فوق الشارت: رقائق مضغوطة */
.tr3-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin: 10px 0 9px;
}
.tr3-stat {
  display: flex;
  align-items: baseline;
  gap: 5px;
  border: 1px solid var(--tr3-line);
  background: rgba(6, 8, 13, 0.5);
  border-radius: 8px;
  padding: 3px 8px;
  min-width: 0;
}
.tr3-stat i {
  font-style: normal;
  font-size: 10px;
  color: var(--tr3-faint);
  font-weight: 700;
  white-space: nowrap;
}
.tr3-stat b {
  font-size: 12px;
  color: var(--tr3-txt);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.tr3-stat.hi b { color: var(--tr3-lime); }
.tr3-stat.mid b { color: var(--tr3-teal); }
.tr3-stat.lo b { color: #f0846e; }
.tr3-stat.up b { color: var(--tr3-up); }
.tr3-stat.dn b { color: var(--tr3-dn); }
.tr3-stat.dim b { color: var(--tr3-faint); }

/* الشارت: قلب المربع */
.tr3-tile canvas.tr3-chart {
  display: block;
  width: 100%;
  height: 232px;
  border-radius: 10px;
  background: #070b12;
  border: 1px solid rgba(148, 163, 184, 0.10);
}

/* ذيل المربع */
.tr3-tile-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
  min-width: 0;
}
.tr3-tile-sig {
  font-size: 11px;
  color: var(--tr3-faint);
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tr3-chbtn {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  text-decoration: none;
  border: 1px solid rgba(45, 212, 191, 0.4);
  background: rgba(45, 212, 191, 0.08);
  color: var(--tr3-teal);
  border-radius: 8px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 800;
  transition: background 0.15s, border-color 0.15s;
}
.tr3-chbtn::before {
  content: "";
  width: 0;
  height: 0;
  border-inline-end: 7px solid currentColor;
  border-block: 4.5px solid transparent;
}
.tr3-chbtn:hover, .tr3-chbtn:focus-visible {
  background: rgba(45, 212, 191, 0.16);
  border-color: rgba(45, 212, 191, 0.7);
}

/* الحالات الفارغة والملاحظات */
.tr3-empty {
  border: 1px dashed var(--tr3-line2);
  border-radius: 12px;
  padding: 18px 16px;
  font-size: 12.5px;
  color: var(--tr3-dim);
  line-height: 1.9;
  background: rgba(6, 8, 13, 0.4);
  margin: 0;
}

/* التوست */
.tr3-toast {
  position: fixed;
  inset-inline: 0;
  bottom: 18px;
  margin-inline: auto;
  width: fit-content;
  max-width: min(480px, 92vw);
  background: rgba(11, 17, 26, 0.96);
  border: 1px solid var(--tr3-line2);
  color: var(--tr3-txt);
  border-radius: 10px;
  padding: 10px 16px;
  font-size: 12.5px;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 0.2s, transform 0.2s;
  z-index: 40;
}
.tr3-toast.show { opacity: 1; transform: translateY(0); }
.tr3-toast.ok { border-color: rgba(163, 230, 53, 0.55); }
.tr3-toast.bad { border-color: rgba(240, 132, 110, 0.55); }

/* ============ الجوال ============ */
@media (max-width: 720px) {
  .tr3-shell { padding: 12px 10px 36px; gap: 10px; }
  .tr3-bar { position: static; padding: 9px 10px 7px; }
  .tr3-bar-row { gap: 8px 10px; }
  .tr3-tfs { min-width: 0; width: 100%; }
  .tr3-scanbox { margin-inline-start: 0; }
  .tr3-hero { padding: 12px; }
  .tr3-hero-title { font-size: 15px; }
  .tr3-grid { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .tr3-tile { padding: 9px 9px 8px; }
  .tr3-rank { width: 30px; height: 30px; font-size: 13.5px; border-radius: 9px; }
  .tr3-stat { padding: 3px 6px; }
  .tr3-tile canvas.tr3-chart { height: 208px; }
}
