/* ================================================================
   SL — لوحة الإدارة | نظام التصميم "Storm & Steel"
   أسود عاصف + فضّي مصقول، حواف حادة تعكس شعار السيرفر.
   ================================================================ */
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;600;700;900&family=Tajawal:wght@400;500;700;800&display=swap');

:root {
  /* الأسطح */
  --bg-void: #07090c;
  --bg-deep: #0a0d11;
  --bg-panel: #0e1116;
  --bg-card: #12161c;
  --bg-raise: #171d25;
  --bg-hover: #1d242e;

  /* الحدود */
  --line: #1a202a;
  --line-mid: #232b36;
  --line-hi: #333d4b;

  /* النص */
  --txt: #e9eef4;
  --txt-2: #98a4b2;
  --txt-3: #616d7b;
  --txt-4: #45505d;

  /* الفضّي — هوية السيرفر */
  --steel: #ccd6e0;
  --steel-2: #9aa7b5;
  --steel-3: #6f7d8c;
  --steel-soft: rgba(204, 214, 224, .10);
  --steel-line: rgba(204, 214, 224, .22);
  --steel-glow: rgba(204, 214, 224, .30);
  --on-steel: #0a0d11;

  /* دلالية */
  --danger: #e2605a;
  --danger-soft: rgba(226, 96, 90, .13);
  --ok: #4ec99a;
  --ok-soft: rgba(78, 201, 154, .13);
  --warn: #e0a44a;
  --warn-soft: rgba(224, 164, 74, .13);
  --info: #6fa8dc;
  --info-soft: rgba(111, 168, 220, .13);
  --violet: #9b8fe0;
  --violet-soft: rgba(155, 143, 224, .13);

  --r: 12px;
  --r-sm: 8px;
  --r-lg: 18px;
  --shadow: 0 12px 34px rgba(0, 0, 0, .5);
  --shadow-lg: 0 28px 80px rgba(0, 0, 0, .7);
  --font: 'Tajawal', 'Segoe UI', Tahoma, system-ui, sans-serif;
  --font-head: 'Cairo', 'Tajawal', 'Segoe UI', sans-serif;
  --sidebar-w: 258px;
}

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

