/* =====================================================================
   لوحة بوت الاشتراكات — نظام التصميم «زجاج على أسود»
   أسود عميق بنمط نقاط خافت، ألواح زجاج أبيض مصنفر تلتقط الضوء من حافتها العلوية،
   خطوط عريضة بيضاء، ولون مميز واحد: ذهبي — للزر الرئيسي والرقم المهم فقط.
   لا يُستخدم color-mix ولا :has حتى يعمل على متصفحات الجوال القديمة.
   ===================================================================== */

:root {
  color-scheme: dark;
  --font: "Rubik", "Segoe UI", Tahoma, system-ui, sans-serif;
  --font-display: "Alexandria", "Rubik", "Segoe UI", sans-serif;

  --bg: #050506;
  --bg-raised: #0f0f12;

  /* زجاج أبيض مصنفر بدرجات */
  --glass-hi: rgba(255, 255, 255, .15);
  --glass: rgba(255, 255, 255, .085);
  --glass-lo: rgba(255, 255, 255, .045);
  --glass-hover: rgba(255, 255, 255, .12);
  --glass-strong: rgba(255, 255, 255, .17);
  --well: rgba(0, 0, 0, .34);
  --line: rgba(255, 255, 255, .11);
  --line-strong: rgba(255, 255, 255, .18);
  --sheen: rgba(255, 255, 255, .24);

  --text: #f6f6f7;
  --text-2: #b4b4bc;
  --muted: #7c7c86;

  --accent: #e9c57a;
  --accent-2: #f7df9f;
  --accent-ink: #1b1507;
  --accent-rgb: 233, 197, 122;

  --success: #6fdba8;  --success-rgb: 111, 219, 168;
  --warning: #f5a965;  --warning-rgb: 245, 169, 101;
  --danger:  #f4788a;  --danger-rgb: 244, 120, 138;
  --info:    #8cbfff;  --info-rgb: 140, 191, 255;
  --neutral: #b4b4bc;  --neutral-rgb: 180, 180, 188;

  --grid: rgba(255, 255, 255, .07);

  --r-xl: 26px;
  --r-lg: 20px;
  --r: 14px;
  --r-sm: 11px;
  --shadow: inset 0 1px 0 var(--sheen), 0 30px 70px -40px rgba(0, 0, 0, .95);
  --shadow-pop: inset 0 1px 0 var(--sheen), 0 36px 90px -24px rgba(0, 0, 0, .9);
  --ring: 0 0 0 3px rgba(233, 197, 122, .25);
  --sidebar-w: 262px;
  --topbar-h: 68px;
  --ease: cubic-bezier(.2, .8, .2, 1);
}

/* ---------- الأساسيات ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 14.5px;
  font-weight: 400;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
/* إضاءة محيطية: ضوء أبيض خافت من أعلى اليمين ودفء ذهبي من أعلى اليسار */
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background:
    radial-gradient(900px 520px at 100% -10%, rgba(255, 255, 255, .07), transparent 62%),
    radial-gradient(700px 480px at -10% 0%, rgba(233, 197, 122, .07), transparent 60%),
    radial-gradient(800px 600px at 50% 110%, rgba(255, 255, 255, .025), transparent 60%);
}
/* نمط نقاط دقيق يتلاشى نحو الأسفل */
body::after {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background-image: radial-gradient(rgba(255, 255, 255, .13) 1px, transparent 1.4px);
  background-size: 24px 24px;
  -webkit-mask-image: linear-gradient(180deg, rgba(0, 0, 0, .9), rgba(0, 0, 0, .25) 55%, transparent 100%);
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, .9), rgba(0, 0, 0, .25) 55%, transparent 100%);
  opacity: .5;
}

body.is-loading .app { visibility: hidden; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-2); }
img, svg { display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; line-height: 1.3; font-weight: 700; font-family: var(--font-display); }
p { margin: 0; }
b, strong { font-weight: 600; }
code, .mono { font-family: ui-monospace, "Cascadia Code", "SF Mono", Consolas, monospace; font-size: .9em; }
::selection { background: rgba(233, 197, 122, .32); }
.num { font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; }
.ltr { direction: ltr; unicode-bidi: isolate; }
.muted { color: var(--muted); }
.text-2 { color: var(--text-2); }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.ico { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ico-sm { width: 15px; height: 15px; }
.ico-lg { width: 22px; height: 22px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* ---------- الهيكل العام ---------- */
.app {
  position: relative; z-index: 1;
  display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 6px;
  padding: 22px 16px 16px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .06), rgba(255, 255, 255, .02));
  border-inline-end: 1px solid var(--line);
  -webkit-backdrop-filter: blur(24px); backdrop-filter: blur(24px);
  z-index: 40;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 2px 8px 22px; color: var(--text); }
.brand:hover { color: var(--text); }
.brand img { width: 40px; height: 40px; border-radius: 12px; }
.brand-name { font-family: var(--font-display); font-weight: 700; font-size: 15.5px; line-height: 1.25; }
.brand-sub { font-size: 11.5px; color: var(--muted); }

.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav-section { font-size: 11px; font-weight: 500; color: var(--muted); padding: 18px 12px 8px; }
.nav a {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  height: 42px; padding: 0 12px; border-radius: 12px;
  color: var(--text-2); font-weight: 500; font-size: 14px;
  transition: background .2s var(--ease), color .2s var(--ease);
}
.nav a:hover { background: var(--glass-lo); color: var(--text); }
.nav a.active { color: var(--text); background: var(--glass); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .18); }
.nav a.active .ico { color: var(--accent); }
.nav a.active::after {
  content: ""; position: absolute; inset-inline-start: -16px; top: 12px; bottom: 12px; width: 3px;
  border-radius: 3px; background: var(--accent); box-shadow: 0 0 14px rgba(233, 197, 122, .6);
}

.sidebar-foot {
  display: flex; align-items: center; gap: 10px;
  padding: 10px; border-radius: 16px;
  background: var(--glass-lo); border: 1px solid var(--line);
}
.sidebar-foot .who { min-width: 0; flex: 1; }
.sidebar-foot .who b { display: block; font-size: 13.5px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-foot .who span { font-size: 11.5px; color: var(--muted); }
.sidebar-backdrop { display: none; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 12px;
  height: var(--topbar-h); padding: 0 32px;
  background: rgba(5, 5, 6, .7);
  -webkit-backdrop-filter: blur(20px) saturate(140%); backdrop-filter: blur(20px) saturate(140%);
  border-bottom: 1px solid var(--line);
}
.topbar .crumbs { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); min-width: 0; }
.topbar .crumbs b { color: var(--text); font-weight: 500; white-space: nowrap; }
.topbar .crumbs .sep { opacity: .5; }
.topbar .mobile-brand { display: none; }
.topbar .spacer { flex: 1; }
.account-btn {
  display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px 0 6px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--glass-lo); cursor: pointer; font-size: 13px; font-weight: 500;
}
.account-btn:hover { background: var(--glass); }

