/* Falcon — التصميم الموحّد (نفس شكل الـ Demo panel)
   يُحمَّل بعد style.css ويغيّر الشكل فقط — كل الـ IDs والكلاسات اللي يستخدمها panel.js باقية */
@import url('https://fonts.googleapis.com/css2?family=Sora:wght@400;500;600;700&family=DM+Sans:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&family=IBM+Plex+Sans+Arabic:wght@400;500;600;700&display=swap');

:root {
  --bg: #000000; --bg2: #0A0A0A; --panel: #101010; --panel2: #181818;
  --line: #222222; --line2: #2E2E2E;
  --text: #F5F5F5; --muted: #9A9A9A; --dim: #5C5C5C;
  --surface: #101010; --surface2: #141414; --surface3: #181818;
  --border: #222222; --border2: #2E2E2E; --faint: #5C5C5C;
  --blue: #D0D0D0; --accent: #FFFFFF;
  --r: 10px; --rs: 6px; --radius: 10px;
  --font: "DM Sans", "IBM Plex Sans Arabic", system-ui, -apple-system, "Segoe UI", sans-serif;
  --head: "Sora", "IBM Plex Sans Arabic", "DM Sans", system-ui, sans-serif;
  color-scheme: dark;
}
html[dir="rtl"] { --font: "IBM Plex Sans Arabic", "DM Sans", system-ui, sans-serif; --head: "IBM Plex Sans Arabic", "Sora", system-ui, sans-serif; }
*, *::before, *::after { box-sizing: border-box; }
html, body { background: var(--bg); }
body { font-family: var(--font); font-size: 14px; color: var(--text); }
h1, h2, h3, h4 { font-family: var(--head); letter-spacing: -.01em; }
a { color: inherit; text-decoration: none; }
a:hover { color: inherit; }
:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.mono, code { font-family: "JetBrains Mono", ui-monospace, monospace; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- buttons / inputs ---------- */
.btn, button.btn, a.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 16px; border-radius: var(--rs); border: 1px solid var(--line2);
  background: var(--panel2); color: var(--text); font-weight: 500; font-size: 13.5px;
  font-family: inherit; cursor: pointer; text-decoration: none;
  transition: background .15s, border-color .15s, box-shadow .2s;
}
.btn:hover { background: #222; border-color: #444; color: var(--text); }
.btn.gold, .btn-primary, .btn.btn-primary { background: #fff; color: #000; border-color: #fff; }
.btn.gold:hover, .btn-primary:hover { background: #fff; color: #000; box-shadow: 0 0 24px rgba(255,255,255,.35); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--panel2); border-color: var(--line2); color: var(--text); }
.btn.sm, .btn.btn-sm { padding: 6px 11px; font-size: 13px; }
.btn.danger, .btn-danger, .btn-danger-soft { background: #fff; color: #000; border-color: #fff; }
.btn.danger:hover, .btn-danger:hover { background: #e5e5e5; }
.btn-monitor, .btn-warn, .btn-success { background: var(--panel2); color: var(--text); border-color: var(--line2); }
.btn-monitor:hover, .btn-warn:hover, .btn-success:hover { border-color: #fff; }
.btn svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

input, select, textarea {
  background: var(--bg2); border: 1px solid var(--line); color: var(--text);
  border-radius: var(--rs); font-family: inherit;
}
input:focus, select:focus, textarea:focus { border-color: #555; box-shadow: none; }
input::placeholder, textarea::placeholder { color: var(--dim); }

.card, .info-card, .ws-card, .cfg-card, .set-block, .chart-card, .chart-wrap, .an-chart-box, .custom-section {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r);
}
.item, .ban-card, .server-row { background: var(--panel); border-color: var(--line); }
.item:hover, .ban-card:hover, .server-row:hover { background: var(--panel2); border-color: var(--line2); }
.empty { color: var(--muted); }

.badge, .tag { border-radius: 99px; font-weight: 500; }
.badge.green, .badge-on, .badge-online { background: #fff; color: #000; }
.badge.yellow, .badge-warn, .badge.owner { background: transparent; color: #fff; border: 1px solid #fff; }
.badge.red, .badge-off, .badge-exp { background: transparent; color: #bdbdbd; border: 1px solid #555; }
.ok { color: #fff; }

.toggle.on, .switch input:checked + .slider { background: #fff; border-color: #fff; }
.switch input:checked + .slider:before { background: #000; }
.cfg-tab.active, .cfg-tab.on, .ws-tab.on { background: #fff; color: #000; border-color: #fff; }

.an-tooltip .dot.p, .lg-p i { background: #fff; }
.an-tooltip .dot.b, .lg-b i { background: #7a7a7a; }
.an-tooltip .an-t { color: #fff; }
.an-stat { background: var(--bg2); border: 1px solid var(--line); border-radius: 8px; }
.an-stat b { color: #fff; font-family: var(--head); }
.an-stat span { color: var(--muted); }
.leaflet-container { background: #050505 !important; }

.toast, #toast.toast { background: #fff; color: #000; border: 1px solid var(--line2); border-radius: 8px; }
#toast.toast.err { background: #fff; color: #000; }
#toast.toast.ok { background: #fff; color: #000; }

.modal-bg, .ban-detail-back, .fl-confirm-back, .fl-prompt-back { background: rgba(0,0,0,.8) !important; }
.modal-box, .ban-detail, .fl-confirm, .fl-prompt {
  background: var(--panel) !important; border: 1px solid var(--line) !important; border-radius: var(--r) !important;
}
.modal-box input, .modal-box select { background: var(--bg2) !important; border-color: var(--line) !important; border-radius: var(--rs) !important; }

/* ---------- APP SHELL (sidebar + top bar) ---------- */
.fx-app { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 100vh; }
.fx-side {
  background: var(--bg2); border-inline-end: 1px solid var(--line);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto;
  width: auto; padding: 0; align-items: stretch; gap: 0;
}
.fx-side .srv { display: flex; align-items: center; gap: 10px; padding: 14px; border-bottom: 1px solid var(--line); }
.fx-side .srv img { width: 28px; height: 28px; border-radius: 6px; object-fit: contain; margin: 0; }
.fx-side .srv b { font-family: var(--head); font-weight: 600; font-size: 14px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 170px; }
.fx-side .srv span { font-size: 11.5px; color: var(--muted); }
.fx-side nav { padding: 6px 10px 20px; display: flex; flex-direction: column; }
.fx-side .grp {
  display: flex; align-items: center; gap: 9px; padding: 8px 10px; margin-top: 10px;
  color: var(--muted); font-weight: 500; font-size: 13px; border-radius: 6px; cursor: pointer; user-select: none;
}
.fx-side .grp .chev { margin-inline-start: auto; font-size: 10px; transition: transform .15s; }
.fx-side .grp.closed .chev { transform: rotate(-90deg); }
.fx-side .grp.closed + .sub { display: none; }
.fx-side .nav-item, .fx-side .it {
  width: auto; min-height: 0; flex-direction: row; justify-content: flex-start;
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; margin: 1px 0;
  border-radius: 6px; color: var(--muted); font-weight: 500; font-size: 13.5px; letter-spacing: 0;
  background: transparent; border: 0; box-shadow: none; text-align: start; font-family: inherit; cursor: pointer;
}
.fx-side .sub .nav-item, .fx-side .sub .it { padding-inline-start: 22px; }
.fx-side .nav-item i, .fx-side .it i { width: 16px; font-size: 14px; text-align: center; }
.fx-side .nav-item:hover, .fx-side .it:hover { color: var(--text); background: var(--panel); }
.fx-side .nav-item.active, .fx-side .it.on { color: #000; background: #fff; font-weight: 600; box-shadow: none; }
.fx-side .user { margin-top: auto; padding: 14px; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.fx-side .user img { width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--line2); background: #222; }
.fx-side .user b { display: block; font-size: 13px; }
.fx-side .user span { font-size: 11.5px; color: var(--muted); }
.fx-side .user .grow { flex: 1; min-width: 0; }

.fx-main { display: flex; flex-direction: column; min-width: 0; }
.fx-top {
  display: flex; align-items: center; gap: 12px; padding: 12px 22px;
  border-bottom: 1px solid var(--line); background: var(--bg2);
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5;
}
.fx-top h1 { font-size: 17px; font-weight: 600; margin: 0; }
.fx-top .grow { flex: 1; }
.fx-top .burger { display: none; }
.fx-top .lang-btn, .fx-top .icon-btn {
  background: transparent; border: 1px solid var(--line2); color: var(--muted);
  padding: 6px 11px; border-radius: var(--rs); font-size: 13px; cursor: pointer; font-family: inherit;
  display: inline-flex; align-items: center; gap: 6px;
}
.fx-top .lang-btn:hover, .fx-top .icon-btn:hover { color: var(--text); background: var(--panel2); border-color: #444; }
.fx-content { padding: 22px; flex: 1; min-width: 0; overflow-x: hidden; }
.fx-content > .tab-pane > h1 { font-size: 22px; margin-bottom: 14px; }
.fx-content h1 { font-family: var(--head); }
.fx-overlay { display: none; }

/* panel.html sections look */
.fx-content .grid-3 { gap: 14px; }
.fx-content .card { padding: 18px 20px; }
.fx-content .card-head { font-family: var(--head); font-weight: 600; color: var(--text); }
.fx-content .card-head i, .fx-content .card-line i { color: var(--muted); }
.fx-content .hint { color: var(--muted); }
.admins-table th, .ws-table th { color: var(--muted); font-weight: 500; border-bottom: 1px solid var(--line); }
.admins-table td, .ws-table td { border-bottom: 1px solid var(--line); }
.perm-pill, .perm-pill.all { background: var(--panel2); color: var(--text); border: 1px solid var(--line2); }

@media (max-width: 820px) {
  .fx-app { grid-template-columns: minmax(0, 1fr); }
  .fx-side {
    position: fixed; inset-block: 0; inset-inline-start: 0; width: 260px; z-index: 30;
    transform: translateX(-100%); transition: transform .2s; padding-top: env(safe-area-inset-top, 0px);
  }
  html[dir="rtl"] .fx-side { transform: translateX(100%); }
  .fx-side.open, html[dir="rtl"] .fx-side.open { transform: none; }
  .fx-overlay.open { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 25; }
  .fx-top .burger { display: inline-flex; }
  .fx-top .hide-sm { display: none; }
  .fx-content { padding: 16px; }
}

/* اللوقو أسود — نقلبه أبيض عشان يبان على الخلفية السوداء */
img[src*="logo.png"] { filter: invert(1); }
[hidden] { display: none !important; }
/* أرقام الشارت ما تنقص في العربي */
canvas { direction: ltr; }
/* العنوان موجود في الشريط العلوي — ما نكرره داخل الصفحة */
.fx-content > .tab-pane > h1 { display: none; }

/* ---------- اختيار السيرفر (أعلى القائمة) ---------- */
.srv-switch {
  display: flex; align-items: center; gap: 10px; margin: 12px 12px 6px; padding: 10px 12px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r);
  color: var(--text); font-family: inherit; text-align: start; cursor: pointer; width: calc(100% - 24px);
  transition: border-color .15s, background .15s;
}
.srv-switch:hover, .srv-switch.open { border-color: #444; background: var(--panel2); }
.srv-switch.static { cursor: default; }
.srv-switch.static:hover { border-color: var(--line); background: var(--panel); }
.srv-switch .srv-ic {
  width: 34px; height: 34px; flex: none; border-radius: 8px; display: grid; place-items: center;
  background: var(--bg2); border: 1px solid var(--line2); color: #fff;
}
.srv-switch .srv-ic img { width: 22px; height: 22px; object-fit: contain; }
.srv-switch .srv-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.srv-switch .srv-txt b { font-family: var(--head); font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.srv-switch .srv-txt span { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.srv-switch .updown { color: var(--muted); font-size: 11px; }
.srv-pop {
  position: fixed; z-index: 60; width: 260px; max-height: 70vh; overflow: auto;
  background: var(--panel); border: 1px solid var(--line2); border-radius: var(--r);
  box-shadow: 0 20px 60px rgba(0,0,0,.7); padding: 6px;
}
.srv-pop .h { font-size: 12px; color: var(--muted); padding: 6px 10px 8px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.srv-pop a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 6px; color: var(--text); font-size: 13.5px; }
.srv-pop a:hover { background: var(--panel2); }
.srv-pop a.cur { background: #fff; color: #000; }
.srv-pop a .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.srv-pop a small { color: inherit; opacity: .6; font-size: 11.5px; }
.srv-pop .ic { width: 26px; height: 26px; border-radius: 6px; border: 1px solid var(--line2); display: grid; place-items: center; flex: none; font-size: 12px; }
.srv-pop a.cur .ic { border-color: rgba(0,0,0,.2); }
.srv-pop .sep { height: 1px; background: var(--line); margin: 4px 0; }
.side-search { display: flex; align-items: center; gap: 8px; margin: 8px 12px 4px; padding: 8px 12px; background: var(--bg); border: 1px solid var(--line); border-radius: var(--rs); color: var(--dim); }
.side-search input { background: none; border: 0; outline: none; padding: 0; flex: 1; min-width: 0; color: var(--text); font-size: 13px; width: auto; }
.fx-top .top-note {
  display: flex; align-items: center; gap: 10px; background: linear-gradient(90deg, rgba(255,255,255,.12), rgba(255,255,255,.02));
  border: 1px solid #333; border-radius: 8px; padding: 6px 12px; font-size: 12.5px; color: #fff;
}
html[dir="rtl"] .fx-top .top-note { background: linear-gradient(270deg, rgba(255,255,255,.12), rgba(255,255,255,.02)); }

/* ---------- عناصر الصفحات ---------- */
.page { display: flex; flex-direction: column; gap: 16px; }
.card.pad { padding: 18px 20px; }
.card-t { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.card-t h3 { font-size: 15px; margin: 0; color: var(--text); }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.kpi { position: relative; overflow: hidden; background: linear-gradient(180deg, #141414, #0c0c0c); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; }
.kpi span { display: block; color: var(--muted); font-size: 12.5px; }
.kpi b { display: block; font-family: var(--head); font-size: 30px; font-weight: 700; line-height: 1.2; margin-top: 4px; color: #fff; }
.kpi small { color: var(--dim); font-size: 12px; }
.kpi::after { content: ""; position: absolute; inset-inline-end: -30px; top: -30px; width: 110px; height: 110px; border-radius: 50%; background: radial-gradient(circle, rgba(255,255,255,.045), transparent 70%); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.rows { display: flex; flex-direction: column; }
.rows .r { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.rows .r:last-child { border-bottom: 0; }
.rows .r b { display: block; font-weight: 600; }
.quick { display: flex; gap: 10px; flex-wrap: wrap; }
.quick .btn { flex: 1; min-width: 160px; padding: 12px; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.toolbar .grow, .grow { flex: 1; }
.fx-search { display: flex; align-items: center; gap: 8px; background: var(--bg2); border: 1px solid var(--line); border-radius: var(--rs); padding: 8px 12px; color: var(--dim); min-width: 260px; }
.fx-search input { background: none; border: 0; outline: none; padding: 0; flex: 1; min-width: 0; color: var(--text); width: auto; }
.seg { display: inline-flex; background: var(--bg2); border: 1px solid var(--line); border-radius: 7px; padding: 2px; flex-wrap: wrap; }
.seg span { padding: 5px 11px; border-radius: 5px; font-size: 12.5px; color: var(--muted); cursor: pointer; user-select: none; }
.seg span:hover { color: var(--text); }
.seg span.on { background: #fff; color: #000; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 99px; font-size: 12px; font-weight: 500; border: 1px solid var(--line2); color: var(--muted); white-space: nowrap; }
.pill.on { background: #fff; color: #000; border-color: #fff; }
.pill.line { border-color: #fff; color: #fff; }
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #444; margin-inline-end: 4px; }
.dot.on { background: #fff; box-shadow: 0 0 0 3px rgba(255,255,255,.15); }
.scrollx { overflow-x: auto; max-width: 100%; }
.fx-table { width: 100%; border-collapse: collapse; }
.fx-table th { text-align: start; font-weight: 500; color: var(--muted); font-size: 12.5px; padding: 11px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.fx-table td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; white-space: nowrap; }
.fx-table tr:last-child td { border-bottom: 0; }
.fx-table tbody tr:hover td { background: rgba(255,255,255,.02); }
.fx-table td.empty { text-align: center; padding: 30px; }
.acts-cell { text-align: end; }
.acts-cell .btn, .menu-wrap .btn { padding: 6px 9px; }
.menu-wrap { display: inline-flex; gap: 6px; }
.fx-menu {
  position: fixed; z-index: 70; min-width: 190px; background: var(--panel); border: 1px solid var(--line2);
  border-radius: 8px; padding: 5px; box-shadow: 0 16px 50px rgba(0,0,0,.7);
}
.fx-menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; background: none; color: var(--text); font-family: inherit; font-size: 13px; border-radius: 5px; cursor: pointer; text-align: start; }
.fx-menu button i { width: 14px; color: var(--muted); }
.fx-menu button:hover { background: var(--panel2); }
.fx-menu button.danger { color: #fff; border-top: 1px solid var(--line); border-radius: 0 0 5px 5px; margin-top: 4px; }
.fx-menu button.danger:hover { background: #fff; color: #000; }
.fx-menu button.danger:hover i { color: #000; }
.fx-modal { position: fixed; inset: 0; background: rgba(0,0,0,.8); display: grid; place-items: center; z-index: 80; padding: 20px; animation: fade .15s ease; }
.fx-modal-card { width: 100%; max-width: 460px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 24px; box-shadow: 0 30px 80px rgba(0,0,0,.8); }
.fx-modal-card h3 { font-size: 18px; margin: 0 0 6px; color: #fff; }
.fx-modal-card p { margin: 0 0 6px; font-size: 13px; }
.fx-modal-card label { display: block; font-size: 12.5px; color: var(--muted); margin: 14px 0 6px; }
.fx-in { width: 100%; background: var(--bg2); border: 1px solid var(--line); border-radius: var(--rs); padding: 10px 12px; color: var(--text); font-family: inherit; font-size: 14px; outline: none; }
.fx-in:focus { border-color: #555; }
.fx-modal-card .acts { display: flex; justify-content: flex-end; gap: 8px; margin-top: 22px; }
.codes-out { background: var(--bg); border: 1px solid var(--line); border-radius: var(--rs); padding: 12px 14px; margin: 14px 0 10px; font-size: 13.5px; line-height: 1.8; max-height: 260px; overflow: auto; user-select: all; direction: ltr; text-align: left; }
.fx-toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%) translateY(20px);
  background: #fff; color: #000; padding: 10px 16px; border-radius: 8px; font-size: 13px; font-weight: 500;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 99; box-shadow: 0 10px 30px rgba(0,0,0,.4);
}
.fx-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
@media (max-width: 1000px) { .kpis { grid-template-columns: 1fr 1fr; } .two { grid-template-columns: 1fr; } }
@media (max-width: 820px) { .fx-search { min-width: 0; flex: 1; } .fx-top .btn.gold .lbl { display: none; } }

/* ---------- صفحة "عام" في البنل (بطاقات الـ Demo) ---------- */
.dash-top { display: grid; grid-template-columns: 1.2fr 2fr; gap: 14px; margin-bottom: 14px; }
.srvcard { padding: 20px 22px !important; display: flex; justify-content: space-between; align-items: flex-start; gap: 12px;
  background: radial-gradient(400px 160px at 100% 0%, rgba(255,255,255,.08), transparent 70%), var(--panel) !important; }
.srvcard h2 { font-family: var(--head); font-size: 26px; font-weight: 600; margin: 0; color: #fff; }
.srvcard p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.lic { padding: 18px 22px !important; display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; align-items: center; }
.lic .k { color: var(--muted); font-size: 12.5px; }
.lic .v { font-family: var(--head); font-weight: 600; font-size: 16px; color: #fff; margin-top: 2px; }
@media (max-width: 1100px) { .dash-top { grid-template-columns: 1fr; } }
@media (max-width: 600px) { .lic { grid-template-columns: 1fr 1fr; } }

/* لمسات عامة على البنل */
.fx-content .card { background: linear-gradient(180deg, #121212, #0d0d0d); transition: border-color .2s; }
.fx-content .card:hover { border-color: #2c2c2c; }
.fx-content .tab-pane.active { animation: fxIn .22s ease both; }
@keyframes fxIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.fx-content .card-head { padding-bottom: 12px; margin-bottom: 8px; border-bottom: 1px solid var(--line); }
.fx-side { scrollbar-width: thin; scrollbar-color: #222 transparent; }
.fx-side .user .btn { padding: 6px 9px; }

/* ---------- small helpers ---------- */
.muted { color: var(--muted); }
.dim { color: var(--dim); }
.small { font-size: 12px; }
.fx-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.fx-stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; }
.fx-stat span { display: block; font-size: 12px; color: var(--muted); }
.fx-stat b { font-family: var(--head); font-size: 22px; font-weight: 700; color: #fff; }
@media (max-width: 800px) { .fx-stats { grid-template-columns: 1fr 1fr; } }