body {
  font-family: var(--font);
  color: var(--txt);
  direction: rtl;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  background:
    radial-gradient(1200px 700px at 78% -18%, #182430 0%, transparent 62%),
    radial-gradient(900px 600px at 8% 108%, #131a22 0%, transparent 58%),
    var(--bg-void);
  background-attachment: fixed;
}

/* وميض خافت خلف كل شيء — يعطي إحساس الغيوم العاصفة بدون صور */
body::before {
  content: '';
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background:
    radial-gradient(600px 300px at 50% 0%, rgba(204, 214, 224, .05), transparent 70%),
    radial-gradient(400px 200px at 85% 40%, rgba(204, 214, 224, .03), transparent 70%);
}
#root { position: relative; z-index: 1; }

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font-family: inherit; }
button { cursor: pointer; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line-hi); border-radius: 20px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: #46525f; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }
::selection { background: var(--steel-soft); color: var(--steel); }

/* ---------------- أدوات ---------------- */
.row { display: flex; align-items: center; gap: 12px; }
.row.wrap { flex-wrap: wrap; }
.col { display: flex; flex-direction: column; }
.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--txt-2); }
.dim { color: var(--txt-3); }
.steel { color: var(--steel); }
.tiny { font-size: 12px; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }
.mono { font-family: ui-monospace, 'Cascadia Code', Consolas, monospace; direction: ltr; unicode-bidi: plaintext; }
.clickable { cursor: pointer; }
.trunc { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ================================================================
   الدخول
   ================================================================ */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px;
}
.login-card {
  width: 100%; max-width: 396px; position: relative; overflow: hidden;
  background: linear-gradient(168deg, var(--bg-card), var(--bg-deep));
  border: 1px solid var(--line-mid);
  border-radius: var(--r-lg);
  padding: 42px 34px 34px;
  box-shadow: var(--shadow-lg);
}
.login-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--steel-glow), transparent);
}
.login-logo {
  width: 74px; margin: 0 auto 20px;
  filter: drop-shadow(0 8px 26px var(--steel-glow));
}
.login-logo svg, .login-logo img { width: 100%; height: auto; display: block; }
.login-card h1 {
  font-family: var(--font-head); font-size: 25px; font-weight: 800; text-align: center;
  letter-spacing: -.3px;
  background: linear-gradient(180deg, #fff, var(--steel-2));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.login-card .sub { text-align: center; color: var(--txt-3); font-size: 13.5px; margin: 4px 0 26px; }

/* ================================================================
   نماذج
   ================================================================ */
.field { margin-bottom: 15px; }
.field > label { display: block; font-size: 12.5px; color: var(--txt-2); margin-bottom: 7px; font-weight: 500; }
.input, .select, textarea.input {
  width: 100%; height: 43px; padding: 0 13px; font-size: 14px; outline: none;
  color: var(--txt); background: var(--bg-void);
  border: 1px solid var(--line-mid); border-radius: var(--r-sm);
  transition: border-color .15s, box-shadow .15s, background .15s;
}
textarea.input { height: auto; min-height: 92px; padding: 11px 13px; resize: vertical; line-height: 1.6; }
.input:focus, .select:focus, textarea.input:focus {
  border-color: var(--steel-line); box-shadow: 0 0 0 3px var(--steel-soft); background: var(--bg-deep);
}
.input::placeholder { color: var(--txt-4); }
.input:disabled, .select:disabled { opacity: .45; cursor: not-allowed; }
select.select {
  appearance: none; padding-inline-end: 34px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2398a4b2' viewBox='0 0 24 24'><path d='M7 10l5 5 5-5z'/></svg>");
  background-repeat: no-repeat; background-position: left 12px center;
}
input[type=color].input { padding: 4px; height: 43px; cursor: pointer; }
.hint { font-size: 11.5px; color: var(--txt-3); margin-top: 5px; line-height: 1.5; }

/* ================================================================
   أزرار
   ================================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 40px; padding: 0 15px; white-space: nowrap;
  font-size: 13.5px; font-weight: 600; color: var(--txt);
  background: var(--bg-raise); border: 1px solid var(--line-mid); border-radius: var(--r-sm);
  transition: background .14s, border-color .14s, transform .1s, box-shadow .14s;
}
.btn:hover { background: var(--bg-hover); border-color: var(--line-hi); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn svg { width: 17px; height: 17px; flex: 0 0 auto; }

.btn.primary {
  background: linear-gradient(165deg, #f2f6fa, var(--steel-2));
  color: var(--on-steel); border-color: transparent; font-weight: 700;
  box-shadow: 0 4px 16px rgba(204, 214, 224, .16);
}
.btn.primary:hover { filter: brightness(1.06); box-shadow: 0 6px 22px rgba(204, 214, 224, .26); }
.btn.danger { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.btn.danger:hover { background: var(--danger); color: #fff; }
.btn.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.btn.ok:hover { background: var(--ok); color: #06120d; }
.btn.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--txt-2); }
.btn.ghost:hover { background: var(--bg-raise); color: var(--txt); }
.btn.sm { height: 32px; padding: 0 11px; font-size: 12.5px; border-radius: 7px; }
.btn.sm svg { width: 15px; height: 15px; }
.btn.xs { height: 27px; padding: 0 9px; font-size: 12px; border-radius: 6px; }
.btn.xs svg { width: 14px; height: 14px; }
.btn.icon { width: 40px; padding: 0; }
.btn.icon.sm { width: 32px; }
.btn.icon.xs { width: 27px; }
.btn.block { width: 100%; }

/* ================================================================
   الهيكل
   ================================================================ */
.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; grid-template-areas: "side main"; min-height: 100vh; }
.sidebar {
  grid-area: side; position: sticky; top: 0; height: 100vh; z-index: 40;
  display: flex; flex-direction: column; padding: 16px 12px 12px;
  background: linear-gradient(180deg, var(--bg-panel), var(--bg-void));
  border-inline-end: 1px solid var(--line);
  overflow-y: auto;
}
.main { grid-area: main; padding: 20px 26px 40px; min-width: 0; }

/* العلامة */
.brand { display: flex; align-items: center; gap: 11px; padding: 6px 8px 18px; }
.brand .mark { width: 36px; flex: 0 0 36px; filter: drop-shadow(0 4px 12px var(--steel-glow)); }
.brand .mark svg { width: 100%; height: auto; display: block; }
.brand .wm { line-height: 1.15; }
.brand .wm b {
  display: block; font-family: var(--font-head); font-size: 19px; font-weight: 900; letter-spacing: .5px;
  background: linear-gradient(180deg, #fff, var(--steel-2));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.brand .wm span { font-size: 10.5px; color: var(--txt-4); letter-spacing: .4px; }

/* التنقل */
.nav { display: flex; flex-direction: column; gap: 1px; flex: 1; }
.nav-sec { font-size: 10.5px; color: var(--txt-4); font-weight: 700; letter-spacing: .8px; padding: 14px 12px 5px; }
.nav-item {
  position: relative; display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 8px; cursor: pointer;
  color: var(--txt-2); font-size: 14px; font-weight: 500;
  transition: background .13s, color .13s;
}
.nav-item:hover { background: var(--bg-card); color: var(--txt); }
.nav-item svg { width: 18px; height: 18px; flex: 0 0 18px; opacity: .85; }
.nav-item.active {
  color: var(--txt); font-weight: 600;
  background: linear-gradient(90deg, var(--steel-soft), transparent 85%);
}
.nav-item.active::before {
  content: ''; position: absolute; inset-inline-start: 0; top: 8px; bottom: 8px; width: 2.5px;
  background: linear-gradient(180deg, #fff, var(--steel-3));
  border-radius: 0 3px 3px 0;
}
.nav-item.active svg { opacity: 1; color: var(--steel); }
.nav-item .pill {
  margin-inline-start: auto; min-width: 19px; height: 19px; padding: 0 5px;
  display: flex; align-items: center; justify-content: center;
  background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; border-radius: 20px;
}
.nav-item .pill.soft { background: var(--warn); color: #1a1206; }

/* تذييل الشريط */
.side-foot { border-top: 1px solid var(--line); padding-top: 10px; margin-top: 8px; }
.me-box { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 9px; transition: background .14s; }
.me-box:hover { background: var(--bg-card); }
.me-box .info { flex: 1; min-width: 0; line-height: 1.25; }
.me-box .info b { display: block; font-size: 13.5px; }
.me-box .info span { font-size: 11px; color: var(--txt-3); }

/* ================================================================
   رأس الصفحة
   ================================================================ */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-title { font-family: var(--font-head); font-size: 23px; font-weight: 800; letter-spacing: -.2px; }
.page-title small { display: block; font-family: var(--font); font-size: 12.5px; color: var(--txt-3); font-weight: 400; margin-top: 1px; }
.menu-btn { display: none; }

.status-pill {
  display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px;
  background: var(--bg-card); border: 1px solid var(--line); border-radius: 20px;
  font-size: 12.5px; color: var(--txt-2);
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); flex: 0 0 8px; }
.dot.off { background: var(--txt-4); box-shadow: 0 0 0 3px rgba(69, 80, 93, .2); }
.dot.red { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }
.dot.pulse { animation: pulse 1.8s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1 } 50% { opacity: .3 } }

/* ================================================================
   بطاقات
   ================================================================ */
.card {
  background: linear-gradient(178deg, var(--bg-card), var(--bg-panel));
  border: 1px solid var(--line); border-radius: var(--r);
  position: relative;
}
.card.pad { padding: 17px; }
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 13px 17px; border-bottom: 1px solid var(--line);
}
.card-head h3 { font-family: var(--font-head); font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.card-head h3 svg { width: 17px; height: 17px; color: var(--steel-3); }
.card-body { padding: 17px; }

.grid { display: grid; gap: 14px; }
.g-auto { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.g-stats { grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)); }

/* بطاقة إحصائية */
.stat {
  position: relative; overflow: hidden; padding: 15px 16px;
  background: linear-gradient(160deg, var(--bg-card), var(--bg-panel));
  border: 1px solid var(--line); border-radius: var(--r);
  transition: transform .16s, border-color .16s;
}
.stat::before {
  content: ''; position: absolute; top: 0; inset-inline-start: 0; width: 40%; height: 2px;
  background: linear-gradient(90deg, var(--steel-line), transparent);
}
.stat:hover { transform: translateY(-2px); border-color: var(--line-mid); }
.stat .ic {
  position: absolute; top: 13px; inset-inline-start: 14px;
  width: 34px; height: 34px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
}
.stat .ic svg { width: 18px; height: 18px; }
.stat .lbl { font-size: 12.5px; color: var(--txt-2); margin-bottom: 5px; }
.stat .val { font-family: var(--font-head); font-size: 26px; font-weight: 800; line-height: 1.05; }
.stat .sub { font-size: 11.5px; color: var(--txt-3); margin-top: 5px; }

.ic.s-steel { background: var(--steel-soft); color: var(--steel); }
.ic.s-ok { background: var(--ok-soft); color: var(--ok); }
.ic.s-danger { background: var(--danger-soft); color: var(--danger); }
.ic.s-warn { background: var(--warn-soft); color: var(--warn); }
.ic.s-info { background: var(--info-soft); color: var(--info); }
.ic.s-violet { background: var(--violet-soft); color: var(--violet); }

/* ================================================================
   شارات
   ================================================================ */
.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px;
  border-radius: 6px; font-size: 11.5px; font-weight: 600; white-space: nowrap;
}
.badge svg { width: 13px; height: 13px; }
.b-steel { background: var(--steel-soft); color: var(--steel); }
.b-ok { background: var(--ok-soft); color: var(--ok); }
.b-danger { background: var(--danger-soft); color: var(--danger); }
.b-warn { background: var(--warn-soft); color: var(--warn); }
.b-info { background: var(--info-soft); color: var(--info); }
.b-violet { background: var(--violet-soft); color: var(--violet); }
.b-gray { background: var(--bg-raise); color: var(--txt-2); }

/* ================================================================
   جداول
   ================================================================ */
.tbl-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r); background: var(--bg-panel); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 620px; }
table.tbl th {
  position: sticky; top: 0; z-index: 2; text-align: right; white-space: nowrap;
  padding: 11px 14px; font-size: 11.5px; font-weight: 700; letter-spacing: .3px;
  color: var(--txt-3); background: var(--bg-deep); border-bottom: 1px solid var(--line);
}
table.tbl td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.tbl tbody tr { transition: background .12s; }
table.tbl tbody tr:hover { background: var(--bg-card); }
table.tbl tbody tr:last-child td { border-bottom: none; }
table.tbl tr.click { cursor: pointer; }

