:root {
  --bg: #0A0E13;
  --panel: #121822;
  --panel-2: #171F2B;
  --border: rgba(231, 236, 242, 0.09);
  --border-strong: rgba(231, 236, 242, 0.16);
  --text: #E7ECF2;
  --text-dim: #8B96A5;
  --amber: #D4A24C;
  --amber-dim: rgba(212, 162, 76, 0.15);
  --green: #26A69A;
  --green-dim: rgba(38, 166, 154, 0.15);
  --red: #EF5350;
  --red-dim: rgba(239, 83, 80, 0.15);
  --radius: 14px;
  --font-display: 'Vazirmatn', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;   /* جلوگیری از بزرگ‌نمایی خودکار متن در چرخش صفحه */
}

body {
  margin: 0;
  overflow-x: hidden;               /* هیچ‌وقت اسکرول افقی نداشته باشیم */
  -webkit-tap-highlight-color: transparent;
  background: var(--bg);
  background-image:
    radial-gradient(circle at 15% 0%, rgba(212, 162, 76, 0.06), transparent 40%),
    radial-gradient(circle at 85% 20%, rgba(38, 166, 154, 0.05), transparent 45%);
  color: var(--text);
  font-family: var(--font-display);
  line-height: 1.6;
  min-height: 100vh;
}

.mono { font-family: var(--font-mono); direction: ltr; unicode-bidi: isolate; }

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

/* ---------------- topbar ---------------- */

.topbar {
  border-bottom: 1px solid var(--border);
  background: rgba(10, 14, 19, 0.85);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 1.1rem;
  letter-spacing: -0.01em;
}

.brand-mark { color: var(--amber); font-size: 1.3rem; }
.brand-accent { color: var(--amber); }

/* ---------------- buttons ---------------- */

