/* متتبّع محفظة Binance — واجهة عربية داكنة */
:root {
  --bg: #0b0f17;
  --panel: #131a26;
  --panel-2: #182130;
  --border: #22304a;
  --border-soft: #1a2436;
  --text: #e8eef8;
  --muted: #8ea0bb;
  --gold: #f0b90b;
  --gold-soft: rgba(240, 185, 11, 0.12);
  --green: #2fbf71;
  --red: #ef4d5a;
  --blue: #4f8ff7;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(1100px 520px at 85% -10%, #17243b 0%, rgba(11, 15, 23, 0) 60%),
    var(--bg);
  color: var(--text);
  font-family: "Segoe UI", Tahoma, "Noto Naskh Arabic", "Dubai", Arial, sans-serif;
  font-size: 17px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--gold); text-decoration: none; }
a:hover { text-decoration: underline; }

code {
  background: var(--panel-2);
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  padding: 1px 6px;
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.85em;
  direction: ltr;
  display: inline-block;
}

.container {
  width: 100%;
  max-width: 1560px;
  margin: 0 auto;
  padding: 0 32px;
}

/* ------------------------------------------------------------------ topbar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(11, 15, 23, 0.86);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-soft);
}

.topbar-inner {
  max-width: 1560px;
  margin: 0 auto;
  padding: 12px 32px;
  display: flex;
  align-items: center;
  gap: 22px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 700;
  font-size: 18px;
}
.brand:hover { text-decoration: none; }

.brand-mark {
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  border-radius: 10px;
  background: var(--gold);
  color: #10151f;
  font-weight: 900;
  font-size: 18px;
}

.brand-center {
  justify-content: center;
  margin-bottom: 10px;
  font-size: 20px;
}

.badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
  white-space: nowrap;
}
.badge-demo { color: var(--gold); border-color: rgba(240, 185, 11, 0.45); background: var(--gold-soft); }
.badge-ok { color: var(--green); border-color: rgba(47, 191, 113, 0.4); background: rgba(47, 191, 113, 0.1); }
.badge-warn { color: var(--red); border-color: rgba(239, 77, 90, 0.4); background: rgba(239, 77, 90, 0.1); }
.badge-muted { color: var(--muted); }

.nav {
  display: flex;
  gap: 4px;
  flex: 1;
  overflow-x: auto;
  scrollbar-width: none;
}
.nav::-webkit-scrollbar { display: none; }

.nav a {
  color: var(--muted);
  padding: 7px 13px;
  border-radius: 9px;
  font-size: 15px;
  white-space: nowrap;
}
.nav a:hover { color: var(--text); background: var(--panel); text-decoration: none; }
.nav a.active { color: var(--gold); background: var(--gold-soft); }

/* شريط سعر بيتكوين في الشريط العلوي (بعد الإعدادات) */
.topbar-btc {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 11px;
  margin-inline-start: 4px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.02);
  white-space: nowrap;
}
.topbar-btc .ticker-symbol { font-size: 10.5px; }
.topbar-btc .ticker-price { font-size: 13.5px; }
.topbar-btc .ticker-change { font-size: 11px; font-weight: 700; }

.logout-form { margin: 0; }

/* ------------------------------------------------------------------ buttons */
.btn {
  appearance: none;
  border: 1px solid rgba(240, 185, 11, 0.55);
  background: var(--gold);
  color: #131313;
  font-weight: 700;
  font-family: inherit;
  font-size: 15px;
  padding: 10px 20px;
  border-radius: 10px;
  cursor: pointer;
  transition: transform 0.08s ease, filter 0.15s ease, opacity 0.15s ease;
  white-space: nowrap;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}
