/* فونت اختیاری: فایل Vazirmatn.woff2 را در static/fonts بگذارید */
@font-face {
  font-family: "Vazirmatn";
  src: url("/static/fonts/Vazirmatn.woff2") format("woff2");
  font-display: swap;
}

:root {
  --bg: #0b1114;
  --panel: #121b20;
  --panel-2: #172329;
  --line: #22323a;
  --text: #e6eef0;
  --muted: #8fa3aa;
  --accent: #5eead4;
  --accent-ink: #052a25;
  --warn: #fbbf24;
  --bad: #f87171;
  --ok: #4ade80;
  --radius: 14px;
  --nav-h: 62px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: "Vazirmatn", "Vazir", Tahoma, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.75;
  min-height: 100vh;
  -webkit-text-size-adjust: 100%;
}
button, input, select { font: inherit; color: inherit; }
.mono, code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; direction: ltr; unicode-bidi: isolate; }
.ltr { direction: ltr; unicode-bidi: isolate; display: inline-block; }
.boot { padding: 40px; text-align: center; color: var(--muted); }

/* ---------- layout ---------- */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.side {
  background: var(--panel);
  border-inline-end: 1px solid var(--line);
  padding: 20px 14px;
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 6px;
}
.brand { font-weight: 800; font-size: 18px; padding: 4px 10px 16px; letter-spacing: .3px; }
.brand b { color: var(--accent); }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav button {
  display: flex; align-items: center; gap: 10px; width: 100%;
  background: none; border: 0; border-radius: 10px; padding: 10px 12px;
  color: var(--muted); cursor: pointer; text-align: start;
}
.nav button:hover { background: var(--panel-2); color: var(--text); }
.nav button.on { background: rgba(94, 234, 212, .12); color: var(--accent); }
.nav svg { width: 20px; height: 20px; flex: none; }
.side .spacer { flex: 1; }
.who { display: flex; align-items: center; gap: 10px; padding: 10px; border-top: 1px solid var(--line); }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; background: var(--panel-2);
  display: grid; place-items: center; font-weight: 700; color: var(--accent); overflow: hidden; flex: none;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.who .n { font-size: 13px; line-height: 1.3; min-width: 0; }
.who .n div { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who .n small { color: var(--muted); }

main { padding: 28px clamp(16px, 3vw, 36px) 40px; max-width: 980px; width: 100%; }
h1 { margin: 0 0 4px; font-size: 22px; }
.sub { color: var(--muted); margin: 0 0 22px; }
h2 { font-size: 16px; margin: 0 0 12px; }

/* ---------- components ---------- */
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; margin-bottom: 16px;
}
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid .card { margin: 0; }
.stat { font-size: 30px; font-weight: 800; line-height: 1.2; }
.stat small { font-size: 14px; color: var(--muted); font-weight: 500; }
.label { color: var(--muted); font-size: 13px; margin-bottom: 4px; }

.badge { display: inline-block; padding: 2px 10px; border-radius: 99px; font-size: 12.5px; font-weight: 600; }
.badge.ok { background: rgba(74, 222, 128, .14); color: var(--ok); }
.badge.bad { background: rgba(248, 113, 113, .14); color: var(--bad); }
.badge.warn { background: rgba(251, 191, 36, .14); color: var(--warn); }

.bar { height: 8px; border-radius: 99px; background: var(--panel-2); overflow: hidden; margin: 12px 0 6px; }
.bar i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.bar.low i { background: var(--warn); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--accent); color: var(--accent-ink); font-weight: 700;
  border: 0; border-radius: 10px; padding: 10px 18px; cursor: pointer; min-height: 44px;
}
.btn:hover { filter: brightness(1.08); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
.btn.ghost:hover { background: var(--panel-2); }
.btn.danger { background: transparent; color: var(--bad); border: 1px solid rgba(248, 113, 113, .4); }
.btn.sm { min-height: 34px; padding: 4px 12px; font-size: 13px; }
.btn.block { width: 100%; }
.btn:focus-visible, .nav button:focus-visible, .tabs button:focus-visible, input:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}

