/* ThetaDesk — نظام التصميم
   الألوان كرموز على :root، والوضع الداكن كخطوات خاصة به (ليس قلبًا آليًا). */

:root {
  color-scheme: light;
  --bg: #f4f3ef;
  --card: #ffffff;
  --tile: #f1f0ec;
  --tile-2: #f7f6f2;
  --border: #e6e3db;
  --border-strong: #d6d2c6;
  --text: #141414;
  --text-2: #3b3a37;
  --muted: #6e6b64;
  --faint: #9a968d;
  --gold: #d8ad52;
  --gold-1: #f2d792;
  --gold-2: #d5a744;
  --gold-text: #87631a;
  --gold-soft: #fbf4e3;
  --gold-line: #e7c77a;
  --up: #1d7f47;
  --up-soft: #e5f3ea;
  --down: #c03a35;
  --down-soft: #f8e9e8;
  --down-border: #e3a39f;
  --amber-soft: #fbeedb;
  --amber-text: #94570f;
  --ink-btn: #1a1712;
  --shadow: 0 1px 2px rgba(20, 20, 20, 0.04), 0 10px 30px rgba(20, 20, 20, 0.05);
  --shadow-gold: 0 8px 22px rgba(201, 152, 51, 0.28);
  --overlay: rgba(25, 23, 20, 0.45);

  /* ألوان الرسوم البيانية (مُتحقق منها لعمى الألوان والتباين) */
  --chart-surface: #ffffff;
  --chart-grid: #ece9e1;
  --chart-axis: #c9c5b9;
  --chart-label: #85827a;
  --series-1: #2a78d6;
  --series-neg: #e34948;
  --chart-ref: #8f8b82;

  --radius: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --font: 'Inter', 'IBM Plex Sans Arabic', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --container: 1180px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    color-scheme: dark;
    --bg: #0e0e0f;
    --card: #17171a;
    --tile: #212125;
    --tile-2: #1c1c1f;
    --border: #2b2b30;
    --border-strong: #3a3a40;
    --text: #f4f3f0;
    --text-2: #d6d4ce;
    --muted: #a3a09a;
    --faint: #7d7a74;
    --gold-text: #e2bf6e;
    --gold-soft: #2a2416;
    --gold-line: #8a6b2a;
    --up: #3fbf74;
    --up-soft: #15291d;
    --down: #ef6b62;
    --down-soft: #2c1918;
    --down-border: #6b302c;
    --amber-soft: #2c2213;
    --amber-text: #e7a95a;
    --ink-btn: #0b0a08;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 30px rgba(0, 0, 0, 0.25);
    --shadow-gold: 0 8px 22px rgba(201, 152, 51, 0.18);
    --overlay: rgba(0, 0, 0, 0.6);
    --chart-surface: #17171a;
    --chart-grid: #2a2a2e;
    --chart-axis: #3b3b40;
    --chart-label: #8f8c85;
    --series-1: #3987e5;
    --series-neg: #e66767;
    --chart-ref: #8a877f;
  }
}

:root[data-theme='dark'] {
  color-scheme: dark;
  --bg: #0e0e0f;
  --card: #17171a;
  --tile: #212125;
  --tile-2: #1c1c1f;
  --border: #2b2b30;
  --border-strong: #3a3a40;
  --text: #f4f3f0;
  --text-2: #d6d4ce;
  --muted: #a3a09a;
  --faint: #7d7a74;
  --gold-text: #e2bf6e;
  --gold-soft: #2a2416;
  --gold-line: #8a6b2a;
  --up: #3fbf74;
  --up-soft: #15291d;
  --down: #ef6b62;
  --down-soft: #2c1918;
  --down-border: #6b302c;
  --amber-soft: #2c2213;
  --amber-text: #e7a95a;
  --ink-btn: #0b0a08;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 30px rgba(0, 0, 0, 0.25);
  --shadow-gold: 0 8px 22px rgba(201, 152, 51, 0.18);
  --overlay: rgba(0, 0, 0, 0.6);
  --chart-surface: #17171a;
  --chart-grid: #2a2a2e;
  --chart-axis: #3b3b40;
  --chart-label: #8f8c85;
  --series-1: #3987e5;
  --series-neg: #e66767;
  --chart-ref: #8a877f;
}

/* ───────────── الأساس ───────────── */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 96px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  line-height: 1.3;
  font-weight: 700;
  letter-spacing: -0.01em;
}

p {
  margin: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

img,
svg {
  display: block;
  max-width: 100%;
}

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

.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 24px;
}

