:root {
  --bg: #0d1117; --panel: #161b22; --border: #30363d; --text: #e6edf3;
  --muted: #8b949e; --accent: #2f81f7; --green: #3fb950; --red: #f85149;
  --amber: #d29922;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { background: var(--bg); color: var(--text); font: 14px/1.5 "Segoe UI", system-ui, sans-serif; }

/* Login */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-card { background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
  padding: 40px; width: 380px; box-shadow: 0 8px 40px rgba(0,0,0,.5); }
.login-card h1 { font-size: 20px; margin-bottom: 4px; }
.login-card .sub { color: var(--muted); font-size: 12px; margin-bottom: 24px; }
.login-card input { width: 100%; padding: 10px 12px; margin-bottom: 14px; border-radius: 6px;
  border: 1px solid var(--border); background: var(--bg); color: var(--text); font-size: 14px; }
.login-card input:focus { outline: 2px solid var(--accent); border-color: var(--accent); }
.login-card button { width: 100%; padding: 11px; border: 0; border-radius: 6px; background: var(--accent);
  color: #fff; font-size: 15px; font-weight: 600; cursor: pointer; }
.login-card button:hover { filter: brightness(1.1); }
.login-error { color: var(--red); font-size: 13px; margin-bottom: 12px; min-height: 18px; }

/* Layout */
.topbar { display: flex; align-items: center; gap: 16px; padding: 10px 20px;
  background: var(--panel); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
.topbar .brand { font-weight: 700; font-size: 16px; }
.badge { padding: 2px 10px; border-radius: 12px; font-size: 11px; font-weight: 700; }
.badge.mode { background: #1f6feb33; color: var(--accent); border: 1px solid var(--accent); }
.badge.kill-on { background: #f8514933; color: var(--red); border: 1px solid var(--red); }
.badge.kill-off { background: #3fb95033; color: var(--green); border: 1px solid var(--green); }
.topbar .spacer { flex: 1; }
.topbar button, .btn { padding: 7px 14px; border-radius: 6px; border: 1px solid var(--border);
  background: var(--panel); color: var(--text); cursor: pointer; font-size: 13px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn.danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn:hover { filter: brightness(1.15); }

nav.tabs { display: flex; gap: 4px; padding: 8px 20px; border-bottom: 1px solid var(--border);
  background: var(--bg); flex-wrap: wrap; }
nav.tabs button { padding: 7px 14px; border: 0; background: none; color: var(--muted);
  border-bottom: 2px solid transparent; cursor: pointer; font-size: 13px; }
nav.tabs button.active { color: var(--text); border-bottom-color: var(--accent); }

main { padding: 20px; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 16px; }
.card h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 12px; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; color: var(--muted); font-weight: 600; padding: 6px 8px; border-bottom: 1px solid var(--border); }
td { padding: 7px 8px; border-bottom: 1px solid #21262d; }
tr:hover td { background: #1c2129; }

.pill { padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 700; }
.pill.CANDIDATE, .pill.APPROVED { background: #3fb95022; color: var(--green); }
.pill.WATCHLIST { background: #d2992222; color: var(--amber); }
.pill.NO_SETUP, .pill.REJECTED { background: #f8514922; color: var(--red); }
.pill.LONG { background: #3fb95022; color: var(--green); }
.pill.SHORT { background: #f8514922; color: var(--red); }
.pill.NEUTRAL { background: #8b949e22; color: var(--muted); }

.muted { color: var(--muted); }
.mono { font-family: Consolas, monospace; font-size: 12px; }
.form-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.form-row input, .form-row select { padding: 8px 10px; border-radius: 6px; border: 1px solid var(--border);
  background: var(--bg); color: var(--text); font-size: 13px; }
.kv { display: grid; grid-template-columns: 180px 1fr; gap: 4px 12px; font-size: 13px; }
.kv dt { color: var(--muted); }
pre.dump { background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
  padding: 12px; overflow: auto; max-height: 420px; font-size: 12px; }
.notice { background: #d2992218; border: 1px solid var(--amber); border-radius: 8px;
  padding: 10px 14px; color: var(--amber); font-size: 13px; margin-bottom: 16px; }
.stat { font-size: 26px; font-weight: 700; }

/* ── bilingual + help system ── */
[dir="rtl"] body, [dir="rtl"] input, [dir="rtl"] button, [dir="rtl"] select {
  font-family: "Vazirmatn", "Segoe UI", Tahoma, sans-serif;
}
[dir="rtl"] .kv { grid-template-columns: 1fr 180px; }
[dir="rtl"] .kv dt { order: 2; }
[dir="rtl"] .kv dd { order: 1; text-align: left; }
.lang-toggle { margin-top: 10px; width: 100%; }

.card-head { display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px; }
.card-head h3 { margin-bottom: 0; }
.help-circle { width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--accent);
  background: transparent; color: var(--accent); font-size: 12px; font-weight: 700;
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0; margin-inline-start: 6px; padding: 0; }
.help-circle:hover { background: var(--accent); color: #fff; }
.help-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 20px; }
.help-box { background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
  padding: 24px; max-width: 520px; box-shadow: 0 12px 48px rgba(0,0,0,.6); }
.help-box h3 { margin-bottom: 12px; color: var(--accent); }
.help-box p { line-height: 1.9; margin-bottom: 18px; }
.toast { position: fixed; bottom: 24px; inset-inline-start: 24px; background: var(--panel);
  border: 1px solid var(--accent); border-radius: 8px; padding: 12px 18px; z-index: 200;
  box-shadow: 0 8px 30px rgba(0,0,0,.5); }