.btn-ghost:hover { background: var(--panel-2); }
.btn-ghost.active { color: var(--gold); border-color: var(--gold); background: var(--gold-soft); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-block { width: 100%; margin-top: 14px; }

/* -------------------------------------------------------------------- cards */
.card {
  background: linear-gradient(180deg, var(--panel) 0%, #111826 100%);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 20px 22px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.card-head h2 { margin: 0; font-size: 18.5px; font-weight: 700; }
.card-head-title { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }

/* شريط سعر BTC/ETH بجانب عنوان الأصول */
.asset-ticker { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ticker-item {
  display: inline-flex;
  align-items: baseline;
  gap: 7px;
  padding: 3px 10px;
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.02);
  font-size: 12.5px;
}
.ticker-symbol { font-size: 11px; font-weight: 800; letter-spacing: 0.4px; color: var(--muted); }
.ticker-price {
  font-weight: 700;
  color: var(--text);
  direction: ltr;
  font-variant-numeric: tabular-nums;
}
.ticker-change { font-size: 11.5px; direction: ltr; font-variant-numeric: tabular-nums; }
.asset-ticker-lg { gap: 10px; }
.asset-ticker-lg .ticker-item { padding: 7px 16px; gap: 10px; font-size: 15px; }
.asset-ticker-lg .ticker-symbol { font-size: 14px; letter-spacing: 0.6px; }
.asset-ticker-lg .ticker-price { font-size: 20px; letter-spacing: -0.3px; }
.asset-ticker-lg .ticker-change { font-size: 14px; font-weight: 700; }
.spark-card { padding-bottom: 10px; }

/* -------------------------------------------------------------------- stats */
.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.stats-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.stats-6 .stat { padding: 14px 16px; }

/* ثماني بطاقات في سطر واحد: خطوط ومقاسات مضغوطة */
.stats-8 { grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 10px; }
.stats-8 .stat { padding: 11px 12px; }
.stats-8 .stat-label {
  font-size: 12px;
  line-height: 1.3;
  margin-bottom: 5px;
  min-height: 31px;
}
.stats-8 .stat-value { font-size: 19px; letter-spacing: -0.4px; }
.stats-8 .stat-sub { font-size: 11px; line-height: 1.35; }

/* ------------------------------------------------------------------- tabs */
.tabs {
  display: flex;
  gap: 6px;
  margin: 4px 0 18px;
  border-bottom: 1px solid var(--border);
}
.tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: 10px 10px 0 0;
  color: var(--muted);
  font-weight: 700;
  margin-bottom: -1px;
}
.tab:hover { color: var(--text); text-decoration: none; background: rgba(255, 255, 255, 0.03); }
.tab.active {
  color: var(--text);
  background: var(--panel);
  border-color: var(--border);
  box-shadow: inset 0 2px 0 var(--gold);
}
.tab-count {
  min-width: 26px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--panel-2);
  border: 1px solid var(--border-soft);
  color: var(--muted);
  font-size: 12.5px;
  text-align: center;
}
.tab.active .tab-count {
  color: var(--gold);
  border-color: rgba(240, 185, 11, 0.4);
  background: var(--gold-soft);
}
.overview-bar .stat-value.small-value { font-size: 21px; }
.stat-value.tiny-value { font-size: 17px; }

.stat {
  background: linear-gradient(180deg, var(--panel) 0%, #111826 100%);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
}
.stat-label { color: var(--muted); font-size: 14px; margin-bottom: 6px; }
.stat-value {
  font-size: 29px;
  font-weight: 800;
  letter-spacing: -0.3px;
  direction: ltr;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.stat-value.small-value { font-size: 22px; }
.stat-value .unit { font-size: 14px; color: var(--muted); font-weight: 600; }
.stat-sub { font-size: 14px; margin-top: 2px; direction: ltr; text-align: right; }

/* أرقام داخلية داخل نص عربي */
.eq-num { display: inline-block; direction: ltr; unicode-bidi: isolate; }

/* ------------------------------------------------------------------- tables */
.table-wrap {
  overflow-x: auto;
  border-radius: 10px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.table-wrap::-webkit-scrollbar { height: 8px; }
.table-wrap::-webkit-scrollbar-track { background: transparent; }
.table-wrap::-webkit-scrollbar-thumb { background: var(--border); border-radius: 999px; }

.table { width: 100%; border-collapse: collapse; font-size: 15.5px; }

.table th {
  text-align: right;
  color: var(--muted);
  font-weight: 600;
  font-size: 13.5px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.015);
  white-space: nowrap;
}
.table td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--border-soft);
  white-space: nowrap;
}
.table tbody tr:hover { background: rgba(255, 255, 255, 0.025); }
.table tbody tr:last-child td { border-bottom: 0; }

.table tfoot th {
  background: var(--panel-2);
  border-top: 1px solid var(--border);
  border-bottom: 0;
  color: var(--text);
  font-weight: 700;
  padding: 13px 14px;
}

.table .num {
  direction: ltr;
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-family: Consolas, "Segoe UI", monospace;
  font-size: 15px;
}
.table .strong { font-weight: 700; color: #fff; }

/* سهم صغير بجانب الربح/الخسارة غير المحققة */
.pnl-arrow {
  font-size: 10.5px;
  margin-inline-end: 4px;
  vertical-align: 1.5px;
  opacity: 0.95;
}

/* ---------------------------------------------------- قسم الأصول (الجدول) */
#assets-table {
  border-collapse: separate;
  border-spacing: 0 7px;
  font-size: 16.5px;
}
#assets-table thead th {
  padding: 13px 14px;
  font-size: 14.5px;
  color: #c9d3e3;
  letter-spacing: 0.2px;
  background: linear-gradient(180deg, rgba(240, 185, 11, 0.09), rgba(255, 255, 255, 0.015));
  border-bottom: 1px solid var(--border);
}
#assets-table tbody td {
  padding: 15px 14px;
  font-size: 16px;
  background: rgba(255, 255, 255, 0.022);
  border-top: 1px solid var(--border-soft);
  border-bottom: 1px solid var(--border-soft);
}
#assets-table tbody td:first-child {
  border-inline-start: 1px solid var(--border-soft);
  border-start-start-radius: 12px;
  border-end-start-radius: 12px;
}
#assets-table tbody td:last-child {
  border-inline-end: 1px solid var(--border-soft);
  border-start-end-radius: 12px;
  border-end-end-radius: 12px;
}
#assets-table tbody tr:nth-child(even) td {
  background: rgba(255, 255, 255, 0.042);
}
#assets-table tbody tr:last-child td {
  border-bottom: 1px solid var(--border-soft);
}
#assets-table tbody tr:hover td {
  background: rgba(240, 185, 11, 0.07);
  border-color: rgba(240, 185, 11, 0.28);
}
#assets-table .coin {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 17px;
  font-weight: 700;
}
#assets-table .coin::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 8px rgba(240, 185, 11, 0.5);
}
#assets-table .num { font-size: 17px; }
#assets-table .price-cell {
  font-size: 20px;
  color: var(--green);
  font-weight: 800;
}
#assets-table .cost-cell {
  font-size: 18px;
  color: var(--gold);
  font-weight: 700;
}
#assets-table .low-soft {
  color: #ff9ea6;
  font-size: 17.5px;
}
#assets-table .strong { font-size: 18.5px; }
#assets-table .muted-cap { font-size: 16px; }

/* رأس العمود القابل للنقر لترتيب الأصول حسب الربح/الخسارة */
.th-sort {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}
.th-sort:hover { color: var(--gold); }
.sort-arrow { font-size: 12px; color: var(--gold); }