.page { padding: 34px 32px 56px; max-width: 1480px; width: 100%; margin: 0 auto; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 26px; flex-wrap: wrap; }
.page-head h1 { font-size: 30px; }
.page-head p { color: var(--text-2); margin-top: 6px; max-width: 640px; }
.page-head .eyebrow { margin: 0 0 6px; font-size: 12.5px; color: var(--accent); font-weight: 500; }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- ألواح الزجاج ---------- */
.card {
  position: relative;
  background:
    radial-gradient(120% 70% at 90% -10%, rgba(255, 255, 255, .13), transparent 55%),
    linear-gradient(165deg, var(--glass-hi) 0%, var(--glass) 40%, var(--glass-lo) 100%);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  -webkit-backdrop-filter: blur(24px) saturate(130%); backdrop-filter: blur(24px) saturate(130%);
}
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 20px 22px 0; }
.card-head h2, .card-head h3 { font-size: 15.5px; font-weight: 600; }
.card-head .sub { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.card-body { padding: 18px 22px 22px; }
.card + .card { margin-top: 20px; }

.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.dash-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 20px; margin-top: 20px; }

/* ---------- نظرة عامة (لوحة التحكم) ---------- */
.overview { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 2.6fr); gap: 20px; }
.hero-card {
  padding: 24px 26px; display: flex; flex-direction: column; justify-content: space-between; gap: 22px; overflow: hidden;
  background:
    radial-gradient(70% 90% at 100% 0%, rgba(255, 255, 255, .2), transparent 60%),
    linear-gradient(165deg, rgba(255, 255, 255, .17), rgba(255, 255, 255, .07));
}
.hero-label { display: flex; align-items: center; gap: 8px; color: var(--text-2); font-size: 13.5px; }
.hero-label .live-dot { color: var(--success); }
.hero-value { font-family: var(--font-display); font-size: 66px; font-weight: 700; line-height: 1; color: var(--accent); text-shadow: 0 0 44px rgba(233, 197, 122, .35); font-variant-numeric: tabular-nums; }
.hero-foot { display: flex; flex-direction: column; gap: 10px; }
.hero-meta { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--muted); }
.ratio { height: 4px; border-radius: 4px; background: rgba(255, 255, 255, .14); overflow: hidden; }
.ratio > span { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }

.strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.strip-cell { padding: 22px 22px 20px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.strip-cell + .strip-cell { border-inline-start: 1px solid var(--line); }
.strip-top { display: flex; align-items: center; gap: 8px; color: var(--text-2); font-size: 13px; }
.strip-top .ico { color: var(--muted); }
.strip-value { font-family: var(--font-display); font-size: 34px; font-weight: 700; line-height: 1.05; }
.strip-hint { font-size: 12px; color: var(--muted); line-height: 1.5; }
.strip-cell.attention .strip-value { color: var(--warning); }
.strip-cell.attention .strip-top .ico { color: var(--warning); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.stat { padding: 20px 22px; display: flex; flex-direction: column; gap: 12px; overflow: hidden; }
.stat-top { display: flex; align-items: center; justify-content: space-between; }
.stat-label { color: var(--text-2); font-size: 13.5px; }
.stat-icon { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; }
.stat-value { font-family: var(--font-display); font-size: 32px; font-weight: 700; line-height: 1.1; }
.stat-foot { font-size: 12.5px; color: var(--muted); }

/* درجات موحّدة: كل عنصر ملوّن يأخذ لونه من --c و --c-rgb */
.tone-primary { --c: var(--accent);  --c-rgb: var(--accent-rgb); }
.tone-success { --c: var(--success); --c-rgb: var(--success-rgb); }
.tone-warning { --c: var(--warning); --c-rgb: var(--warning-rgb); }
.tone-danger  { --c: var(--danger);  --c-rgb: var(--danger-rgb); }
.tone-info    { --c: var(--info);    --c-rgb: var(--info-rgb); }
.tone-muted   { --c: var(--neutral); --c-rgb: var(--neutral-rgb); }
.stat-icon, .tl-dot, .modal-icon, .empty-icon {
  color: var(--c, var(--text-2));
  background: rgba(var(--c-rgb, 180, 180, 188), .13);
  border: 1px solid rgba(var(--c-rgb, 180, 180, 188), .22);
}

/* ---------- الأزرار ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; padding: 0 18px;
  border-radius: 12px; border: 1px solid transparent;
  font-weight: 500; font-size: 14px; white-space: nowrap;
  cursor: pointer; text-decoration: none !important;
  transition: background .2s var(--ease), border-color .2s, color .2s, box-shadow .2s, transform .08s, filter .2s;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary {
  color: var(--accent-ink); font-weight: 600;
  background: linear-gradient(180deg, var(--accent-2), var(--accent));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .5), 0 12px 30px -14px rgba(233, 197, 122, .8);
}
.btn-primary:hover:not(:disabled) { filter: brightness(1.06); color: var(--accent-ink); }
.btn-soft { background: rgba(var(--accent-rgb), .12); color: var(--accent); border-color: rgba(var(--accent-rgb), .22); }
.btn-soft:hover:not(:disabled) { background: rgba(var(--accent-rgb), .2); color: var(--accent); }
.btn-ghost { background: var(--glass-lo); border-color: var(--line-strong); color: var(--text); }
.btn-ghost:hover:not(:disabled) { background: var(--glass-hover); color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25); }
.btn-danger:hover:not(:disabled) { filter: brightness(1.06); }
.btn-success { background: var(--success); color: #062016; }
.btn-sm { height: 34px; padding: 0 13px; font-size: 13px; border-radius: 10px; }
.btn-block { width: 100%; }
.btn.is-busy { position: relative; color: transparent !important; pointer-events: none; }
.btn.is-busy::after {
  content: ""; position: absolute; width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid var(--accent-ink); border-color: var(--accent-ink) var(--accent-ink) transparent transparent;
  animation: spin .7s linear infinite;
}
.btn-ghost.is-busy::after, .btn-soft.is-busy::after { border-color: var(--accent) var(--accent) transparent transparent; }
.btn-danger.is-busy::after { border-color: #fff #fff transparent transparent; }

.icon-btn {
  width: 38px; height: 38px; border-radius: 11px; border: 0; background: transparent;
  display: inline-grid; place-items: center; cursor: pointer; color: var(--text-2);
  transition: background .2s var(--ease), color .2s var(--ease);
}
.icon-btn:hover { background: var(--glass-hover); color: var(--text); }
.icon-btn.sm { width: 32px; height: 32px; border-radius: 9px; }

/* ---------- النماذج ---------- */
.field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 18px; }
.field > label, .label { font-size: 13px; font-weight: 500; color: var(--text); }
.field .hint { font-size: 12.5px; color: var(--muted); line-height: 1.6; }
.input, .select, .textarea {
  width: 100%; height: 44px; padding: 0 14px;
  background: var(--well); border: 1px solid var(--line-strong); border-radius: 12px;
  transition: border-color .2s, box-shadow .2s; outline: none;
}
.textarea { height: auto; min-height: 120px; padding: 12px 14px; line-height: 1.75; resize: vertical; }
.input:hover, .select:hover, .textarea:hover { border-color: rgba(255, 255, 255, .28); }
.input:focus, .select:focus, .textarea:focus { border-color: rgba(var(--accent-rgb), .55); box-shadow: var(--ring); }
.input::placeholder, .textarea::placeholder { color: var(--muted); }
.select {
  appearance: none; -webkit-appearance: none; padding-inline-end: 38px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%238b8a95' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: left 13px center;
}
.select option { background: var(--bg-raised); color: var(--text); }
.input-group { position: relative; }
.input-group > .ico { position: absolute; top: 50%; transform: translateY(-50%); inset-inline-start: 14px; color: var(--muted); pointer-events: none; }
.input-group .input { padding-inline-start: 42px; }
.input-group .input.ltr { padding-left: 14px; padding-right: 42px; }
.input-affix { display: flex; align-items: stretch; }
.input-affix .input { border-start-end-radius: 0; border-end-end-radius: 0; }
.input-affix .affix {
  display: grid; place-items: center; padding: 0 16px; color: var(--text-2); font-size: 13px; font-weight: 500;
  background: var(--glass); border: 1px solid var(--line-strong); border-inline-start: 0;
  border-start-end-radius: 12px; border-end-end-radius: 12px;
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  border: 1px solid var(--line-strong); background: var(--glass-lo); border-radius: 999px;
  padding: 4px 12px; font-size: 12.5px; cursor: pointer; color: var(--text-2); transition: all .2s var(--ease);
}
.chip:hover { color: var(--text); background: var(--glass-hover); }
.chip.active { border-color: rgba(var(--accent-rgb), .5); color: var(--accent); background: rgba(var(--accent-rgb), .12); }

.segmented { display: flex; gap: 4px; padding: 4px; background: var(--well); border: 1px solid var(--line); border-radius: 14px; }
.segmented button {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; border: 0; border-radius: 10px; background: transparent; cursor: pointer;
  color: var(--text-2); font-weight: 500; font-size: 13.5px; transition: all .2s var(--ease);
}
.segmented button:hover { color: var(--text); }
.segmented button.active {
  color: var(--accent); background: linear-gradient(180deg, var(--glass-strong), var(--glass));
  box-shadow: inset 0 1px 0 var(--sheen), 0 0 0 1px rgba(var(--accent-rgb), .4);
}

.switch { position: relative; display: inline-flex; align-items: center; gap: 12px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track { width: 44px; height: 26px; border-radius: 999px; background: var(--glass-strong); border: 1px solid var(--line-strong); position: relative; transition: background .25s var(--ease); flex: none; }
.switch .track::after {
  content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 18px; height: 18px; border-radius: 50%;
  background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .35); transition: transform .25s var(--ease);
}
.switch input:checked + .track { background: var(--accent); border-color: transparent; }
.switch input:checked + .track::after { transform: translateX(-18px); }
.switch input:focus-visible + .track { box-shadow: var(--ring); }

/* ---------- الشارات ---------- */
.badge {
  --c: var(--neutral); --c-rgb: var(--neutral-rgb);
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 500; white-space: nowrap; line-height: 1.55;
  color: var(--c);
  background: rgba(var(--c-rgb), .12);
  border: 1px solid rgba(var(--c-rgb), .24);
}
.badge .ico { width: 13px; height: 13px; stroke-width: 2.1; }
.badge-success { --c: var(--success); --c-rgb: var(--success-rgb); }
.badge-warning { --c: var(--warning); --c-rgb: var(--warning-rgb); }
.badge-danger  { --c: var(--danger);  --c-rgb: var(--danger-rgb); }
.badge-info    { --c: var(--info);    --c-rgb: var(--info-rgb); }
.badge-primary { --c: var(--accent);  --c-rgb: var(--accent-rgb); }
.badge-muted   { --c: var(--neutral); --c-rgb: var(--neutral-rgb); }
.badge-outline { --c: var(--text-2);  --c-rgb: var(--neutral-rgb); background: transparent; }

/* ---------- التبويبات والأدوات ---------- */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.toolbar .input-group { flex: 1 1 260px; max-width: 400px; }
.toolbar .select, .toolbar .input[type="date"] { width: auto; min-width: 150px; height: 40px; }
.tabs { display: flex; gap: 2px; padding: 8px 10px 0; overflow-x: auto; border-bottom: 1px solid var(--line); scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  position: relative; display: inline-flex; align-items: center; gap: 8px; white-space: nowrap;
  padding: 10px 14px 12px; border: 0; background: transparent; cursor: pointer;
  color: var(--text-2); font-weight: 500; font-size: 13.5px; transition: color .2s;
}
.tab:hover, .tab.active { color: var(--text); }
.tab.active::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--accent); box-shadow: 0 0 12px rgba(233, 197, 122, .5); }
.tab .count { font-size: 11.5px; background: var(--glass-strong); color: var(--text-2); padding: 0 8px; border-radius: 999px; line-height: 20px; }
.tab.active .count { background: rgba(var(--accent-rgb), .14); color: var(--accent); }

