@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  --bg:        #0e1116;
  --bg-2:      #161b22;
  --panel:     #1b222c;
  --line:      #2a323d;
  --line-soft: #222a34;
  --txt:       #e6edf3;
  --txt-dim:   #8b97a6;
  --txt-faint: #5c6773;
  --accent:    #3ddc97;
  --accent-d:  #2bbd80;
  --danger:    #ff6b6b;
  --warn:      #f5b14c;
  --radius:    11px;
  --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --sans: 'Vazirmatn', system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--sans);
  background: var(--bg);
  background-image:
    radial-gradient(circle at 88% -10%, rgba(61,220,151,.08), transparent 42%),
    linear-gradient(transparent 95%, rgba(255,255,255,.015) 95%),
    linear-gradient(90deg, transparent 95%, rgba(255,255,255,.015) 95%);
  background-size: auto, 26px 26px, 26px 26px;
  color: var(--txt);
  line-height: 1.7;
  font-size: 14px;
}

/* ---------- نوار بالا ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 26px;
  border-bottom: 1px solid var(--line);
  background: rgba(14,17,22,.72);
  backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 20;
}
.brand {
  display: flex; align-items: center; gap: 9px;
  font-weight: 700; font-size: 16px; letter-spacing: .2px;
}
.brand .dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(61,220,151,.15), 0 0 12px var(--accent);
}

.wrap { max-width: 940px; margin: 0 auto; padding: 30px 22px 80px; }

.crumbs { color: var(--txt-dim); font-size: 13px; margin-bottom: 18px; }
.crumbs a { color: var(--txt-dim); text-decoration: none; }
.crumbs a:hover { color: var(--accent); }
.crumbs b { color: var(--txt); font-family: var(--mono); }
.crumbs span { margin: 0 6px; color: var(--txt-faint); }

.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  margin-bottom: 22px; gap: 16px; flex-wrap: wrap;
}
.page-head h1 { margin: 0; font-size: 24px; font-weight: 700; }
.muted { color: var(--txt-dim); margin: 2px 0 0; font-size: 13px; }
.head-actions { display: flex; gap: 10px; }

/* ---------- دکمه‌ها ---------- */
.btn {
  font-family: var(--sans); font-size: 13.5px; font-weight: 600;
  padding: 9px 16px; border-radius: 9px; border: 1px solid transparent;
  cursor: pointer; transition: .15s; white-space: nowrap;
}
.btn.sm { padding: 6px 12px; font-size: 12.5px; }
.btn.full { width: 100%; margin-top: 8px; }
.btn.primary { background: var(--accent); color: #06160e; }
.btn.primary:hover { background: var(--accent-d); }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--txt-dim); }
.btn.ghost:hover { border-color: var(--txt-dim); color: var(--txt); }
.btn.danger { color: var(--danger); }
.btn.danger.ghost { border-color: rgba(255,107,107,.3); }
.btn.danger.ghost:hover { border-color: var(--danger); background: rgba(255,107,107,.08); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- کارت / فهرست ---------- */
.card {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.list .row {
  display: flex; align-items: center; gap: 14px;
  padding: 15px 20px; text-decoration: none; color: var(--txt);
  border-bottom: 1px solid var(--line-soft); transition: background .12s;
}
.list .row:last-child { border-bottom: none; }
.zone-row:hover { background: var(--panel); }
.zone-name { font-family: var(--mono); font-weight: 600; font-size: 15px; flex: 1; }
.badge {
  font-size: 11px; font-family: var(--mono); color: var(--txt-dim);
  border: 1px solid var(--line); padding: 2px 8px; border-radius: 20px;
}
.chev { color: var(--txt-faint); font-size: 20px; transform: scaleX(-1); }
.empty { padding: 38px; text-align: center; color: var(--txt-faint); }

/* ---------- جدول رکوردها ---------- */
.rec-table { width: 100%; border-collapse: collapse; }
.rec-table th {
  text-align: right; font-size: 11.5px; font-weight: 600; color: var(--txt-dim);
  padding: 12px 16px; border-bottom: 1px solid var(--line);
  background: var(--panel); text-transform: uppercase; letter-spacing: .5px;
}
.rec-table td { padding: 13px 16px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.rec-table tr:last-child td { border-bottom: none; }
.rec-table tbody tr:hover { background: rgba(255,255,255,.018); }
.mono { font-family: var(--mono); font-size: 13px; }
.val { color: var(--txt); max-width: 360px; word-break: break-all; }
.actions { white-space: nowrap; text-align: left; }
.ic {
  background: transparent; border: 1px solid var(--line); color: var(--txt-dim);
  width: 30px; height: 30px; border-radius: 7px; cursor: pointer; font-size: 13px;
  margin-inline-start: 5px; transition: .12s;
}
.ic:hover { border-color: var(--accent); color: var(--accent); }
.ic.danger:hover { border-color: var(--danger); color: var(--danger); }

/* برچسب نوع رکورد — رنگ‌بندی برای خوانایی */
.type-tag {
  font-family: var(--mono); font-size: 11px; font-weight: 600;
  padding: 3px 9px; border-radius: 6px; display: inline-block;
  background: var(--line); color: var(--txt);
}
.t-a, .t-aaaa { background: rgba(61,220,151,.16); color: #6ff0bb; }
.t-cname     { background: rgba(110,168,255,.16); color: #9cc4ff; }
.t-mx        { background: rgba(245,177,76,.16); color: #f5c578; }
.t-txt       { background: rgba(186,140,255,.16); color: #c8aaff; }
.t-ns        { background: rgba(255,107,107,.15); color: #ff9b9b; }
.t-srv, .t-caa { background: rgba(120,200,255,.14); color: #a3d8ff; }

/* ---------- فرم / مودال ---------- */
label { display: block; font-size: 12.5px; color: var(--txt-dim); margin: 14px 0 6px; font-weight: 500; }
.hint { color: var(--txt-faint); font-size: 11px; font-weight: 400; }
input, select, textarea {
  width: 100%; background: var(--bg); border: 1px solid var(--line);
  color: var(--txt); padding: 10px 12px; border-radius: 8px;
  font-family: var(--mono); font-size: 13.5px; transition: border .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(61,220,151,.12);
}
textarea { resize: vertical; line-height: 1.6; }
select { font-family: var(--sans); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.modal-bg {
  position: fixed; inset: 0; background: rgba(6,9,13,.72);
  backdrop-filter: blur(3px); display: none;
  align-items: center; justify-content: center; z-index: 50; padding: 20px;
}
.modal-bg.open { display: flex; animation: fade .15s ease; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: 14px; padding: 24px; width: 100%; max-width: 420px;
  box-shadow: 0 24px 60px rgba(0,0,0,.55);
}
.modal.wide { max-width: 520px; }
.modal h3 { margin: 0 0 6px; font-size: 18px; }
.modal-actions { display: flex; justify-content: flex-start; gap: 10px; margin-top: 22px; }

.alert { padding: 11px 14px; border-radius: 9px; font-size: 13px; margin-top: 14px; }
.alert.err { background: rgba(255,107,107,.1); border: 1px solid rgba(255,107,107,.3); color: #ffb0b0; }
.hidden { display: none; }

/* ---------- صفحه‌ی ورود ---------- */
.auth-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.auth-card {
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: 16px; padding: 34px 30px; width: 100%; max-width: 360px;
  box-shadow: 0 24px 60px rgba(0,0,0,.5);
}
.auth-card .brand { font-size: 20px; justify-content: center; }
.auth-sub { text-align: center; color: var(--txt-dim); margin: 6px 0 22px; font-size: 13px; }

/* ---------- ناوبری بالا ---------- */
.topnav { display: flex; align-items: center; gap: 14px; }
.navlink { color: var(--txt-dim); text-decoration: none; font-size: 13.5px; font-weight: 600; }
.navlink:hover { color: var(--accent); }
.navuser { color: var(--txt-faint); font-family: var(--mono); font-size: 12.5px; }

/* ---------- پیوند زیر فرم احراز هویت ---------- */
.auth-alt { text-align: center; color: var(--txt-dim); margin: 18px 0 0; font-size: 13px; }
.auth-alt a { color: var(--accent); text-decoration: none; font-weight: 600; }
.auth-alt a:hover { text-decoration: underline; }

/* ---------- نشان مالک (پنل ادمین) ---------- */
.badge.owner { color: var(--accent); border-color: rgba(61,220,151,.3); }
.badge.owner.muted-badge { color: var(--txt-faint); border-color: var(--line); }

/* ---------- بالانسینگ ---------- */
.bal-pill {
  font-family: var(--mono); font-size: 10.5px; font-weight: 600;
  padding: 2px 7px; border-radius: 6px; display: inline-block;
  background: rgba(245,177,76,.16); color: var(--warn);
}
.bal-note { color: var(--txt-faint); font-size: 11px; font-family: var(--sans); margin-top: 4px; }

.balance-toggle { margin-top: 16px; }
.check { display: flex; align-items: center; gap: 9px; cursor: pointer; color: var(--txt); font-size: 13px; margin: 0; }
.check input { width: auto; }
.balance-panel {
  margin-top: 12px; padding: 14px; border: 1px dashed var(--line);
  border-radius: 10px; background: rgba(255,255,255,.015);
}
.geo-note { margin: 12px 0 0; }

/* چک‌باکس‌ها نباید مثل input‌های متنی تمام‌عرض شوند */
input[type="checkbox"] { width: auto; box-shadow: none; }

/* ---------- پنل ادمین ---------- */
.card.pad { padding: 20px; margin-bottom: 20px; }
.card-title { margin: 0 0 14px; font-size: 15px; }
.setting-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 12px 0; border-top: 1px solid var(--line-soft);
}
.setting-row:first-of-type { border-top: none; }
.setting-row .muted { font-size: 12px; }
.inline-set { display: flex; align-items: center; gap: 8px; }
.inline-set input { width: auto; }

.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-inline-end: 4px; }
.status-dot.on { background: var(--accent); box-shadow: 0 0 6px var(--accent); }
.status-dot.off { background: var(--txt-faint); }

/* کلید روشن/خاموش */
.switch { position: relative; display: inline-block; width: 44px; height: 24px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
  position: absolute; inset: 0; cursor: pointer; background: var(--line);
  border-radius: 24px; transition: .2s;
}
.switch .slider::before {
  content: ""; position: absolute; height: 18px; width: 18px; right: 3px; top: 3px;
  background: var(--txt-dim); border-radius: 50%; transition: .2s;
}
.switch input:checked + .slider { background: var(--accent); }
.switch input:checked + .slider::before { transform: translateX(-20px); background: #06160e; }

@media (max-width: 560px) {
  .grid2 { grid-template-columns: 1fr; }
  .val { max-width: 180px; }
  .wrap { padding: 22px 14px 60px; }
  .rec-table th:nth-child(4), .rec-table td:nth-child(4) { display: none; }
  .topnav { gap: 9px; }
  .navuser { display: none; }
}

/* ---------- نصاب (install.php) ---------- */
.install-wrap { max-width: 720px; }
.install-h1 { margin: 0 0 4px; font-size: 23px; font-weight: 700; }
.alert.warn { background: rgba(245,177,76,.1); border: 1px solid rgba(245,177,76,.32); color: #f5c578; }
code { font-family: var(--mono); background: var(--bg); border: 1px solid var(--line); padding: 1px 6px; border-radius: 6px; font-size: 12.5px; }

.req-list { list-style: none; margin: 0; padding: 0; }
.req-item { display: flex; align-items: flex-start; gap: 11px; padding: 9px 0; border-top: 1px solid var(--line-soft); }
.req-item:first-child { border-top: none; }
.req-ico {
  flex-shrink: 0; width: 22px; height: 22px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; margin-top: 2px;
}
.req-ico.ok   { background: rgba(61,220,151,.16); color: var(--accent); }
.req-ico.bad  { background: rgba(255,107,107,.16); color: var(--danger); }
.req-ico.warn { background: rgba(245,177,76,.16); color: var(--warn); }
.req-label { font-size: 13.5px; color: var(--txt); }
.req-detail { display: block; font-family: var(--mono); font-size: 11.5px; color: var(--txt-faint); margin-top: 2px; word-break: break-all; }

.install-actions { display: flex; align-items: center; gap: 12px; margin-top: 18px; flex-wrap: wrap; }
.install-submit { margin-bottom: 60px; }
.tls-check { margin-top: 16px; }

.probe-result { font-size: 13px; font-family: var(--sans); }
.probe-result.ok  { color: var(--accent); }
.probe-result.err { color: var(--danger); }

.install-body .card.pad { margin-bottom: 18px; }
