@font-face { font-family: 'Vazirmatn'; src: url('/vendor/vazirmatn.woff2') format('woff2'); font-weight: 100 900; font-display: swap; }

:root {
  --font: 'Vazirmatn', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --bg: #121418; --bg-2: #1a1d23; --panel: rgba(31, 34, 41, .85); --panel-solid: #1f2229;
  --surface: rgba(255, 255, 255, .05); --surface-2: rgba(255, 255, 255, .09); --line: rgba(255, 255, 255, .08);
  --text: #f3f4f6; --muted: #a9b0ba; --accent: #ffc21a; --accent-ink: #1f2229; --accent-text: #ffc21a; --accent-soft: rgba(255, 194, 26, .14);
  --blue: #4fa3ff; --amber: #ff7a1a; --red: #ff5d73; --violet: #a78bfa;
  --shadow: 0 20px 60px rgba(0, 0, 0, .5); --glow: 0 0 0 1px rgba(255, 194, 26, .4), 0 0 24px rgba(255, 194, 26, .2);
  --r: 16px; color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: radial-gradient(1200px 600px at 80% -10%, rgba(255, 194, 26, .07), transparent), var(--bg); color: var(--text); font: 14px/1.5 var(--font); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
a { color: var(--accent-text); text-decoration: none; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: 12.5px; direction: ltr; unicode-bidi: embed; }
.nowrap { white-space: nowrap; }

/* ---------- Login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: min(420px, 100%); padding: 32px; border-radius: 28px; background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow); backdrop-filter: blur(20px); }
.login-card .logo { width: 52px; height: 52px; border-radius: 14px; box-shadow: var(--glow); }
.login-card h1 { margin: 16px 0 4px; font-size: 24px; }
.login-card p { margin: 0 0 20px; color: var(--muted); }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 12.5px; color: var(--muted); }
.input, select, textarea {
  width: 100%; padding: 11px 13px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); outline: none; transition: border-color .15s, box-shadow .15s;
}
.input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: var(--glow); }
textarea { min-height: 80px; resize: vertical; }
select option { background: var(--panel-solid); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 16px; border-radius: 12px; font-weight: 600; background: var(--surface-2); border: 1px solid var(--line); transition: all .15s; white-space: nowrap; }
.btn:hover { background: rgba(255, 255, 255, .14); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; box-shadow: var(--glow); }
.btn.primary:hover { filter: brightness(1.07); }
.btn.danger { color: var(--red); }
.btn.small { padding: 5px 10px; font-size: 12.5px; border-radius: 9px; }
.btn.block { width: 100%; padding: 12px; }
.btn:disabled { opacity: .5; cursor: default; }

/* ---------- Shell ---------- */
.shell { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; padding: 18px 12px; border-inline-end: 1px solid var(--line); background: rgba(10, 14, 19, .7); backdrop-filter: blur(16px); display: flex; flex-direction: column; gap: 4px; }
.side .brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; }
.side .brand img { width: 34px; height: 34px; border-radius: 10px; box-shadow: var(--glow); }
.side .brand b { font-size: 17px; display: block; }
.side .brand span { font-size: 11.5px; color: var(--muted); }
.nav { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 11px; color: var(--muted); font-weight: 500; text-align: start; width: 100%; }
.nav:hover { background: var(--surface); color: var(--text); }
.nav.active { background: var(--accent-soft); color: var(--accent-text); box-shadow: inset 2px 0 0 var(--accent); }
[dir="rtl"] .nav.active { box-shadow: inset -2px 0 0 var(--accent); }
.nav .count { margin-inline-start: auto; font-size: 11px; padding: 1px 7px; border-radius: 999px; background: var(--amber); color: #201400; font-weight: 700; }
.side .spacer { flex: 1; }
.side .me { padding: 10px 12px; border-radius: 12px; background: var(--surface); font-size: 12.5px; }
.side .me b { display: block; font-size: 13px; }
.main { padding: 24px 28px 60px; min-width: 0; }
.head { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.head h1 { margin: 0; font-size: 22px; flex: 1; }
.head .sub { width: 100%; color: var(--muted); margin-top: -8px; font-size: 13px; }

/* ---------- Cards & grids ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; box-shadow: 0 6px 24px rgba(0, 0, 0, .25); }
.card h3 { margin: 0 0 12px; font-size: 14px; color: var(--muted); font-weight: 600; letter-spacing: .3px; display: flex; align-items: center; gap: 8px; }
.grid { display: grid; gap: 14px; }
.kpis { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); margin-bottom: 14px; }
.kpi { position: relative; overflow: hidden; }
.kpi .v { font-size: 28px; font-weight: 800; letter-spacing: -.5px; font-variant-numeric: tabular-nums; }
.kpi .l { color: var(--muted); font-size: 12.5px; }
.kpi .bar { position: absolute; inset-inline-start: 0; top: 0; bottom: 0; width: 3px; background: var(--c, var(--accent)); box-shadow: 0 0 14px var(--c, var(--accent)); }
.two { grid-template-columns: 1.4fr 1fr; }
.three { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 1200px) { .two, .three { grid-template-columns: 1fr; } }
.mapbox { height: 420px; border-radius: 14px; overflow: hidden; border: 1px solid var(--line); }
.mapbox.tall { height: 520px; }
.chart svg { width: 100%; height: auto; overflow: visible; }
.chart .axis { fill: var(--muted); font-size: 10px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 8px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-inline-end: 6px; vertical-align: middle; }
.health { display: flex; flex-direction: column; gap: 10px; }
.health .row { display: flex; align-items: center; gap: 10px; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--red); box-shadow: 0 0 10px var(--red); flex: none; }
.dot.ok { background: var(--accent); box-shadow: 0 0 10px var(--accent); }
.bars .b { display: flex; align-items: center; gap: 10px; margin: 6px 0; font-size: 13px; }
.bars .b span:first-child { width: 120px; color: var(--muted); }
.bars .track { flex: 1; height: 8px; border-radius: 4px; background: var(--surface); overflow: hidden; }
.bars .fill { height: 100%; border-radius: 4px; background: var(--c, var(--accent)); box-shadow: 0 0 10px var(--c, var(--accent)); }

/* ---------- Tables ---------- */
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.toolbar .input, .toolbar select { width: auto; min-width: 150px; padding: 8px 11px; }
.toolbar .grow { flex: 1; }
.table-wrap { overflow: auto; border-radius: var(--r); border: 1px solid var(--line); background: var(--panel); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 11px 14px; text-align: start; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 11.5px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .4px; background: rgba(255, 255, 255, .02); position: sticky; top: 0; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--surface); }
tr.clickable { cursor: pointer; }
.actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.empty { padding: 40px; text-align: center; color: var(--muted); }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; background: var(--surface-2); white-space: nowrap; }
.pill.green { background: rgba(255, 194, 26, .16); color: var(--accent-text); }
.pill.amber { background: rgba(247, 185, 85, .15); color: var(--amber); }
.pill.red { background: rgba(255, 93, 115, .15); color: var(--red); }
.pill.blue { background: rgba(79, 163, 255, .15); color: var(--blue); }
.pill.violet { background: rgba(167, 139, 250, .15); color: var(--violet); }
.more { display: flex; justify-content: center; padding: 14px; }