/* الصورة الرمزية */
.av {
  width: 34px; height: 34px; flex: 0 0 34px; position: relative; border-radius: 9px;
  background: linear-gradient(150deg, var(--bg-raise), var(--bg-hover));
  border: 1px solid var(--line-mid);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; color: var(--steel-2); overflow: visible;
}
.av img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
.av.round { border-radius: 50%; }
.av .dot-i {
  position: absolute; bottom: -1px; inset-inline-end: -1px; width: 10px; height: 10px;
  border-radius: 50%; border: 2px solid var(--bg-panel);
}
.av .dot-i.on { background: var(--ok); }
.av .dot-i.off { background: var(--txt-4); }

/* ================================================================
   شريط الأدوات والتبويبات
   ================================================================ */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 15px; }
.search { position: relative; flex: 1; min-width: 210px; }
.search svg { position: absolute; inset-inline-start: 12px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: var(--txt-4); pointer-events: none; }
.search .input { padding-inline-start: 38px; }

.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--bg-deep); border: 1px solid var(--line); border-radius: 9px; }
.seg button {
  padding: 6px 13px; border: none; background: transparent; border-radius: 6px;
  color: var(--txt-3); font-size: 12.5px; font-weight: 600; transition: .14s;
}
.seg button:hover { color: var(--txt-2); }
.seg button.active { background: var(--steel-soft); color: var(--steel); }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs button {
  padding: 10px 15px; border: none; background: transparent; white-space: nowrap;
  color: var(--txt-3); font-size: 13.5px; font-weight: 600;
  border-bottom: 2px solid transparent; margin-bottom: -1px; transition: .14s;
}
.tabs button:hover { color: var(--txt-2); }
.tabs button.active { color: var(--steel); border-bottom-color: var(--steel); }