/* ---------- الجداول ---------- */
.table-wrap { overflow-x: auto; position: relative; }
table.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: start; font-size: 12px; font-weight: 500; color: var(--muted);
  padding: 13px 18px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.table td { padding: 14px 18px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr { transition: background .15s; }
.table tbody tr:hover { background: rgba(255, 255, 255, .035); }
.table tbody tr:last-child td { border-bottom: 0; }
.table tr.clickable { cursor: pointer; }
.table .actions { text-align: end; width: 1%; white-space: nowrap; }
.table .nowrap { white-space: nowrap; }

.person { display: flex; align-items: center; gap: 12px; min-width: 200px; }
.person-info { min-width: 0; }
.person-name { font-weight: 500; display: flex; align-items: center; gap: 6px; }
.person-meta { font-size: 12.5px; color: var(--muted); display: flex; gap: 7px; flex-wrap: wrap; }
/* --h = ثلاثية RGB للون الصبغة (تُضبط من JS) */
.avatar {
  --h: 180, 180, 188;
  width: 40px; height: 40px; border-radius: 13px; flex: none;
  display: grid; place-items: center; font-weight: 600; font-size: 15px;
  color: rgb(var(--h));
  background: rgba(var(--h), .16);
  border: 1px solid rgba(var(--h), .3);
}
.avatar.sm { width: 32px; height: 32px; border-radius: 10px; font-size: 13px; }
.avatar.xs { width: 26px; height: 26px; border-radius: 8px; font-size: 11.5px; }
.avatar.bot { --h: 233, 197, 122; }
.premium { color: #cdb3ff; }
.premium .ico { width: 14px; height: 14px; fill: currentColor; stroke: none; }

.meter { width: 128px; }
.meter-track { height: 5px; border-radius: 999px; background: rgba(255, 255, 255, .14); overflow: hidden; }
.meter-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .5s var(--ease); }
.meter-fill.warn { background: var(--warning); }
.meter-fill.danger { background: var(--danger); }
.meter-label { font-size: 12.5px; margin-top: 6px; color: var(--text-2); white-space: nowrap; }

.pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.pagination .info { font-size: 13px; color: var(--muted); }
.pagination .pages { display: flex; gap: 6px; }
.page-btn {
  min-width: 34px; height: 34px; padding: 0 10px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--glass-lo); cursor: pointer; font-weight: 500; font-size: 13px;
  display: inline-grid; place-items: center; color: var(--text-2);
}
.page-btn:hover:not(:disabled) { background: var(--glass-hover); color: var(--text); }
.page-btn.active { background: var(--accent); border-color: transparent; color: var(--accent-ink); }
.page-btn:disabled { opacity: .4; cursor: not-allowed; }

/* ---------- الحالات الفارغة والتحميل ---------- */
.empty { text-align: center; padding: 56px 20px; color: var(--text-2); }
.empty-icon { --c: var(--accent); --c-rgb: var(--accent-rgb); width: 60px; height: 60px; border-radius: 18px; margin: 0 auto 18px; display: grid; place-items: center; }
.empty-icon .ico { width: 26px; height: 26px; }
.empty h3 { font-size: 16px; color: var(--text); margin-bottom: 6px; }
.empty p { max-width: 420px; margin: 0 auto 20px; font-size: 13.5px; }
.skeleton {
  border-radius: 8px; height: 13px;
  background: linear-gradient(90deg, var(--glass) 25%, var(--glass-strong) 50%, var(--glass) 75%);
  background-size: 200% 100%; animation: shimmer 1.4s infinite;
}
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- القوائم والخط الزمني ---------- */
.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.list-item:first-child { padding-top: 4px; }
.list-item:last-child { border-bottom: 0; padding-bottom: 0; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .title { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-item .meta { font-size: 12.5px; color: var(--muted); }

.timeline { display: flex; flex-direction: column; }
.tl-item { display: flex; gap: 14px; padding: 10px 0; position: relative; }
.tl-item:not(:last-child)::before {
  content: ""; position: absolute; inset-inline-start: 15px; top: 44px; bottom: -8px; width: 1px;
  background: linear-gradient(180deg, var(--line-strong), transparent);
}
.tl-dot { width: 32px; height: 32px; border-radius: 10px; flex: none; display: grid; place-items: center; }
.tl-dot .ico { width: 15px; height: 15px; }
.tl-body { min-width: 0; flex: 1; }
.tl-text { font-size: 13.5px; line-height: 1.6; }
.tl-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ---------- القائمة المنسدلة ---------- */
.menu {
  position: fixed; z-index: 90; min-width: 230px; padding: 6px;
  background: rgba(18, 18, 21, .92);
  -webkit-backdrop-filter: blur(22px); backdrop-filter: blur(22px);
  border: 1px solid var(--line-strong); border-radius: 14px; box-shadow: var(--shadow-pop);
  animation: pop .14s var(--ease);
}
.menu button {
  width: 100%; display: flex; align-items: center; gap: 10px; padding: 9px 12px; border: 0; background: transparent;
  border-radius: 9px; cursor: pointer; text-align: start; font-size: 13.5px; color: var(--text);
}
.menu button .ico { color: var(--text-2); }
.menu button:hover { background: var(--glass-hover); }
.menu button.danger, .menu button.danger .ico { color: var(--danger); }
.menu button.danger:hover { background: rgba(var(--danger-rgb), .12); }
.menu button:disabled { opacity: .35; cursor: not-allowed; }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 5px 4px; }
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } }

/* ---------- النوافذ المنبثقة ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(3, 3, 4, .66); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  display: grid; place-items: center; padding: 16px;
  animation: fade .18s ease-out;
}
.modal {
  width: 100%; max-width: 540px; max-height: calc(100vh - 32px);
  display: flex; flex-direction: column;
  background:
    radial-gradient(120% 60% at 90% 0%, rgba(255, 255, 255, .14), transparent 55%),
    linear-gradient(165deg, rgba(34, 34, 38, .96), rgba(16, 16, 19, .96));
  border: 1px solid var(--line-strong); border-radius: var(--r-xl); box-shadow: var(--shadow-pop);
  animation: rise .24s var(--ease);
}
.modal.lg { max-width: 780px; }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 22px 24px 0; }
.modal-head h3 { font-size: 17px; flex: 1; }
.modal-head .modal-icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex: none; }
.modal-body { padding: 20px 24px; overflow-y: auto; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 0 24px 22px; flex-wrap: wrap; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(16px) scale(.985); } }
@keyframes sheet-up { from { transform: translateY(100%); } }

.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.detail { background: var(--glass-lo); border: 1px solid var(--line); border-radius: 13px; padding: 11px 14px; min-width: 0; }
.detail dt { font-size: 12px; color: var(--muted); }
.detail dd { margin: 3px 0 0; font-weight: 500; overflow-wrap: anywhere; }
.section-title { font-size: 13px; font-weight: 600; margin: 22px 0 10px; color: var(--text-2); }

/* ---------- التنبيهات والإشعارات ---------- */
.alert {
  --c: var(--info); --c-rgb: var(--info-rgb);
  display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 14px; font-size: 13.5px;
  color: var(--text);
  background: rgba(var(--c-rgb), .09);
  border: 1px solid rgba(var(--c-rgb), .22);
}
.alert > .ico { margin-top: 2px; color: var(--c); }
.alert > div { flex: 1; min-width: 0; }
.alert > div > b:first-child { display: block; margin-bottom: 3px; }
.alert-warning { --c: var(--warning); --c-rgb: var(--warning-rgb); }
.alert-info    { --c: var(--info);    --c-rgb: var(--info-rgb); }
.alert-danger  { --c: var(--danger);  --c-rgb: var(--danger-rgb); }
.alert-success { --c: var(--success); --c-rgb: var(--success-rgb); }
.alerts { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }
.alerts:empty { display: none; }

