@import url('https://cdn.jsdelivr.net/npm/vazirmatn@33.0.3/Vazirmatn-font-face.css');

* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg-1: #0b1026;
  --bg-2: #131b3f;
  --card: rgba(255, 255, 255, 0.055);
  --card-2: rgba(255, 255, 255, 0.09);
  --line: rgba(255, 255, 255, 0.12);
  --text: #f2f5ff;
  --muted: #a8b3d9;
  --accent: #6d8bff;
  --accent-2: #b06bff;
  --mint: #4ce2c0;
  --gold: #ffcf5c;
  --danger: #ff7a7a;
}

html, body { min-height: 100%; }

body {
  font-family: Vazirmatn, "Segoe UI", Tahoma, sans-serif;
  background: radial-gradient(1100px 700px at 85% -10%, #2b1a5e 0%, transparent 60%),
              radial-gradient(900px 600px at -10% 110%, #123a5c 0%, transparent 55%),
              linear-gradient(160deg, var(--bg-1), var(--bg-2));
  color: var(--text);
  padding: 16px;
  display: flex;
  justify-content: center;
}

.muted { color: var(--muted); }

.btn {
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  background: var(--card-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 9px 13px;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.15s ease, border-color 0.15s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.btn:hover { background: rgba(255, 255, 255, 0.15); }
.btn:active { transform: scale(0.97); }

.btn.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent;
  box-shadow: 0 10px 24px rgba(109, 139, 255, 0.3);
}

.btn.gold {
  background: linear-gradient(135deg, #ffcf5c, #ff9f43);
  border-color: transparent;
  color: #3a2400;
  box-shadow: 0 8px 20px rgba(255, 178, 60, 0.25);
}

.btn.danger { color: var(--danger); border-color: rgba(255, 122, 122, 0.35); }
.btn.wide { width: 100%; justify-content: center; padding: 12px; }
.btn.ghost { background: rgba(255, 255, 255, 0.04); }

/* ================= ورود ================= */

.gate {
  width: 100%;
  max-width: 420px;
  margin: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 32px);
}

.gate[hidden] { display: none; }

.gate-card {
  width: 100%;
  background: linear-gradient(180deg, rgba(24, 32, 68, 0.95), rgba(12, 17, 40, 0.96));
  border: 1px solid var(--line);
  border-radius: 26px;
  padding: 28px 24px 22px;
  text-align: center;
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.gate-crown {
  font-size: 40px;
  line-height: 1;
  filter: drop-shadow(0 8px 18px rgba(255, 200, 80, 0.4));
}

.gate-card h1 { font-size: 21px; font-weight: 800; }
.gate-card .muted { font-size: 13px; line-height: 1.9; }

.gate-card input[type="password"] {
  font-family: inherit;
  font-size: 16px;
  letter-spacing: 3px;
  text-align: center;
  color: var(--text);
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 13px;
  outline: none;
}

.gate-card input[type="password"]:focus { border-color: var(--accent); }

.remember {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--muted);
  justify-content: center;
  cursor: pointer;
}

.remember input { accent-color: var(--accent); width: 15px; height: 15px; }

.err { color: var(--danger); font-size: 12.5px; min-height: 16px; }

.hint {
  font-size: 12.5px;
  color: var(--gold);
  background: rgba(255, 207, 92, 0.1);
  border: 1px dashed rgba(255, 207, 92, 0.4);
  border-radius: 12px;
  padding: 9px 12px;
  line-height: 1.8;
}

.back { font-size: 12.5px; color: var(--muted); text-decoration: none; }
.back:hover { color: var(--text); }

.link-btn {
  font-family: inherit;
  font-size: 12px;
  color: var(--muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 0;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.link-btn:hover { color: var(--text); }

/* ================= پنل ================= */

.panel {
  width: 100%;
  max-width: 900px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.panel[hidden] { display: none; }

.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  background: linear-gradient(120deg, rgba(255, 207, 92, 0.16), rgba(109, 139, 255, 0.14));
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 16px 18px;
}

.brand { display: flex; align-items: center; gap: 12px; flex: 1 1 260px; min-width: 0; }

.brand-crown {
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  display: grid;
  place-items: center;
  font-size: 24px;
  border-radius: 15px;
  background: linear-gradient(140deg, #ffcf5c, #ff9f43);
  box-shadow: 0 10px 24px rgba(255, 178, 60, 0.28);
}

.brand-text h1 { font-size: 17px; font-weight: 800; }
.brand-text p { font-size: 12.5px; margin-top: 3px; }

.topbar-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- آمار ---------- */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
}

.stat {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.stat .num { font-size: 24px; font-weight: 800; letter-spacing: 0.5px; }
.stat .lbl { font-size: 12px; color: var(--muted); }
.stat.gold .num { color: var(--gold); }
.stat.mint .num { color: var(--mint); }
.stat.warn .num { color: var(--danger); }

/* ---------- تب‌ها ---------- */

.tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: thin;
}

.tab {
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 15px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}

.tab:hover { color: var(--text); }

.tab.on {
  color: #10142c;
  background: linear-gradient(135deg, #ffffff, #dbe4ff);
  border-color: transparent;
}

.pill {
  font-size: 11px;
  font-weight: 800;
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(255, 207, 92, 0.22);
  color: var(--gold);
}

.tab.on .pill { background: rgba(16, 20, 44, 0.14); color: #10142c; }

/* ---------- بخش‌ها ---------- */

.views { display: flex; flex-direction: column; gap: 12px; }

.view { display: none; flex-direction: column; gap: 10px; }
.view.on { display: flex; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.card.vip { border-color: rgba(255, 207, 92, 0.45); background: rgba(255, 207, 92, 0.07); }

.user { flex-direction: row; align-items: flex-start; gap: 12px; flex-wrap: wrap; }

.avatar {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 16px;
  color: #0f1430;
  background: linear-gradient(140deg, #9fb4ff, #6d8bff);
}

.card.vip .avatar { background: linear-gradient(140deg, #ffe08a, #ffb43c); }

.who { flex: 1 1 220px; min-width: 0; display: flex; flex-direction: column; gap: 5px; }

.name-line { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.name-line strong { font-size: 14.5px; font-weight: 800; }

.sub { font-size: 12px; color: var(--muted); line-height: 1.75; overflow-wrap: anywhere; }
.sub b { color: #dfe6ff; font-weight: 700; }

.badge {
  font-size: 11px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid transparent;
}

.badge.vip { background: rgba(255, 207, 92, 0.18); color: var(--gold); border-color: rgba(255, 207, 92, 0.45); }
.badge.self { background: rgba(76, 226, 192, 0.15); color: var(--mint); border-color: rgba(76, 226, 192, 0.4); }
.badge.ok { background: rgba(76, 226, 192, 0.14); color: var(--mint); }
.badge.bot { background: rgba(109, 139, 255, 0.16); color: #b9c6ff; }
.badge.bad { background: rgba(255, 122, 122, 0.16); color: var(--danger); }

.acts { display: flex; gap: 7px; flex-wrap: wrap; align-items: center; }

.q {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.85;
  overflow-wrap: anywhere;
}

.a {
  font-size: 13.5px;
  line-height: 1.9;
  color: #e6ebff;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

textarea,
input[type="text"],
input[type="search"],
input[type="password"] {
  font-family: inherit;
  font-size: 13.5px;
  color: var(--text);
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  width: 100%;
  outline: none;
  line-height: 1.85;
  resize: vertical;
}

textarea:focus,
input:focus { border-color: var(--accent); }

input::placeholder, textarea::placeholder { color: #7d88ac; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12.5px; color: var(--muted); font-weight: 700; }

.price-edit {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 8px 0;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.08);
}

.price-edit:last-of-type { border-bottom: none; }

.price-edit .sub { flex: 1 1 150px; font-size: 13px; color: #e6ebff; font-weight: 700; }

.price-edit input {
  width: 120px;
  flex: 0 0 auto;
  direction: ltr;
  text-align: center;
  font-weight: 700;
}

.price-edit .unit { flex: 0 0 auto; font-size: 11px; color: var(--muted); }

.row { display: flex; gap: 8px; flex-wrap: wrap; }
.row > .field { flex: 1 1 180px; }

.logrow {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 11px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.07);
  font-size: 12.5px;
  flex-wrap: wrap;
}

.logrow .time { color: var(--muted); font-size: 11.5px; flex: 0 0 auto; }
.logrow .qtext { flex: 1 1 160px; min-width: 0; overflow-wrap: anywhere; color: #e9eeff; }
.logrow .whoami { color: #b9c6ff; font-weight: 700; }

.empty {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  line-height: 2;
  padding: 26px 16px;
  border: 1px dashed var(--line);
  border-radius: 18px;
}

.note {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.9;
  background: rgba(109, 139, 255, 0.09);
  border: 1px solid rgba(109, 139, 255, 0.24);
  border-radius: 14px;
  padding: 11px 13px;
}

.toast {
  position: fixed;
  inset-inline: 0;
  bottom: 18px;
  margin: 0 auto;
  width: max-content;
  max-width: 90vw;
  background: linear-gradient(135deg, #4ce2c0, #35c9a8);
  color: #06231c;
  font-size: 13px;
  font-weight: 800;
  padding: 11px 18px;
  border-radius: 999px;
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.4);
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
  z-index: 50;
}

.toast.show { opacity: 1; transform: translateY(0); }

.warn {
  font-size: 12px;
  line-height: 1.95;
  color: #ffd0c8;
  background: rgba(255, 122, 122, 0.12);
  border: 1px solid rgba(255, 122, 122, 0.45);
  border-radius: 14px;
  padding: 11px 13px;
}

.warn[hidden] { display: none; }

.foot {
  font-size: 11.5px;
  color: #8b96ba;
  text-align: center;
  padding: 4px 0 16px;
}

@media (max-width: 520px) {
  body { padding: 10px; }
  .topbar { padding: 13px; }
  .brand-text h1 { font-size: 15.5px; }
  .topbar-actions { width: 100%; }
  .topbar-actions .btn { flex: 1 1 auto; justify-content: center; font-size: 12px; padding: 8px 10px; }
  .stat .num { font-size: 20px; }
}