/* ستوك — أنماط صفحة اختبار الامتداد (/ext) v1 — Apple HIG: أرضية النص 12px
   تعتمد على هوية stock.css العامة وتضيف فقط ما يخص الصفحة:
   التخطيط الثنائي للشارت وبطاقات الاتجاهين وقارئات kv ومنحنى النجاح
   وقسم المسح الكامل بشريطه وتقدمه وشرائح فلاتره — صفر إيموجي */

/* ===== التخطيط الثنائي للشارت والبطاقات ===== */
.ext-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 14px; margin-top: 14px; }
.ext-host { position: relative; min-height: 360px; }
.ext-host canvas { display: block; width: 100%; height: 360px; }
.ext-side { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.ext-card {
  background: rgba(10, 15, 26, 0.72);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 14px 12px;
}
.ext-card h3 { margin: 0 0 10px; font-size: 0.86rem; font-weight: 900; color: var(--ink); }
.ext-mini { margin: 8px 0 0; color: var(--dim); font-size: 0.75rem; line-height: 1.6; }

/* ===== منتقي النسبة داخل البطاقة ===== */
.ext-xpick {
  display: flex; align-items: center; gap: 7px;
  margin: 0 0 10px; font-size: 0.75rem; color: var(--ink2); font-weight: 700;
}
.ext-xpick input {
  width: 74px; padding: 7px 9px; border-radius: 9px;
  border: 1px solid var(--line); background: rgba(17, 24, 38, 0.65);
  color: var(--ink); font: 800 0.8rem/1 Cairo, Tahoma, sans-serif;
  font-variant-numeric: tabular-nums; text-align: center;
}
.ext-xpick input:focus-visible { outline: 2px solid var(--acc2); outline-offset: 1px; }

/* ===== مفتاح الرسم ===== */
.ext-legend { display: flex; flex-wrap: wrap; gap: 7px; justify-content: flex-end; }
.ext-legend .lg-swatch { width: 14px; height: 3px; border-radius: 2px; display: inline-block; }
.sw-zz { background: rgba(167, 177, 199, 0.75); }
.sw-tgt-up { background: #34d399; }
.sw-tgt-dn { background: #fb5569; }
.sw-fib { background: rgba(255, 211, 77, 0.75); }
.sw-curve-up { background: #34d399; }
.sw-curve-dn { background: #fb5569; }
.sw-base { background: rgba(151, 167, 199, 0.6); }
.lg-tri { width: 0; height: 0; display: inline-block; border-left: 5px solid transparent; border-right: 5px solid transparent; }
.tri-up { border-bottom: 8px solid #34d399; }
.tri-dn { border-top: 8px solid #fb5569; }

/* ===== قارئات القيم kv ===== */
.ext-kv { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 7px; }
.ext-kv li { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 0.75rem; color: var(--ink2); }
.ext-kv li b { color: var(--ink); font-weight: 800; font-variant-numeric: tabular-nums; direction: ltr; }
.ext-kv li b.is-up { color: #34d399; }
.ext-kv li b.is-dn { color: #fb5569; }
.ext-kv li b.is-warn { color: #ffd34d; }
.ext-kv li b.is-dim { color: var(--dim); }

/* ===== قائمة محاور قيد المتابعة ===== */
.ext-opens { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; max-height: 220px; overflow: auto; }
.ext-opens li {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 9px; border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(17, 24, 38, 0.5);
  font-size: 0.75rem; color: var(--ink2);
}
.ext-opens li .op-side { font-weight: 900; min-width: 44px; }
.ext-opens li.is-up .op-side { color: #34d399; }
.ext-opens li.is-dn .op-side { color: #fb5569; }
.ext-opens li .op-date { color: var(--ink); font-weight: 700; }
.ext-opens li .op-price { margin-inline-start: auto; font-weight: 800; font-variant-numeric: tabular-nums; direction: ltr; color: var(--ink); }

/* ===== قسم المنحنى ===== */
.ext-curve-sec {
  margin-top: 16px;
  background: rgba(10, 15, 26, 0.72);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px 16px 12px;
}
.ext-curve-sec .hm-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 10px; margin: 0 0 10px; }
.ext-curve-sec .idx-title { font-size: 1rem; }
.ext-curve-sec .idx-note { max-width: 760px; line-height: 1.7; }
.ext-curve-host { position: relative; min-height: 300px; }
.ext-curve-host canvas { display: block; width: 100%; height: 300px; cursor: crosshair; }

/* ===== قسم المسح الكامل ===== */
.ext-scan {
  margin-top: 16px;
  background: rgba(10, 15, 26, 0.72);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px 16px 12px;
}
.ext-scan-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 10px; }
.ext-scan-head .idx-title { font-size: 1rem; }
.ext-scan-head .idx-note { max-width: 740px; line-height: 1.7; }
.ext-scan-tools { display: flex; gap: 8px; flex: none; flex-wrap: wrap; }
.ext-scan-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; }
.ext-scan-bar .hm-field input { min-width: 190px; }
.ext-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.ext-chips button {
  padding: 6px 12px; border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(17, 24, 38, 0.5);
  color: var(--ink2); font: 700 0.75rem/1 Cairo, Tahoma, sans-serif;
  cursor: pointer; transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.ext-chips button:hover { color: var(--ink); border-color: var(--line2); }
.ext-chips button.on {
  color: #fff; border-color: rgba(10, 132, 255, 0.65);
  background: rgba(10, 132, 255, 0.22);
}

/* شريط التقدم */
.ext-progress { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.ext-progress-track { flex: 1; height: 7px; border-radius: 4px; background: rgba(151, 167, 199, 0.16); overflow: hidden; }
.ext-progress-fill {
  height: 100%; width: 0%; border-radius: 4px;
  background: linear-gradient(90deg, rgba(10, 132, 255, 0.9), rgba(45, 212, 191, 0.9));
  transition: width 0.25s ease;
}
.ext-progress-text { font: 800 0.75rem/1 Cairo, Tahoma, sans-serif; color: var(--ink2); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* الجدول */
.ext-tbl-wrap { margin-top: 12px; overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
.ext-tbl-wrap .data-table { min-width: 940px; margin: 0; }
.ext-tbl-wrap .data-table thead th { position: sticky; top: 0; background: rgba(10, 15, 26, 0.98); z-index: 2; }
.ext-tbl-wrap .data-table tbody td { white-space: nowrap; }
.ext-tbl-wrap .data-table th.sortable { cursor: pointer; user-select: none; }
.ext-tbl-wrap .data-table th.sortable.is-sorted-asc::after { content: " ↑"; color: var(--acc2); }
.ext-tbl-wrap .data-table th.sortable.is-sorted-desc::after { content: " ↓"; color: var(--acc2); }
.ext-tbl-wrap .data-table tbody tr { transition: background 0.12s ease; }
.ext-tbl-wrap .data-table tbody tr:hover { background: rgba(10, 132, 255, 0.06); }
.ext-tbl-wrap .data-table tbody tr.is-up-ok { box-shadow: inset 3px 0 0 #34d399; }
.ext-tbl-wrap .data-table tbody tr.is-dn-ok { box-shadow: inset 3px 0 0 #fb5569; }
.ext-tbl-wrap .data-table tbody td .sym-link { color: var(--ink); font-weight: 800; text-decoration: none; }
.ext-tbl-wrap .data-table tbody td .sym-link:hover { text-decoration: underline; }

/* شارات الموثوقية والتحذيرات */
.ext-symname { color: var(--dim); font-size: 0.75rem; font-weight: 600; }
.stat-pill.up .st-num { color: #34d399; }
.stat-pill.dn .st-num { color: #fb5569; }
.ext-pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 999px;
  font: 800 0.75rem/1.3 Cairo, Tahoma, sans-serif;
  border: 1px solid transparent;
}
.ext-pill.high { color: #04060a; background: #34d399; }
.ext-pill.mid { color: #04060a; background: #ffd34d; }
.ext-pill.low { color: var(--ink2); background: rgba(151, 167, 199, 0.18); }
.ext-warnchips { display: flex; flex-wrap: wrap; gap: 4px; }
.ext-warnchips i {
  font-style: normal; font-size: 0.75rem; font-weight: 800;
  padding: 2px 7px; border-radius: 999px;
  border: 1px solid rgba(255, 211, 77, 0.4); color: #ffd34d; white-space: nowrap;
}
.ext-foot-note { margin: 10px 2px 0; color: var(--dim); font-size: 0.75rem; line-height: 1.7; }

/* شرائح المصدر والبصمة تلتف على الجوال كي لا تفيض الصفحة */
.idx-controls .cache-chip, .ext-scan-bar .cache-chip { max-width: 100%; white-space: normal; line-height: 1.5; }

/* حقل العلامة الاختيارية بمحاذاة HIG */
.hm-check {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 0.78rem; color: var(--ink2); font-weight: 700;
  cursor: pointer; padding: 6px 4px;
}
.hm-check input[type="checkbox"] {
  width: 18px; height: 18px; accent-color: var(--acc2); cursor: pointer;
}
.hm-check input[type="checkbox"]:focus-visible { outline: 2px solid var(--acc2); outline-offset: 2px; }

/* ===== الاستجابة ===== */
@media (max-width: 980px) {
  .ext-layout { grid-template-columns: 1fr; }
  .ext-legend { justify-content: flex-start; }
  .ext-scan-head { flex-direction: column; }
  .ext-scan-tools { width: 100%; }
  .ext-scan-tools .btn-sm { flex: 1 1 auto; justify-content: center; }
}
@media (max-width: 560px) {
  .ext-scan, .ext-curve-sec { padding: 13px 11px 10px; }
  .ext-scan-bar .hm-field { flex: 1 1 100%; }
  .ext-scan-bar .hm-field input, .ext-scan-bar .hm-field select { width: 100%; }
  .ext-chips button { padding: 6px 10px; font-size: 0.75rem; }
  .ext-host canvas { height: 300px; }
  .ext-curve-host canvas { height: 260px; }
}