/* عمود القيمة السوقية للعملة */
.table .muted-cap { color: var(--muted); font-size: 14px; }

/* ------------------------------------------------------ قائمة المراقبة */
.watch-form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 14px;
}
.watch-input {
  flex: 1 1 260px;
  min-width: 180px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #0f1724;
  color: #fff;
  font-size: 16.5px;
  font-family: inherit;
  direction: ltr;
  text-align: right;
}
.watch-input::placeholder { color: var(--muted); direction: rtl; text-align: right; }
.watch-input:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-soft);
}
/* حقول حاسبة الصفقة في صفحة الأوامر: عنوان ظاهر لكل خانة */
.calc-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
  align-items: end;
  margin-top: 14px;
}
.calc-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.calc-field > span { font-size: 13px; color: var(--muted); }
.calc-field > .watch-input {
  flex: 0 0 auto;
  width: 100%;
  min-width: 0;
  height: 47px;
  box-sizing: border-box;
}
.calc-form .btn { height: 47px; }
.watch-search { flex: 0 1 240px; min-width: 190px; padding: 8px 12px; font-size: 15px; }
.binance-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 30px;
  margin-top: 2px;
  padding: 2px 7px;
  border: 1px solid var(--border-soft);
  border-radius: 7px;
  font-size: 11.5px;
  color: var(--muted);
  white-space: nowrap;
  touch-action: manipulation;
}
.binance-link:hover,
.binance-link:focus-visible { color: var(--gold); border-color: var(--gold); text-decoration: none; }
.coins-binance {
  margin-top: 0;
  margin-inline-start: 8px;
  vertical-align: middle;
}
.inline-form { display: inline; margin: 0; }

/* شريط الترتيب في قائمة المراقبة */
.table-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 4px 0 14px;
}
.table-toolbar label { font-size: 14.5px; }
.sort-select {
  padding: 9px 36px 9px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #0f1724 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath fill='%23f0b90b' d='M6 8 0 0h12z'/%3E%3C/svg%3E") no-repeat left 14px center;
  color: #fff;
  font-size: 15.5px;
  font-family: inherit;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}
.sort-select:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-soft);
}
.sort-select optgroup { color: var(--muted); font-size: 13px; }
.sort-select option { color: #fff; background: #0f1724; }

#watch-table th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
#watch-table th.sortable:hover { color: var(--gold); }
.sort-arrow { font-size: 11px; color: var(--gold); }

/* عمود وزر المفضّلة */
.fav-col { width: 42px; text-align: center; }
.fav-btn {
  background: none;
  border: 0;
  padding: 2px;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  color: #43506a;
  transition: color 0.15s ease, transform 0.15s ease;
}
.fav-btn:hover { color: var(--gold); transform: scale(1.15); }
.fav-btn.is-fav { color: var(--gold); text-shadow: 0 0 10px rgba(240, 185, 11, 0.55); }
.fav-btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 6px; }
#watch-filter-empty[hidden] { display: none; }

/* ------------------------------------------------------ صفحة العملات */
.coins-search { flex: 1 1 220px; min-width: 200px; max-width: 340px; }
#coins-table th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
#coins-table th.sortable:hover { color: var(--gold); }
#coins-table tbody tr[hidden] { display: none; }
#coins-table .row-actions { padding-top: 8px; padding-bottom: 8px; }
#coins-table .row-actions .btn { padding: 5px 12px; font-size: 13.5px; }
#coins-empty[hidden] { display: none; }

button.live-pill { cursor: pointer; font-family: inherit; }
button.live-pill:hover { filter: brightness(1.12); }
button.live-pill:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* ------------------------------------------------------ صفحة الأوامر */
.side-badge, .status-badge, .oco-badge {
  display: inline-block;
  font-size: 12.5px;
  font-weight: 700;
  border-radius: 999px;
  padding: 2px 10px;
  white-space: nowrap;
  border: 1px solid transparent;
}
.side-buy { color: var(--green); background: rgba(47, 191, 113, 0.1); border-color: rgba(47, 191, 113, 0.32); }
.side-sell { color: var(--red); background: rgba(239, 77, 90, 0.1); border-color: rgba(239, 77, 90, 0.32); }
.status-badge { color: var(--muted); background: rgba(255, 255, 255, 0.04); border-color: var(--border); }
.status-new { color: var(--gold); background: rgba(240, 185, 11, 0.1); border-color: rgba(240, 185, 11, 0.32); }
.status-partially_filled { color: var(--gold); background: rgba(240, 185, 11, 0.08); border-color: rgba(240, 185, 11, 0.28); }
.status-filled { color: var(--green); background: rgba(47, 191, 113, 0.1); border-color: rgba(47, 191, 113, 0.32); }
.status-canceled, .status-expired, .status-expired_in_match { color: var(--muted); background: rgba(255, 255, 255, 0.03); border-color: var(--border); }
.status-rejected { color: var(--red); background: rgba(239, 77, 90, 0.1); border-color: rgba(239, 77, 90, 0.32); }
.oco-badge { font-size: 11px; padding: 1px 7px; color: var(--gold); background: rgba(240, 185, 11, 0.1); border-color: rgba(240, 185, 11, 0.3); margin-inline-start: 5px; }
#open-orders-table .empty-row td { text-align: center; padding: 22px 14px; }

/* -------------------------------------------------- تنبيهات السعر */
.toolbar-end { margin-inline-start: auto; }

.alert-badge {
  display: inline-block;
  margin-top: 5px;
  font-size: 12.5px;
  color: var(--gold);
  background: rgba(240, 185, 11, 0.12);
  border: 1px solid rgba(240, 185, 11, 0.32);
  border-radius: 999px;
  padding: 1px 9px;
  white-space: nowrap;
}
.alert-badge.off {
  color: var(--muted);
  background: rgba(142, 160, 187, 0.08);
  border-color: var(--border);
}

