:root {
  --bg: #F2F4F8; --surface: #FFFFFF; --stroke: #E1E5EC;
  --text: #1C1C1E; --muted: #6B7280;
  --blue: #0A6CFF; --green: #1FA84F; --red: #E5322D; --yellow: #E09B00;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Vazirmatn', 'Segoe UI', Tahoma, sans-serif;
  font-size: 15px; line-height: 1.7; direction: rtl;
  padding-bottom: env(safe-area-inset-bottom);
}
a { color: var(--blue); text-decoration: none; }
h1, h2, h3, p { margin: 0; }
hr { border: 0; border-top: 1px solid var(--stroke); margin: 12px 0; }

/* هدر */
.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 8px;
  padding: calc(env(safe-area-inset-top) + 8px) 10px 8px;
  background: var(--surface); border-bottom: 1px solid var(--stroke);
}
.topbar h1 { flex: 1; font-size: 19px; }
.icon-btn {
  width: 44px; height: 44px; display: flex; align-items: center; justify-content: center;
  border: 0; background: transparent; font-size: 24px; color: var(--text); border-radius: 12px; cursor: pointer;
}
.pill {
  border: 1px solid var(--blue); color: var(--blue); background: var(--surface);
  border-radius: 20px; padding: 6px 14px; font-size: 13px; font-weight: 700; white-space: nowrap;
}
.content { padding: 14px; max-width: 720px; margin: 0 auto; display: flex; flex-direction: column; gap: 12px; }