main.container {
  min-height: 70vh;
  padding-top: 28px;
  padding-bottom: 64px;
  outline: none;
}

.num {
  direction: ltr;
  unicode-bidi: isolate;
  display: inline-block;
}

.tabnum {
  font-variant-numeric: tabular-nums;
}

.ltr {
  direction: ltr;
  unicode-bidi: isolate;
}

.muted {
  color: var(--muted);
}

.faint {
  color: var(--faint);
}

.up {
  color: var(--up);
}

.down {
  color: var(--down);
}

.gold {
  color: var(--gold-text);
}

.small {
  font-size: 13px;
}

.tiny {
  font-size: 12px;
}

.bold {
  font-weight: 700;
}

.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ───────────── الرأس ───────────── */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--card) 92%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 18px;
  min-height: 80px;
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.brand-logo {
  width: 48px;
  height: 48px;
  border-radius: 13px;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.brand-name {
  font-weight: 700;
  font-size: 19px;
  letter-spacing: -0.01em;
}

.brand-sub {
  font-size: 11px;
  color: var(--gold-text);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 600;
  margin-top: 3px;
}

.nav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
  justify-content: center;
  flex-wrap: wrap;
}

.nav a {
  padding: 8px 11px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 500;
  color: var(--text-2);
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}

.nav a:hover {
  background: var(--tile);
  color: var(--text);
}

.nav a.active {
  color: var(--gold-text);
  background: var(--gold-soft);
  font-weight: 600;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.icon-btn {
  width: 44px;
  height: 44px;
  border-radius: 13px;
  border: 1px solid var(--border);
  background: var(--card);
  display: grid;
  place-items: center;
  color: var(--text);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  transition: background 0.15s, border-color 0.15s;
}

.icon-btn:hover {
  background: var(--tile);
}

.icon-btn svg {
  width: 20px;
  height: 20px;
}

.icon-btn.gold-icon {
  color: var(--gold-text);
}

.user-pill {
  height: 44px;
  padding: 0 18px;
  border-radius: 14px;
  border: 1px solid var(--border-strong);
  background: var(--card);
  font-weight: 600;
  font-size: 15px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 220px;
}

.user-pill span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.menu-btn {
  display: none;
}

.header-back {
  margin-inline-start: auto;
}

.user-menu {
  position: relative;
}

.dropdown {
  position: absolute;
  top: calc(100% + 8px);
  inset-inline-end: 0;
  min-width: 220px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 8px;
  z-index: 60;
}

.dropdown a,
.dropdown button {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 0;
  background: none;
  text-align: start;
  font-size: 15px;
}

.dropdown a:hover,
.dropdown button:hover {
  background: var(--tile);
}

.dropdown .dd-head {
  padding: 10px 12px 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 6px;
}

/* شريط الأسعار */
.ticker-strip {
  border-bottom: 1px solid var(--border);
  background: var(--card);
  overflow: hidden;
}

.ticker-track {
  display: flex;
  gap: 28px;
  padding: 9px 24px;
  max-width: 1320px;
  margin: 0 auto;
  overflow-x: auto;
  scrollbar-width: none;
  font-size: 13px;
}

.ticker-track::-webkit-scrollbar {
  display: none;
}

.ticker-item {
  display: inline-flex;
  gap: 8px;
  align-items: baseline;
  white-space: nowrap;
}

.ticker-item b {
  font-weight: 700;
}

.session-dot {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
  font-weight: 600;
}

.session-dot::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--faint);
}

.session-dot.open::before {
  background: var(--up);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--up) 22%, transparent);
}

.session-dot.pre::before,
.session-dot.post::before {
  background: var(--gold);
}

/* ───────────── عناصر عامة ───────────── */

.section {
  margin-top: 56px;
}

.section:first-child {
  margin-top: 8px;
}

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}

.eyebrow {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold-text);
  margin-bottom: 8px;
  direction: ltr;
  unicode-bidi: isolate;
  display: block;
  text-align: right;
}

.h-page {
  font-size: clamp(30px, 4vw, 44px);
  font-weight: 800;
}

.h-section {
  font-size: clamp(24px, 3vw, 34px);
  font-weight: 800;
}

.h-card {
  font-size: 20px;
  font-weight: 700;
}

.lead {
  color: var(--muted);
  font-size: 15px;
}

.divider {
  height: 1px;
  background: var(--border);
  margin: 56px 0 0;
  border: 0;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
}

