:root {
  --bg: #060913;
  --bg2: #0a1020;
  --panel: #0e1629;
  --panel2: #121d36;
  --line: #1b2842;
  --line2: #26365a;
  --text: #e8eefb;
  --muted: #8a9bbd;
  --accent: #22d3ee;
  --accent2: #34d399;
  --violet: #818cf8;
  --danger: #f87171;
  --warn: #fbbf24;
  --radius: 16px;
  --grad: linear-gradient(135deg, #22d3ee, #34d399);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Tahoma, "Noto Sans Arabic", "Noto Naskh Arabic", sans-serif;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1;
  background:
    radial-gradient(900px 520px at 80% -10%, rgba(34, 211, 238, 0.13), transparent 60%),
    radial-gradient(700px 480px at 0% 100%, rgba(129, 140, 248, 0.10), transparent 60%),
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px) 0 0 / 44px 44px,
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px) 0 0 / 44px 44px,
    var(--bg);
}

a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
svg.ic { width: 18px; height: 18px; flex: none; }

/* ---------- buttons / inputs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--grad); color: #03141c; font-weight: 700; border: 0; border-radius: 11px;
  padding: 10px 18px; cursor: pointer; transition: transform 0.12s, filter 0.15s, box-shadow 0.2s;
  box-shadow: 0 6px 22px rgba(34, 211, 238, 0.18);
}
.btn:hover { filter: brightness(1.08); box-shadow: 0 8px 28px rgba(34, 211, 238, 0.28); }
.btn:active { transform: translateY(1px); }
.btn.ghost { background: rgba(255, 255, 255, 0.03); color: var(--text); border: 1px solid var(--line2); font-weight: 600; box-shadow: none; }
.btn.ghost:hover { border-color: var(--accent); background: rgba(34, 211, 238, 0.06); }
.btn.small { padding: 6px 12px; font-size: 13px; border-radius: 9px; }
.btn.big { padding: 14px 26px; font-size: 16px; border-radius: 13px; }
.btn.danger { background: transparent; border: 1px solid rgba(248, 113, 113, 0.4); color: var(--danger); font-weight: 600; box-shadow: none; }
.btn.danger:hover { background: rgba(248, 113, 113, 0.08); }

.select, .input {
  background: var(--bg2); border: 1px solid var(--line2); border-radius: 10px;
  padding: 9px 12px; min-width: 0; outline: none; width: 100%;
}
.select:focus, .input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.14); }
.lang .select { width: auto; padding: 7px 10px; font-size: 13.5px; }

.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 19px; letter-spacing: 0.3px; }
.brand svg { width: 30px; height: 30px; }
.spacer { flex: 1; }

.avatar { width: 36px; height: 36px; border-radius: 11px; background: var(--line); display: grid; place-items: center; font-weight: 700; overflow: hidden; flex: none; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.round { border-radius: 50%; }
.avatar.lg { width: 56px; height: 56px; border-radius: 16px; font-size: 22px; }

.chip { display: flex; align-items: center; gap: 9px; background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line); border-radius: 99px; padding: 4px 14px 4px 4px; font-size: 14px; }
[dir="rtl"] .chip { padding: 4px 4px 4px 14px; }
.chip .avatar { width: 30px; height: 30px; }

/* ---------- landing ---------- */
.lnav { display: flex; align-items: center; gap: 14px; max-width: 1140px; margin: 0 auto; padding: 18px 22px; }
.hero { max-width: 860px; margin: 0 auto; text-align: center; padding: 70px 22px 50px; }
.badge {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: 99px;
  background: rgba(34, 211, 238, 0.08); border: 1px solid rgba(34, 211, 238, 0.25); color: var(--accent); font-size: 13.5px; font-weight: 600;
}
.hero h1 {
  font-size: clamp(34px, 6vw, 62px); line-height: 1.12; margin: 22px 0 18px; font-weight: 800; letter-spacing: -0.5px;
  background: linear-gradient(180deg, #fff, #9fb3d9); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero h1 em { font-style: normal; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { color: var(--muted); font-size: 18px; max-width: 640px; margin: 0 auto 30px; }
.cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

.features { max-width: 1140px; margin: 30px auto 0; padding: 0 22px; display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.feature {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.01));
  border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; transition: border-color 0.2s, transform 0.2s;
}
.feature:hover { border-color: rgba(34, 211, 238, 0.4); transform: translateY(-3px); }
.feature .fi { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: rgba(34, 211, 238, 0.10); color: var(--accent); margin-bottom: 14px; }
.feature .fi svg { width: 22px; height: 22px; }
.feature h3 { margin: 0 0 6px; font-size: 17px; }
.feature p { margin: 0; color: var(--muted); font-size: 14.5px; }
.footer { text-align: center; color: var(--muted); font-size: 13.5px; padding: 60px 20px 36px; }

/* ---------- servers page ---------- */
.tbar { display: flex; align-items: center; gap: 12px; max-width: 1140px; margin: 0 auto; padding: 16px 22px; }
.wrap { max-width: 1140px; margin: 0 auto; padding: 8px 22px 60px; }
.page-head h1 { margin: 10px 0 4px; font-size: 28px; }
.page-head p { margin: 0 0 24px; color: var(--muted); }

.server-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.scard {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.01));
  border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 18px; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 12px; transition: border-color 0.2s, transform 0.2s;
}
.scard:hover { border-color: rgba(34, 211, 238, 0.4); transform: translateY(-3px); }
.scard .name { font-weight: 700; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scard .btn { width: 100%; }

/* ---------- dashboard shell ---------- */
.shell { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh; padding: 20px 14px; display: flex; flex-direction: column; gap: 6px;
  background: rgba(10, 16, 32, 0.85); backdrop-filter: blur(12px); border-inline-end: 1px solid var(--line);
}
.side .brand { padding: 4px 10px 16px; }
.sguild { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 13px; background: var(--panel); border: 1px solid var(--line); margin-bottom: 14px; }
.sguild .nm { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sguild small { color: var(--muted); display: block; font-size: 12px; }
.nav {
  display: flex; align-items: center; gap: 11px; padding: 11px 12px; border-radius: 11px; cursor: pointer;
  background: transparent; border: 0; color: var(--muted); width: 100%; text-align: start; font-weight: 600; font-size: 14.5px;
  transition: background 0.15s, color 0.15s;
}
.nav:hover { background: rgba(255, 255, 255, 0.05); color: var(--text); }
.nav.active { background: linear-gradient(135deg, rgba(34, 211, 238, 0.16), rgba(52, 211, 153, 0.10)); color: var(--accent); }
.side .grow { flex: 1; }

.main { padding: 22px 30px 110px; min-width: 0; }
.mhead { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; flex-wrap: wrap; }
.mhead h1 { margin: 0; font-size: 26px; }
.mhead p { margin: 2px 0 0; color: var(--muted); font-size: 14px; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; border-inline-end: 0; border-bottom: 1px solid var(--line); padding: 12px; }
  .side .brand, .side .grow { display: none; }
  .sguild { width: 100%; margin-bottom: 4px; }
  .nav { width: auto; flex: 1 1 auto; justify-content: center; }
  .main { padding: 18px 14px 110px; }
}

/* ---------- cards ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 18px; }
.card h2 { margin: 0 0 14px; font-size: 16.5px; display: flex; align-items: center; gap: 9px; }
.card h2 svg { color: var(--accent); }
.hint { color: var(--muted); font-size: 13.5px; margin: 0 0 12px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 900px) { .grid2 { grid-template-columns: 1fr; } }

.banner { display: flex; align-items: center; gap: 16px; padding: 22px; border-radius: var(--radius); margin-bottom: 18px; border: 1px solid rgba(52, 211, 153, 0.35); background: linear-gradient(135deg, rgba(52, 211, 153, 0.12), rgba(34, 211, 238, 0.06)); }
.banner.bad { border-color: rgba(251, 191, 36, 0.4); background: linear-gradient(135deg, rgba(251, 191, 36, 0.12), rgba(248, 113, 113, 0.05)); }
.banner .bi { width: 52px; height: 52px; border-radius: 15px; display: grid; place-items: center; background: rgba(52, 211, 153, 0.16); color: var(--accent2); flex: none; }
.banner.bad .bi { background: rgba(251, 191, 36, 0.16); color: var(--warn); }
.banner .bi svg { width: 28px; height: 28px; }
.banner h3 { margin: 0; font-size: 19px; }
.banner p { margin: 2px 0 0; color: var(--muted); font-size: 14px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.stat b { display: block; font-size: 32px; line-height: 1.1; }
.stat span { color: var(--muted); font-size: 13.5px; }
.stat.good b { color: var(--accent2); }
.stat.bad b { color: var(--danger); }

/* ---------- modules ---------- */
.mods { display: grid; grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); gap: 16px; }
.mod { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; transition: border-color 0.2s; }
.mod.on { border-color: rgba(52, 211, 153, 0.35); }
.mod .top { display: flex; align-items: flex-start; gap: 12px; }
.mod .mi { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; background: rgba(255, 255, 255, 0.05); color: var(--muted); flex: none; }
.mod.on .mi { background: rgba(52, 211, 153, 0.14); color: var(--accent2); }
.mod .txt { flex: 1; min-width: 0; }
.mod .txt b { display: block; font-size: 15.5px; }
.mod .txt small { color: var(--muted); font-size: 13px; }
.mod .limits { margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--line2); display: grid; gap: 10px; }
.lrow { display: flex; align-items: center; gap: 12px; font-size: 13.5px; color: var(--muted); }
.lrow span { flex: 1; }
.lrow .input { width: 78px; text-align: center; padding: 7px; }

