@font-face {
  font-family: "Cairo";
  src: url("fonts/Cairo.ttf") format("truetype");
  font-weight: 400 800;
  font-style: normal;
  font-display: swap;
}

/* فاطمة للتداول — واجهة عربية من اليمين لليسار، مناسبة للموبايل */
:root {
  --teal: #0b3d4a;
  --teal-2: #115566;
  --teal-deep: #082e38;
  --paper: #f4f1ea;
  --card: #ffffff;
  --ink: #14323c;
  --muted: #5c6b73;
  --line: #e4ddd1;
  --buy: #1b7f4e;
  --buy-bg: #e5f6ee;
  --sell: #c0392b;
  --sell-bg: #fdecea;
  --hold: #b37b12;
  --hold-bg: #fbf0d8;
  --wait: #5c6b73;
  --wait-bg: #eef1f2;
  --gold: #c4a35a;
  --shadow: 0 8px 24px rgba(11, 61, 74, 0.08);
  --radius: 18px;
  --header-h: 64px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Cairo", "Noto Naskh Arabic", "Segoe UI", Tahoma, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  min-height: 100%;
  -webkit-text-size-adjust: 100%;
}
button, input { font-family: inherit; }
a { color: var(--teal); }
.boot {
  padding: 40vh 24px 0;
  text-align: center;
  color: var(--muted);
}

.app-shell { min-height: 100dvh; display: flex; flex-direction: column; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--teal);
  color: #f4f1ea;
  padding: calc(var(--safe-top) + 10px) 16px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 2px 12px rgba(8, 46, 56, 0.25);
}
.topbar h1 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: 0;
  flex: 1;
}
.topbar .sub {
  display: block;
  font-size: 0.72rem;
  font-weight: 400;
  opacity: 0.85;
  margin-top: 1px;
}
.icon-btn {
  appearance: none;
  border: 0;
  background: rgba(255,255,255,0.12);
  color: #fff;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 1.15rem;
  cursor: pointer;
}
.icon-btn:active { transform: scale(0.97); }
.icon-btn[disabled] { opacity: 0.5; cursor: default; }
.icon-btn.spin svg { animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(-360deg); } }

.page {
  flex: 1;
  padding: 14px 14px calc(24px + var(--safe-bottom));
  max-width: 640px;
  width: 100%;
  margin: 0 auto;
}

.banner {
  background: #fff7e6;
  border: 1px solid #efd59a;
  color: #5a4308;
  border-radius: 14px;
  padding: 10px 12px;
  font-size: 0.86rem;
  margin-bottom: 12px;
}
.banner strong { font-weight: 700; }

.source-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.8rem;
  margin: 4px 0 12px;
}
.pill-src {
  background: #e7eef0;
  color: var(--teal);
  border-radius: 999px;
  padding: 2px 10px;
  font-weight: 600;
  font-size: 0.75rem;
}
.pill-src.live { background: #e5f6ee; color: var(--buy); }
.pill-src.cached { background: #fbf0d8; color: #7a5410; }

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 14px 12px;
  margin-bottom: 12px;
  border: 1px solid rgba(11, 61, 74, 0.04);
}
.ticker-card { cursor: pointer; text-align: start; width: 100%; appearance: none; display: block; color: inherit; }
.ticker-card:active { transform: scale(0.995); }

.row { display: flex; align-items: flex-start; gap: 10px; }
.row .grow { flex: 1; min-width: 0; }
.sym {
  font-weight: 800;
  font-size: 1rem;
  letter-spacing: 0.02em;
  font-variant-numeric: lining-nums tabular-nums;
}
.name { color: var(--muted); font-size: 0.88rem; }
.price {
  font-weight: 800;
  font-size: 1.25rem;
  font-variant-numeric: lining-nums tabular-nums;
  direction: ltr;
  unicode-bidi: isolate;
  text-align: start;
}
.meta, .chg {
  font-size: 0.8rem;
  color: var(--muted);
  font-variant-numeric: lining-nums tabular-nums;
}
.chg.up { color: var(--buy); }
.chg.down { color: var(--sell); }

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.78rem;
  font-weight: 800;
  white-space: nowrap;
}
.badge.BUY { background: var(--buy-bg); color: var(--buy); }
.badge.SELL { background: var(--sell-bg); color: var(--sell); }
.badge.HOLD { background: var(--hold-bg); color: var(--hold); }
.badge.WAIT { background: var(--wait-bg); color: var(--wait); }
.badge.NONE { background: var(--wait-bg); color: var(--wait); }

.spark { width: 86px; height: 36px; display: block; }