/* ================================================================
   نوافذ منبثقة
   ================================================================ */
.overlay {
  position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center;
  padding: 22px; background: rgba(4, 6, 9, .74); backdrop-filter: blur(5px);
  animation: fade .14s ease;
}
@keyframes fade { from { opacity: 0 } }
.modal {
  width: 100%; max-width: 500px; max-height: 88vh; display: flex; flex-direction: column;
  background: linear-gradient(178deg, var(--bg-card), var(--bg-panel));
  border: 1px solid var(--line-mid); border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg); animation: pop .18s cubic-bezier(.2, .9, .3, 1);
}
.modal.md { max-width: 660px; }
.modal.lg { max-width: 860px; }
.modal.xl { max-width: 1120px; }
@keyframes pop { from { transform: translateY(14px) scale(.985); opacity: 0 } }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 19px; border-bottom: 1px solid var(--line); }
.modal-head h3 { font-family: var(--font-head); font-size: 17px; font-weight: 700; }
.modal-body { padding: 19px; overflow-y: auto; flex: 1; }
.modal-foot { padding: 14px 19px; border-top: 1px solid var(--line); display: flex; gap: 9px; }

/* ================================================================
   تنبيهات
   ================================================================ */
.toasts { position: fixed; bottom: 20px; inset-inline-start: 20px; z-index: 300; display: flex; flex-direction: column; gap: 9px; }
.toast {
  display: flex; align-items: center; gap: 11px; min-width: 250px; max-width: 380px;
  padding: 12px 15px; border-radius: 10px;
  background: var(--bg-raise); border: 1px solid var(--line-hi);
  box-shadow: var(--shadow); animation: slidein .22s cubic-bezier(.2, .9, .3, 1);
  transition: opacity .25s, transform .25s;
}
@keyframes slidein { from { transform: translateX(-26px); opacity: 0 } }
.toast svg { width: 19px; height: 19px; flex: 0 0 19px; }
.toast span { font-size: 13.5px; line-height: 1.5; }
.toast.ok { border-inline-start: 3px solid var(--ok); } .toast.ok svg { color: var(--ok); }
.toast.err { border-inline-start: 3px solid var(--danger); } .toast.err svg { color: var(--danger); }
.toast.info { border-inline-start: 3px solid var(--info); } .toast.info svg { color: var(--info); }