.row-actions { white-space: nowrap; }
.alert-btn {
  background: none;
  border: 0;
  padding: 2px 6px;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  color: #43506a;
  filter: grayscale(1);
  transition: color 0.15s, transform 0.15s, filter 0.15s;
}
.alert-btn:hover { transform: scale(1.12); filter: none; color: var(--gold); }
.alert-btn.is-set { color: var(--gold); filter: none; }
.alert-btn.is-off { color: var(--muted); filter: grayscale(1); opacity: 0.6; }
.alert-btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 6px; }

/* نافذة إعداد التنبيه */
.alert-dialog {
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--panel);
  color: var(--text);
  padding: 22px;
  width: min(430px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  box-shadow: var(--shadow);
}
.alert-dialog::backdrop { background: rgba(3, 6, 12, 0.7); backdrop-filter: blur(2px); }
.alert-title { margin: 0 0 4px; font-size: 21px; }
.alert-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 14px;
  font-size: 14.5px;
  color: var(--muted);
}
.alert-field input,
.alert-field select {
  padding: 11px 13px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #0f1724;
  color: #fff;
  font-size: 16.5px;
  font-family: inherit;
}
.alert-field input:focus,
.alert-field select:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-soft);
}
.alert-check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  font-size: 14.5px;
  color: var(--text);
  cursor: pointer;
}
.alert-check input { width: 17px; height: 17px; accent-color: var(--gold); }
.alert-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 20px; }
.alert-actions .btn { padding: 9px 16px; }

/* إشعارات منبثقة داخل الصفحة */
.alert-toasts {
  position: fixed;
  z-index: 9999;
  inset-block-start: 16px;
  inset-inline-start: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: min(390px, calc(100vw - 32px));
}
.alert-toast {
  background: linear-gradient(180deg, #1d2740, #151d2b);
  border: 1px solid rgba(240, 185, 11, 0.5);
  border-inline-start: 4px solid var(--gold);
  border-radius: 12px;
  padding: 12px 15px;
  box-shadow: var(--shadow);
  cursor: pointer;
  animation: alert-in 0.25s ease-out;
}
.alert-toast strong { display: block; color: var(--gold); font-size: 15.5px; margin-bottom: 2px; }
.alert-toast span { display: block; color: var(--text); font-size: 14.5px; }
@keyframes alert-in {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: none; }
}

tr.alert-hit td { background: rgba(240, 185, 11, 0.16) !important; }



/* السعر الحالي: عمود مميّز مباشرة بعد اسم العملة */
.table .price-cell {
  font-weight: 700;
  color: var(--gold);
  font-size: 15.5px;
}

/* مؤشر التحديث المباشر */
.live-meta { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--green);
  border: 1px solid rgba(47, 191, 113, 0.35);
  background: rgba(47, 191, 113, 0.08);
  border-radius: 999px;
  padding: 3px 11px;
  white-space: nowrap;
}
.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  animation: livePulse 2s infinite;
}
@keyframes livePulse {
  0% { box-shadow: 0 0 0 0 rgba(47, 191, 113, 0.55); }
  70% { box-shadow: 0 0 0 7px rgba(47, 191, 113, 0); }
  100% { box-shadow: 0 0 0 0 rgba(47, 191, 113, 0); }
}
.live-pill.is-stale {
  color: var(--red);
  border-color: rgba(239, 77, 90, 0.4);
  background: rgba(239, 77, 90, 0.08);
}
.live-pill.is-stale .live-dot { animation: none; }

.asset-link { display: inline-flex; align-items: center; gap: 8px; color: var(--text); }
.asset-link:hover { text-decoration: none; }
.coin {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 2px 9px;
  font-weight: 700;
  font-size: 14px;
  direction: ltr;
}
.tiny { font-size: 12.5px; margin-inline-start: 4px; }

/* ------------------------------------------------------------------ colors */
.pos { color: var(--green); }
.neg { color: var(--red); }
.muted { color: var(--muted); }
.small { font-size: 13.5px; }
.note { margin-top: 12px; }

/* ------------------------------------------------------------------ notices */
.notice {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 16px;
  margin-bottom: 16px;
  font-size: 13.5px;
  color: var(--muted);
}
.notice strong { color: var(--text); }
.notice-demo { border-color: rgba(240, 185, 11, 0.4); background: var(--gold-soft); color: #f3dfa0; }
.notice-warn { border-color: rgba(239, 77, 90, 0.45); background: rgba(239, 77, 90, 0.08); color: #ffb7bd; }

.flashes { margin-bottom: 16px; }
.flash {
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 8px;
  font-size: 13.5px;
  border: 1px solid var(--border);
  background: var(--panel);
}
.flash-error { border-color: rgba(239, 77, 90, 0.5); color: #ffb7bd; }

.error-card { border-color: rgba(239, 77, 90, 0.4); }
.error-card h2 { margin-top: 0; }

/* -------------------------------------------------------------------- charts */
.chart { width: 100%; height: auto; display: block; margin-top: 4px; }
.chart-grid { stroke: var(--border-soft); stroke-width: 1; }
.chart-axis { fill: var(--muted); font-size: 11px; font-family: Consolas, monospace; direction: ltr; }
.chart-line { fill: none; stroke: var(--gold); stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; }
.chart-area { fill: var(--gold); opacity: 0.08; }
.chart-dot { fill: var(--gold); opacity: 0.85; }
.empty-chart { color: var(--muted); font-size: 13px; padding: 30px 0; text-align: center; }

/* --------------------------------------------------------------------- sync */
.sync-card .progress {
  height: 6px;
  background: var(--panel-2);
  border-radius: 999px;
  overflow: hidden;
  margin: 12px 0 16px;
}
.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--gold), #ffd85e);
  border-radius: 999px;
  transition: width 0.35s ease;
  min-width: 0;
}
.actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------------------------------------------------------------- page head */
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin: 26px 0 18px;
  flex-wrap: wrap;
}
.page-title { margin: 0; font-size: 31px; font-weight: 800; letter-spacing: -0.5px; }
.page-value {
  font-size: 26px;
  font-weight: 800;
  direction: ltr;
  font-variant-numeric: tabular-nums;
}
.page-value .unit { font-size: 14px; color: var(--muted); }
.page-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.back { font-size: 14px; color: var(--muted); display: inline-block; margin-bottom: 4px; }
.back:hover { color: var(--gold); text-decoration: none; }