.toasts { position: fixed; z-index: 200; bottom: 24px; left: 24px; display: flex; flex-direction: column; gap: 10px; max-width: min(420px, calc(100vw - 48px)); }
.toast {
  display: flex; align-items: flex-start; gap: 10px; padding: 13px 16px; border-radius: 14px;
  color: var(--text); font-size: 13.5px; line-height: 1.6;
  background: rgba(18, 18, 21, .92);
  -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
  border: 1px solid var(--line-strong); box-shadow: var(--shadow-pop);
  animation: rise .22s var(--ease); cursor: pointer;
}
.toast .ico { margin-top: 2px; }
.toast.success .ico { color: var(--success); }
.toast.error .ico { color: var(--danger); }
.toast.warning .ico { color: var(--warning); }
.toast.info .ico { color: var(--info); }
.toast.out { opacity: 0; transform: translateY(8px); transition: all .2s; }

.live-pill {
  display: inline-flex; align-items: center; gap: 8px; height: 30px; padding: 0 12px; border-radius: 999px;
  color: var(--success); font-size: 12px; font-weight: 500; white-space: nowrap;
  background: rgba(var(--success-rgb), .1);
  border: 1px solid rgba(var(--success-rgb), .22);
}
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; position: relative; flex: none; }
.live-dot::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: currentColor; animation: live-ping 1.8s cubic-bezier(0, 0, .2, 1) infinite; }
.live-pill.off { color: var(--muted); background: var(--glass-lo); border-color: var(--line); }
.live-pill.off .live-dot::after { animation: none; }
@keyframes live-ping { 75%, 100% { transform: scale(2.6); opacity: 0; } }

/* ---------- الرسم البياني ---------- */
.chart { position: relative; direction: ltr; padding: 8px 0 0 34px; }
.chart-plot { position: relative; height: 210px; }
.chart-grid { position: absolute; inset: 0; }
.chart-grid .gl { position: absolute; left: 0; right: 0; border-top: 1px solid var(--grid); }
.chart-grid .gl span { position: absolute; left: -34px; top: -9px; width: 26px; text-align: right; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.chart-bars { position: absolute; inset: 0; display: flex; align-items: stretch; gap: 2px; }
.bar-slot { flex: 1; display: flex; align-items: flex-end; justify-content: center; position: relative; border-radius: 8px; transition: background .15s; }
.bar-slot:hover { background: rgba(var(--accent-rgb), .07); }
.bar {
  width: min(22px, 62%); border-radius: 4px 4px 0 0;
  background: linear-gradient(180deg, var(--accent-2), var(--accent));
  box-shadow: 0 0 18px -4px rgba(var(--accent-rgb), .55);
  transition: height .6s var(--ease);
}
.bar.zero { height: 2px !important; background: var(--grid); box-shadow: none; border-radius: 1px; }
.bar-tip {
  position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%);
  background: rgba(18, 18, 21, .95); border: 1px solid var(--line-strong);
  color: var(--text); font-size: 12px; padding: 6px 10px; border-radius: 9px; white-space: nowrap;
  pointer-events: none; opacity: 0; transition: opacity .12s; direction: rtl; z-index: 2; box-shadow: var(--shadow-pop);
}
.bar-slot:hover .bar-tip, .bar-slot:focus .bar-tip { opacity: 1; }
.chart-x { display: flex; gap: 2px; margin-top: 10px; }
.chart-x span { flex: 1; text-align: center; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.chart-empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: 13px; direction: rtl; }

/* ---------- المجموعات ---------- */
.group-card { padding: 22px; display: flex; flex-direction: column; gap: 18px; }
.group-card.off { opacity: .7; }
.group-top { display: flex; gap: 14px; align-items: flex-start; }
.group-avatar {
  --h: 233, 197, 122;
  width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; flex: none;
  font-family: var(--font-display); font-weight: 700; font-size: 20px;
  color: rgb(var(--h)); background: rgba(var(--h), .15); border: 1px solid rgba(var(--h), .3);
}
.group-title { font-size: 16px; font-weight: 600; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.group-sub { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.checks { display: flex; flex-direction: column; gap: 8px; }
.check { display: flex; align-items: center; gap: 9px; font-size: 13.5px; color: var(--text-2); }
.check .ico { width: 17px; height: 17px; }
.check.ok .ico { color: var(--success); }
.check.no .ico { color: var(--danger); }
.group-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; border-radius: 14px; overflow: hidden; background: var(--line); border: 1px solid var(--line); }
.group-stats div { background: rgba(0, 0, 0, .38); padding: 12px 8px; text-align: center; }
.group-stats b { display: block; font-family: var(--font-display); font-size: 19px; font-weight: 700; }
.group-stats span { font-size: 11.5px; color: var(--muted); }
.group-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; border-top: 1px solid var(--line); padding-top: 14px; }
.group-actions .switch { margin-inline-end: auto; font-size: 13.5px; font-weight: 500; }