/* ================================================================
   عناصر متنوعة
   ================================================================ */
.empty { text-align: center; padding: 46px 20px; color: var(--txt-3); }
.empty svg { width: 40px; height: 40px; opacity: .35; margin-bottom: 11px; }
.empty div { font-size: 13.5px; }

.spinner {
  width: 30px; height: 30px; margin: 38px auto; border-radius: 50%;
  border: 2.5px solid var(--line-mid); border-top-color: var(--steel);
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg) } }

.divider { height: 1px; background: var(--line); margin: 15px 0; }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 7px 15px; font-size: 13.5px; align-items: center; }
.kv .k { color: var(--txt-3); font-size: 12.5px; }

.info-box { background: var(--bg-deep); border: 1px solid var(--line); border-radius: 10px; padding: 11px 13px; }
.info-box .k { font-size: 11.5px; color: var(--txt-3); margin-bottom: 3px; display: flex; align-items: center; gap: 5px; }
.info-box .k svg { width: 13px; height: 13px; }
.info-box .v { font-size: 15px; font-weight: 600; }

/* مفتاح تبديل */
.switch {
  width: 40px; height: 23px; flex: 0 0 40px; position: relative; cursor: pointer;
  background: var(--bg-hover); border-radius: 20px; transition: background .18s;
}
.switch::after {
  content: ''; position: absolute; top: 3px; inset-inline-end: 3px; width: 17px; height: 17px;
  border-radius: 50%; background: var(--txt-3); transition: .18s;
}
.switch.on { background: var(--steel-soft); }
.switch.on::after { inset-inline-end: 20px; background: var(--steel); }