/* --------------------------------------------------------------------- auth */
.auth-wrap {
  min-height: 60vh;
  display: grid;
  place-items: center;
  padding: 40px 0;
}
.auth-card { width: 100%; max-width: 420px; padding: 30px 28px; }
.auth-title { margin: 4px 0 6px; font-size: 22px; text-align: center; }
.auth-form { display: flex; flex-direction: column; gap: 8px; margin-top: 18px; }
.auth-form label { font-size: 14px; color: var(--muted); }
.auth-form input {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  padding: 11px 13px;
  font-family: inherit;
  font-size: 16px;
  outline: none;
  transition: border-color 0.15s ease;
}
.auth-form input:focus { border-color: var(--gold); }
.auth-foot { text-align: center; margin: 18px 0 0; }
.error-code { font-size: 52px; font-weight: 900; color: var(--red); text-align: center; direction: ltr; }
.error-card .auth-title { text-align: center; }

/* --------------------------------------------------------------------- misc */
.steps h2 { font-size: 16px; margin: 22px 0 8px; }
.steps h2:first-child { margin-top: 0; }
.steps ol { margin: 0; padding-inline-start: 22px; }
.steps li { margin-bottom: 7px; }
.code-block {
  background: #0a0f18;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  direction: ltr;
  text-align: left;
  font-family: Consolas, monospace;
  font-size: 14px;
  color: #cfe0ff;
  overflow-x: auto;
  white-space: pre;
}

/* ------------------------------------------------------------------- footer */
.footer {
  margin-top: auto;
  border-top: 1px solid var(--border-soft);
  background: rgba(9, 12, 18, 0.6);
  font-size: 13.5px;
  color: var(--muted);
}
.footer-inner {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-top: 18px;
  padding-bottom: 18px;
  flex-wrap: wrap;
}

main.container { padding-top: 6px; padding-bottom: 40px; flex: 1; }

/* --------------------------------------------------------------- responsive */
@media (max-width: 1240px) {
  .stats-8 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .stats-8 .stat-label { min-height: 0; }
}

@media (max-width: 1024px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stats-8 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
  body { font-size: 15.5px; }
  .container { padding: 0 16px; }
  .topbar-inner { flex-wrap: wrap; gap: 10px; padding: 10px 16px; }
  .nav { order: 3; width: 100%; }
  .logout-form { margin-inline-start: auto; }
  .stats, .stats-6, .stats-8 { grid-template-columns: 1fr 1fr; }
  .stat-value { font-size: 23px; }
  .card { padding: 16px; }
  .page-title { font-size: 25px; }
  .ticker-change { display: none; }
}

/* -------------------------------------------------------- فحص العملة */
.analysis-form {
  display: flex;
  gap: 14px;
  align-items: flex-end;
  flex-wrap: wrap;
}
.analysis-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 210px;
}
.analysis-field.grow { flex: 1 1 320px; }

/* داخل عمود رأسي لا معنى لـ flex-basis الأفقي: كان يجعل ارتفاع الحقل 260px */
.analysis-field > .watch-input,
.analysis-field > .sort-select {
  flex: 0 0 auto;
  height: 47px;
}
.analysis-form .btn { height: 47px; }
.analysis-help {
  margin: 0;
  padding-inline-start: 20px;
  color: var(--muted);
  line-height: 2;
}
.analysis-help strong { color: var(--text); }

