/* ============================================================
   v2.3.0 — استایل بخش‌های جدید مینی‌اپ (عملکرد، دستاوردها، لیدربورد، هشدار، تور، اشتراک‌گذاری)
   فقط از توکن‌های brand-tokens.css رنگ می‌گیرد؛ رنگ دلخواه ممنوع (قانون مرحله ۱۴).
   ============================================================ */

/* ---------- نوار زیرتب‌ها (Segmented) ---------- */
.segbar { display: flex; gap: 4px; padding: 4px; margin: 0 0 var(--gap-md); background: var(--surface); border: 1px solid var(--divider);
  border-radius: var(--radius-pill); overflow-x: auto; scrollbar-width: none; }
.segbar::-webkit-scrollbar { display: none; }
.segbar button { flex: 1 0 auto; appearance: none; border: 0; background: none; color: var(--muted); font: inherit; font-size: 13px; font-weight: 600;
  padding: 8px 14px; border-radius: var(--radius-pill); cursor: pointer; white-space: nowrap; transition: background-color 140ms ease, color 140ms ease; }
.segbar button.on { background: color-mix(in srgb, var(--gold) 18%, transparent); color: var(--gold-text); }
.chips.range { margin: 0 0 var(--gap-md); }
.chip.on { border-color: var(--gold); color: var(--gold-text); background: color-mix(in srgb, var(--gold) 12%, transparent); }

/* ---------- داشبورد: خوش‌آمد، سطح، بازار ---------- */
.hello { padding-bottom: var(--gap-md); }
.hello-top { display: flex; align-items: center; justify-content: space-between; gap: var(--gap-md); }
.hello-greet { font-size: 19px; font-weight: 700; line-height: 1.4; }
.lvl { appearance: none; border: 1px solid color-mix(in srgb, var(--gold) 45%, var(--divider)); background: color-mix(in srgb, var(--gold) 10%, transparent);
  color: var(--gold-text); border-radius: 14px; padding: 6px 12px; font: inherit; cursor: pointer; text-align: center; min-width: 74px; }
.lvl b { display: block; font-size: 15px; }
.lvl small { display: block; font-size: 10.5px; opacity: .85; margin-top: 1px; }
.xpbar { height: 6px; border-radius: 999px; background: var(--divider); overflow: hidden; margin: 12px 0 6px; }
.xpbar > i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--gold), var(--tier-plusplus)); transition: width .6s ease; }
.xpcap { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); direction: ltr; }
html[dir="rtl"] .xpcap { direction: rtl; }

.mkt { display: flex; align-items: center; justify-content: space-between; gap: var(--gap-sm); padding: 12px var(--gap-md); }
.mkt .m-l { display: flex; align-items: center; gap: 10px; font-size: 13.5px; font-weight: 600; }
.mkt .m-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--success); flex: none; }
.mkt.closed .m-dot { background: var(--danger); }
.mkt .m-cd { font-size: 13px; color: var(--muted); direction: ltr; unicode-bidi: plaintext; }
.mkt .m-cd b { color: var(--text); font-variant-numeric: tabular-nums; }

.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--gap-sm); }
.kpi { background: var(--surface); border: 1px solid var(--divider); border-radius: var(--radius-card); padding: 12px 10px; text-align: center; min-width: 0; }
.kpi .k-l { font-size: 11px; color: var(--muted); margin-bottom: 4px; }
.kpi .k-v { font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; direction: ltr; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi.skel-k { height: 66px; }

.qa { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--gap-sm); }
.qa button { appearance: none; border: 1px solid var(--divider); background: var(--surface); color: var(--text); border-radius: var(--radius-card);
  padding: 12px 4px 10px; font: inherit; font-size: 11.5px; display: flex; flex-direction: column; align-items: center; gap: 6px; cursor: pointer; }