/* ---------- Modal & toast ---------- */
.backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, .55); backdrop-filter: blur(4px); z-index: 50; display: grid; place-items: center; padding: 20px; animation: fade .15s; }
.modal { width: min(640px, 100%); max-height: calc(100vh - 40px); overflow: auto; background: var(--panel-solid); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow); padding: 22px; animation: rise .2s cubic-bezier(.2, .8, .2, 1); }
.modal.wide { width: min(980px, 100%); }
.modal h2 { margin: 0 0 16px; font-size: 18px; display: flex; align-items: center; gap: 10px; }
.modal h2 .x { margin-inline-start: auto; }
.modal .foot { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.form-grid .full { grid-column: 1 / -1; }
.checks { display: flex; flex-wrap: wrap; gap: 8px; }
.checks label { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); font-size: 12.5px; cursor: pointer; }
.secret { padding: 14px; border-radius: 12px; background: rgba(255, 194, 26, .1); border: 1px dashed var(--accent); word-break: break-all; }
.kv { display: grid; grid-template-columns: 160px 1fr; gap: 6px 14px; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-word; }
pre.json { margin: 0; padding: 12px; border-radius: 10px; background: var(--surface); overflow: auto; max-height: 260px; font-size: 12px; direction: ltr; text-align: left; }
.toast { position: fixed; z-index: 60; bottom: 22px; left: 50%; transform: translateX(-50%); padding: 11px 18px; border-radius: 14px; background: var(--panel-solid); border: 1px solid var(--line); box-shadow: var(--shadow); animation: rise .2s; }
.toast.err { border-color: var(--red); color: var(--red); }
.verify { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: 14px; margin-bottom: 14px; }
.verify.ok { background: rgba(255, 194, 26, .1); border: 1px solid rgba(255, 194, 26, .45); }
.verify.bad { background: rgba(255, 93, 115, .08); border: 1px solid rgba(255, 93, 115, .5); }
.verify svg { width: 26px; height: 26px; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
@keyframes fade { from { opacity: 0; } }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; border-inline-end: 0; border-bottom: 1px solid var(--line); }
  .side .brand, .side .spacer, .side .me { display: none; }
  .nav { width: auto; }
  .main { padding: 16px; }
  .form-grid { grid-template-columns: 1fr; }
}