.card.pad-lg {
  padding: 36px;
}

.card.flat {
  box-shadow: none;
}

.card-accent {
  border-inline-end: 3px solid var(--gold);
  border-start-end-radius: var(--radius);
  border-end-end-radius: var(--radius);
}

.card-title {
  font-size: 19px;
  font-weight: 700;
  margin-bottom: 12px;
}

.card-text {
  color: var(--muted);
  font-size: 15.5px;
  line-height: 1.95;
}

.grid {
  display: grid;
  gap: 16px;
}

.grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.grid-5 {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.mt-8 {
  margin-top: 8px;
}

.mt-12 {
  margin-top: 12px;
}

.mt-16 {
  margin-top: 16px;
}

.mt-24 {
  margin-top: 24px;
}

/* الأزرار */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 48px;
  padding: 0 22px;
  border-radius: 14px;
  border: 1px solid transparent;
  font-weight: 700;
  font-size: 16px;
  white-space: nowrap;
  transition: transform 0.12s, box-shadow 0.15s, background 0.15s, border-color 0.15s;
  text-align: center;
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-gold {
  background: linear-gradient(180deg, var(--gold-1), var(--gold-2));
  color: #1b160c;
  box-shadow: var(--shadow-gold);
}

.btn-gold:hover {
  filter: brightness(1.03);
}

.btn-outline {
  background: var(--card);
  border-color: var(--border-strong);
  color: var(--text);
}

.btn-outline:hover {
  background: var(--tile);
}

.btn-ghost {
  background: transparent;
  color: var(--text-2);
}

.btn-ghost:hover {
  background: var(--tile);
}

.btn-danger {
  background: var(--down-soft);
  color: var(--down);
  border-color: var(--down-border);
}

.btn-sm {
  height: 38px;
  padding: 0 14px;
  font-size: 14px;
  border-radius: 11px;
}

.btn-block {
  width: 100%;
}

.btn-chip {
  height: 34px;
  padding: 0 14px;
  font-size: 13px;
  border-radius: 10px;
  background: var(--gold-soft);
  color: var(--gold-text);
  border: 1px solid color-mix(in srgb, var(--gold) 35%, var(--border));
  font-weight: 600;
}

.btn-chip:hover {
  background: color-mix(in srgb, var(--gold-soft) 70%, var(--gold) 30%);
}

.link-arrow {
  color: var(--gold-text);
  font-weight: 700;
  display: inline-flex;
  gap: 6px;
  align-items: center;
}

.link-arrow:hover {
  text-decoration: underline;
}

/* الشارات */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  background: var(--tile);
  color: var(--text-2);
}

.pill.amber {
  background: var(--amber-soft);
  color: var(--amber-text);
}

.pill.up {
  background: var(--up-soft);
  color: var(--up);
}

.pill.down {
  background: var(--down-soft);
  color: var(--down);
}

.pill.gold {
  background: var(--gold-soft);
  color: var(--gold-text);
}

.pill.outline {
  background: transparent;
  border: 1px solid var(--border-strong);
}

/* بطاقات القيم */
.stat {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 18px 22px;
  min-width: 0;
}

.stat-label {
  font-size: 13px;
  color: var(--muted);
}

.stat-value {
  font-size: 24px;
  font-weight: 700;
  margin-top: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stat-sub {
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 4px;
}

.stat.danger {
  border-color: var(--down-border);
}

.stat.goldish {
  border-color: var(--gold-line);
}

.tile {
  background: var(--tile);
  border-radius: 14px;
  padding: 12px 14px;
  min-width: 0;
}

.tile-label {
  font-size: 12px;
  color: var(--muted);
}

.tile-value {
  font-size: 18px;
  font-weight: 700;
  margin-top: 2px;
  white-space: nowrap;
}

/* ───────────── الصفحة الرئيسية ───────────── */

.hero {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 18px;
  align-items: stretch;
}

.hero-main {
  position: relative;
  overflow: hidden;
  background: radial-gradient(120% 140% at 100% 0%, var(--gold-soft) 0%, transparent 55%), var(--card);
}

.hero-title {
  font-size: clamp(30px, 4.2vw, 48px);
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: -0.02em;
}

.hero-title em {
  font-style: normal;
  color: var(--gold-text);
}

.hero-text {
  color: var(--muted);
  font-size: 17px;
  margin-top: 14px;
  max-width: 560px;
  line-height: 1.9;
}

.hero-cta {
  display: flex;
  gap: 12px;
  margin-top: 26px;
  flex-wrap: wrap;
}

.kpis {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.kpi {
  background: var(--tile-2);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px 18px;
}

.kpi-value {
  font-size: 30px;
  font-weight: 800;
  line-height: 1.2;
}

.kpi-label {
  color: var(--muted);
  font-size: 13px;
  margin-top: 4px;
}

.update-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  background: var(--tile);
  border-radius: 16px;
  padding: 14px 18px;
  border-inline-end: 3px solid var(--gold);
}

.account-links {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
}

/* الفلاتر */
.filters {
  display: grid;
  grid-template-columns: 1.3fr repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.input,
.select,
.textarea {
  width: 100%;
  height: 52px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--card);
  padding: 0 16px;
  font-size: 15px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.textarea {
  height: auto;
  min-height: 96px;
  padding: 12px 16px;
  resize: vertical;
  line-height: 1.7;
}

.input:focus,
.select:focus,
.textarea:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--gold) 18%, transparent);
}