.qa button svg { width: 22px; height: 22px; color: var(--gold-text); }
.qa button.buy svg { color: var(--success); } .qa button.sell svg { color: var(--danger); }

.bellbtn { position: relative; }
.bellbtn .dot { position: absolute; top: 5px; inset-inline-end: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); border: 2px solid var(--bg); display: none; }
.bellbtn.has .dot { display: block; }
.pricebell { appearance: none; border: 0; background: none; color: var(--gold-text); padding: 2px 6px; cursor: pointer; vertical-align: middle; }
.pricebell svg { width: 18px; height: 18px; }

/* ---------- عملکرد ---------- */
.net-hero { text-align: center; padding: var(--gap-md); }
.net-hero .n-v { font-size: 34px; font-weight: 800; line-height: 1.2; direction: ltr; font-variant-numeric: tabular-nums; margin: 4px 0; }
.net-hero .n-s { font-size: 12.5px; color: var(--muted); }
.ringrow { display: flex; align-items: center; gap: var(--gap-md); }
.ring { width: 84px; height: 84px; flex: none; }
.ring circle { fill: none; stroke-width: 9; }
.ring .bg { stroke: var(--divider); } .ring .fg { stroke: var(--success); stroke-linecap: round; transform: rotate(-90deg); transform-origin: 50% 50%; transition: stroke-dasharray .7s ease; }
.ring text { fill: var(--text); font-size: 20px; font-weight: 700; text-anchor: middle; dominant-baseline: central; direction: ltr; }
.ringrow .r-t { flex: 1; min-width: 0; }
.kgrid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap-sm); }
.kgrid .kpi { text-align: start; padding: 11px 13px; }
.kgrid .kpi .k-v { font-size: 15px; }
.curve { width: 100%; height: 150px; display: block; direction: ltr; overflow: visible; }
.curve .zero { stroke: var(--divider); stroke-dasharray: 3 4; stroke-width: 1; vector-effect: non-scaling-stroke; }
.curve .ln { fill: none; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.curve .ar { stroke: none; opacity: .16; }
.curve.up .ln { stroke: var(--success); } .curve.up .ar { fill: var(--success); }
.curve.down .ln { stroke: var(--danger); } .curve.down .ar { fill: var(--danger); }
.curve-cap { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 6px; }
.splitbar { display: flex; height: 10px; border-radius: 999px; overflow: hidden; background: var(--divider); margin: 8px 0 6px; }
.splitbar i { display: block; height: 100%; } .splitbar .b { background: var(--success); } .splitbar .s { background: var(--danger); }
.tips { list-style: none; margin: 0; padding: 0; }
.tips li { display: flex; gap: 10px; padding: 9px 0; font-size: 13px; line-height: 1.8; border-top: 1px solid var(--divider); }
.tips li:first-child { border-top: 0; padding-top: 0; }
.tips li svg { width: 18px; height: 18px; flex: none; margin-top: 4px; color: var(--gold-text); }
.tips li.good svg { color: var(--success); } .tips li.warn svg { color: var(--warning); }

/* ---------- تقویم گرمایی ---------- */
.heat { display: grid; grid-template-rows: repeat(7, auto); grid-auto-columns: 1fr; grid-auto-flow: column; gap: 4px; direction: ltr; }
.heat i { display: block; aspect-ratio: 1; border-radius: 4px; background: var(--divider); cursor: pointer; min-width: 0; }
.heat i.sel { outline: 2px solid var(--gold); outline-offset: 1px; }
.heat i.blank { background: transparent; pointer-events: none; }
.heatlegend { display: flex; align-items: center; justify-content: flex-end; gap: 4px; font-size: 10.5px; color: var(--muted); margin-top: 8px; direction: ltr; }
.heatlegend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.dayinfo { min-height: 22px; margin-top: 10px; font-size: 13px; text-align: center; }

/* ---------- لیست معاملات (با اشتراک) ---------- */
.tcard { margin-bottom: var(--gap-sm); }
.tcard .t-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tcard .t-pnl { font-size: 18px; font-weight: 800; direction: ltr; font-variant-numeric: tabular-nums; }
.tcard .t-meta { font-size: 12px; color: var(--muted); margin: 3px 0 8px; direction: ltr; text-align: start; }
html[dir="rtl"] .tcard .t-meta { text-align: end; }
.tcard .t-act { display: flex; gap: 8px; }
.tcard .t-act .chip { display: inline-flex; align-items: center; gap: 6px; }
.tcard .t-act svg, .chip svg { width: 15px; height: 15px; }
.pill-tp { background: color-mix(in srgb, var(--success) 18%, transparent); color: var(--success); }
.pill-sl, .pill-liquidation { background: color-mix(in srgb, var(--danger) 18%, transparent); color: var(--danger); }

/* ---------- دستاوردها ---------- */
.lvlcard { text-align: center; }
.lvlcard .l-n { font-size: 40px; font-weight: 800; color: var(--gold-text); line-height: 1.1; direction: ltr; }
.lvlcard .l-t { font-size: 14px; font-weight: 700; margin-bottom: 6px; }
.badges { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--gap-sm); }
.badge2 { background: var(--surface); border: 1px solid var(--divider); border-radius: var(--radius-card); padding: 12px 6px 10px; text-align: center; min-width: 0; position: relative; }
.badge2 .b-i { width: 44px; height: 44px; margin: 0 auto 8px; border-radius: 50%; display: grid; place-items: center; background: var(--divider); color: var(--muted); }
.badge2 .b-i svg { width: 22px; height: 22px; }
.badge2 .b-n { font-size: 11.5px; font-weight: 700; line-height: 1.5; }
.badge2 .b-p { height: 4px; border-radius: 999px; background: var(--divider); overflow: hidden; margin: 7px 8px 0; }
.badge2 .b-p i { display: block; height: 100%; background: var(--muted); }
.badge2 .b-c { font-size: 10px; color: var(--muted); margin-top: 3px; direction: ltr; }
.badge2.done { border-color: color-mix(in srgb, var(--gold) 55%, var(--divider)); }
.badge2.done .b-i { background: color-mix(in srgb, var(--gold) 20%, transparent); color: var(--gold-text); box-shadow: 0 0 14px color-mix(in srgb, var(--gold) 30%, transparent); }
.badge2.done .b-p i { background: var(--gold); }
.badge2:not(.done) { opacity: .82; }