.verdict-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px 24px;
  align-items: center;
  border-inline-start: 5px solid var(--v, var(--gold));
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0) 60%),
    linear-gradient(180deg, var(--panel) 0%, #111826 100%);
}
.verdict-strong_buy { --v: var(--green); }
.verdict-buy { --v: #5ac98a; }
.verdict-wait { --v: var(--gold); }
.verdict-avoid { --v: #f2994a; }
.verdict-strong_avoid { --v: var(--red); }

.verdict-main {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
}
.verdict-coin { display: flex; flex-direction: column; gap: 2px; }
.verdict-badge {
  font-size: 20px;
  font-weight: 800;
  padding: 5px 18px;
  border-radius: 999px;
  color: var(--v, var(--gold));
  border: 1px solid var(--v, var(--gold));
  background: rgba(255, 255, 255, 0.03);
  white-space: nowrap;
}
.verdict-score { display: flex; align-items: baseline; gap: 5px; margin-inline-start: auto; }
.score-number {
  font-size: 46px;
  font-weight: 900;
  line-height: 1;
  color: var(--v, var(--gold));
  direction: ltr;
  font-variant-numeric: tabular-nums;
}
.score-max { color: var(--muted); font-size: 15px; }
.verdict-price { text-align: left; min-width: 200px; }
.analysis-live-price {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border-soft);
}
.analysis-live-price .stat-label { margin-bottom: 0; }
.analysis-live-price .stat-value { text-align: inherit; }
.verdict-time { grid-column: 1 / -1; }

.mini-verdict {
  display: inline-block;
  font-size: 12.5px;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  white-space: nowrap;
  color: var(--muted);
}
.mini-strong_buy,
.mini-buy { color: var(--green); border-color: rgba(47, 191, 113, 0.45); background: rgba(47, 191, 113, 0.1); }
.mini-wait { color: var(--gold); border-color: rgba(240, 185, 11, 0.45); background: var(--gold-soft); }
.mini-avoid { color: #f2994a; border-color: rgba(242, 153, 74, 0.45); background: rgba(242, 153, 74, 0.1); }
.mini-strong_avoid { color: var(--red); border-color: rgba(239, 77, 90, 0.45); background: rgba(239, 77, 90, 0.1); }

.trend-up { color: var(--green); }
.trend-down { color: var(--red); }
.trend-flat { color: var(--muted); }

.reasons {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.reason {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  font-size: 14.5px;
  line-height: 1.7;
}
.reason-mark { font-weight: 900; line-height: 1.55; flex-shrink: 0; }
.reason-pos .reason-mark { color: var(--green); }
.reason-neg .reason-mark { color: var(--red); }
.reason-neutral .reason-mark { color: var(--muted); }
.reasons-summary { gap: 10px; font-size: 15.5px; }

.levels-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.level {
  background: var(--panel-2);
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  padding: 13px 15px;
}
.level-entry { border-inline-start: 3px solid var(--blue); }
.level-stop { border-inline-start: 3px solid var(--red); }
.level-target { border-inline-start: 3px solid var(--green); }
.level-label { color: var(--muted); font-size: 13.5px; }
.level-value {
  font-size: 19px;
  font-weight: 800;
  direction: ltr;
  text-align: right;
  font-variant-numeric: tabular-nums;
  margin: 3px 0;
}
.level .unit { font-size: 12.5px; color: var(--muted); font-weight: 600; }

/* حاسبة حجم المركز */
.calc-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}
.calc-grid .analysis-field { min-width: 0; }
.calc-input { width: 100%; min-width: 0; flex: none; }
.calc-warning {
  margin: 0 0 14px;
  padding: 11px 14px;
  border-radius: 10px;
  border: 1px solid rgba(246, 70, 93, 0.4);
  background: rgba(246, 70, 93, 0.1);
  color: #ffb3bd;
  font-size: 14px;
  line-height: 1.7;
}
.calc-warning[hidden] { display: none; }
.calc-results {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(165px, 1fr));
  gap: 12px;
}
.calc-results .level-value { font-size: 18px; }
.level.over { border-color: rgba(246, 70, 93, 0.55); }
.level.over .level-value { color: var(--red); }

/* ------------------------------------------------------ التسوية اليدوية */
.adj-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
  gap: 14px;
  align-items: end;
  margin-top: 6px;
}
.adj-form .analysis-field { min-width: 0; }
.adj-form .analysis-field.grow { grid-column: span 2; }
.adj-form .watch-input,
.adj-form .sort-select { width: 100%; }
.adj-submit { height: 47px; white-space: nowrap; }
@media (max-width: 1100px) {
  .adj-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .adj-form .analysis-field.grow { grid-column: 1 / -1; }
  .adj-submit { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
  .adj-form { grid-template-columns: 1fr; }
  .adj-form .analysis-field.grow { grid-column: auto; }
}

.frames-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 18px;
  margin-bottom: 18px;
}
.frames-grid .card { margin-bottom: 0; }
.frame-meta { margin-bottom: 12px; direction: ltr; text-align: right; }

@media (max-width: 1000px) {
  .verdict-card { grid-template-columns: 1fr; }
  .verdict-price { text-align: right; }
  .levels-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .calc-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .levels-grid { grid-template-columns: 1fr; }
  .calc-grid { grid-template-columns: 1fr; }
  .analysis-field { min-width: 100%; }
  .analysis-form .btn { width: 100%; }
}

/* ------------------------------------------- سجل الإشارات والفحص الجماعي */
.scan-meta {
  margin: 12px 0 14px;
  padding-top: 12px;
  border-top: 1px dashed var(--border-soft);
}
.alerts-note code { direction: ltr; }

/* ------------------------------------------------------------ صفحة الإعدادات */
.info-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.info-grid .level { min-width: 0; }
.info-grid .level-value { font-size: 17px; }

/* تبويبات صفحة الإعدادات */
.settings-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 0 0 18px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
}
.settings-tab {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 600;
  font-size: 15.5px;
  padding: 8px 16px;
  border-radius: 9px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  white-space: nowrap;
}
.settings-tab:hover { background: var(--panel-2); color: var(--text); }
.settings-tab:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}
.settings-tab[aria-selected="true"] {
  background: var(--gold-soft);
  border-color: rgba(240, 185, 11, 0.45);
  color: var(--gold);
}
[data-settings-panel][hidden] { display: none !important; }

.settings-form { display: block; }
.settings-card { margin-bottom: 16px; }
.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px 16px;
}
.settings-grid .analysis-field { min-width: 0; }
.settings-grid .watch-input,
.settings-grid .sort-select { width: 100%; }
.field-note { line-height: 1.6; }
.settings-actions {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 2px;
}
.settings-password { gap: 14px; }
.settings-save { border-color: rgba(240, 185, 11, 0.35); }

/* جلب معرّف محادثة Telegram تلقائيًا */
.tg-fetch,
.tg-chats {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed var(--border-soft);
}
.tg-chats { margin-top: 10px; padding-top: 0; border-top: none; }
.tg-fetch .btn,
.tg-chats .btn { flex: 0 0 auto; }
.tg-chats .btn { direction: ltr; }