.input.tinted,
.select.tinted {
  background: var(--tile-2);
}

.select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m7 15 5 5 5-5'/%3E%3Cpath d='m7 9 5-5 5 5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 16px center;
  padding-left: 36px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-label {
  font-weight: 700;
  font-size: 15px;
}

.field-hint {
  font-size: 12.5px;
  color: var(--muted);
}

.check {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  cursor: pointer;
}

.check input {
  width: 20px;
  height: 20px;
  accent-color: var(--gold-2);
}

/* ───────────── بطاقة الفرصة ───────────── */

.opp-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 18px;
}

.opp-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 26px;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: box-shadow 0.2s, transform 0.2s;
}

.opp-card:hover {
  box-shadow: var(--shadow);
}

.opp-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.opp-sym {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.opp-when {
  font-size: 13px;
  color: var(--text-2);
  font-weight: 500;
}

.dir-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--tile);
  border-radius: 14px;
  padding: 14px 18px;
  gap: 10px;
}

.dir-label {
  font-weight: 800;
  font-size: 18px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.dir-label.bullish {
  color: var(--up);
}

.dir-label.bearish {
  color: var(--down);
}

.dir-label.neutral {
  color: var(--muted);
}

.strength {
  font-size: 13px;
  color: var(--muted);
}

.opp-tiles {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.opp-update {
  background: var(--tile);
  border-radius: 14px;
  padding: 12px 16px;
  border-inline-end: 3px solid var(--gold);
  font-size: 14px;
}

.opp-update .when {
  color: var(--gold-text);
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 2px;
}

.opp-inv {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  padding: 12px 18px;
  gap: 10px;
}

.opp-inv .lbl {
  color: var(--muted);
  font-size: 14px;
}

.opp-inv .val {
  font-weight: 800;
  font-size: 18px;
}

.action-text {
  font-weight: 700;
  font-size: 14px;
}

.action-text.follow {
  color: var(--down);
}

.action-text.reeval {
  color: var(--down);
}

.action-text.profit {
  color: var(--up);
}

.opp-contract {
  font-size: 13.5px;
  color: var(--text-2);
  background: var(--tile-2);
  border: 1px dashed var(--border-strong);
  border-radius: 12px;
  padding: 10px 14px;
  line-height: 1.8;
}

.opp-actions {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 10px;
  margin-top: auto;
}

.empty {
  text-align: center;
  padding: 48px 24px;
  color: var(--muted);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--tile-2);
}

.empty-title {
  font-weight: 700;
  color: var(--text);
  font-size: 18px;
  margin-bottom: 6px;
}

/* ───────────── الجداول ───────────── */

.table-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--card);
}

.table-scroll {
  overflow-x: auto;
}

table.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}

.table th {
  background: color-mix(in srgb, var(--gold-soft) 70%, var(--tile));
  font-weight: 600;
  color: var(--text-2);
  text-align: start;
  padding: 16px 22px;
  font-size: 14px;
  white-space: nowrap;
}

.table td {
  padding: 16px 22px;
  border-top: 1px solid var(--border);
  vertical-align: middle;
}

.table tr.clickable {
  cursor: pointer;
}

.table tr.clickable:hover td {
  background: var(--tile-2);
}

.table.nowrap td {
  white-space: nowrap;
}

.table .sym {
  font-weight: 800;
  font-size: 16px;
}

.table .res {
  font-weight: 800;
  font-size: 17px;
}

.table th.sortable {
  cursor: pointer;
  user-select: none;
}