/* کارت‌ها */
.card {
  display: block; background: var(--surface); border: 1px solid var(--stroke);
  border-radius: 16px; padding: 14px; color: var(--text);
}
a.card:active { background: #f7f8fb; }
.list { display: flex; flex-direction: column; gap: 10px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; align-items: center; gap: 10px; }
.between { justify-content: space-between; }
.end { justify-content: flex-end; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.center { text-align: center; }
.strong { font-weight: 700; }
.ltr { direction: ltr; text-align: right; }
.pre { white-space: pre-line; }
.status { color: var(--muted); text-align: center; padding: 24px 8px; }
.section-title { font-size: 14px; color: var(--blue); margin-top: 6px; }

.headline { font-size: 16px; margin: 8px 0 4px; line-height: 1.6; }
.summary { color: #3a3a3c; font-size: 14px; }
.clamp { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-line; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chip { font-size: 12px; padding: 3px 10px; border-radius: 12px; background: #eef1f6; }
.chip.dir-up { background: #e3f5ea; color: var(--green); }
.chip.dir-down { background: #fde8e7; color: var(--red); }
.chip.dir-both { background: #fff3d6; color: var(--yellow); }
.dir { font-weight: 700; font-size: 13px; }
.dir.dir-up { color: var(--green); } .dir.dir-down { color: var(--red); }
.dir.dir-both { color: var(--yellow); } .dir.dir-neutral { color: var(--muted); }

.badge { font-size: 11.5px; font-weight: 700; padding: 2px 10px; border-radius: 12px; }
.imp-high { background: #fde8e7; color: var(--red); }
.imp-medium { background: #fff3d6; color: var(--yellow); }
.imp-low { background: #eef1f6; color: var(--muted); }
.st-open { background: #fff3d6; color: var(--yellow); }
.st-answered { background: #e3f5ea; color: var(--green); }
.st-closed { background: #eef1f6; color: var(--muted); }

/* دکمه و ورودی */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid transparent; border-radius: 14px; padding: 12px 18px;
  font: inherit; font-weight: 700; cursor: pointer; text-align: center;
}
.btn.block { display: flex; width: 100%; }
.btn.primary { background: var(--blue); color: #fff; }
.btn.ghost { background: var(--surface); color: var(--blue); border-color: var(--blue); }
.btn.danger { background: var(--surface); color: var(--red); border-color: var(--red); }
.btn.link { background: transparent; color: var(--muted); }
.btn:disabled { opacity: .5; cursor: default; }
.input {
  width: 100%; font: inherit; font-size: 16px; /* ۱۶ برای جلوگیری از زوم iOS */
  padding: 12px 14px; border: 1px solid var(--stroke); border-radius: 12px; background: var(--surface); color: var(--text);
}
.input.code { text-align: center; letter-spacing: 3px; }
textarea.input { resize: vertical; }
.check { display: flex; align-items: center; gap: 10px; padding: 8px 0; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--blue); flex-shrink: 0; }

/* ورود */
.login { max-width: 420px; margin: 0 auto; padding: calc(env(safe-area-inset-top) + 40px) 20px 30px; display: flex; flex-direction: column; gap: 16px; }
.login h1 { text-align: center; font-size: 22px; }
.logo { width: 96px; height: 96px; border-radius: 22px; margin: 0 auto; display: block; }

/* منو و پنجره‌ها */
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 20; display: flex; justify-content: flex-start; }
.overlay.center { align-items: center; justify-content: center; padding: 20px; }
.sheet { width: 78%; max-width: 320px; height: 100%; background: var(--surface); padding: calc(env(safe-area-inset-top) + 16px) 12px 20px; display: flex; flex-direction: column; gap: 4px; }
.sheet-title { font-weight: 700; font-size: 17px; padding: 8px 12px 16px; }
.menu-item { padding: 13px 12px; border-radius: 12px; color: var(--text); font-size: 15px; }
.menu-item.active { background: #eaf1ff; color: var(--blue); font-weight: 700; }
.dialog { background: var(--surface); border-radius: 18px; padding: 20px; width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 12px; }
.toast {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 24px); transform: translate(-50%, 20px);
  background: #1c1c1e; color: #fff; padding: 11px 18px; border-radius: 14px; font-size: 14px; max-width: 88%;
  opacity: 0; pointer-events: none; transition: .25s; z-index: 30; text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* تحلیل بازار */
.tabs { display: flex; gap: 8px; }
.tab { flex: 1; font: inherit; font-weight: 700; padding: 9px 0; border-radius: 20px; border: 1px solid var(--stroke); background: var(--surface); color: var(--text); cursor: pointer; }
.tab.active { background: var(--blue); border-color: var(--blue); color: #fff; }
.bar { display: flex; height: 10px; border-radius: 6px; overflow: hidden; margin: 10px 0; background: var(--stroke); }
.seg.up { background: var(--green); } .seg.mid { background: var(--stroke); } .seg.down { background: var(--red); }
.legend { font-size: 13px; white-space: pre-wrap; }

/* فیلترها */
.symbols.dim { opacity: .45; }

/* تیکت */
.thread { display: flex; flex-direction: column; gap: 10px; }
.bubble { max-width: 88%; padding: 10px 14px; border-radius: 16px; }
.bubble.user { align-self: flex-start; background: #eaf1ff; }
.bubble.admin { align-self: flex-end; background: var(--surface); border: 1px solid var(--stroke); }
.bubble .who { font-size: 12px; font-weight: 700; color: var(--blue); margin-bottom: 2px; }
.reply { display: flex; flex-direction: column; gap: 10px; }

/* قوانین */
.terms h2 { font-size: 18px; margin-bottom: 12px; }
.terms h3 { font-size: 15px; margin: 18px 0 6px; color: var(--blue); }
.terms p { margin: 0 0 8px; color: #3a3a3c; }
.terms ul { margin: 0 0 8px; padding-inline-start: 22px; color: #3a3a3c; }

/* راهنمای نصب */
.install {
  max-width: 420px; margin: 0 auto; text-align: center;
  padding: calc(env(safe-area-inset-top) + 30px) 24px 40px;
  display: flex; flex-direction: column; align-items: center; gap: 14px;
}
.install h1 { font-size: 22px; margin-top: 6px; }
.install .steps { line-height: 2.2; }
.install .steps .svg-inline { vertical-align: middle; margin: 0 2px; }
.install .latin { direction: ltr; unicode-bidi: isolate; font-weight: 700; }
.install .btn { margin-top: 8px; }
.svg-inline { display: inline-block; line-height: 0; }
