/* Language switch + RTL (Persian) */
.lang-switch {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 5px;
  overflow: hidden;
  background: var(--bg-2);
  margin-inline-end: 4px;
}
.lang-btn {
  background: transparent;
  border: none;
  color: var(--text-mid);
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .04em;
  padding: 6px 11px;
  cursor: pointer;
  transition: background .12s, color .12s;
}
.lang-btn + .lang-btn { border-inline-start: 1px solid var(--line); }
.lang-btn:hover { color: var(--text-hi); background: var(--bg-3); }
.lang-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.lang-btn.active { background: var(--accent); color: #1a120a; }

body.lang-fa {
  font-family: "Vazirmatn", "IBM Plex Sans", system-ui, sans-serif;
}
body.lang-fa .brand-name,
body.lang-fa .tab-btn,
body.lang-fa .panel-head h2,
body.lang-fa label,
body.lang-fa .hint,
body.lang-fa button {
  font-family: "Vazirmatn", "IBM Plex Sans", system-ui, sans-serif;
}

/* RTL layout tweaks */
html[dir="rtl"] .topbar {
  flex-direction: row;
}
html[dir="rtl"] .bot-control {
  flex-direction: row-reverse;
}
html[dir="rtl"] .filter-row {
  flex-direction: row-reverse;
}
html[dir="rtl"] .table-scroll {
  direction: rtl;
}
html[dir="rtl"] #perf-table th,
html[dir="rtl"] #trades-table th,
html[dir="rtl"] #candidates-table th {
  text-align: right;
}
html[dir="rtl"] .perf-actions {
  flex-direction: row-reverse;
}
html[dir="rtl"] .auth-card {
  text-align: right;
}
html[dir="rtl"] .auth-brand {
  flex-direction: row-reverse;
}

/* Numbers and signs stay readable inside RTL tables and canvases */
html[dir="rtl"] table td { unicode-bidi: plaintext; }
html[dir="rtl"] table td.num-pos, html[dir="rtl"] table td.num-neg { direction: ltr; text-align: right; }
html[dir="rtl"] canvas { direction: ltr; }
html[dir="rtl"] .filter-count { margin-inline-start: 0; margin-inline-end: auto; }