.table th.sortable:hover {
  color: var(--text);
}

.timing {
  font-size: 12.5px;
  line-height: 1.7;
}

.timing .closed {
  font-weight: 700;
}

/* ───────────── تفاصيل الفرصة ───────────── */

.detail-hero {
  position: relative;
  overflow: hidden;
  padding: 38px 36px 34px;
}

.detail-hero::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 6px;
  background: var(--faint);
}

.detail-hero.bullish::before {
  background: var(--up);
}

.detail-hero.bearish::before {
  background: var(--down);
}

.detail-hero-grid {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}

.detail-sym {
  font-size: clamp(48px, 7vw, 72px);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin-top: 4px;
}

.detail-sub {
  color: var(--muted);
  margin-top: 10px;
  font-size: 16px;
}

.chips {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.chip-box {
  background: var(--tile);
  border-radius: 14px;
  padding: 10px 16px;
  min-width: 140px;
}

.chip-box .l {
  font-size: 12px;
  color: var(--muted);
}

.chip-box .v {
  font-size: 14px;
  font-weight: 600;
  margin-top: 2px;
}

.score-tiles {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.score-tile {
  background: var(--tile);
  border-radius: 18px;
  padding: 20px 22px;
  min-width: 0;
}

.score-tile .l {
  color: var(--muted);
  font-size: 15px;
}

.score-tile .v {
  font-size: 34px;
  font-weight: 800;
  margin-top: 6px;
  line-height: 1.1;
}

.score-tile .v small {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.score-tile .bar {
  height: 5px;
  border-radius: 99px;
  background: color-mix(in srgb, var(--text) 8%, transparent);
  margin-top: 12px;
  overflow: hidden;
}

.score-tile .bar i {
  display: block;
  height: 100%;
  border-radius: 99px;
  background: var(--text-2);
}

.score-tile.final {
  background: linear-gradient(180deg, #ecc56c, #e0b04e);
  color: #1b160c;
}

.score-tile.final .l,
.score-tile.final .v small {
  color: #4a3a17;
}

.score-tile.final .bar {
  background: rgba(0, 0, 0, 0.1);
}

.score-tile.final .bar i {
  background: #1b160c;
}

.invalid-card {
  background: var(--down-soft);
  border: 1px solid var(--down-border);
  border-radius: var(--radius);
  padding: 30px 36px;
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 24px;
  align-items: center;
}

.invalid-level {
  font-size: 30px;
  font-weight: 800;
}

.contract-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 16px;
}

.contract-card {
  border: 1px solid var(--border);
  border-radius: 20px;
  overflow: hidden;
  background: var(--card);
}

.contract-head {
  background: var(--tile);
  padding: 18px 20px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.contract-title {
  font-weight: 800;
  font-size: 18px;
}

.contract-sub {
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 4px;
}

.contract-ret {
  text-align: center;
  flex-shrink: 0;
}

.contract-ret .v {
  font-size: 24px;
  font-weight: 800;
  color: var(--up);
  line-height: 1.1;
}

.contract-ret .l {
  font-size: 11px;
  color: var(--up);
  font-weight: 600;
}

.contract-body {
  padding: 16px 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.legs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.leg {
  background: var(--tile);
  border-radius: 14px;
  padding: 12px 14px;
}

.leg .act {
  font-weight: 700;
  font-size: 15px;
}

.leg .act.sell {
  color: var(--down);
}

.leg .act.buy {
  color: var(--up);
}

.leg .what {
  font-weight: 800;
  font-size: 17px;
  margin-top: 2px;
}

.mini-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.mini-stat {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
}

.mini-stat .l {
  font-size: 11.5px;
  color: var(--muted);
}

.mini-stat .v {
  font-weight: 700;
  font-size: 16px;
  margin-top: 2px;
  white-space: nowrap;
}

.live-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--tile-2);
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 13.5px;
}

.progress {
  height: 8px;
  border-radius: 99px;
  background: var(--tile);
  overflow: hidden;
  position: relative;
}

.progress i {
  position: absolute;
  inset-block: 0;
  inset-inline-start: 0;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--gold-1), var(--gold-2));
}

.progress.neg i {
  background: var(--series-neg);
}

.timeline {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tl-item {
  background: var(--card);
  border: 1px solid var(--border);
  border-inline-end: 3px solid var(--gold);
  border-radius: 18px;
  padding: 18px 22px;
}

.tl-item.danger {
  border-inline-end-color: var(--down);
}

.tl-item.success {
  border-inline-end-color: var(--up);
}

.tl-item.warn {
  border-inline-end-color: var(--amber-text);
}

.tl-time {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 4px;
}

.kv {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 16px;
  font-size: 14.5px;
}

.kv dt {
  color: var(--muted);
}

.kv dd {
  margin: 0;
  font-weight: 600;
  text-align: start;
}

/* ───────────── الرسوم البيانية ───────────── */

.chart-card .chart-wrap {
  position: relative;
  margin-top: 14px;
  direction: ltr;
}

.chart svg {
  width: 100%;
  height: auto;
  overflow: visible;
}

.chart text {
  font-family: var(--font);
  fill: var(--chart-label);
  font-size: 11px;
}

.chart .lvl-label {
  fill: var(--text-2);
  font-size: 11px;
  font-weight: 600;
}

.chart .grid-line {
  stroke: var(--chart-grid);
  stroke-width: 1;
}

.chart .axis-line {
  stroke: var(--chart-axis);
  stroke-width: 1;
}

.chart .price-line {
  fill: none;
  stroke: var(--series-1);
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.chart .price-area {
  fill: var(--series-1);
  opacity: 0.1;
}

.chart .ref-line {
  stroke: var(--chart-ref);
  stroke-width: 1.25;
  stroke-dasharray: 5 4;
}

.chart .ref-line.critical {
  stroke: var(--series-neg);
  stroke-width: 1.5;
}

.chart .spot-line {
  stroke: var(--text-2);
  stroke-width: 1.25;
}

.chart .bar-pos {
  fill: var(--series-1);
}

.chart .bar-neg {
  fill: var(--series-neg);
}

.chart .bar-pos:hover,
.chart .bar-neg:hover,
.chart .hit:hover + .bar-pos,
.chart .hit:hover + .bar-neg {
  opacity: 0.8;
}

.chart .crosshair {
  stroke: var(--chart-axis);
  stroke-width: 1;
}

.chart .dot {
  fill: var(--series-1);
  stroke: var(--chart-surface);
  stroke-width: 2;
}

.chart-tip {
  position: absolute;
  pointer-events: none;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 8px 12px;
  font-size: 12.5px;
  white-space: nowrap;
  z-index: 5;
  direction: rtl;
  transform: translate(-50%, calc(-100% - 12px));
}

.chart-tip b {
  font-size: 15px;
  display: block;
}

.legend {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 12.5px;
  color: var(--text-2);
  margin-top: 10px;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend .key-line {
  width: 18px;
  height: 0;
  border-top: 2px solid var(--series-1);
}

.legend .key-line.dash {
  border-top: 1.5px dashed var(--chart-ref);
}

.legend .key-line.crit {
  border-top: 1.5px dashed var(--series-neg);
}

.legend .key-rect {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  background: var(--series-1);
}

.legend .key-rect.neg {
  background: var(--series-neg);
}

details.table-view {
  margin-top: 12px;
  font-size: 13px;
}

details.table-view summary {
  cursor: pointer;
  color: var(--muted);
  font-weight: 600;
}

details.table-view table {
  margin-top: 10px;
  width: 100%;
  border-collapse: collapse;
}

details.table-view td,
details.table-view th {
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
  text-align: start;
  font-variant-numeric: tabular-nums;
}

/* ───────────── بوصلة السوق ───────────── */

.index-tiles {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.index-tile .sym {
  font-weight: 800;
  font-size: 18px;
}

.index-tile .px {
  font-size: 26px;
  font-weight: 800;
  margin-top: 6px;
}

.heatmap {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  gap: 8px;
}

.heat-cell {
  border-radius: 14px;
  padding: 12px 12px 10px;
  border: 1px solid var(--border);
  background: var(--card);
  transition: transform 0.12s, box-shadow 0.15s;
  display: block;
  min-width: 0;
}

.heat-cell:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.heat-cell .s {
  font-weight: 800;
  font-size: 15px;
}

.heat-cell .p {
  font-size: 13px;
  margin-top: 2px;
}

.heat-cell .meter {
  height: 4px;
  border-radius: 99px;
  background: var(--tile);
  margin-top: 8px;
  overflow: hidden;
}

.heat-cell .meter i {
  display: block;
  height: 100%;
  border-radius: 99px;
}

.heat-cell.bullish {
  background: color-mix(in srgb, var(--up-soft) 70%, var(--card));
  border-color: color-mix(in srgb, var(--up) 25%, var(--border));
}

.heat-cell.bullish .meter i {
  background: var(--up);
}

.heat-cell.bearish {
  background: color-mix(in srgb, var(--down-soft) 70%, var(--card));
  border-color: color-mix(in srgb, var(--down) 25%, var(--border));
}

.heat-cell.bearish .meter i {
  background: var(--down);
}

.heat-cell.neutral .meter i {
  background: var(--faint);
}

.breadth-bar {
  display: flex;
  height: 12px;
  border-radius: 99px;
  overflow: hidden;
  gap: 2px;
  background: var(--card);
}

.breadth-bar i {
  display: block;
  height: 100%;
}

/* ───────────── النافذة المنبثقة ───────────── */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 16px;
  animation: fade 0.15s ease;
}

.modal {
  background: var(--card);
  border-radius: 28px;
  width: min(600px, 100%);
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  padding: 30px 32px 28px;
  position: relative;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.25);
  animation: pop 0.18s ease;
}

.modal-close {
  position: absolute;
  top: 18px;
  left: 18px;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--card);
  display: grid;
  place-items: center;
  font-size: 20px;
  color: var(--muted);
}

.modal-title {
  font-size: 26px;
  font-weight: 800;
}

.grid.keep-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.keep-3 .tile {
  padding: 10px 10px;
}

.alloc-pills {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.alloc-pills button {
  height: 46px;
  border-radius: 13px;
  border: 1px solid var(--border);
  background: var(--tile-2);
  font-weight: 700;
  font-size: 16px;
}

.alloc-pills button.on {
  border-color: var(--gold);
  background: var(--gold-soft);
  color: var(--gold-text);
}

.calc-box {
  background: color-mix(in srgb, var(--gold-soft) 60%, var(--card));
  border: 1px solid var(--gold-line);
  border-radius: 16px;
  padding: 16px 18px;
  font-size: 14px;
  line-height: 1.9;
}

.calc-box .head {
  font-weight: 800;
  color: var(--gold-text);
  font-size: 17px;
  margin-bottom: 2px;
}

.warn-box {
  background: var(--down-soft);
  border: 1px solid var(--down-border);
  color: var(--down);
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 13.5px;
  font-weight: 600;
}

@keyframes fade {
  from {
    opacity: 0;
  }
}

@keyframes pop {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
}

/* ───────────── الجولة السريعة ───────────── */

.tour-fab {
  position: fixed;
  bottom: 22px;
  left: 22px;
  z-index: 40;
  height: 44px;
  padding: 0 20px;
  border-radius: 999px;
  border: 1px solid #5a4a26;
  background: var(--ink-btn);
  color: #f1d58e;
  font-weight: 700;
  font-size: 14px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.25);
}

.tour-layer {
  position: fixed;
  inset: 0;
  z-index: 120;
}

.tour-shade {
  position: fixed;
  border-radius: 18px;
  box-shadow: 0 0 0 9999px rgba(20, 18, 14, 0.55);
  border: 2px solid var(--gold);
  transition: all 0.25s ease;
  pointer-events: none;
}

.tour-pop {
  position: fixed;
  width: min(420px, calc(100vw - 32px));
  background: var(--card);
  border: 1px solid var(--gold-line);
  border-radius: 22px;
  padding: 22px 24px 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  transition: top 0.25s ease, left 0.25s ease;
}

.tour-step {
  color: var(--gold-text);
  font-size: 13px;
  font-weight: 700;
}

.tour-title {
  font-size: 20px;
  font-weight: 800;
  margin: 4px 0 6px;
}

/* ───────────── التنبيهات ───────────── */

.toast-root {
  position: fixed;
  top: 92px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 150;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}

.toast {
  background: var(--ink-btn);
  color: #fff;
  padding: 12px 20px;
  border-radius: 14px;
  font-weight: 600;
  font-size: 14px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
  animation: pop 0.2s ease;
  pointer-events: auto;
  max-width: calc(100vw - 32px);
}

.toast.error {
  background: var(--down);
}

.toast.success {
  background: #1d6b3f;
}

/* ───────────── المسار والقوائم ───────────── */

.route-num {
  font-size: 13px;
  font-weight: 700;
  color: var(--gold-text);
  margin-bottom: 18px;
  direction: ltr;
  display: block;
  text-align: right;
}

.check-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  color: var(--text-2);
}

.check-list li {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.check-list li::before {
  content: '✓';
  color: var(--gold-text);
  font-weight: 800;
}

.faq details {
  border-bottom: 1px solid var(--border);
  padding: 16px 0;
}

.faq summary {
  cursor: pointer;
  font-weight: 700;
  font-size: 16.5px;
}

.faq details p {
  margin-top: 10px;
  color: var(--muted);
  line-height: 1.9;
}

.formula {
  background: var(--tile);
  border-radius: 14px;
  padding: 14px 18px;
  font-size: 14.5px;
  line-height: 2;
}

/* ───────────── الإدارة ───────────── */

.tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
  margin-bottom: 22px;
}

.tabs button {
  border: 0;
  background: none;
  padding: 12px 16px;
  font-weight: 600;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.tabs button.on {
  color: var(--gold-text);
  border-bottom-color: var(--gold);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.log-list {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  direction: ltr;
  text-align: left;
  max-height: 360px;
  overflow: auto;
  background: var(--tile-2);
  border-radius: 12px;
  padding: 12px;
  line-height: 1.7;
}

.log-list .warn {
  color: var(--amber-text);
}

.log-list .error {
  color: var(--down);
}

/* ───────────── التذييل ───────────── */

.site-footer {
  border-top: 1px solid var(--border);
  background: var(--card);
  margin-top: 40px;
}

.footer-inner {
  max-width: var(--container);
  margin: 0 auto;
  padding: 26px 24px 80px;
  display: flex;
  gap: 18px;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  font-size: 13.5px;
  color: var(--muted);
}

.footer-inner strong {
  color: var(--gold-text);
}

/* ───────────── الشاشات الأصغر ───────────── */

@media (max-width: 1180px) {
  .nav a {
    padding: 8px 8px;
    font-size: 14px;
  }
}

@media (max-width: 1080px) {
  .menu-btn {
    display: grid;
  }

  .nav {
    position: fixed;
    top: 81px;
    inset-inline: 0;
    background: var(--card);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    align-items: stretch;
    padding: 12px 16px 18px;
    gap: 2px;
    display: none;
    box-shadow: var(--shadow);
    max-height: calc(100vh - 81px);
    overflow-y: auto;
  }

  .nav.open {
    display: flex;
  }

  .nav a {
    padding: 12px 14px;
    font-size: 16px;
  }

  .header-inner {
    justify-content: space-between;
  }

  .hero {
    grid-template-columns: 1fr;
  }

  .score-tiles {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .score-tiles .final {
    grid-column: span 3;
  }

  .filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .filters .input {
    grid-column: span 2;
  }

  .grid-4,
  .index-tiles {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .grid-5 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .container,
  .header-inner {
    padding: 0 16px;
  }

  main.container {
    padding-top: 18px;
  }

  .header-inner {
    min-height: 68px;
    gap: 10px;
  }

  .nav {
    top: 69px;
    max-height: calc(100vh - 69px);
  }

  .brand-logo {
    width: 42px;
    height: 42px;
  }

  .brand-name {
    font-size: 17px;
  }

  .header-actions .hide-sm {
    display: none;
  }

  .brand {
    min-width: 0;
    gap: 9px;
  }

  .brand-sub {
    font-size: 10px;
    letter-spacing: 0.08em;
  }

  .header-back .btn {
    height: 40px;
    padding: 0 12px;
    font-size: 14px;
  }

  .icon-btn {
    width: 40px;
    height: 40px;
  }

  .user-pill {
    height: 40px;
    padding: 0 12px;
    max-width: 130px;
    font-size: 14px;
  }

  .card {
    padding: 20px;
  }

  .card.pad-lg {
    padding: 24px 20px;
  }

  .grid-2,
  .grid-3,
  .invalid-card {
    grid-template-columns: 1fr;
  }

  .grid-5 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .invalid-card {
    padding: 22px 20px;
  }

  .opp-grid,
  .contract-grid {
    grid-template-columns: 1fr;
  }

  .score-tiles {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .score-tiles .final {
    grid-column: span 2;
  }

  .score-tile .v {
    font-size: 28px;
  }

  .filters {
    grid-template-columns: 1fr 1fr;
  }

  .detail-hero {
    padding: 28px 20px 24px;
  }

  .opp-tiles {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .table th,
  .table td {
    padding: 12px 14px;
  }

  .modal {
    padding: 24px 18px 20px;
    border-radius: 22px;
  }

  .alloc-pills button {
    height: 42px;
    font-size: 14px;
  }

  .tour-fab {
    bottom: 14px;
    left: 14px;
    height: 40px;
    padding: 0 16px;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .kpi-value {
    font-size: 24px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
