@font-face {
  font-family: 'Vazirmatn';
  src: url('/fonts/Vazirmatn[wght].woff2') format('woff2-variations');
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --bg: #0b0d14;
  --bg-2: #11141e;
  --panel: #161a26;
  --panel-2: #1d2231;
  --line: #262c3d;
  --line-2: #323a50;
  --text: #eef0f6;
  --muted: #9aa3b8;
  --dim: #6b7389;
  --brand: #7c5cff;
  --brand-2: #22d3ee;
  --brand-grad: linear-gradient(135deg, #7c5cff 0%, #4f8bff 50%, #22d3ee 100%);
  --ok: #22c55e;
  --warn: #f59e0b;
  --danger: #ef4444;
  --danger-soft: rgba(239, 68, 68, .14);
  --radius: 14px;
  --radius-lg: 20px;
  --shadow: 0 20px 50px rgba(0, 0, 0, .45);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: 'Vazirmatn', Tahoma, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "ss01";
}
a { color: var(--brand-2); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: rgba(124, 92, 255, .4); }
.ltr { direction: ltr; unicode-bidi: plaintext; }
.muted { color: var(--muted); }
.hidden { display: none !important; }

/* scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }

/* ---------- brand ---------- */
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; font-size: 20px; color: var(--text); }
.brand .mark {
  width: 36px; height: 36px; border-radius: 11px; background: var(--brand-grad);
  display: grid; place-items: center; box-shadow: 0 6px 20px rgba(124, 92, 255, .45);
}
.brand .mark svg { width: 20px; height: 20px; }
.brand b { background: var(--brand-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--line-2); background: var(--panel-2); color: var(--text);
  padding: 10px 18px; border-radius: 12px; cursor: pointer; font-weight: 600; font-size: 14px;
  transition: transform .12s, background .15s, border-color .15s, box-shadow .15s; white-space: nowrap;
}
.btn:hover { background: #252b3d; border-color: #3d4660; }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn.primary { background: var(--brand-grad); border-color: transparent; color: #fff; box-shadow: 0 8px 24px rgba(124, 92, 255, .35); }
.btn.primary:hover { box-shadow: 0 10px 30px rgba(124, 92, 255, .5); filter: brightness(1.08); }
.btn.danger { background: var(--danger); border-color: transparent; color: #fff; }
.btn.danger:hover { background: #dc2626; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: rgba(255, 255, 255, .06); }
.btn.sm { padding: 6px 12px; font-size: 13px; border-radius: 10px; }
.btn.block { width: 100%; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 10px; border: 0; background: transparent; color: var(--muted);
  display: inline-grid; place-items: center; cursor: pointer; transition: background .15s, color .15s;
}
.icon-btn:hover { background: rgba(255, 255, 255, .07); color: var(--text); }
.icon-btn svg { width: 20px; height: 20px; }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field label { font-size: 13px; color: var(--muted); font-weight: 600; }
.input {
  width: 100%; background: var(--bg-2); border: 1px solid var(--line-2); border-radius: 12px;
  padding: 12px 14px; outline: none; transition: border-color .15s, box-shadow .15s;
}
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(124, 92, 255, .18); }
textarea.input { resize: vertical; min-height: 80px; }
select.input { appearance: none; }

.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.switch:last-child { border-bottom: 0; }
.switch .s-text b { display: block; font-weight: 600; font-size: 14px; }
.switch .s-text small { color: var(--dim); font-size: 12px; }
.switch input { display: none; }
.switch .toggle { width: 44px; height: 24px; border-radius: 99px; background: var(--line-2); position: relative; transition: background .2s; flex: none; }
.switch .toggle::after { content: ''; position: absolute; top: 3px; right: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .2s; }
.switch input:checked + .toggle { background: var(--brand); }
.switch input:checked + .toggle::after { transform: translateX(-20px); }

/* ---------- cards & layout ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 24px; }
.container { max-width: 1180px; margin: 0 auto; padding: 0 20px; }

.topbar {
  position: sticky; top: 0; z-index: 20; backdrop-filter: blur(14px);
  background: rgba(11, 13, 20, .75); border-bottom: 1px solid var(--line);
}
.topbar .container { display: flex; align-items: center; justify-content: space-between; height: 68px; gap: 16px; }
.topbar nav { display: flex; gap: 6px; align-items: center; }
.topbar nav a { color: var(--muted); padding: 8px 14px; border-radius: 10px; font-weight: 600; font-size: 14px; }
.topbar nav a:hover, .topbar nav a.active { color: var(--text); background: rgba(255, 255, 255, .06); }
.user-chip { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 700;
  color: #fff; flex: none; font-size: 15px;
}

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 36px 0 24px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 28px; font-weight: 800; }
.page-head p { margin: 4px 0 0; color: var(--muted); }

.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 99px; background: rgba(255, 255, 255, .07); color: var(--muted); }
.badge.live { background: rgba(239, 68, 68, .15); color: #fca5a5; }
.badge.live::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--danger); animation: pulse 1.4s infinite; }
.badge.ok { background: rgba(34, 197, 94, .14); color: #86efac; }
.badge.brand { background: rgba(124, 92, 255, .18); color: #c4b5fd; }
.badge.warn { background: rgba(245, 158, 11, .15); color: #fcd34d; }
@keyframes pulse { 50% { opacity: .35; } }

/* ---------- table ---------- */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: right; color: var(--dim); font-weight: 600; font-size: 12px; padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr:hover td { background: rgba(255, 255, 255, .02); }

/* ---------- modal ---------- */
.modal-back {
  position: fixed; inset: 0; background: rgba(4, 6, 12, .7); backdrop-filter: blur(6px);
  display: grid; place-items: center; z-index: 100; padding: 16px; animation: fade .15s;
}
.modal { width: min(520px, 100%); max-height: calc(100vh - 32px); overflow: auto; background: var(--panel); border: 1px solid var(--line-2); border-radius: var(--radius-lg); box-shadow: var(--shadow); animation: pop .18s; }
.modal header { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.modal header h3 { margin: 0; font-size: 17px; }
.modal .body { padding: 22px; }
.modal footer { display: flex; gap: 10px; justify-content: flex-start; padding: 16px 22px; border-top: 1px solid var(--line); }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.98); } }

/* ---------- toast ---------- */
#toasts { position: fixed; bottom: 100px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: #252b3d; border: 1px solid var(--line-2); padding: 10px 18px; border-radius: 12px; box-shadow: var(--shadow); font-size: 14px; animation: pop .2s; max-width: 90vw; }
.toast.error { background: #3b1518; border-color: #7f1d1d; }
.toast.ok { background: #0f2e1d; border-color: #166534; }

/* ---------- copy box ---------- */
.copy-row { display: flex; align-items: center; gap: 8px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px; padding: 6px 6px 6px 12px; }
.copy-row .lbl { font-size: 12px; color: var(--dim); white-space: nowrap; padding-right: 6px; }
.copy-row code { flex: 1; direction: ltr; text-align: left; font-family: ui-monospace, monospace; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }

.empty { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty svg { width: 56px; height: 56px; opacity: .4; margin-bottom: 8px; }

.spinner { width: 22px; height: 22px; border: 3px solid rgba(255, 255, 255, .15); border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 640px) {
  .card { padding: 18px; }
  .page-head h1 { font-size: 22px; }
  .topbar nav a span { display: none; }
}