.switch { position: relative; width: 46px; height: 26px; flex: none; }
.switch input { opacity: 0; width: 100%; height: 100%; margin: 0; position: absolute; inset: 0; cursor: pointer; z-index: 1; }
.switch i { position: absolute; inset: 0; background: #22304f; border-radius: 99px; transition: background 0.2s; }
.switch i::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 20px; height: 20px; background: #fff; border-radius: 50%; transition: transform 0.2s; }
.switch input:checked + i { background: var(--accent2); }
.switch input:checked + i::after { transform: translateX(20px); }
[dir="rtl"] .switch input:checked + i::after { transform: translateX(-20px); }

/* ---------- forms / lists ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 13px; color: var(--muted); font-weight: 600; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.item { display: flex; align-items: center; gap: 10px; background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; }
.item .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .name small { color: var(--muted); display: block; font-size: 11.5px; }
.dot { width: 12px; height: 12px; border-radius: 50%; flex: none; background: var(--muted); margin-inline: 4px; }
.addrow { display: flex; gap: 8px; }
.empty { color: var(--muted); font-size: 14px; padding: 8px 2px; }
.sub { color: var(--muted); font-size: 12.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; margin: 4px 0 8px; }

/* ---------- table ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { text-align: start; padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 12.5px; }
td.res div { margin-bottom: 2px; }
.tag { display: inline-block; background: rgba(248, 113, 113, 0.12); color: var(--danger); border-radius: 7px; padding: 1px 9px; font-size: 12.5px; font-weight: 600; }
.ev { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.ev:last-child { border-bottom: 0; }
.ev .when { color: var(--muted); font-size: 12.5px; margin-inline-start: auto; white-space: nowrap; }

/* ---------- save bar ---------- */
#savebar {
  position: fixed; inset-inline: 0; bottom: 22px; margin: 0 auto; width: max-content; max-width: 94vw;
  display: flex; align-items: center; gap: 14px; background: var(--panel2); border: 1px solid var(--accent); border-radius: 14px;
  padding: 10px 14px 10px 18px; box-shadow: 0 18px 50px rgba(0, 0, 0, 0.5);
  opacity: 0; transform: translateY(30px); pointer-events: none; transition: opacity 0.25s, transform 0.25s; z-index: 40;
}
[dir="rtl"] #savebar { padding: 10px 18px 10px 14px; }
#savebar.show { opacity: 1; transform: none; pointer-events: auto; }

/* ---------- toast + loader ---------- */
#toast {
  position: fixed; inset-inline: 0; top: 20px; margin: 0 auto; width: max-content; max-width: 90vw;
  background: var(--panel2); border: 1px solid var(--accent2); border-radius: 12px; padding: 10px 18px;
  opacity: 0; transform: translateY(-20px); pointer-events: none; transition: opacity 0.25s, transform 0.25s; z-index: 60;
}
#toast.show { opacity: 1; transform: none; }
#toast.err { border-color: var(--danger); color: var(--danger); }
.loading { min-height: 60vh; display: grid; place-items: center; }
.spin { width: 38px; height: 38px; border-radius: 50%; border: 3px solid var(--line2); border-top-color: var(--accent); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