/* ---------- لیدربورد ---------- */

/* ---------- هشدارها و اعلان‌ها ---------- */
.alrow { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-top: 1px solid var(--divider); }
.alrow:first-child { border-top: 0; }
.alrow .ai { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; flex: none; background: color-mix(in srgb, var(--success) 16%, transparent); color: var(--success); }
.alrow.below .ai { background: color-mix(in srgb, var(--danger) 16%, transparent); color: var(--danger); }
.alrow.done { opacity: .55; }
.alrow .ai svg { width: 18px; height: 18px; }
.alrow .at { flex: 1; min-width: 0; } .alrow .at b { display: block; font-size: 15px; direction: ltr; text-align: start; }
html[dir="rtl"] .alrow .at b { text-align: end; }
.alrow .at small { color: var(--muted); font-size: 11.5px; }
.nrow { display: flex; gap: 12px; padding: 11px 0; border-top: 1px solid var(--divider); font-size: 13px; line-height: 1.7; }
.nrow:first-child { border-top: 0; }
.nrow .ni { width: 32px; height: 32px; border-radius: 50%; background: var(--divider); display: grid; place-items: center; flex: none; color: var(--gold-text); }
.nrow .ni svg { width: 16px; height: 16px; }
.nrow small { display: block; color: var(--muted); font-size: 11px; }
.nrow.new .ni { background: color-mix(in srgb, var(--gold) 20%, transparent); }