.install-card {
  background: var(--teal);
  color: #f4f1ea;
  border: 0;
}
.install-card h2, .install-card p { margin: 0 0 8px; color: inherit; }
.install-card h2 { font-size: 1rem; }
.install-card p { font-size: 0.86rem; opacity: 0.92; }
.primary, .ghost, .text-btn {
  appearance: none;
  border: 0;
  cursor: pointer;
  border-radius: 12px;
  font-weight: 700;
  font-size: 0.95rem;
  padding: 11px 16px;
  min-height: 44px;
}
.primary { background: var(--gold); color: var(--teal-deep); width: 100%; }
.primary:active { filter: brightness(0.96); }
.ghost {
  background: transparent;
  color: inherit;
  border: 1px solid currentColor;
  opacity: 0.9;
  width: 100%;
  margin-top: 8px;
}
.text-btn {
  background: transparent;
  color: var(--teal);
  padding: 8px 0;
}

.detail-hero { text-align: center; padding-top: 6px; }
.detail-hero .name-lg { font-size: 0.95rem; color: var(--muted); margin: 0; }
.detail-hero .sym-lg { margin: 0; font-size: 0.85rem; font-weight: 700; color: var(--teal); letter-spacing: 0.04em; }
.detail-hero .price-lg {
  font-size: 2rem;
  font-weight: 800;
  margin: 8px 0 2px;
  font-variant-numeric: lining-nums tabular-nums;
  direction: ltr;
  unicode-bidi: isolate;
}
.detail-hero .badge { font-size: 0.9rem; padding: 6px 14px; margin-top: 8px; }

.hold-box {
  background: #f7f4ee;
  border-radius: 14px;
  padding: 10px 12px;
  font-size: 0.9rem;
  margin-top: 10px;
}
.hold-box.loss { background: #fdecea; }
.hold-box.gain { background: #e5f6ee; }

.reasons { margin: 0; padding: 0 0 0 0; list-style: none; }
.reasons li {
  position: relative;
  padding: 8px 0 8px 0;
  padding-inline-start: 18px;
  border-bottom: 1px solid var(--line);
  font-size: 0.94rem;
}
.reasons li:last-child { border-bottom: 0; }
.reasons li::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--gold);
  position: absolute;
  inset-inline-start: 0;
  top: 16px;
}

.plan-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.plan-grid .cell { background: #f7f4ee; border-radius: 14px; padding: 10px 12px; }
.plan-grid .cell.wide { grid-column: 1 / -1; }
.plan-grid .lbl { display: block; color: var(--muted); font-size: 0.75rem; font-weight: 600; }
.plan-grid .val {
  font-weight: 800;
  font-size: 1.05rem;
  font-variant-numeric: lining-nums tabular-nums;
  direction: ltr;
  unicode-bidi: isolate;
  display: block;
  margin-top: 2px;
}

.chart-wrap { background: #fff; border-radius: 16px; padding: 8px 4px 4px; }
.chart-wrap canvas { width: 100%; height: 180px; display: block; }
.chart-legend { display: flex; gap: 12px; justify-content: center; font-size: 0.75rem; color: var(--muted); margin-top: 4px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-inline-end: 4px; }

.footer-note {
  font-size: 0.78rem;
  color: var(--muted);
  text-align: center;
  margin-top: 16px;
}
.exec-note {
  text-align: center;
  font-weight: 800;
  color: var(--teal);
  background: #e7eef0;
  border-radius: 14px;
  padding: 12px;
  margin-top: 8px;
}

.modal-back {
  position: fixed;
  inset: 0;
  background: rgba(8, 46, 56, 0.55);
  z-index: 50;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 16px 16px calc(16px + var(--safe-bottom));
}
.modal {
  background: #fff;
  border-radius: 22px 22px 18px 18px;
  padding: 20px 18px 16px;
  max-width: 520px;
  width: 100%;
  max-height: 90dvh;
  overflow: auto;
  box-shadow: 0 16px 48px rgba(0,0,0,0.2);
}
.modal h2 { margin: 0 0 10px; font-size: 1.15rem; }
.modal p { margin: 0 0 10px; }
.modal ul { margin: 0 0 14px; padding-inline-start: 18px; }
.modal li { margin-bottom: 6px; }

.empty {
  text-align: center;
  color: var(--muted);
  padding: 28px 10px;
}
h2.section { font-size: 1rem; margin: 4px 0 10px; }

@media (prefers-reduced-motion: reduce) {
  .icon-btn.spin svg, .ticker-card { animation: none; transition: none; }
}
