/* واصل Wasel — لوحة التحكم. RTL عربي، بدون أي خطوط أو مكتبات خارجية. */
:root {
  --accent: #0e7a5f;
  --accent-dark: #0a5c48;
  --accent-soft: #e3f2ec;
  --teal: #0f766e;
  --bg: #f4f7f5;
  --surface: #ffffff;
  --surface-muted: #eef3f0;
  --text: #17251f;
  --muted: #5f7269;
  --border: #d9e4dd;
  --danger: #b3261e;
  --danger-soft: #fbe9e7;
  --warn: #9a6a00;
  --warn-soft: #fdf3d7;
  --ok: #146c43;
  --ok-soft: #e2f2e7;
  --info: #175cd3;
  --info-soft: #e8effc;
  --gray-soft: #eceff1;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(16, 42, 33, 0.08), 0 4px 14px rgba(16, 42, 33, 0.05);
  --font: Tahoma, "Segoe UI", "Noto Kufi Arabic", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
}
.hidden { display: none !important; }
a { color: var(--accent); }
h1, h2, h3 { margin: 0 0 0.5rem; line-height: 1.35; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.ltr { direction: ltr; unicode-bidi: embed; }

/* ---------- التخطيط ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 248px; flex: 0 0 248px;
  background: linear-gradient(180deg, #0b3d2f, #0e7a5f 140%);
  color: #eafaf3;
  padding: 20px 14px;
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 6px;
  overflow-y: auto;
}
.brand { padding: 4px 8px 16px; border-bottom: 1px solid rgba(255,255,255,0.18); margin-bottom: 12px; }
.brand .logo { font-size: 1.7rem; font-weight: bold; letter-spacing: 0.2px; }
.brand .logo .en { font-size: 0.95rem; opacity: 0.85; font-weight: normal; }
.brand .tagline { font-size: 0.8rem; opacity: 0.8; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav button {
  font: inherit; text-align: right; cursor: pointer;
  background: transparent; border: 0; color: #dff5ea;
  padding: 9px 12px; border-radius: 8px; width: 100%;
}
.nav button:hover { background: rgba(255,255,255,0.12); }
.nav button.active { background: rgba(255,255,255,0.2); color: #fff; font-weight: bold; }
.sidebar .spacer { flex: 1; }
.userbox {
  border-top: 1px solid rgba(255,255,255,0.18); padding-top: 12px;
  font-size: 0.85rem; display: flex; flex-direction: column; gap: 8px;
}
.userbox .email { word-break: break-all; opacity: 0.9; }

.main { flex: 1; min-width: 0; padding: 22px 26px 60px; }
.main header.topbar { display: flex; align-items: baseline; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.main header.topbar h1 { font-size: 1.45rem; }

/* ---------- بطاقات وشبكات ---------- */
.grid { display: grid; gap: 14px; }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px;
}
.stat-card .num { font-size: 1.9rem; font-weight: bold; color: var(--accent-dark); line-height: 1.2; }
.stat-card .label { color: var(--muted); font-size: 0.9rem; }
.panel { margin-bottom: 18px; }
.panel > h2 { font-size: 1.1rem; margin-bottom: 10px; }