.tag {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  border: 1px solid var(--border);
  color: var(--muted);
  vertical-align: middle;
}
.tag-warn {
  border-color: rgba(240, 185, 11, 0.45);
  background: var(--gold-soft);
  color: #f3dfa0;
}

@media (max-width: 1100px) {
  .info-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .info-grid { grid-template-columns: 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
  .settings-actions .btn { width: 100%; }
  .settings-tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: thin; }
  .settings-tab { flex: 0 0 auto; font-size: 14.5px; padding: 7px 12px; }
}

/* -------------------------------------------------- حاسبة الشراء العائمة */
.calc-open {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  line-height: 1;
  margin-inline-start: 6px;
  padding: 2px 5px;
  vertical-align: middle;
}

.calc-open:hover,
.calc-open:focus-visible {
  background: var(--gold-soft);
  border-color: rgba(240, 185, 11, 0.45);
  color: var(--gold);
  outline: none;
}

.calc-float {
  position: fixed;
  z-index: 60;
  width: 372px;
  max-width: calc(100vw - 16px);
  max-height: calc(100vh - 16px);
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
  direction: rtl;
  overflow: hidden;
}

.calc-float[hidden] { display: none; }

.calc-float-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 12px;
  background: var(--panel-2);
  border-bottom: 1px solid var(--border-soft);
  cursor: move;
  touch-action: none;
  user-select: none;
}

.calc-float-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 15px;
}

.calc-coin {
  color: var(--gold);
  font-weight: 700;
  letter-spacing: 0.4px;
}

.calc-float-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.calc-chip {
  background: var(--gold-soft);
  border: 1px solid rgba(240, 185, 11, 0.35);
  border-radius: 999px;
  color: var(--gold);
  cursor: pointer;
  font: inherit;
  font-size: 11.5px;
  padding: 2px 9px;
  white-space: nowrap;
}

.calc-chip:hover { background: rgba(240, 185, 11, 0.22); }

.calc-close {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  height: 26px;
  line-height: 1;
  width: 26px;
}

.calc-close:hover {
  border-color: var(--red);
  color: var(--red);
}

.calc-float-body { padding: 10px 12px 12px; overflow-y: auto; }