input[type=text], input[type=search], input[type=number] {
  width: 100%; background: var(--bg); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; min-height: 44px;
}
input::placeholder { color: #5d7077; }
.field { margin-bottom: 14px; }
.field label { display: block; color: var(--muted); font-size: 13px; margin-bottom: 6px; }
.hint { color: var(--muted); font-size: 13px; margin-top: 10px; }

.tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 14px; scrollbar-width: thin; }
.tabs button {
  flex: none; background: var(--panel-2); border: 1px solid transparent; border-radius: 99px;
  padding: 6px 14px; color: var(--muted); cursor: pointer; white-space: nowrap;
}
.tabs button.on { color: var(--accent); border-color: rgba(94, 234, 212, .5); background: rgba(94, 234, 212, .08); }

.dns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.dns > div { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.dns .v { font-size: 17px; font-weight: 700; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.copy { background: none; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); padding: 2px 10px; cursor: pointer; font-size: 12px; }
.copy:hover { color: var(--accent); border-color: var(--accent); }

ol.steps { margin: 0; padding: 0; list-style: none; counter-reset: s; }
ol.steps li { counter-increment: s; display: flex; gap: 12px; padding: 8px 0; }
ol.steps li::before {
  content: counter(s); flex: none; width: 26px; height: 26px; border-radius: 50%;
  background: var(--panel-2); color: var(--accent); display: grid; place-items: center; font-size: 13px; font-weight: 700;
}

.list { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.row:first-child { border-top: 0; }
.row .grow { flex: 1; min-width: 160px; }
.row .t { font-weight: 600; }
.row .s { color: var(--muted); font-size: 13px; }
.empty { color: var(--muted); text-align: center; padding: 22px 8px; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; }
.detail { background: var(--bg); border-radius: 10px; padding: 12px; margin: 0 0 10px; width: 100%; }
.detail h3 { font-size: 13px; color: var(--muted); margin: 10px 0 6px; font-weight: 600; }
.inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline input { width: 110px; }

.notice { border: 1px solid rgba(251, 191, 36, .4); background: rgba(251, 191, 36, .07); border-radius: 12px; padding: 12px 14px; margin-bottom: 16px; }

.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login .box { max-width: 380px; width: 100%; text-align: center; }
.login h1 { font-size: 26px; }
#tg-widget { display: flex; justify-content: center; margin-top: 18px; min-height: 48px; }

#toast {
  position: fixed; inset-inline: 0; bottom: calc(var(--nav-h) + 16px); display: flex; justify-content: center;
  pointer-events: none; z-index: 50;
}
#toast div {
  background: var(--panel-2); border: 1px solid var(--line); padding: 10px 18px; border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, .4); max-width: 90vw;
}
#toast div.bad { border-color: rgba(248, 113, 113, .6); }

/* ---------- mobile: bottom tab bar ---------- */
@media (max-width: 800px) {
  .shell { display: block; }
  .side {
    position: fixed; inset-inline: 0; bottom: 0; top: auto; height: var(--nav-h);
    flex-direction: row; padding: 0 6px env(safe-area-inset-bottom); border-inline-end: 0;
    border-top: 1px solid var(--line); z-index: 20; gap: 0;
  }
  .brand, .who, .side .spacer { display: none; }
  .nav { flex-direction: row; width: 100%; justify-content: space-around; gap: 0; }
  .nav button { flex-direction: column; gap: 2px; font-size: 11.5px; padding: 8px 4px; justify-content: center; align-items: center; text-align: center; }
  main { padding-bottom: calc(var(--nav-h) + 30px); }
  .dns { grid-template-columns: 1fr; }
  #toast { bottom: calc(var(--nav-h) + 16px); }
}
@media (prefers-reduced-motion: no-preference) {
  .btn, .nav button, .tabs button { transition: background .15s, filter .15s, color .15s; }
}