/* عنصر قابل للتحديد */
.pick {
  display: flex; align-items: center; gap: 11px; padding: 9px 12px; cursor: pointer;
  background: var(--bg-deep); border: 1px solid var(--line); border-radius: 9px;
  transition: border-color .14s, background .14s;
}
.pick:hover { border-color: var(--line-hi); background: var(--bg-card); }
.pick.on { border-color: var(--steel-line); background: var(--steel-soft); }
.pick .box {
  width: 18px; height: 18px; flex: 0 0 18px; border-radius: 5px;
  border: 1.5px solid var(--line-hi); display: flex; align-items: center; justify-content: center;
  transition: .14s;
}
.pick.on .box { background: var(--steel); border-color: var(--steel); color: var(--on-steel); }
.pick .box svg { width: 13px; height: 13px; display: none; }
.pick.on .box svg { display: block; }

/* رقاقة صلاحية */
.perm-chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 5px 10px; cursor: pointer;
  border: 1px solid var(--line); border-radius: 7px; background: var(--bg-deep);
  font-size: 12px; font-weight: 500; color: var(--txt-3); transition: .13s;
}
.perm-chip:hover { border-color: var(--line-hi); color: var(--txt-2); }
.perm-chip.on { background: var(--steel-soft); border-color: var(--steel-line); color: var(--steel); font-weight: 600; }
.perm-chip.on.sensitive { background: var(--danger-soft); border-color: rgba(226, 96, 90, .3); color: var(--danger); }
.perm-chip svg { width: 12px; height: 12px; }

/* شبكة الحقيبة */
.inv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(66px, 1fr)); gap: 7px; }
.inv-slot {
  aspect-ratio: 1; position: relative; cursor: pointer; padding: 5px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: var(--bg-deep); border: 1px solid var(--line); border-radius: 9px;
  transition: border-color .13s, background .13s;
}
.inv-slot:hover { border-color: var(--steel-line); background: var(--bg-card); }
.inv-slot.sel { border-color: var(--steel); background: var(--steel-soft); }
.inv-slot .amt { position: absolute; top: 3px; inset-inline-start: 5px; font-size: 10px; font-weight: 700; color: var(--steel); }
.inv-slot svg { width: 20px; height: 20px; color: var(--txt-4); }
.inv-slot .nm {
  font-size: 9.5px; color: var(--txt-2); text-align: center; line-height: 1.15; margin-top: 4px;
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}