.calc-live-row {
  align-items: baseline;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.calc-live-price {
  color: var(--gold);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.calc-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.calc-field {
  color: var(--muted);
  display: flex;
  flex-direction: column;
  font-size: 12px;
  gap: 3px;
}

.calc-field input {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  direction: ltr;
  font: inherit;
  font-size: 14px;
  padding: 5px 8px;
  text-align: left;
  width: 100%;
}

.calc-field input:focus {
  border-color: var(--gold);
  outline: none;
}

.calc-out {
  background: var(--panel-2);
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  font-size: 12px;
  gap: 1px;
  padding: 4px 8px;
}

.calc-out strong {
  color: var(--text);
  font-size: 13.5px;
  font-variant-numeric: tabular-nums;
}

.calc-note { margin: 8px 0 0; }

@media (max-width: 480px) {
  .calc-float { width: calc(100vw - 16px); }
  .calc-grid { grid-template-columns: 1fr; }
}

/* ------------------------------------------------- أوامر مفتوحة: أسعار مباشرة */
.order-price {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.order-price-buy { color: var(--green); }
.order-price-sell { color: var(--red); }

.live-price {
  color: var(--gold);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

/* ==================================================== توافق الهاتف المحمول
   يُطبّق على الشاشات الصغيرة فقط حتى لا يتأثر سطح المكتب. */
@media (max-width: 720px) {
  body { font-size: 15.5px; }

  /* ---------------------------------------------- الشريط العلوي بصفّين */
  .topbar-inner {
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 10px;
    padding: 8px 14px 6px;
  }
  .brand { font-size: 16px; gap: 8px; }
  .brand-mark {
    width: 30px;
    height: 30px;
    font-size: 16px;
    border-radius: 9px;
  }
  .logout-form { margin-inline-start: auto; }
  .logout-form .btn { min-height: 34px; }
  .topbar-btc { margin-inline-start: 0; padding: 4px 9px; gap: 6px; }
  .topbar-btc .ticker-price { font-size: 13px; }

  /* شريط تنقّل كامل العرض قابل للسحب أفقيًا */
  .nav {
    order: 4;
    flex: 1 1 100%;
    width: 100%;
    gap: 2px;
    padding: 2px 0 1px;
    margin-inline: -4px;
    padding-inline: 4px;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
  }
  .nav a {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    padding: 7px 11px;
    font-size: 14.5px;
    scroll-snap-align: start;
  }

  /* --------------------------------------------------------- المحتوى */
  .container { padding: 0 12px; }
  .card { padding: 14px; border-radius: 12px; margin-bottom: 14px; }
  .page-title { font-size: 23px; }
  .card-head { gap: 10px; margin-bottom: 12px; }
  .card-head h2 { font-size: 17px; }
  .card-head-title { gap: 10px; }

  /* ---------------------------------------------------- بطاقات الأرقام */
  .stats, .stats-6, .stats-8 { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat { padding: 12px; }
  .stat-label { font-size: 12.5px; margin-bottom: 4px; }
  .stats-8 .stat-label { font-size: 12px; min-height: 0; }
  .stat-value,
  .stats-8 .stat-value { font-size: 19px; }
  .stat-sub { font-size: 11.5px; }
  .overview-bar .stat-value.small-value { font-size: 18px; }

  /* ------------------------------------------------------ شريط الأدوات */
  .table-toolbar { gap: 8px; margin-bottom: 12px; }
  .table-toolbar > label { display: none; }
  .table-toolbar .sort-select { flex: 1 1 calc(50% - 4px); min-width: 0; }
  .table-toolbar .btn { flex: 0 0 auto; }
  .coins-search,
  .watch-search { flex: 1 1 100%; max-width: none; }

  /* حقول بخط 16px حتى لا يكبّر iOS الصفحة عند الكتابة */
  .watch-input,
  .sort-select,
  .analysis-field input,
  .analysis-field select,
  .alert-field input,
  .alert-field select,
  .settings-grid input,
  .settings-grid select,
  input[type="text"],
  input[type="search"],
  input[type="number"],
  input[type="date"],
  input[type="password"],
  select,
  textarea { font-size: 16px; }

  /* -------------------------------------------------- الجداول (تمرير أفقي) */
  .table-wrap {
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    border-radius: 10px;
  }
  .table { font-size: 14px; }
  .table th { padding: 9px 10px; font-size: 12.5px; }
  .table td { padding: 9px 10px; }

  #assets-table { font-size: 14.5px; }
  #assets-table thead th { padding: 9px 10px; font-size: 12.5px; }
  #assets-table tbody td { padding: 10px; font-size: 14.5px; }
  #assets-table .coin { font-size: 15px; }
  #assets-table .num { font-size: 14.5px; }
  #assets-table .price-cell { font-size: 16px; }
  #assets-table .cost-cell { font-size: 15px; }
  #assets-table .low-soft { font-size: 14.5px; }
  #assets-table .strong { font-size: 15.5px; }
  #assets-table .muted-cap { font-size: 13.5px; }

  /* تثبيت عمود العملة أثناء السحب الأفقي في الجداول العريضة فقط */
  #assets-table thead th:first-child,
  #assets-table tbody td:first-child,
  #coins-table thead th:first-child,
  #coins-table tbody td:first-child,
  #watch-table thead th:first-child,
  #watch-table tbody td:first-child,
  #open-orders-table thead th:first-child,
  #open-orders-table tbody td:first-child {
    position: sticky;
    inset-inline-start: 0;
    z-index: 3;
    background-color: #121a28 !important;
  }
  /* في صفحتي العملات والمراقبة يسبق الاسمَ عمودُ النجمة، فثبّتهما معًا */
  #coins-table thead th:nth-child(2),
  #coins-table tbody td:nth-child(2),
  #watch-table thead th:nth-child(2),
  #watch-table tbody td:nth-child(2) {
    position: sticky;
    inset-inline-start: 44px;
    z-index: 2;
    background-color: #121a28 !important;
    box-shadow: -8px 0 12px -10px rgba(0, 0, 0, 0.75);
  }

  /* اسم العملة يلتف بدل أن يدفع بقية الأعمدة خارج الشاشة */
  #assets-table tbody td:first-child,
  #coins-table tbody td:nth-child(2),
  #watch-table tbody td:nth-child(2) { white-space: normal; }
  #coins-table tbody td:nth-child(2) .binance-link,
  #watch-table tbody td:nth-child(2) .binance-link {
    display: flex;
    width: max-content;
    margin-top: 1px;
    font-size: 12.5px;
  }
  .table th.fav-col,
  .table td.fav-col { padding-inline: 5px; }
  #assets-table thead th:first-child,
  #coins-table thead th:first-child,
  #coins-table thead th:nth-child(2),
  #watch-table thead th:first-child,
  #watch-table thead th:nth-child(2),
  #open-orders-table thead th:first-child { background-color: #182130 !important; }
  #assets-table thead th:first-child,
  #open-orders-table thead th:first-child {
    box-shadow: -8px 0 12px -10px rgba(0, 0, 0, 0.75);
  }
  #assets-table tbody tr:hover td:first-child,
  #coins-table tbody tr:hover td:first-child,
  #coins-table tbody tr:hover td:nth-child(2),
  #watch-table tbody tr:hover td:first-child,
  #watch-table tbody tr:hover td:nth-child(2),
  #open-orders-table tbody tr:hover td:first-child { background-color: #1b2330 !important; }
  #assets-table tbody tr.alert-hit td:first-child,
  #coins-table tbody tr.alert-hit td:first-child,
  #coins-table tbody tr.alert-hit td:nth-child(2),
  #watch-table tbody tr.alert-hit td:first-child,
  #watch-table tbody tr.alert-hit td:nth-child(2),
  #open-orders-table tbody tr.alert-hit td:first-child { background-color: #2a2a1c !important; }

  /* --------------------------------------------- أزرار ومساحات اللمس */
  .fav-btn { padding: 6px 4px; font-size: 20px; min-width: 34px; min-height: 34px; }
  .alert-btn { padding: 6px 7px; font-size: 19px; min-width: 34px; min-height: 34px; }
  .calc-open { padding: 5px 6px; }
  .binance-link {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
  }
  .row-actions .btn,
  #coins-table .row-actions .btn { min-height: 34px; }
  .btn-sm { min-height: 34px; }

  /* --------------------------------------------- الفحص والحاسبة العائمة */
  .analysis-form { gap: 10px; }
  .analysis-form .btn { width: 100%; }
  .verdict-main { gap: 10px; }
  .verdict-badge { font-size: 17px; padding: 4px 13px; }
  .score-number { font-size: 38px; }
  .calc-float { max-height: calc(100dvh - 16px); }
  .alert-dialog { max-width: calc(100vw - 24px); }
}

/* شاشات صغيرة جدًا */
@media (max-width: 400px) {
  .topbar-btc .ticker-change { display: none; }
  .stat-value,
  .stats-8 .stat-value { font-size: 18px; }
  .verdict-score { margin-inline-start: 0; }
}