/* ---------- الإعدادات ---------- */
.settings-layout { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 24px; align-items: start; }
.settings-nav { position: sticky; top: calc(var(--topbar-h) + 20px); display: flex; flex-direction: column; gap: 2px; padding: 8px; }
.settings-nav a { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 10px; color: var(--text-2); font-weight: 500; font-size: 13.5px; }
.settings-nav a:hover { background: var(--glass-hover); color: var(--text); }
.template { border: 1px solid var(--line); border-radius: 16px; padding: 16px; background: var(--glass-lo); }
.template + .template { margin-top: 14px; }
.template-head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; margin-bottom: 10px; }
.template-head b { display: block; font-weight: 600; }
.template-head span { font-size: 12.5px; color: var(--muted); }
.kv { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 12px 18px; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.copy-box { display: flex; gap: 8px; align-items: center; background: var(--well); border: 1px solid var(--line); border-radius: 12px; padding: 8px 8px 8px 12px; }
.copy-box code { flex: 1; min-width: 0; overflow-x: auto; white-space: nowrap; direction: ltr; text-align: left; font-size: 12.5px; color: var(--text-2); scrollbar-width: thin; }

/* ---------- صفحة الدخول ---------- */
.auth-page { position: relative; z-index: 1; min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); }
.auth-aside {
  position: relative; overflow: hidden; padding: 48px 56px;
  display: flex; flex-direction: column; justify-content: space-between;
  border-inline-end: 1px solid var(--line);
  background:
    radial-gradient(600px 400px at 100% 0%, rgba(255, 255, 255, .09), transparent 65%),
    radial-gradient(500px 420px at 0% 100%, rgba(233, 197, 122, .1), transparent 65%),
    linear-gradient(180deg, rgba(255, 255, 255, .03), transparent);
}
.auth-aside .brand { padding: 0; }
.auth-aside h2 { font-size: 42px; line-height: 1.3; max-width: 520px; }
.auth-aside h2 em { font-style: normal; color: var(--accent); }
.auth-aside p { color: var(--text-2); margin-top: 16px; max-width: 460px; font-size: 15px; line-height: 1.8; }
.auth-steps { list-style: none; margin: 40px 0 0; padding: 0; display: grid; gap: 4px; max-width: 460px; }
.auth-steps li { display: flex; gap: 18px; align-items: baseline; padding: 14px 0; border-top: 1px solid var(--line); }
.auth-steps li:last-child { border-bottom: 1px solid var(--line); }
.auth-steps .n { font-size: 12px; color: var(--accent); font-variant-numeric: tabular-nums; min-width: 22px; }
.auth-steps b { display: block; font-size: 14.5px; font-weight: 500; }
.auth-steps span { font-size: 13px; color: var(--muted); }
.auth-note { font-size: 12.5px; color: var(--muted); }
.auth-main { display: grid; place-items: center; align-content: center; gap: 22px; padding: 32px 20px; }
.auth-mobile-logo { display: none; width: 56px; height: 56px; border-radius: 17px; box-shadow: 0 16px 40px -16px rgba(233, 197, 122, .45); }
.auth-card {
  width: 100%; max-width: 430px; padding: 34px 32px; border-radius: var(--r-xl);
  background:
    radial-gradient(120% 70% at 90% -10%, rgba(255, 255, 255, .14), transparent 55%),
    linear-gradient(165deg, var(--glass-hi), var(--glass), var(--glass-lo));
  border: 1px solid var(--line); box-shadow: var(--shadow);
  -webkit-backdrop-filter: blur(24px); backdrop-filter: blur(24px);
}
.auth-card h1 { font-size: 27px; }
.auth-card .lead { color: var(--text-2); margin: 8px 0 28px; }
.auth-foot { margin-top: 22px; font-size: 12.5px; color: var(--muted); text-align: center; }
.pw-toggle { position: absolute; inset-inline-end: 6px; top: 50%; transform: translateY(-50%); }