/* شبكة المراقبة */
.mon-grid { display: grid; gap: 11px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.mon-cell {
  position: relative; aspect-ratio: 16/9; overflow: hidden;
  background: var(--bg-void); border: 1px solid var(--line); border-radius: 11px;
}
.mon-cell img { width: 100%; height: 100%; object-fit: cover; display: block; opacity: 0; transition: opacity .2s; }
.mon-cell.live img { opacity: 1; }
.mon-cell .wait { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--txt-4); font-size: 12.5px; }
.mon-cell.live .wait { display: none; }
.mon-cell .bar {
  position: absolute; top: 0; inset-inline: 0; z-index: 2; padding: 7px 10px;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  background: linear-gradient(180deg, rgba(0, 0, 0, .78), transparent);
}
.mon-cell .bar b { font-size: 12.5px; text-shadow: 0 1px 4px #000; }
.mon-add {
  aspect-ratio: 16/9; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px;
  border: 1.5px dashed var(--line-hi); border-radius: 11px; color: var(--txt-3);
  cursor: pointer; font-size: 13px; transition: .14s;
}
.mon-add:hover { border-color: var(--steel-line); color: var(--steel); }
.mon-add svg { width: 24px; height: 24px; }

/* محادثة */
.chat { display: flex; flex-direction: column; height: 440px; }
.chat-body { flex: 1; overflow-y: auto; padding: 15px; display: flex; flex-direction: column; gap: 9px; }
.msg { max-width: 74%; padding: 9px 13px; border-radius: 13px; font-size: 13.5px; line-height: 1.55; }
.msg .meta { font-size: 10.5px; opacity: .55; margin-top: 4px; }
.msg.them { align-self: flex-start; background: var(--bg-raise); border-bottom-right-radius: 4px; }
.msg.us { align-self: flex-end; background: linear-gradient(160deg, #232c37, #1a222b); border: 1px solid var(--line-mid); border-bottom-left-radius: 4px; }
.chat-input { display: flex; gap: 8px; padding: 11px; border-top: 1px solid var(--line); }

/* رسم بياني بالأعمدة */
.bars { display: flex; align-items: flex-end; gap: 3px; height: 150px; }
.bars .bar {
  flex: 1; min-height: 3px; border-radius: 3px 3px 0 0; position: relative;
  background: linear-gradient(180deg, var(--steel-2), rgba(154, 167, 181, .18));
  transition: filter .15s;
}
.bars .bar:hover { filter: brightness(1.35); }
.bars .bar.alt { background: linear-gradient(180deg, var(--info), rgba(111, 168, 220, .18)); }

/* شريط تقدم */
.meter { height: 6px; background: var(--bg-void); border-radius: 20px; overflow: hidden; }
.meter > i { display: block; height: 100%; border-radius: 20px; background: linear-gradient(90deg, var(--steel-3), var(--steel)); }

/* لوحة تنبيه */
.notice {
  display: flex; gap: 11px; padding: 13px 15px; border-radius: 10px; font-size: 13px; line-height: 1.6;
  background: var(--warn-soft); border: 1px solid rgba(224, 164, 74, .25); color: #f0d3a4;
}
.notice svg { width: 18px; height: 18px; flex: 0 0 18px; color: var(--warn); margin-top: 2px; }
.notice.info { background: var(--info-soft); border-color: rgba(111, 168, 220, .25); color: #cfe2f4; }
.notice.info svg { color: var(--info); }
.notice.danger { background: var(--danger-soft); border-color: rgba(226, 96, 90, .25); color: #f4cfcd; }
.notice.danger svg { color: var(--danger); }

/* ================================================================
   استجابة الشاشات
   ================================================================ */
@media (max-width: 980px) {
  .app { grid-template-columns: 1fr; grid-template-areas: "main"; }
  .sidebar {
    position: fixed; inset-inline-end: 0; top: 0; width: 268px;
    transform: translateX(-100%); transition: transform .25s cubic-bezier(.2, .9, .3, 1);
    box-shadow: -18px 0 50px rgba(0, 0, 0, .6);
  }
  html[dir="rtl"] .sidebar { transform: translateX(100%); }
  .sidebar.open { transform: none !important; }
  .menu-btn { display: inline-flex !important; }
  .main { padding: 16px 15px 34px; }
  .scrim { position: fixed; inset: 0; z-index: 35; background: rgba(0, 0, 0, .55); }
}
@media (max-width: 560px) {
  .page-title { font-size: 20px; }
  .modal { max-height: 92vh; }
  .toasts { inset-inline: 12px; bottom: 12px; }
  .toast { min-width: 0; max-width: none; }
}
