/* ============================================================
   لوحة السيرفر — نفس نظام تصميم AGENCY (Dark Metal / Chrome, RTL)
   ============================================================ */
@font-face {
  font-family: 'Cairo';
  src: url('/assets/Cairo.ttf') format('truetype');
  font-weight: 200 900;
  font-display: swap;
}
:root {
  --primary: #C6CFD8;
  --primary-dark: #98A2AC;
  --secondary: #4A525B;
  --bg: #0E1013;
  --card: #16191D;
  --card-2: #1E232A;
  --text: #E4E9EE;
  --muted: #7E8892;
  --border: #262C33;
  --gold: #E9EEF3;
  --stone: #6B747E;
  --metal: linear-gradient(140deg, #FFFFFF 0%, #C9D2DA 20%, #7C858E 46%, #EDF2F6 62%, #939CA5 82%, #DDE4EA 100%);
  --ok: #5FBF89;
  --ok-bg: rgba(95, 191, 137, .12);
  --warn: #D9A441;
  --err: #E06A6A;
  --err-bg: rgba(224, 106, 106, .12);
  --line: #1E242B;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .45);
  --shadow-lg: 0 26px 64px rgba(0, 0, 0, .62);
  --font: 'Cairo', Tahoma, sans-serif;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
body::before {
  content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background:
    radial-gradient(900px 520px at 50% -8%, rgba(190, 205, 220, .07), transparent 62%),
    radial-gradient(700px 460px at 6% 92%, rgba(140, 155, 170, .05), transparent 62%),
    radial-gradient(700px 460px at 94% 96%, rgba(140, 155, 170, .045), transparent 62%);
}
a { color: inherit; text-decoration: none; }

/* ---------- الشعار ---------- */
.brand { display: inline-flex; align-items: center; gap: 11px; font-weight: 800; font-size: 19px; }
.brand-mark { width: 38px; height: 38px; position: relative; flex-shrink: 0; transform-style: preserve-3d; animation: brandSpin 14s linear infinite; }
.brand-mark i {
  position: absolute; inset: 0; display: block;
  background: linear-gradient(135deg, #FFFFFF 0%, #C9D2DA 18%, #7C858E 42%, #EDF2F6 58%, #8C959E 78%, #DDE4EA 100%);
  clip-path: polygon(50% 4%, 96% 96%, 72% 96%, 50% 46%, 28% 96%, 4% 96%);
  filter: drop-shadow(0 3px 8px rgba(0, 0, 0, .6));
}
@keyframes brandSpin { to { transform: rotateY(360deg); } }
@media (prefers-reduced-motion: reduce) { .brand-mark { animation: none; } }
.metal-text {
  background: var(--metal); -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; font-weight: 800;
}

/* ---------- أزرار مجسّمة ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 20px; border: 1px solid var(--border); border-radius: 14px;
  background: linear-gradient(180deg, #262C34, #171B21);
  color: var(--text); font-family: var(--font); font-size: 14px; font-weight: 700;
  cursor: pointer; position: relative;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.09), 0 3px 0 #0A0C0F, 0 7px 16px -5px rgba(0,0,0,.6);
  transition: transform .16s cubic-bezier(.2,.7,.3,1), box-shadow .16s, border-color .2s;
}
.btn:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: inset 0 1px 0 rgba(255,255,255,.13), 0 5px 0 #0A0C0F, 0 12px 24px -6px rgba(0,0,0,.65); }
.btn:active { transform: translateY(1px); box-shadow: inset 0 1px 0 rgba(255,255,255,.06), 0 1px 0 #0A0C0F, 0 4px 10px -4px rgba(0,0,0,.6); }
.btn-primary {
  background: linear-gradient(180deg, #E8EDF2, #B9C3CC); color: #10141A; border-color: #8C959E;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.7), 0 3px 0 #6D767F, 0 8px 18px -5px rgba(0,0,0,.55);
}
.btn-primary:hover { box-shadow: inset 0 1px 0 rgba(255,255,255,.85), 0 5px 0 #6D767F, 0 14px 26px -6px rgba(0,0,0,.6); }
.btn-block { width: 100%; }

/* ---------- صفحة الدخول ---------- */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; position: relative; z-index: 1; }
.auth-side {
  background: linear-gradient(160deg, #05070A 0%, #171C22 55%, #2A323B 100%);
  color: #fff; padding: 60px; display: flex; flex-direction: column; justify-content: center;
  position: relative; overflow: hidden;
}
.auth-side:before {
  content: ''; position: absolute; width: 420px; height: 420px; border-radius: 50%;
  background: radial-gradient(circle, rgba(198,207,216,.18), transparent 70%); top: -120px; left: -120px;
}
.auth-side h2 { font-size: 30px; font-weight: 800; margin: 22px 0 12px; position: relative; }
.auth-side p { color: #B6BEC6; font-size: 15px; max-width: 380px; position: relative; }
.auth-points { margin-top: 30px; position: relative; }
.auth-points div { display: flex; gap: 10px; align-items: center; padding: 7px 0; font-size: 14px; color: #C9D2DA; }
.auth-points span.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--metal); flex-shrink: 0; }
.auth-form-col { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.auth-card { width: 100%; max-width: 420px; }
.auth-card h1 { font-size: 24px; font-weight: 800; margin-bottom: 6px; }
.auth-card .sub { color: var(--muted); font-size: 14px; margin-bottom: 24px; }

.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13.5px; font-weight: 700; margin-bottom: 7px; color: var(--muted); }
.field input {
  width: 100%; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--border);
  background: #10141A; color: var(--text); font-family: var(--font); font-size: 14.5px;
  transition: border-color .2s, box-shadow .2s;
}
.field input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(198,207,216,.10); }
.alert { padding: 11px 15px; border-radius: 14px; font-size: 13.5px; margin-bottom: 18px; font-weight: 600; }
.alert-err { background: var(--err-bg); color: var(--err); border: 1px solid rgba(224,106,106,.3); }
.auth-foot { text-align: center; margin-top: 20px; font-size: 13px; color: var(--stone); }

/* ---------- الهيكل الداخلي ---------- */
.topbar {
  position: relative; z-index: 2; display: flex; align-items: center; justify-content: space-between;
  padding: 16px 28px; border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #14181D, #0F1216);
}
.topbar .nav { display: flex; gap: 8px; align-items: center; }
.topbar .nav a {
  padding: 8px 15px; border-radius: 12px; font-size: 13.5px; font-weight: 700; color: var(--muted);
  transition: .18s; border: 1px solid transparent;
}
.topbar .nav a:hover { color: var(--text); background: var(--card-2); }
.topbar .nav a.active { color: var(--text); background: var(--card-2); border-color: var(--border); }
.wrap { position: relative; z-index: 1; max-width: 1180px; margin: 0 auto; padding: 30px 24px 60px; }
.page-head { margin-bottom: 24px; }
.page-head h1 { font-size: 26px; font-weight: 800; margin-bottom: 4px; }
.page-head .sub { color: var(--muted); font-size: 14px; }

/* ---------- بطاقات الإحصاء ---------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 26px; }
.stat {
  background: linear-gradient(180deg, var(--card-2), var(--card)); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow);
}
.stat .lbl { color: var(--muted); font-size: 12.5px; font-weight: 700; margin-bottom: 6px; }
.stat .val { font-size: 25px; font-weight: 800; }
.stat .val small { font-size: 13px; color: var(--muted); font-weight: 600; }

/* ---------- أدوات ---------- */
.tools { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 28px; }
.tool {
  display: flex; align-items: center; gap: 14px; padding: 18px 20px;
  background: linear-gradient(180deg, #262C34, #171B21); border: 1px solid var(--border);
  border-radius: var(--radius); cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.07), 0 4px 0 #0A0C0F, 0 10px 22px -8px rgba(0,0,0,.6);
  transition: transform .16s cubic-bezier(.2,.7,.3,1), box-shadow .16s, border-color .2s;
}
.tool:hover { border-color: var(--primary); transform: translateY(-3px); box-shadow: inset 0 1px 0 rgba(255,255,255,.12), 0 7px 0 #0A0C0F, 0 18px 32px -10px rgba(0,0,0,.65); }
.tool .ic { font-size: 26px; line-height: 1; }
.tool .t { font-weight: 800; font-size: 15px; }
.tool .d { color: var(--muted); font-size: 12.5px; }

/* ---------- الجداول ---------- */
.card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden; margin-bottom: 20px;
}
.card-head { padding: 16px 20px; border-bottom: 1px solid var(--line); font-weight: 800; font-size: 15.5px; display: flex; align-items: center; gap: 9px; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 13px 18px; text-align: right; border-bottom: 1px solid var(--line); font-size: 14px; }
th { background: #12161A; color: var(--muted); font-size: 12.5px; font-weight: 700; }
tr:last-child td { border-bottom: none; }
tbody tr { transition: background .15s; }
tbody tr:hover { background: rgba(198,207,216,.03); }
td .lnk { color: var(--primary); font-weight: 700; }
td .lnk:hover { text-decoration: underline; }
code {
  background: #10141A; border: 1px solid var(--border); padding: 3px 9px; border-radius: 8px;
  color: var(--primary); direction: ltr; display: inline-block; font-size: 13px;
  font-family: ui-monospace, Menlo, Consolas, monospace;
}
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 11px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.badge-ok { background: var(--ok-bg); color: var(--ok); }
.badge-err { background: var(--err-bg); color: var(--err); }
.badge-wait { background: rgba(126,136,146,.14); color: var(--muted); }
.dot-live { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.note { padding: 14px 20px; color: var(--muted); font-size: 13px; line-height: 1.9; border-top: 1px solid var(--line); background: #12161A; }
.copy { cursor: pointer; user-select: all; }
.copy:hover { border-color: var(--primary); }

/* ---------- عدّاد الدومينات الفرعية ---------- */
.subcount {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-width: 38px; padding: 4px 12px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--border); background: linear-gradient(180deg, #262C34, #171B21);
  color: var(--text); font-family: var(--font); font-size: 13px; font-weight: 700;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.07), 0 2px 0 #0A0C0F;
  transition: transform .15s cubic-bezier(.2,.7,.3,1), box-shadow .15s, border-color .2s;
}
.subcount:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: inset 0 1px 0 rgba(255,255,255,.12), 0 4px 0 #0A0C0F; }
.subcount:active { transform: translateY(1px); box-shadow: inset 0 1px 0 rgba(255,255,255,.06), 0 1px 0 #0A0C0F; }
.subcount.empty { opacity: .38; cursor: default; box-shadow: none; background: none; }
.subcount.empty:hover { transform: none; border-color: var(--border); box-shadow: none; }

/* ---------- مودال ---------- */
.modal-back {
  position: fixed; inset: 0; z-index: 90; display: none;
  background: rgba(5, 7, 10, .72); backdrop-filter: blur(3px);
  align-items: center; justify-content: center; padding: 24px;
}
.modal-back.open { display: flex; animation: fadeIn .16s ease; }
@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }
.modal {
  width: 100%; max-width: 520px; max-height: 82vh; overflow: auto;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); animation: popIn .18s cubic-bezier(.2,.7,.3,1);
}
@keyframes popIn { from { opacity: 0; transform: translateY(10px) scale(.98) } to { opacity: 1; transform: none } }
.modal-head {
  padding: 18px 22px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  position: sticky; top: 0; background: var(--card);
}
.modal-head h3 { font-size: 16.5px; font-weight: 800; }
.modal-head .x {
  width: 32px; height: 32px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--card-2); color: var(--muted); cursor: pointer; font-size: 17px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  transition: .18s; font-family: var(--font);
}
.modal-head .x:hover { color: var(--text); border-color: var(--primary); }
.modal-body { padding: 8px 0 12px; }
.dom-item {
  display: flex; align-items: center; gap: 11px; padding: 12px 22px;
  border-bottom: 1px solid var(--line); font-size: 14px;
}
.dom-item:last-child { border-bottom: none; }
.dom-item .n { color: var(--stone); font-size: 12px; min-width: 20px; }
.dom-item a { color: var(--primary); font-weight: 700; word-break: break-all; }
.dom-item a:hover { text-decoration: underline; }
.dom-item .tag { margin-inline-start: auto; font-size: 11.5px; padding: 2px 9px; border-radius: 999px; background: var(--card-2); color: var(--muted); flex-shrink: 0; }
.dom-item.primary .tag { background: rgba(198,207,216,.14); color: var(--primary); }

@media (max-width: 960px) {
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-side { display: none; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .tools { grid-template-columns: 1fr; }
  .wrap { padding: 20px 14px 40px; }
  .topbar { padding: 12px 16px; flex-wrap: wrap; gap: 10px; }
  table { display: block; overflow-x: auto; }

  /* ═══ اسم الموقع ودومينه سطرٌ واحد على الجوال ═══
     الالتفاف يقسم «تحكم ديسكورد» و«agency.mudar.net» سطرين، فيتضاعف
     ارتفاع كل صفّ ويصير الجدول ضعف طوله بلا فائدة.

     و`display:block` على الجدول نفسه لا يكفي: يجعله صندوقاً بعرض
     الحاوية فتُضغط الأعمدة ويلتف نصّها مهما منعناه. فالتمرير ينتقل
     إلى غلافٍ حوله، ويعود الجدول جدولاً يتمدّد بمقدار ما يحتاجه. */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

  .table-wrap .tbl-hosts {
    display: table;
    width: auto;
    min-width: 100%;
  }

  .tbl-hosts th,
  .tbl-hosts td { padding: 12px 12px; }

  .tbl-hosts th { white-space: nowrap; }

  .tbl-hosts td:nth-child(1),
  .tbl-hosts td:nth-child(2) { white-space: nowrap; }

  /* أعرض من أطول نصّ فيهما — «مغسلة السيارات» و«pos-fast.mudar.net» */
  .tbl-hosts td:nth-child(1) { min-width: 150px; }
  .tbl-hosts td:nth-child(2) { min-width: 175px; }
}