/* ---------- دعوت ---------- */
.invite .i-n { font-size: 30px; font-weight: 800; color: var(--gold-text); direction: ltr; }
.inv-recent { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }

/* ---------- کمک‌های ترید ---------- */
.hint { font-size: 11.5px; color: var(--muted); margin: 10px 0 2px; }
.chips.tight { margin-top: 4px; }
.chip.sm { padding: 4px 10px; font-size: 12px; }
.rr { display: inline-block; padding: 2px 10px; border-radius: 999px; background: color-mix(in srgb, var(--gold) 14%, transparent); color: var(--gold-text); font-weight: 700; direction: ltr; }

/* ---------- اشتراک‌گذاری ---------- */
.sharebox img { width: 100%; border-radius: 14px; border: 1px solid var(--divider); display: block; margin-bottom: var(--gap-md); }
.sharebox .grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--gap-sm); }

/* ---------- تور معرفی ---------- */
.tour { position: fixed; inset: 0; z-index: 60; background: var(--bg); display: flex; flex-direction: column; animation: cardIn 200ms ease-out both; }
.tour .t-skip { align-self: flex-end; margin: 16px; appearance: none; border: 0; background: none; color: var(--muted); font: inherit; font-size: 14px; cursor: pointer; padding: 6px 10px; }
.tour .t-body { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 0 var(--gap-lg); max-width: 520px; margin: 0 auto; }
.tour .t-art { width: 190px; height: 190px; margin-bottom: 26px; border-radius: 50%; display: grid; place-items: center;
  background: radial-gradient(circle at 50% 40%, color-mix(in srgb, var(--gold) 20%, transparent), transparent 70%); color: var(--gold-text); }
.tour .t-art svg { width: 96px; height: 96px; }
.tour h2 { margin: 0 0 10px; font-size: 23px; } .tour p { margin: 0; color: var(--muted); line-height: 2; font-size: 14.5px; }
.tour .t-foot { padding: var(--gap-md) var(--gap-lg) calc(var(--gap-lg) + env(safe-area-inset-bottom, 0)); max-width: 520px; margin: 0 auto; width: 100%; box-sizing: border-box; }
.tour .t-dots { display: flex; justify-content: center; gap: 7px; margin-bottom: var(--gap-md); }
.tour .t-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--divider); transition: all 160ms ease; }
.tour .t-dots i.on { width: 22px; border-radius: 999px; background: var(--gold); }

/* ---------- Pull to refresh و توست اکشن‌دار ---------- */
.ptr { position: fixed; top: -48px; left: 50%; transform: translateX(-50%); z-index: 35; width: 38px; height: 38px; border-radius: 50%; background: var(--surface);
  border: 1px solid var(--divider); display: grid; place-items: center; color: var(--gold-text); transition: top 140ms ease; box-shadow: 0 4px 14px rgba(0,0,0,.25); }
.ptr svg { width: 18px; height: 18px; transition: transform 140ms ease; }
.ptr.spin svg { animation: ptrspin .8s linear infinite; }
@keyframes ptrspin { to { transform: rotate(360deg); } }
.toast .tact { appearance: none; margin-inline-start: 12px; border: 1px solid var(--gold); background: none; color: var(--gold-text); font: inherit; font-size: 13px; border-radius: 999px; padding: 3px 12px; cursor: pointer; }

/* ---------- موبایل‌های باریک ---------- */
@media (max-width: 360px) {
  .qa { grid-template-columns: repeat(2, 1fr); }
  .kpis { grid-template-columns: repeat(3, 1fr); } .kpi .k-v { font-size: 14px; }
  .badges { grid-template-columns: repeat(2, 1fr); }
}
.tabbar { grid-template-columns: repeat(6, 1fr); }

.btn svg { width: 18px; height: 18px; vertical-align: -3px; }
.sharebox .btn { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 12px; padding: 10px 4px; }