/* ---------- متفرقات ---------- */
.divider { height: 1px; background: var(--line); margin: 20px 0; }
.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 4px; }
.mt-0 { margin-top: 0 !important; }
.mb-0 { margin-bottom: 0 !important; }
.tag { display: inline-block; font-size: 11px; background: var(--glass-strong); color: var(--text-2); border-radius: 6px; padding: 1px 7px; font-weight: 500; }
.link-btn { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; font-weight: 500; display: inline-flex; align-items: center; gap: 5px; }
.link-btn:hover { color: var(--accent-2); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.status-line { display: flex; align-items: center; gap: 10px; padding: 10px 0; font-size: 13.5px; }
.status-line .grow { flex: 1; }
.log-desc { max-width: 580px; line-height: 1.6; }

/* ---------- الأمان: التحقق بخطوتين والفحص الذاتي ---------- */
.tf-code {
  font-family: var(--font-display); font-size: 38px; font-weight: 700; letter-spacing: .22em; text-align: center; direction: ltr;
  color: var(--accent); padding: 14px 14px 14px 20px; margin-bottom: 14px;
  border: 1px dashed rgba(var(--accent-rgb), .45); border-radius: 14px; background: rgba(var(--accent-rgb), .07);
}
.tf-steps { margin: 0 0 14px; padding-inline-start: 22px; color: var(--text-2); font-size: 13.5px; line-height: 1.9; }
.tf-steps code { color: var(--text); background: var(--well); padding: 1px 8px; border-radius: 6px; }

.sec-head { display: flex; align-items: center; gap: 16px; margin-bottom: 14px; flex-wrap: wrap; }
.sec-score { font-family: var(--font-display); font-size: 34px; font-weight: 700; line-height: 1; }
.sec-score small { font-size: 15px; color: var(--muted); font-weight: 500; }
.sec-bar { flex: 1 1 200px; height: 6px; border-radius: 6px; background: rgba(255, 255, 255, .12); overflow: hidden; }
.sec-bar > span { display: block; height: 100%; border-radius: 6px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .6s var(--ease); }
.sec-bar.bad > span { background: var(--danger); }
.sec-bar.mid > span { background: var(--warning); }
.sec-list { display: flex; flex-direction: column; }
.sec-item { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.sec-item:last-child { border-bottom: 0; }
.sec-mark { --c-rgb: var(--neutral-rgb); width: 28px; height: 28px; border-radius: 9px; flex: none; display: grid; place-items: center; color: var(--c); background: rgba(var(--c-rgb), .13); border: 1px solid rgba(var(--c-rgb), .22); }
.sec-mark .ico { width: 15px; height: 15px; stroke-width: 2.2; }
.sec-item.ok .sec-mark { --c: var(--success); --c-rgb: var(--success-rgb); }
.sec-item.fail .sec-mark { --c: var(--danger); --c-rgb: var(--danger-rgb); }
.sec-item.warn .sec-mark { --c: var(--warning); --c-rgb: var(--warning-rgb); }
.sec-item.info .sec-mark { --c: var(--info); --c-rgb: var(--info-rgb); }
.sec-body { min-width: 0; flex: 1; }
.sec-title { font-weight: 500; }
.sec-detail { font-size: 12.5px; color: var(--muted); line-height: 1.6; }
.sec-fix { display: flex; gap: 6px; align-items: flex-start; font-size: 12.5px; color: var(--text-2); margin-top: 5px; }
.sec-fix .ico { width: 14px; height: 14px; margin-top: 3px; color: var(--accent); flex: none; }

/* ---------- شريط التنقل السفلي وورقة «المزيد» (الجوال) ---------- */
.bottom-nav { display: none; }
.sheet-list { display: flex; flex-direction: column; gap: 2px; }
.sheet-item {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 13px 12px; border-radius: 12px;
  border: 0; background: transparent; color: var(--text); font-size: 14.5px; font-weight: 500; text-align: start; cursor: pointer;
}
.sheet-item:hover, .sheet-item.active { background: var(--glass-hover); color: var(--text); }
.sheet-item > .ico:first-child { color: var(--text-2); }
.sheet-item.active > .ico:first-child { color: var(--accent); }
.sheet-item span { flex: 1; }
.sheet-item .ico-sm { color: var(--muted); }
.sheet-item.danger, .sheet-item.danger > .ico:first-child { color: var(--danger); }

/* =====================================================================
   الأجهزة
   ===================================================================== */

@media (max-width: 1280px) {
  .overview { grid-template-columns: minmax(0, 1fr); }
  .hero-card { flex-direction: row; align-items: flex-end; }
  .hero-card .hero-foot { flex: 0 1 300px; }
}
@media (max-width: 1180px) {
  .dash-grid { grid-template-columns: minmax(0, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* التابلت والآيباد العمودي: شريط أيقونات نحيف */
@media (max-width: 1080px) and (min-width: 761px) {
  :root { --sidebar-w: 84px; }
  .sidebar { padding: 18px 12px 14px; align-items: center; }
  .brand { padding: 0 0 18px; }
  .brand > div, .nav a span, .sidebar-foot .who { display: none; }
  .nav { width: 100%; }
  .nav-section { height: 1px; padding: 0; margin: 10px 14px; background: var(--line); font-size: 0; }
  .nav a { justify-content: center; padding: 0; height: 46px; }
  .nav a.active::after { inset-inline-start: -12px; }
  .sidebar-foot { flex-direction: column; padding: 8px; gap: 6px; }
  .topbar, .page { padding-inline: 24px; }
  .strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .strip-cell:nth-child(3) { border-inline-start: 0; }
  .strip-cell:nth-child(n+3) { border-top: 1px solid var(--line); }
  .settings-layout { grid-template-columns: minmax(0, 1fr); }
  .settings-nav { position: static; flex-direction: row; overflow-x: auto; }
}

/* الجوال */
@media (max-width: 760px) {
  :root { --topbar-h: 60px; }
  body { font-size: 14px; }
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { display: none; }
  .topbar { padding: 0 16px; gap: 10px; }
  .topbar .mobile-brand { display: block; width: 32px; height: 32px; border-radius: 10px; }
  .topbar .crumbs .app-name, .topbar .crumbs .sep { display: none; }
  .topbar .crumbs b { font-family: var(--font-display); font-size: 15px; font-weight: 700; }
  .live-pill { width: 30px; padding: 0; justify-content: center; }
  .live-pill [data-live-text] { display: none; }
  .account-btn { padding: 0 4px; border: 0; background: transparent; }
  .account-btn span { display: none; }

  .page { padding: 22px 16px calc(96px + env(safe-area-inset-bottom)); }
  .page-head { margin-bottom: 20px; align-items: stretch; }
  .page-head h1 { font-size: 24px; }
  .page-actions, .page-actions .btn { width: 100%; }
  .page-actions .btn { flex: 1; }

  .grid-2, .grid-3, .form-row, .detail-grid { grid-template-columns: minmax(0, 1fr); }
  .settings-layout { grid-template-columns: minmax(0, 1fr); }
  .settings-nav { position: static; flex-direction: row; overflow-x: auto; }
  .kv { grid-template-columns: minmax(0, 1fr); gap: 2px 0; }
  .kv dd { margin-bottom: 12px; }

  .hero-card { flex-direction: column; align-items: stretch; padding: 22px; }
  .hero-card .hero-foot { flex: none; }
  .hero-value { font-size: 56px; }
  .strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .strip-cell { padding: 16px; }
  .strip-cell:nth-child(3) { border-inline-start: 0; }
  .strip-cell:nth-child(n+3) { border-top: 1px solid var(--line); }
  .strip-value { font-size: 28px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .stats .stat:first-child:nth-last-child(odd) { grid-column: 1 / -1; }
  .stat { padding: 16px; }
  .stat-value { font-size: 26px; }
  .card-head { padding: 18px 18px 0; }
  .card-body { padding: 16px 18px 18px; }

  .toolbar { padding: 14px; }
  .toolbar .input-group { max-width: none; flex-basis: 100%; }
  .toolbar .select, .toolbar .input[type="date"], .toolbar label.row { flex: 1 1 140px; }

  /* الجداول ← بطاقات */
  .table-wrap { overflow: visible; }
  .table thead { display: none; }
  .table, .table tbody { display: block; width: 100%; }
  .table tbody { padding: 6px 12px 12px; }
  .table tr {
    position: relative; display: flex; flex-direction: column;
    margin-top: 10px; border: 1px solid var(--line); border-radius: 16px; background: var(--glass-lo);
  }
  .table tbody tr:hover { background: var(--glass); }
  .table td { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 9px 14px; border: 0; text-align: start; }
  .table td[data-label]::before { content: attr(data-label); color: var(--muted); font-size: 12.5px; flex: none; }
  .table td[data-label] > * { text-align: end; }
  .table td.cell-main { order: -1; padding: 14px 14px 12px; padding-inline-end: 52px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
  .table td.cell-main .person { min-width: 0; }
  .table td.actions { position: absolute; top: 12px; inset-inline-end: 8px; width: auto; padding: 0; }
  .table td.hide-sm { display: none; }
  .table tr.full { border: 0; background: transparent; }
  .table tr.full td { display: block; padding: 0; }
  .meter { width: 120px; }

  /* النوافذ ← ورقة سفلية */
  .modal-backdrop { place-items: end stretch; padding: 0; }
  .modal, .modal.lg { max-width: none; max-height: 92vh; border-radius: 24px 24px 0 0; border-bottom: 0; animation: sheet-up .3s var(--ease); padding-bottom: env(safe-area-inset-bottom); }
  .modal-head { position: relative; padding-top: 26px; }
  .modal-head::before { content: ""; position: absolute; top: 8px; left: 50%; transform: translateX(-50%); width: 40px; height: 4px; border-radius: 4px; background: var(--line-strong); }
  .modal-foot .btn { flex: 1; }

  .toasts { left: 12px; right: 12px; bottom: calc(84px + env(safe-area-inset-bottom)); max-width: none; }

  .bottom-nav {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 60;
    display: flex; gap: 2px; padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
    background: rgba(10, 10, 12, .88);
    -webkit-backdrop-filter: blur(24px) saturate(140%); backdrop-filter: blur(24px) saturate(140%);
    border-top: 1px solid var(--line);
  }
  .bottom-nav a, .bottom-nav button {
    flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 3px;
    padding: 4px 0; border: 0; background: transparent; cursor: pointer;
    color: var(--muted); font-size: 10.5px; font-weight: 500;
  }
  .bottom-nav .bn-ico { width: 44px; height: 30px; border-radius: 999px; display: grid; place-items: center; transition: background .2s var(--ease); }
  .bottom-nav .active { color: var(--accent); }
  .bottom-nav .active .bn-ico { background: rgba(var(--accent-rgb), .14); }
  .bottom-nav span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }

  .auth-page { grid-template-columns: minmax(0, 1fr); }
  .auth-aside { display: none; }
  .auth-mobile-logo { display: block; }
  .auth-card { padding: 28px 22px; }
}

@media (max-width: 380px) {
  .strip-value { font-size: 24px; }
  .hero-value { font-size: 48px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* =====================================================================
   تتبع المشتركين
   ===================================================================== */
.modal.xl { max-width: 980px; }
/* عنصر الشبكة لا يتمدد بعرض محتواه (التبويبات الطويلة) فيخرج من الشاشة على الجوال */
.modal { min-width: 0; }
.avatar.lg { width: 58px; height: 58px; border-radius: 18px; font-size: 22px; }
.sub { font-size: 12px; margin-top: 3px; line-height: 1.5; }
.text-warn { color: var(--warning); }
.text-danger { color: var(--danger); }

.trk-table tbody tr.clickable:focus-visible { outline: 2px solid rgba(var(--accent-rgb), .55); outline-offset: -2px; }
.trk-table .trk-open { color: var(--muted); transition: color .2s, background .2s; }
.trk-table tr.clickable:hover .trk-open { color: var(--accent); background: rgba(var(--accent-rgb), .1); }

.trk-head { display: flex; align-items: center; gap: 16px; margin-bottom: 18px; }
.trk-who { min-width: 0; flex: 1; }
.trk-name { font-family: var(--font-display); font-size: 20px; font-weight: 700; line-height: 1.3; overflow-wrap: anywhere; }
.trk-ids { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; margin-top: 4px; font-size: 13px; color: var(--text-2); }
.trk-sep { color: var(--muted); }
.trk-id {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--glass-lo); color: var(--text-2);
  font: inherit; font-size: 12.5px; cursor: pointer; transition: background .2s, color .2s;
}
.trk-id:hover { color: var(--text); background: var(--glass-hover); }
.trk-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }

.trk-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(112px, 1fr)); gap: 8px; margin-bottom: 14px; }
.trk-stat { background: var(--glass-lo); border: 1px solid var(--line); border-radius: 14px; padding: 11px 13px; min-width: 0; }
.trk-stat b { display: block; font-family: var(--font-display); font-size: 19px; font-weight: 700; line-height: 1.25; overflow-wrap: anywhere; }
.trk-stat span { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.trk-stat.tone-warning b { color: var(--warning); }
.trk-stat.tone-info b { color: var(--info); }
.trk-stat.tone-danger b { color: var(--danger); }

/* التبويبات تبقى ظاهرة أثناء التمرير داخل الملف */
.trk-tabs {
  position: sticky; top: -20px; z-index: 2;
  margin: 0 -24px; padding: 4px 14px 0;
  background: rgba(22, 22, 25, .97); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.trk-pane { padding-top: 14px; }
.trk-pane .table-wrap { border: 1px solid var(--line); border-radius: 14px; }
.trk-pane .table th, .trk-pane .table td { padding: 11px 12px; }
.trk-pno { display: flex; align-items: center; gap: 10px; min-width: 170px; }
.pno {
  width: 30px; height: 30px; flex: none; border-radius: 10px; display: grid; place-items: center;
  font-size: 12.5px; font-weight: 600; background: var(--glass-strong); color: var(--text-2);
}
.trk-outcome { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; min-width: 190px; }
.trk-day { font-size: 12px; font-weight: 600; color: var(--muted); padding: 14px 0 2px; }
.trk-day:first-child { padding-top: 0; }
.trk-names { display: flex; flex-direction: column; gap: 8px; }
.trk-name-row {
  display: flex; justify-content: space-between; align-items: center; gap: 4px 10px; flex-wrap: wrap;
  padding: 8px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--glass-lo); font-size: 13px;
}

.table .show-md { display: none; }
.trk-range { display: flex; flex-direction: column; gap: 3px; font-size: 13px; }

/* التابلت: تاريخا البدء والانتهاء في عمود واحد، وبدون عمود «السجل» حتى لا يزدحم الجدول */
@media (max-width: 1080px) and (min-width: 761px) {
  .table .hide-md { display: none; }
  .table .show-md { display: table-cell; }
  .trk-table th, .trk-table td { padding-inline: 12px; }
  .trk-table .person { min-width: 170px; }
  .stats.stats-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
  .stats.stats-4 .stat { padding: 16px; }
  .stats.stats-4 .stat-value { font-size: 26px; }
}

/* الجوال */
@media (max-width: 760px) {
  .trk-head { gap: 12px; margin-bottom: 14px; }
  .avatar.lg { width: 50px; height: 50px; border-radius: 15px; font-size: 19px; }
  .trk-name { font-size: 18px; }
  .trk-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .trk-stat { padding: 9px 10px; border-radius: 12px; }
  .trk-stat b { font-size: 16px; }
  .trk-stat span { font-size: 11.5px; }
  .trk-tabs { padding: 4px 8px 0; }
  .trk-pane .table-wrap { border: 0; border-radius: 0; }
  .trk-pane .table tbody { padding: 0; }
  .trk-pane .table td { padding: 8px 12px; }
  .trk-pane .table td.cell-main { padding: 12px; }
  .trk-pno, .trk-outcome { min-width: 0; }
  .trk-outcome { align-items: flex-end; text-align: end; }
  .trk-name-row { flex-direction: column; align-items: flex-start; }
}