.btn {
  font-family: var(--font-display);
  font-size: 0.88rem;
  font-weight: 600;
  padding: 9px 18px;
  border-radius: 9px;
  border: 1px solid var(--border-strong);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn:hover { border-color: var(--amber); color: var(--amber); }

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

.btn-primary {
  background: var(--amber);
  border-color: var(--amber);
  color: #1A1408;
}
.btn-primary:hover { filter: brightness(1.08); color: #1A1408; }

.btn-buy {
  background: var(--green-dim);
  border-color: var(--green);
  color: var(--green);
}
.btn-buy:hover { background: var(--green); color: #06201D; }
.btn-buy.active { background: var(--green); color: #06201D; }

.btn-sell {
  background: var(--red-dim);
  border-color: var(--red);
  color: var(--red);
}
.btn-sell:hover { background: var(--red); color: #2A0808; }
.btn-sell.active { background: var(--red); color: #2A0808; }

/* ---------------- layout ---------------- */

.wrap { max-width: 1120px; margin: 0 auto; padding: 40px 24px 100px; }

/* ---------------- hero ---------------- */

.hero { padding: 40px 0 48px; border-bottom: 1px solid var(--border); margin-bottom: 40px; }

.eyebrow {
  font-family: var(--font-mono);
  direction: ltr;
  text-align: right;
  color: var(--amber);
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin: 0 0 14px;
}

.hero-title {
  font-size: clamp(1.9rem, 4vw, 3rem);
  font-weight: 800;
  line-height: 1.35;
  margin: 0 0 16px;
  letter-spacing: -0.01em;
}

.hero-title .accent { color: var(--amber); }

.hero-sub { color: var(--text-dim); font-size: 1.02rem; max-width: 560px; margin: 0; }

/* ---------------- list head ---------------- */

.list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 22px;
}

.list-head h2 { font-size: 1.3rem; margin: 0; }

.list-head-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.count-pill {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-dim);
  border: 1px solid var(--border);
  padding: 5px 12px;
  border-radius: 20px;
}

/* ---------------- cards ---------------- */

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr));
  gap: 18px;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.card:hover { border-color: var(--amber); transform: translateY(-2px); }

.card-delete-btn {
  position: absolute;
  top: 12px;
  left: 12px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: var(--panel-2);
  color: var(--text-dim);
  cursor: pointer;
  font-size: 0.8rem;
  line-height: 1;
  z-index: 5;
}
.card-delete-btn:hover { background: var(--red); border-color: var(--red); color: #2A0808; }

.card-foot { flex-wrap: wrap; gap: 8px; }
.card-foot .request-support-btn { font-size: 0.78rem; padding: 7px 12px; order: 3; flex: 0 0 100%; margin-top: 4px; }

.card-top { display: flex; align-items: center; gap: 16px; margin-bottom: 14px; }

/* gauge */

.gauge { position: relative; width: 64px; height: 64px; flex-shrink: 0; }
.gauge svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.gauge-track {
  fill: none;
  stroke: var(--border-strong);
  stroke-width: 10;
}
.gauge-value {
  fill: none;
  stroke: var(--amber);
  stroke-width: 10;
  stroke-linecap: round;
  transition: stroke-dasharray 0.6s ease;
}
.gauge-label {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.gauge-num { font-size: 0.86rem; font-weight: 700; line-height: 1; }
.gauge-percent { font-size: 0.58rem; color: var(--text-dim); }

.card-heading h3 { margin: 0 0 4px; font-size: 1.08rem; }
.card-heading .developer { margin: 0 0 6px; font-size: 0.82rem; color: var(--text-dim); }

.symbol-tags { display: flex; flex-wrap: wrap; gap: 5px; }

.symbol-tag {
  display: inline-block;
  font-size: 0.72rem;
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px 8px;
}

.description {
  color: var(--text-dim);
  font-size: 0.88rem;
  margin: 0 0 18px;
  flex-grow: 1;
}

.card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 14px;
  border-top: 1px dashed var(--border);
}

.price-block { display: flex; flex-direction: column; gap: 2px; }
.price-label { font-size: 0.72rem; color: var(--text-dim); }
.price-value { font-size: 1rem; font-weight: 700; }
.currency { font-family: var(--font-display); font-size: 0.72rem; color: var(--text-dim); }

.view-btn { font-size: 0.82rem; color: var(--amber); font-weight: 600; }

.empty { text-align: center; color: var(--text-dim); padding: 60px 0; }

/* ---------------- detail page ---------------- */

.back-link {
  display: inline-block;
  color: var(--text-dim);
  font-size: 0.86rem;
  margin-bottom: 24px;
}
.back-link:hover { color: var(--amber); }

.detail-head {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
  padding-bottom: 28px;
  margin-bottom: 28px;
}

.detail-head-main h1 { margin: 0 0 8px; font-size: 1.7rem; }
.detail-head-main .developer { color: var(--text-dim); font-size: 0.9rem; margin: 0 0 10px; }
.detail-head-main .description { color: var(--text-dim); max-width: 520px; margin: 0; }

.detail-head-stats { display: flex; gap: 14px; }

.stat-box {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 140px;
}
.stat-label { font-size: 0.75rem; color: var(--text-dim); }
.stat-value { font-size: 1.25rem; font-weight: 700; }
.stat-value.accent { color: var(--amber); }

/* chart panel */

.chart-panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}

.chart-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 14px;
}

.tf-switch {
  display: flex;
  gap: 6px;
  background: var(--panel-2);
  padding: 4px;
  border-radius: 9px;
  border: 1px solid var(--border);
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.tf-switch::-webkit-scrollbar { display: none; }

.tf-btn {
  font-family: var(--font-mono);
  direction: ltr;
  font-size: 0.82rem;
  padding: 7px 14px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
}

.tf-btn.active { background: var(--amber); color: #1A1408; font-weight: 700; }
.tf-btn { flex-shrink: 0; white-space: nowrap; }

.admin-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.admin-hint { font-size: 0.8rem; color: var(--text-dim); }

.chart-container {
  position: relative;
  width: 100%;
  height: 480px;
  border-radius: 10px;
  overflow: hidden;
  background: #0D1218;
}

.chart-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  font-size: 0.9rem;
}

.chart-note { color: var(--text-dim); font-size: 0.8rem; margin: 14px 4px 0; }

/* markers panel */

.markers-panel { margin-top: 24px; }
.markers-panel h3 { font-size: 1rem; margin: 0 0 12px; }

.markers-list { display: flex; flex-direction: column; gap: 8px; }

.marker-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 0.85rem;
}

.marker-row .tag {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 5px;
}
.marker-row .tag.buy { color: var(--green); background: var(--green-dim); }
.marker-row .tag.sell { color: var(--red); background: var(--red-dim); }

.marker-row .del-marker {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 0.9rem;
}
.marker-row .del-marker:hover { color: var(--red); }

/* ---------------- overlays / modals ---------------- */

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 7, 10, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.overlay.hidden, .hidden { display: none !important; }

.modal {
  background: var(--panel);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 28px;
  width: 100%;
  max-width: 380px;
  max-height: 88dvh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modal h3 { margin: 0 0 6px; }

.input {
  width: 100%;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 11px 14px;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 0.9rem;
}
.input:focus { outline: none; border-color: var(--amber); }

.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }

.error { color: var(--red); font-size: 0.82rem; margin: 0; }
.success { color: var(--green); font-size: 0.86rem; margin: 0; line-height: 1.7; }


/* ---------------- چت کاربر با دولوپر ---------------- */

.chat-launcher {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--amber);
  color: #1A1408;
  border: none;
  border-radius: 999px;
  padding: 12px 20px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  box-shadow: 0 8px 26px rgba(212, 162, 76, 0.28);
  z-index: 90;
}
.chat-launcher:hover { filter: brightness(1.08); }
.chat-launcher.active { background: var(--panel-2); color: var(--text); box-shadow: none; border: 1px solid var(--border-strong); }
.chat-launcher-icon { font-size: 1rem; }