/* ---------- جداول ---------- */
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; background: var(--surface); }
th, td { padding: 9px 12px; border-bottom: 1px solid var(--border); text-align: right; vertical-align: top; }
th { background: var(--surface-muted); font-size: 0.88rem; color: var(--muted); white-space: nowrap; }
tbody tr:hover { background: #f7faf8; }
td.actions, th.actions { white-space: nowrap; }

/* ---------- شارات ---------- */
.badge {
  display: inline-block; padding: 1px 9px; border-radius: 999px;
  font-size: 0.78rem; font-weight: bold; line-height: 1.7; white-space: nowrap;
}
.badge-green { background: var(--ok-soft); color: var(--ok); }
.badge-red { background: var(--danger-soft); color: var(--danger); }
.badge-yellow { background: var(--warn-soft); color: var(--warn); }
.badge-blue { background: var(--info-soft); color: var(--info); }
.badge-gray { background: var(--gray-soft); color: #546e7a; }
.badge-teal { background: var(--accent-soft); color: var(--accent-dark); }
.chip { font-size: 0.75rem; padding: 0 8px; }

/* ---------- نماذج وأزرار ---------- */
form .field { margin-bottom: 12px; }
label { display: block; font-size: 0.88rem; font-weight: bold; margin-bottom: 4px; }
input, select, textarea {
  font: inherit; width: 100%; padding: 8px 10px;
  border: 1px solid var(--border); border-radius: 8px; background: #fff; color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
textarea { min-height: 110px; resize: vertical; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.hint { font-size: 0.8rem; color: var(--muted); margin-top: 3px; }
.btn {
  font: inherit; cursor: pointer; border-radius: 8px; padding: 8px 16px;
  border: 1px solid var(--accent); background: var(--accent); color: #fff; font-weight: bold;
}
.btn:hover { background: var(--accent-dark); }
.btn.secondary { background: #fff; color: var(--accent-dark); }
.btn.secondary:hover { background: var(--accent-soft); }
.btn.danger { background: #fff; border-color: var(--danger); color: var(--danger); }
.btn.danger:hover { background: var(--danger-soft); }
.btn.small { padding: 3px 10px; font-size: 0.82rem; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn.ghost-light { background: transparent; border-color: rgba(255,255,255,0.55); color: #fff; }
.btn.ghost-light:hover { background: rgba(255,255,255,0.14); }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.toolbar { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar .field { margin-bottom: 0; min-width: 180px; }

/* ---------- حالات ---------- */
.empty {
  border: 1.5px dashed var(--border); border-radius: var(--radius);
  padding: 26px; text-align: center; color: var(--muted); background: #fbfdfc;
}
.notready {
  border: 1px solid #f0dfa0; background: #fffbe9; color: #6d5b00;
  border-radius: var(--radius); padding: 16px 18px; margin-bottom: 14px;
}
.notready strong { display: block; margin-bottom: 2px; }
.error-box {
  border: 1px solid #f3c1bd; background: var(--danger-soft); color: var(--danger);
  border-radius: var(--radius); padding: 12px 16px; margin-bottom: 14px;
}
.loading { color: var(--muted); padding: 22px; text-align: center; }
.progress { height: 10px; background: var(--gray-soft); border-radius: 999px; overflow: hidden; }
.progress > div { height: 100%; background: var(--accent); transition: width 0.4s; }

/* ---------- سجلات DNS ---------- */
.dns-record {
  display: flex; gap: 10px; align-items: flex-start; background: var(--surface-muted);
  border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; margin-bottom: 8px;
}
.dns-record code {
  direction: ltr; text-align: left; flex: 1; word-break: break-all;
  font-family: Consolas, "Courier New", monospace; font-size: 0.83rem; white-space: pre-wrap;
}
.dns-record .rtype { font-weight: bold; color: var(--accent-dark); min-width: 52px; }

/* ---------- خطوات التسلسل ---------- */
.step-row { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; margin-bottom: 10px; background: #fbfdfc; }
.step-row .step-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }

/* ---------- مصادقة ---------- */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px;
  background: linear-gradient(160deg, #0b3d2f, #0e7a5f 75%); }
.auth-card { background: #fff; border-radius: 14px; box-shadow: var(--shadow); padding: 30px; width: 100%; max-width: 430px; }
.auth-card .brandline { text-align: center; margin-bottom: 18px; }
.auth-card .brandline .logo { font-size: 2rem; font-weight: bold; color: var(--accent-dark); }
.auth-tabs { display: flex; gap: 6px; margin-bottom: 18px; }
.auth-tabs button {
  flex: 1; font: inherit; cursor: pointer; padding: 9px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface-muted); color: var(--muted);
}
.auth-tabs button.active { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: bold; }

/* ---------- تنبيهات ---------- */
#toasts { position: fixed; bottom: 18px; inset-inline-start: 18px; z-index: 1000; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, 90vw); }
.toast {
  background: #173b30; color: #eafaf3; border-radius: 10px; padding: 11px 16px;
  box-shadow: var(--shadow); font-size: 0.92rem; animation: toast-in 0.25s ease-out;
}
.toast.error { background: #7c1d18; }
.toast.warn { background: #7a5b00; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- صفحات ---------- */
.pager { display: flex; gap: 8px; align-items: center; margin-top: 12px; flex-wrap: wrap; }

/* ---------- تجاوب ---------- */
@media (max-width: 900px) {
  .grid.cols-4 { grid-template-columns: repeat(2, 1fr); }
  .grid.cols-3 { grid-template-columns: 1fr; }
  .grid.cols-2 { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .app { flex-direction: column; }
  .sidebar { width: 100%; flex: none; height: auto; position: static; }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .nav button { width: auto; }
  .sidebar .spacer { display: none; }
  .main { padding: 16px 14px 50px; }
}