.chat-badge {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--red);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.chat-panel {
  position: fixed;
  bottom: 84px;
  right: 24px;
  width: 370px;
  max-width: calc(100vw - 32px);
  height: 540px;
  max-height: calc(100vh - 120px);
  background: var(--panel);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 95;
}

.chat-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--panel-2);
}
.chat-head-titles { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.chat-title { font-weight: 700; font-size: 0.95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-subtitle { font-size: 0.72rem; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.chat-back, .chat-close {
  background: none;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  color: var(--text-dim);
  width: 28px;
  height: 28px;
  cursor: pointer;
  font-size: 0.9rem;
  flex-shrink: 0;
}
.chat-back:hover, .chat-close:hover { border-color: var(--amber); color: var(--amber); }

.chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chat-empty {
  color: var(--text-dim);
  font-size: 0.84rem;
  text-align: center;
  line-height: 1.9;
  margin: auto 0;
  padding: 20px 10px;
}

/* ردیف‌های لیست گفتگو */

.chat-thread-row {
  position: relative;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 11px 13px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  cursor: pointer;
  text-align: right;
  font-family: var(--font-display);
  color: var(--text);
  width: 100%;
}
.chat-thread-row:hover { border-color: var(--amber); }
.chat-thread-row.unread { border-color: var(--amber); }
.chat-thread-row.selected { background: var(--bg); border-color: var(--amber); }

.chat-thread-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.chat-thread-name { font-weight: 700; font-size: 0.86rem; color: var(--amber); }
.chat-thread-time { font-size: 0.68rem; color: var(--text-dim); font-family: var(--font-mono); }
.chat-thread-dev { font-size: 0.74rem; color: var(--text-dim); }
.chat-thread-visitor { font-size: 0.68rem; color: var(--text-dim); font-family: var(--font-mono); direction: ltr; text-align: right; }
.chat-thread-preview {
  font-size: 0.78rem;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-thread-badge { position: absolute; top: 10px; left: 10px; }
.chat-thread-closed {
  align-self: flex-start;
  font-size: 0.66rem;
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 1px 6px;
}

/* حباب پیام‌ها */

.chat-msg { max-width: 82%; display: flex; flex-direction: column; gap: 3px; }
.chat-msg.from-user { align-self: flex-start; }
.chat-msg.from-dev { align-self: flex-end; }

.chat-msg-body {
  padding: 9px 13px;
  border-radius: 12px;
  font-size: 0.85rem;
  line-height: 1.75;
  white-space: pre-wrap;
  word-break: break-word;
}
.chat-msg.from-user .chat-msg-body {
  background: var(--amber-dim);
  border: 1px solid rgba(212, 162, 76, 0.35);
  border-bottom-right-radius: 4px;
}
.chat-msg.from-dev .chat-msg-body {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}
.chat-msg-time { font-size: 0.65rem; color: var(--text-dim); font-family: var(--font-mono); }
.chat-msg.from-user .chat-msg-time { text-align: right; }
.chat-msg.from-dev .chat-msg-time { text-align: left; }

/* نویسه‌گر */

.chat-composer {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--border);
  background: var(--panel-2);
}

.chat-input {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 0.86rem;
  line-height: 1.6;
  resize: none;
  max-height: 120px;
  overflow-y: auto;
}
.chat-input:focus { outline: none; border-color: var(--amber); }

.chat-send {
  background: var(--amber);
  color: #1A1408;
  border: none;
  border-radius: 10px;
  width: 38px;
  height: 38px;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
}
.chat-send:hover { filter: brightness(1.08); }

.chat-note { color: var(--text-dim); font-size: 0.78rem; margin: 0 0 14px; line-height: 1.8; }

/* ---------------- صندوق چت ادمین ---------------- */

.admin-inbox { margin-top: 18px; text-align: right; }
.admin-inbox h3 { font-size: 1rem; margin: 0 0 6px; display: flex; align-items: center; gap: 8px; }

.admin-inbox-grid {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 14px;
  height: 540px;
}

.admin-thread-list {
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-left: 4px;
  border-left: 1px solid var(--border);
}

.admin-conversation {
  display: flex;
  flex-direction: column;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.admin-conv-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}
.admin-conv-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* دکمه بازگشت صندوق ادمین فقط روی موبایل معنی دارد */
#admin-thread-back { display: none; }
.admin-conv-actions .btn { font-size: 0.74rem; padding: 6px 10px; }

.admin-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.admin-conversation .chat-composer { background: var(--panel); }

/* fab */

.fab {
  position: fixed;
  bottom: 28px;
  left: 28px;
  background: var(--amber);
  color: #1A1408;
  border: none;
  border-radius: 12px;
  padding: 13px 22px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(212, 162, 76, 0.25);
  z-index: 30;
}
.fab:hover { filter: brightness(1.08); }


/* ===========================================================================
   بهینه‌سازی موبایل
   نقاط شکست: 900px (تبلت) · 640px (گوشی) · 400px (گوشی کوچک)
   =========================================================================== */

/* --- دستگاه‌های لمسی: افکت‌های hover نباید «گیر» کنند --------------------- */

@media (hover: none) {
  .card:hover { transform: none; border-color: var(--border); }
  .btn:hover { border-color: var(--border-strong); color: var(--text); }
  .btn-primary:hover { filter: none; }
  .chat-thread-row:hover { border-color: var(--border); }
  .chat-thread-row.unread:hover,
  .chat-thread-row.selected:hover { border-color: var(--amber); }
  .back-link:hover { color: var(--text-dim); }

  /* بازخورد لمسی به‌جای hover */
  .card:active { border-color: var(--amber); }
  .btn:active { transform: scale(0.97); }
  .chat-thread-row:active { background: var(--bg); }
  .chat-send:active { transform: scale(0.93); }
}

/* --- تبلت --------------------------------------------------------------- */

@media (max-width: 900px) {
  .admin-inbox-grid { grid-template-columns: 1fr; height: auto; }
  .admin-thread-list {
    max-height: 260px;
    border-left: none;
    border-bottom: 1px solid var(--border);
    padding-bottom: 10px;
  }
  .admin-conversation { height: 460px; }
}

/* --- گوشی --------------------------------------------------------------- */

@media (max-width: 640px) {

  /* چیدمان کلی */
  .wrap { padding: 22px 14px 96px; }
  .topbar-inner { padding: 13px 14px; }
  .brand { font-size: 1rem; }

  .hero { padding: 22px 0 28px; margin-bottom: 26px; }
  .hero-title { line-height: 1.45; margin-bottom: 12px; }
  .hero-sub { font-size: 0.92rem; }
  .eyebrow { font-size: 0.7rem; margin-bottom: 10px; }

  /* هدف‌های لمسی حداقل ۴۴ پیکسل (توصیه اپل و گوگل) */
  .btn { min-height: 44px; padding: 11px 16px; }
  .tf-btn { min-height: 40px; padding: 9px 15px; }
  .card-delete-btn { width: 34px; height: 34px; top: 10px; left: 10px; }

  /* ورودی‌ها روی iOS اگر کمتر از ۱۶px باشند باعث زوم خودکار می‌شوند */
  .input, .chat-input, textarea, select { font-size: 16px; }

  /* سربرگ لیست */
  .list-head { align-items: stretch; gap: 12px; }
  .list-head h2 { font-size: 1.15rem; }
  .list-head-actions { justify-content: space-between; width: 100%; }
  #sort-switch { flex: 1; }
  #sort-switch .tf-btn { flex: 1; text-align: center; font-family: var(--font-display); }

  /* کارت‌ها */
  .cards { gap: 14px; }
  .card { padding: 18px 16px; }
  .card-top { gap: 13px; margin-bottom: 12px; }
  .gauge { width: 56px; height: 56px; }
  .card-heading h3 { font-size: 1rem; }
  .description { font-size: 0.85rem; margin-bottom: 15px; }
  .card-foot .request-support-btn { min-height: 42px; font-size: 0.82rem; }

  /* صفحه جزئیات */
  .back-link { margin-bottom: 18px; }
  .detail-head { flex-direction: column; gap: 18px; padding-bottom: 22px; margin-bottom: 22px; }
  .detail-head-main h1 { font-size: 1.35rem; }
  .detail-head-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  .stat-box { min-width: 0; padding: 12px 14px; }
  .stat-value { font-size: 1.1rem; }
  .detail-head-stats .request-support-btn { grid-column: 1 / -1; align-self: stretch !important; }

  /* چارت */
  .chart-panel { padding: 13px; }
  .chart-toolbar { flex-direction: column; align-items: stretch; gap: 10px; }
  .chart-container { height: 340px; }
  .chart-note { font-size: 0.75rem; margin-top: 12px; }
  .admin-controls { justify-content: flex-start; }
  .admin-controls .btn { flex: 1 1 auto; min-width: 0; }
  .admin-hint { flex: 0 0 100%; }

  /* لیبل‌ها */
  .marker-row { flex-wrap: wrap; gap: 8px; padding: 10px 12px; }
  .marker-row .mono { flex: 1 1 auto !important; text-align: right !important; }
  .marker-row .del-marker { min-width: 34px; min-height: 34px; }

  /* مودال به‌شکل شیت پایین صفحه */
  .overlay { align-items: flex-end; }
  .modal {
    max-width: none;
    border-radius: var(--radius) var(--radius) 0 0;
    padding: 22px 18px calc(22px + env(safe-area-inset-bottom));
    max-height: 90dvh;
  }
  .modal-actions { flex-direction: column-reverse; gap: 8px; }
  .modal-actions .btn { width: 100%; }

  /* دکمه شناور افزودن اندیکاتور (ادمین) */
  .fab {
    bottom: calc(20px + env(safe-area-inset-bottom));
    left: 16px;
    padding: 12px 18px;
    font-size: 0.85rem;
  }

  /* --- ویجت چت: تمام‌صفحه --- */

  .chat-launcher {
    bottom: calc(18px + env(safe-area-inset-bottom));
    right: 16px;
    width: 56px;
    height: 56px;
    padding: 0;
    justify-content: center;
    border-radius: 50%;
  }
  .chat-launcher-text { display: none; }
  .chat-launcher-icon { font-size: 1.35rem; }
  .chat-launcher .chat-badge { position: absolute; top: -2px; left: -2px; }
  /* وقتی پنل تمام‌صفحه باز است، دکمه شناور بی‌معنی است */
  .chat-launcher.active { display: none; }

  .chat-panel {
    inset: 0;
    width: 100%;
    max-width: none;
    height: 100dvh;
    max-height: none;
    border: none;
    border-radius: 0;
    box-shadow: none;
    z-index: 120;   /* بالاتر از topbar و fab */
  }

  .chat-head {
    padding: calc(12px + env(safe-area-inset-top)) 14px 12px;
    gap: 12px;
  }
  .chat-title { font-size: 1rem; }
  .chat-back, .chat-close { width: 38px; height: 38px; font-size: 1rem; }

  .chat-body { padding: 14px 12px; gap: 12px; }
  .chat-msg { max-width: 88%; }
  .chat-msg-body { font-size: 0.9rem; padding: 10px 14px; }

  .chat-thread-row { padding: 14px 13px; }
  .chat-thread-name { font-size: 0.9rem; }
  .chat-thread-preview { font-size: 0.8rem; }

  .chat-composer {
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
    gap: 10px;
  }
  .chat-send { width: 44px; height: 44px; font-size: 1.2rem; }

  /* وقتی چت تمام‌صفحه باز است، پس‌زمینه نباید اسکرول شود */
  body.chat-open { overflow: hidden; }

  /* --- صندوق چت ادمین: نمای master/detail --- */

  .admin-inbox-grid { gap: 0; }
  .admin-thread-list { max-height: none; border-bottom: none; padding-bottom: 0; }

  /* روی گوشی یا لیست دیده می‌شود یا گفتگو، نه هر دو */
  .admin-inbox-grid .admin-conversation { display: none; }
  .admin-inbox-grid.show-conversation .admin-thread-list { display: none; }
  .admin-inbox-grid.show-conversation .admin-conversation { display: flex; }

  .admin-conversation { height: calc(100dvh - 220px); min-height: 380px; }
  .admin-conv-head { flex-wrap: wrap; gap: 8px; }
  .admin-conv-actions { flex: 1 1 100%; }
  .admin-conv-actions .btn { flex: 1; min-height: 40px; }
  #admin-thread-back { display: inline-flex; }

  .admin-inbox h3 { font-size: 0.95rem; }
  .chat-note { font-size: 0.75rem; }
}

/* --- گوشی کوچک (≤ ۴۰۰ پیکسل) -------------------------------------------- */

@media (max-width: 400px) {
  .wrap { padding: 18px 11px 92px; }
  .card { padding: 16px 13px; }
  .gauge { width: 50px; height: 50px; }
  .card-top { gap: 11px; }
  .card-heading h3 { font-size: 0.95rem; }
  .price-value { font-size: 0.92rem; }
  .detail-head-stats { grid-template-columns: 1fr; }
  .chart-container { height: 300px; }
  #sort-switch .tf-btn { font-size: 0.75rem; padding: 9px 8px; }
}

/* --- صفحه‌های کوتاه در حالت افقی ---------------------------------------- */

@media (max-height: 480px) and (orientation: landscape) {
  .chat-panel { height: 100dvh; }
  .chart-container { height: 260px; }
  .hero { padding: 16px 0 20px; }
}
