/* src/portal/public/app.css — شكل البورتال كله (الموقع العام + لوحة التحكم) حسب DESIGN.md
 *
 * الفكرة:
 *   - سلّم ألوان محايدة دافية (أبيض ← تلات درجات أوف وايت ← أسود دافي) هو اللي بيفصل الأجزاء — من غير ظلال ولا تدرجات.
 *   - كل زرار أساسي بلون واحد (الفحمي) وحواف 4px. الأحمر للاسم بس، والدهبي خط واحد تحت العنوان الكبير.
 *   - خط واحد للموقع كله: Noto Kufi Arabic (متغير 300–800) — الفرق بين العنوان والنص بالوزن مش بخط تاني.
 *   - الموقع العام: كروت 8px. لوحة التحكم: كروت 15px (زي ما DESIGN.md بيفرق بين القالبين).
 *   - الحركة: ظهور تدريجي مع السكرول، عدّاد أرقام، كلمة بتتقلب في العنوان، رسمة عمارات بتتبني، شريط أسماء بيتحرك — وكلها بتقف لو الجهاز طالب حركة أقل.
 *
 * الترتيب: الألوان والمقاسات ← الأساسيات ← الأزرار والحقول ← لوحة التحكم ← الجداول والكروت ← النوافذ ← الموقع العام ← الحركة ← الموبايل
 */

/* ===================== الألوان والمقاسات ===================== */
:root {
  --canvas: #ffffff;
  --canvas-soft: #fbf9f8;
  --canvas-tint: #f5f4f2;
  --canvas-warm: #f1efed;
  --hairline: #e4e1dd;
  --divider: #e9e7e4;
  --field-border: #d4cfca;
  --ink: #161513;
  --ink-deep: #211e1c;
  --body: #3d3935;
  --mute: #6f6862;
  --primary: #312d2a;
  --primary-pressed: #47423e;
  --on-primary: #ffffff;
  --wash: rgba(22, 21, 19, 0.06);
  --wash-strong: rgba(22, 21, 19, 0.1);
  --brand: #c74634;
  --link: #006b8f;
  --gold: #f0cc71;
  --gold-soft: #f7e0a1;
  --band-teal: #d6e5e5;
  --band-forest: #33553c;
  --on-forest: #ffffff;
  --focus: #227e9e;
  --error: #d63b25;
  --disabled-ink: #aea8a2;
  --contour: rgba(49, 45, 42, 0.07);

  /* حالات (بادجات وتنبيهات) — درجات هادية عشان اللون ميعلاش على المحتوى */
  --positive-bg: #e4ede6;
  --positive-ink: #2a4a32;
  --positive-line: #4f7d5b;
  --warning-bg: #f8edcf;
  --warning-ink: #6a4d08;
  --warning-line: #c99a2e;
  --negative-bg: #f7e2dd;
  --negative-ink: #9c2e1c;
  --negative-line: #d63b25;
  --info-bg: #dde9ea;
  --info-ink: #1e4c58;
  --info-line: #227e9e;

  --log-bg: #211e1c;
  --log-ink: #f1efed;

  --font: 'Noto Kufi Arabic', 'Segoe UI', Tahoma, system-ui, sans-serif;

  --r-xs: 4px;
  --r-sm: 6px;
  --r-md: 8px;
  --r-lg: 12px;
  --r-xl: 15px;
  --r-full: 9999px;

  --section: 48px;
  --container: 1280px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  color-scheme: light;
}

/* الوضع الليلي: نفس السلّم مقلوب (الأفتح = الأعلى)، والزرار الأساسي بيقلب لفاتح على غامق */
:root[data-theme='dark'] {
  --canvas: #2a2724;
  --canvas-soft: #24211f;
  --canvas-tint: #1f1d1b;
  --canvas-warm: #191715;
  --hairline: #3a3632;
  --divider: #34302c;
  --field-border: #4d4741;
  --ink: #f1efed;
  --ink-deep: #0f0e0d;
  --body: #d6d0ca;
  --mute: #a39b94;
  --primary: #f1efed;
  --primary-pressed: #d9d4cf;
  --on-primary: #161513;
  --wash: rgba(241, 239, 237, 0.07);
  --wash-strong: rgba(241, 239, 237, 0.12);
  --brand: #e2725e;
  --link: #6cc0de;
  --band-teal: #1f3132;
  --band-forest: #2b4a33;
  --contour: rgba(241, 239, 237, 0.06);
  --positive-bg: #213528;
  --positive-ink: #a9d3b3;
  --warning-bg: #3a3014;
  --warning-ink: #f3d78b;
  --negative-bg: #3d1f19;
  --negative-ink: #f3a598;
  --info-bg: #1c3238;
  --info-ink: #9fd3e3;
  --log-bg: #0f0e0d;
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --canvas: #2a2724;
    --canvas-soft: #24211f;
    --canvas-tint: #1f1d1b;
    --canvas-warm: #191715;
    --hairline: #3a3632;
    --divider: #34302c;
    --field-border: #4d4741;
    --ink: #f1efed;
    --ink-deep: #0f0e0d;
    --body: #d6d0ca;
    --mute: #a39b94;
    --primary: #f1efed;
    --primary-pressed: #d9d4cf;
    --on-primary: #161513;
    --wash: rgba(241, 239, 237, 0.07);
    --wash-strong: rgba(241, 239, 237, 0.12);
    --brand: #e2725e;
    --link: #6cc0de;
    --band-teal: #1f3132;
    --band-forest: #2b4a33;
    --contour: rgba(241, 239, 237, 0.06);
    --positive-bg: #213528;
    --positive-ink: #a9d3b3;
    --warning-bg: #3a3014;
    --warning-ink: #f3d78b;
    --negative-bg: #3d1f19;
    --negative-ink: #f3a598;
    --info-bg: #1c3238;
    --info-ink: #9fd3e3;
    --log-bg: #0f0e0d;
    color-scheme: dark;
  }
}

/* ===================== الأساسيات ===================== */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--canvas-warm);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  font-weight: 350;
  line-height: 1.65;
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  color: var(--ink);
  line-height: 1.3;
  letter-spacing: 0;
}

p {
  margin: 0;
}

a {
  color: var(--link);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

img,
svg {
  max-width: 100%;
}

strong,
b {
  font-weight: 700;
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

::selection {
  background: var(--gold-soft);
  color: #161513;
}

[hidden] {
  display: none !important;
}

.icon {
  width: 20px;
  height: 20px;
  flex: none;
}

.ltr {
  direction: ltr;
  unicode-bidi: isolate;
}

.num {
  font-variant-numeric: tabular-nums;
}

.nowrap {
  white-space: nowrap;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  inset-inline-start: 16px;
  top: -60px;
  z-index: 100;
  padding: 10px 16px;
  border-radius: var(--r-xs);
  background: var(--primary);
  color: var(--on-primary);
  font-weight: 500;
}

.skip-link:focus {
  top: 12px;
}

/* ===================== الأزرار ===================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 18px;
  border: 1px solid transparent;
  border-radius: var(--r-xs);
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  transition:
    background-color 0.18s,
    color 0.18s,
    border-color 0.18s,
    transform 0.18s var(--ease);
}

.btn:hover {
  text-decoration: none;
}

.btn:active {
  transform: translateY(1px);
}

.btn .icon {
  width: 18px;
  height: 18px;
}

.btn-primary {
  background: var(--primary);
  color: var(--on-primary);
}

.btn-primary:hover,
.btn-primary:active {
  background: var(--primary-pressed);
}

.btn-secondary {
  border-color: var(--ink);
  color: var(--ink);
}

.btn-secondary:hover {
  background: var(--wash);
}

.btn-tertiary {
  background: var(--wash);
}

.btn-tertiary:hover {
  background: var(--wash-strong);
}

.btn-danger {
  background: var(--error);
  color: #ffffff;
}

.btn-danger:hover {
  background: #b9311e;
}

.btn[disabled],
.btn:disabled {
  border-color: var(--hairline);
  background: var(--canvas-soft);
  color: var(--disabled-ink);
  cursor: not-allowed;
  transform: none;
}

.btn-sm {
  min-height: 36px;
  padding: 6px 14px;
  font-size: 13px;
}

/* زرار على شريط غامق: بيقلب الألوان مش بيغيّرها */
.btn-inverse {
  background: #ffffff;
  color: #161513;
}

.btn-inverse:hover {
  background: #f1efed;
}

.btn-outline-inverse {
  border-color: #ffffff;
  color: #ffffff;
}

.btn-outline-inverse:hover {
  background: rgba(255, 255, 255, 0.1);
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: var(--r-xs);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  transition:
    background-color 0.18s,
    color 0.18s;
}

.icon-btn:hover {
  background: var(--wash);
  text-decoration: none;
}

.icon-btn.danger:hover {
  background: var(--negative-bg);
  color: var(--negative-ink);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.actions form {
  margin: 0;
}

/* ===================== الحقول ===================== */
.form {
  display: grid;
  gap: 18px;
  margin-top: 8px;
}

.field {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.field label,
.field-label {
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
}

.field .hint,
.help {
  color: var(--mute);
  font-size: 14px;
}

.input {
  width: 100%;
  min-height: 46px;
  padding: 10px 16px;
  border: 1px solid var(--field-border);
  border-radius: var(--r-sm);
  background: var(--canvas);
  color: var(--ink);
  font: inherit;
  font-size: 15px;
  transition: border-color 0.18s;
}

.input:hover {
  border-color: var(--mute);
}

.input:focus {
  border-color: var(--focus);
  outline: 2px solid color-mix(in srgb, var(--focus) 25%, transparent);
  outline-offset: 0;
}

textarea.input {
  min-height: 90px;
  resize: vertical;
}

select.input {
  appearance: none;
  padding-inline-end: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236f6862' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 12px center;
  background-size: 18px;
}

.input-group {
  position: relative;
}

.input-group .input {
  padding-inline-end: 52px;
}

.input-group .icon-btn {
  position: absolute;
  inset-inline-end: 3px;
  top: 3px;
}

.check {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  cursor: pointer;
}

.check input,
.row-select {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
  cursor: pointer;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 20px;
}

.filters .field {
  flex: 1 1 160px;
}

.filters .field.wide {
  flex: 3 1 260px;
}

.field.search {
  position: relative;
}

.field.search .icon {
  position: absolute;
  inset-inline-start: 14px;
  bottom: 13px;
  color: var(--mute);
  pointer-events: none;
}

.field.search .input {
  padding-inline-start: 44px;
}

/* ===================== التنبيهات والبادجات ===================== */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 20px;
  padding: 14px 18px;
  border: 1px solid var(--hairline);
  border-inline-start: 4px solid var(--info-line);
  border-radius: var(--r-md);
  background: var(--canvas);
  color: var(--ink);
  font-size: 15px;
}

.alert ul {
  margin: 6px 0 0;
  padding-inline-start: 20px;
}

.alert.success {
  border-inline-start-color: var(--positive-line);
}

.alert.warning {
  border-inline-start-color: var(--warning-line);
}

.alert.error {
  border-inline-start-color: var(--negative-line);
}

.alert .icon {
  margin-top: 2px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 10px;
  border-radius: var(--r-xs);
  background: var(--canvas-tint);
  color: var(--body);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.7;
  white-space: nowrap;
  text-decoration: none;
}

a.badge:hover {
  background: var(--canvas-warm);
  text-decoration: none;
}

.badge .icon {
  width: 14px;
  height: 14px;
}

.badge.positive {
  background: var(--positive-bg);
  color: var(--positive-ink);
}

.badge.warning {
  background: var(--warning-bg);
  color: var(--warning-ink);
}

.badge.negative {
  background: var(--negative-bg);
  color: var(--negative-ink);
}

.badge.info {
  background: var(--info-bg);
  color: var(--info-ink);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.dot,
.live-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: var(--r-full);
  background: var(--positive-line);
  animation: pulse 1.6s ease-in-out infinite;
}

/* ===================== لوحة التحكم: الهيكل ===================== */
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
}

.brand:hover {
  text-decoration: none;
}

.brand-logo {
  width: auto;
  height: 80px;
  object-fit: contain;
}

/* الاسم: المكان الوحيد للأحمر */
.brand-text {
  display: grid;
  color: var(--brand);
  font-size: 20px;
  font-weight: 800;
  line-height: 1.25;
  white-space: nowrap;
}

.brand-text small {
  color: var(--mute);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.2;
}

.topbar {
  display: none;
}

.shell {
  display: grid;
  grid-template-columns: 272px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 24px;
  height: 100vh;
  padding: 24px 16px;
  overflow-y: auto;
  border-inline-end: 1px solid var(--hairline);
  background: var(--canvas);
}

.sidebar > .brand {
  padding: 0 8px;
}

.sidebar nav {
  display: grid;
  gap: 2px;
}

.nav-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 11px 14px;
  border: 0;
  border-radius: var(--r-md);
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 15px;
  font-weight: 400;
  text-align: start;
  text-decoration: none;
  cursor: pointer;
  transition:
    background-color 0.2s,
    color 0.2s;
}

.nav-link:hover {
  background: var(--canvas-tint);
  text-decoration: none;
}

/* الصفحة الحالية: الفحمي (اللون الوحيد للتأكيد في النظام) */
.nav-link.active {
  background: var(--primary);
  color: var(--on-primary);
  font-weight: 600;
}

.nav-link .dot {
  margin-inline-start: auto;
}

.sidebar-foot {
  display: grid;
  gap: 2px;
  margin-top: auto;
}

.sidebar-foot form {
  margin: 0;
}

.nav-sep {
  height: 1px;
  margin: 8px 0 12px;
  background: var(--hairline);
}

.user-chip {
  padding: 0 14px 8px;
  color: var(--mute);
  font-size: 13px;
}

.main {
  min-width: 0;
  padding: 40px 48px 64px;
}

.scrim {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(22, 21, 19, 0.45);
}

/* عنوان كل صفحة: Kufi رفيع كبير (قالب لوحة التحكم) */
.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px 24px;
  margin-bottom: 32px;
}

.page-title {
  font-size: clamp(28px, 3.2vw, 40px);
  font-weight: 300;
  line-height: 1.3;
}

.page-sub {
  max-width: 760px;
  margin-top: 8px;
  color: var(--body);
  font-size: 15px;
}

.page-sub .badge {
  margin-inline-end: 6px;
}

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
  color: var(--mute);
  font-size: 13px;
}

.breadcrumb a {
  color: var(--mute);
}

.breadcrumb a:hover {
  color: var(--ink);
}

/* ===================== الكروت والإحصائيات ===================== */
.card {
  padding: 28px 32px;
  border-radius: var(--r-xl);
  background: var(--canvas);
}

.card + .card,
.grid + .card,
.card + .grid,
.grid + .grid,
.stats + .card,
.stats + .grid,
.stack > * + * {
  margin-top: 24px;
}

.card-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 18px;
  font-size: 20px;
  font-weight: 800;
}

details.card > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 18px;
  font-weight: 800;
  list-style: none;
  cursor: pointer;
}

details.card > summary::-webkit-details-marker {
  display: none;
}

details.card > summary::after {
  content: '+';
  color: var(--mute);
  font-size: 22px;
  font-weight: 300;
  transition: transform 0.25s var(--ease);
}

details.card[open] > summary::after {
  transform: rotate(45deg);
}

details.card[open] > summary {
  margin-bottom: 18px;
}

.grid {
  display: grid;
  gap: 24px;
}

.grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.stat {
  display: grid;
  align-content: start;
  gap: 4px;
  padding: 22px 24px;
  border-radius: var(--r-xl);
  background: var(--canvas);
  color: var(--ink);
  text-decoration: none;
  transition:
    background-color 0.2s,
    transform 0.3s var(--ease);
}

.stat-link:hover {
  background: var(--canvas-soft);
  text-decoration: none;
  transform: translateY(-2px);
}

.stat-label {
  color: var(--body);
  font-size: 14px;
  font-weight: 500;
}

.stat-value {
  font-size: 44px;
  font-weight: 300;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}

.stat-hint {
  color: var(--mute);
  font-size: 13px;
}

/* الكارت المميز: الفحمي مقلوب (زي الشريط الغامق) */
.stat.featured {
  background: var(--primary);
  color: var(--on-primary);
}

.stat.featured .stat-label,
.stat.featured .stat-hint {
  color: var(--on-primary);
  opacity: 0.8;
}

.stat.featured.stat-link:hover {
  background: var(--primary-pressed);
}

.empty {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 40px 24px;
  border-radius: var(--r-md);
  background: var(--canvas-soft);
  color: var(--body);
  text-align: center;
}

.empty h3 {
  font-size: 18px;
  font-weight: 800;
}

.empty .btn {
  margin-top: 8px;
}

.kv {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 10px 24px;
  margin: 0;
}

.kv dt {
  color: var(--mute);
  font-size: 14px;
}

.kv dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.quote {
  padding: 14px 18px;
  border-inline-start: 3px solid var(--hairline);
  border-radius: var(--r-xs);
  background: var(--canvas-soft);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  margin-top: 4px;
  color: var(--mute);
  font-size: 13px;
}

/* break-word مش anywhere: الكلمة متتقسمش إلا لو مش هتكفي في سطر لوحدها (العمود بيوسع الأول) */
.cell-main {
  color: var(--ink);
  font-weight: 600;
  overflow-wrap: break-word;
}

a.cell-main:hover {
  color: var(--link);
}

.clip {
  display: -webkit-box;
  max-width: 340px;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow-wrap: anywhere;
}

.thumb {
  display: block;
  width: 56px;
  height: 56px;
  border-radius: var(--r-md);
  background: var(--canvas-tint);
  object-fit: cover;
}

.card-image {
  display: block;
  width: 100%;
  max-height: 420px;
  border-radius: var(--r-md);
  background: var(--canvas-tint);
  object-fit: contain;
}

.post-images {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.post-image {
  display: grid;
  gap: 10px;
  margin: 0;
}

.phone-line {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

/* أعمدة جودة البيانات */
.bars {
  display: grid;
  gap: 14px;
}

.bar-row {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) 2fr 48px;
  align-items: center;
  gap: 12px;
  font-size: 14px;
}

.bar-track {
  height: 10px;
  overflow: hidden;
  border-radius: var(--r-xs);
  background: var(--canvas-tint);
}

.bar-fill {
  height: 100%;
  border-radius: var(--r-xs);
  background: var(--primary);
  transform-origin: right center;
  animation: grow-x 1.1s var(--ease) 0.3s both;
}

.bar-fill.positive {
  background: var(--positive-line);
}

.bar-fill.warning {
  background: var(--warning-line);
}

.bar-fill.info {
  background: var(--info-line);
}

.bar-fill.negative {
  background: var(--negative-line);
}

/* التابات (نوع الشركة) — خط تحت المختار بيتمد */
.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  overflow-x: auto;
  border-bottom: 1px solid var(--hairline);
}

.tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  color: var(--body);
  font-size: 15px;
  white-space: nowrap;
  text-decoration: none;
}

.tab:hover {
  color: var(--ink);
  text-decoration: none;
}

.tab::after {
  content: '';
  position: absolute;
  inset-inline: 16px;
  bottom: -1px;
  height: 3px;
  background: var(--ink);
  transform: scaleX(0);
  transition: transform 0.3s var(--ease);
}

.tab.active {
  color: var(--ink);
  font-weight: 700;
}

.tab.active::after,
.tab:hover::after {
  transform: scaleX(1);
}

.tab .count {
  padding: 0 8px;
  border-radius: var(--r-xs);
  background: var(--canvas-tint);
  font-size: 12px;
}

/* ===================== الجداول ===================== */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
}

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}

table.data th {
  padding: 12px 16px;
  background: var(--canvas-tint);
  color: var(--body);
  font-size: 13px;
  font-weight: 600;
  text-align: start;
  white-space: nowrap;
}

table.data td {
  padding: 14px 16px;
  border-top: 1px solid var(--hairline);
  vertical-align: top;
}

table.data tbody tr {
  transition: background-color 0.15s;
}

table.data tbody tr:hover {
  background: var(--canvas-soft);
}

.cell-actions {
  white-space: nowrap;
  text-align: end;
}

.pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 20px;
  color: var(--body);
  font-size: 14px;
}

/* ===================== السحب ===================== */
.scrape-live {
  margin-bottom: 24px;
}

/* شريط السحب: الشريط الغامق الوحيد في لوحة التحكم (ink-deep) والزرار بيقلب أبيض */
.scrape-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 20px;
  padding: 20px 24px;
  border-radius: var(--r-xl);
  background: var(--ink-deep);
  color: #f1efed;
}

.scrape-bar .field {
  flex: 0 1 240px;
}

.scrape-bar .field-label,
.scrape-bar .check {
  color: #f1efed;
}

.scrape-bar .input {
  border-color: #4d4741;
  background: #2a2724;
  color: #f1efed;
}

.scrape-bar .btn-primary {
  background: #ffffff;
  color: #161513;
}

.scrape-bar .btn-primary:hover {
  background: #f1efed;
}

.scrape-bar .btn-primary:disabled {
  border-color: #4d4741;
  background: transparent;
  color: #8a837c;
}

.scrape-bar .selected-count {
  flex: 1 1 100%;
  font-weight: 700;
}

.job-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.job-posts {
  display: grid;
  gap: 8px;
  margin: 16px 0;
}

.job-post {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--r-md);
  background: var(--canvas-soft);
}

.log {
  max-height: 360px;
  margin: 0;
  padding: 18px;
  overflow: auto;
  border-radius: var(--r-md);
  background: var(--log-bg);
  color: var(--log-ink);
  font-family: Consolas, 'Cascadia Mono', monospace;
  font-size: 13px;
  line-height: 1.7;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.log.tall {
  max-height: 60vh;
}

/* فلاج الظهور في الموقع العام */
.public-state {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 16px;
  margin-bottom: 24px;
  padding: 14px 20px;
  border-inline-start: 4px solid var(--hairline);
  border-radius: var(--r-md);
  background: var(--canvas);
}

.public-state.is-on {
  border-inline-start-color: var(--positive-line);
}

.public-state-info {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 12px;
  min-width: 0;
}

.public-state-form {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* ===================== الدخول ===================== */
.auth {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
}

.auth-card {
  width: min(440px, 100%);
  padding: 40px 36px;
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  background: var(--canvas);
  animation: rise 0.6s var(--ease) both;
}

.auth-logo {
  width: auto;
  height: 130px;
  object-fit: contain;
}

.auth-title {
  margin-top: 16px;
  color: var(--brand);
  font-size: 26px;
  font-weight: 800;
}

.auth-title small {
  display: block;
  color: var(--mute);
  font-size: 13px;
  font-weight: 400;
}

.auth-title::after {
  content: '';
  display: block;
  width: 40px;
  height: 4px;
  margin-top: 14px;
  background: var(--gold);
  animation: draw 0.9s var(--ease) 0.4s both;
}

.auth .page-sub {
  margin-top: 14px;
}

.auth .form {
  margin-top: 28px;
}

.auth-tools {
  position: fixed;
  top: 16px;
  inset-inline-end: 16px;
}

/* ===================== النوافذ المنبثقة (من غير ظل — خط رفيع بس) ===================== */
dialog.modal {
  width: min(680px, calc(100% - 32px));
  max-height: calc(100vh - 48px);
  padding: 0;
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  background: var(--canvas);
  color: var(--ink);
}

dialog.modal[open] {
  animation: modal-in 0.35s var(--ease) both;
}

dialog.modal::backdrop {
  background: rgba(22, 21, 19, 0.5);
}

.modal-body {
  padding: 32px;
}

.modal-close {
  position: absolute;
  top: 12px;
  inset-inline-end: 12px;
}

.modal-loading {
  padding: 40px 0;
  color: var(--mute);
  text-align: center;
}

.modal-body .page-head {
  margin-bottom: 20px;
  padding-inline-end: 40px;
}

.modal-body .page-title {
  font-size: 26px;
}

.modal-body .breadcrumb {
  display: none;
}

.modal-body .card {
  padding: 0;
  background: none;
}

/* ===================== الموقع العام ===================== */
body.site {
  background: var(--canvas);
}

.site-wrap {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 40px;
}

/* الهيدر: أبيض، الاسم بالأحمر، والصفحة الحالية عليها خط دهبي */
.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  border-bottom: 1px solid var(--hairline);
  background: var(--canvas);
}

.site-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 76px;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.site-nav > a:not(.btn) {
  position: relative;
  padding: 10px 14px;
  color: var(--ink);
  font-size: 15px;
  font-weight: 500;
  white-space: nowrap;
  text-decoration: none;
}

.site-nav > a:not(.btn)::after {
  content: '';
  position: absolute;
  inset-inline: 14px;
  bottom: -17px;
  height: 4px;
  background: var(--gold-soft);
  transform: scaleX(0);
  transition: transform 0.35s var(--ease);
}

.site-nav > a:not(.btn):hover::after,
.site-nav > a.active::after {
  transform: scaleX(1);
}

.site-nav .btn {
  margin-inline-start: 8px;
}

.short-label {
  display: none;
}

/* الشرايط: عرض كامل، من غير حواف — الفرق بينهم درجة على السلّم */
.band {
  position: relative;
  padding: 80px 0;
  background: var(--canvas);
}

.band-soft {
  background: var(--canvas-soft);
}

.band-tint {
  background: var(--canvas-tint);
}

.band-warm {
  background: var(--canvas-warm);
}

.band-teal {
  padding: 36px 0;
  background: var(--band-teal);
}

.band-forest {
  background: var(--band-forest);
  color: var(--on-forest);
}

.band-forest h2,
.band-forest p {
  color: var(--on-forest);
}

.band-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px 32px;
  margin-bottom: 40px;
}

.band-head p {
  max-width: 620px;
  margin-top: 12px;
  color: var(--body);
  font-size: 17px;
}

/* عناوين الموقع العام: نفس الخط — الكبير رفيع (300) وعناوين الأقسام تقيلة (800) زي DESIGN.md */
.display-xl {
  font-size: clamp(36px, 5vw, 62px);
  font-weight: 300;
  line-height: 1.35;
}

.display-xl strong {
  font-weight: 800;
}

.display-lg {
  font-size: clamp(26px, 3vw, 36px);
  font-weight: 800;
  line-height: 1.4;
}

.display-md {
  font-size: clamp(28px, 3.4vw, 40px);
  font-weight: 300;
  line-height: 1.35;
}

/* الزخرفة الوحيدة: خط دهبي 40×4 تحت العنوان الكبير */
.gold-rule {
  display: block;
  width: 40px;
  height: 4px;
  background: var(--gold);
}

.lead {
  max-width: 600px;
  color: var(--body);
  font-size: clamp(17px, 1.7vw, 20px);
  font-weight: 350;
  line-height: 1.85;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--body);
  font-size: 14px;
  font-weight: 600;
}

.eyebrow::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: var(--r-full);
  background: var(--positive-line);
  animation: pulse 1.8s ease-in-out infinite;
}

/* ===== البطل ===== */
.hero {
  position: relative;
  overflow: hidden;
  padding: 80px 0 136px;
  background: var(--canvas-warm);
  /* الشريط بيخلص بخط مايل والشريط اللي بعده بيدخل فيه */
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 64px), 0 100%);
}

/* خطوط كنتور خفيفة جداً ورا المحتوى (زخرفة الشريط في DESIGN.md) — بتتحرك ببطء */
.hero-contours {
  position: absolute;
  inset: -10% -5%;
  width: 110%;
  height: 120%;
  color: var(--contour);
  pointer-events: none;
  animation: drift 40s ease-in-out infinite alternate;
}

.hero-grid {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  align-items: center;
  gap: 64px;
}

.hero-copy {
  display: grid;
  justify-items: start;
  gap: 24px;
  min-width: 0;
}

/* الكلمة اللي بتتقلب في العنوان (اسم شركة تطوير) */
.flip {
  position: relative;
  display: inline-grid;
  max-width: 100%;
  overflow: hidden;
  vertical-align: bottom;
  /* مسافة جوه الصندوق عشان نقط الحروف العربي فوق وتحت متتقصش */
  padding: 0.2em 0.06em 0.25em;
  margin: -0.2em -0.06em -0.25em;
  transition: width 0.6s var(--ease);
}

.flip-word {
  grid-area: 1 / 1;
  justify-self: start;
  white-space: nowrap;
  transition:
    transform 0.7s var(--ease),
    opacity 0.5s;
}

.flip-word.is-out {
  opacity: 0;
  transform: translateY(-45%);
  transition:
    transform 0.45s var(--ease),
    opacity 0.25s;
}

.flip-word.is-next {
  opacity: 0;
  transform: translateY(45%);
}

.hero-search {
  display: flex;
  gap: 8px;
  width: 100%;
  max-width: 580px;
}

.search-box {
  position: relative;
  flex: 1;
  min-width: 0;
}

.search-box .icon {
  position: absolute;
  inset-inline-start: 16px;
  top: 50%;
  color: var(--mute);
  transform: translateY(-50%);
  pointer-events: none;
}

.search-box .input {
  min-height: 54px;
  padding-inline-start: 48px;
  font-size: 16px;
}

.hero-search .btn {
  min-height: 54px;
  padding: 0 28px;
}

.quick-picks {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  color: var(--mute);
  font-size: 14px;
}

.quick-picks a {
  padding: 4px 12px;
  border: 1px solid var(--hairline);
  border-radius: var(--r-xs);
  background: var(--canvas);
  color: var(--ink);
  font-weight: 500;
  text-decoration: none;
  transition: border-color 0.2s;
}

.quick-picks a:hover {
  border-color: var(--ink);
}

/* ===== رسمة العمارات جنب العنوان: بتتبني من الأرض، والشبابيك بتنوّر، والتليفون بينبض ===== */
.hero-art {
  position: relative;
  min-width: 0;
}

.hero-art svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.art-disc {
  fill: var(--canvas);
}

.art-line {
  fill: none;
  stroke: var(--ink);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.art-bld {
  fill: var(--canvas);
  stroke: var(--ink);
  stroke-width: 2;
  transform-box: fill-box;
  transform-origin: bottom;
  animation: build-up 1.1s var(--ease) both;
  animation-delay: calc(var(--i, 0) * 130ms + 150ms);
}

.art-win {
  fill: var(--canvas-warm);
  animation: fade-in 0.6s ease both;
  animation-delay: calc(var(--i, 0) * 130ms + 900ms);
}

.art-win.lit {
  fill: var(--gold-soft);
  animation:
    fade-in 0.6s ease both,
    flicker 5s ease-in-out infinite;
  animation-delay: calc(var(--i, 0) * 130ms + 900ms), calc(var(--d, 0) * 1s + 2s);
}

.art-radar {
  fill: none;
  stroke: var(--ink);
  stroke-width: 2;
  stroke-linecap: round;
  animation: pulse 2.2s ease-in-out infinite;
}

.art-radar.r2 {
  animation-delay: 0.4s;
}

.art-pin {
  fill: var(--primary);
  animation: pop 0.6s var(--ease) 1.6s both;
  transform-box: fill-box;
  transform-origin: center;
}

.art-pin-icon {
  fill: none;
  stroke: var(--on-primary);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  animation: fade-in 0.4s ease 1.9s both;
}

.art-ring {
  fill: none;
  stroke: var(--primary);
  stroke-width: 2;
  transform-box: fill-box;
  transform-origin: center;
  animation: ring 2.6s ease-out 2.2s infinite both;
}

.art-tree {
  fill: var(--band-teal);
  stroke: var(--ink);
  stroke-width: 2;
  transform-box: fill-box;
  transform-origin: bottom;
  animation: pop 0.7s var(--ease) both;
  animation-delay: calc(var(--i, 0) * 120ms + 1.2s);
}

/* ===== شريط أسماء الشركات اللي بيتحرك (شريط تيل — اللون بيدخل كشريط كامل بس) ===== */
.marquee-label {
  margin-bottom: 12px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
}

.marquee {
  display: flex;
  overflow: hidden;
  mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent);
}

.marquee-track {
  display: flex;
  flex: none;
  align-items: center;
  gap: 56px;
  padding-inline-end: 56px;
  animation: marquee 60s linear infinite;
}

.marquee:hover .marquee-track {
  animation-play-state: paused;
}

.marquee a {
  color: var(--ink);
  font-size: 24px;
  font-weight: 300;
  white-space: nowrap;
  text-decoration: none;
  opacity: 0.7;
  transition: opacity 0.2s;
}

.marquee a:hover {
  opacity: 1;
}

/* ===== الأرقام: أعمدة مفصولة بخط رأسي ===== */
.figures {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.figure {
  padding: 8px 32px;
  border-inline-start: 2px solid var(--divider);
}

.figure:first-child {
  padding-inline-start: 0;
  border-inline-start: 0;
}

.figure strong {
  display: block;
  font-size: clamp(48px, 5.4vw, 72px);
  font-weight: 300;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.figure span {
  color: var(--body);
}

/* ===== شركات التطوير ===== */
.dev-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 16px;
}

.dev-card {
  position: relative;
  display: grid;
  align-content: start;
  gap: 6px;
  min-height: 160px;
  padding: 24px;
  overflow: hidden;
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  background: var(--canvas);
  color: var(--ink);
  text-decoration: none;
  transition:
    background-color 0.25s,
    border-color 0.25s,
    transform 0.4s var(--ease);
}

.dev-card:hover {
  border-color: var(--field-border);
  background: var(--canvas-soft);
  text-decoration: none;
  transform: translateY(-4px);
}

/* خط بيترسم تحت الكارت مع الماوس (border reveal) */
.dev-card::after {
  content: '';
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  height: 3px;
  background: var(--ink);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.5s var(--ease);
}

.dev-card:hover::after {
  transform: scaleX(1);
}

.dev-initial {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-bottom: 10px;
  border-radius: var(--r-md);
  background: var(--canvas-warm);
  font-size: 18px;
  font-weight: 800;
  transition:
    background-color 0.25s,
    color 0.25s;
}

.dev-card:hover .dev-initial {
  background: var(--primary);
  color: var(--on-primary);
}

.dev-name {
  font-size: 17px;
  font-weight: 700;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.dev-meta {
  color: var(--body);
  font-size: 14px;
}

.dev-card .chips {
  margin-top: 6px;
}

.dev-arrow {
  position: absolute;
  top: 26px;
  inset-inline-end: 24px;
  color: var(--ink);
  opacity: 0;
  transform: translateX(10px);
  transition:
    opacity 0.3s,
    transform 0.4s var(--ease);
}

.dev-card:hover .dev-arrow {
  opacity: 1;
  transform: none;
}

/* ===== السيلز ===== */
.sales-list {
  display: grid;
  border-top: 1px solid var(--hairline);
}

.sale-card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  padding: 18px 8px;
  border-bottom: 1px solid var(--hairline);
  transition: background-color 0.2s;
}

.sale-card:hover {
  background: var(--canvas-soft);
}

.sale-who {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.sale-avatar {
  display: grid;
  flex: none;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: var(--r-md);
  background: var(--canvas-warm);
  font-weight: 700;
}

.sale-text {
  display: grid;
  min-width: 0;
}

.sale-name {
  font-size: 16px;
  font-weight: 700;
}

.sale-meta {
  color: var(--mute);
  font-size: 14px;
}

.sale-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 20px;
}

/* الرقم وزراير الاتصال والواتساب وحدة واحدة متتقسمش */
.phone-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.sale-phone {
  margin-inline-end: 6px;
  color: var(--ink);
  font-size: 16px;
  font-weight: 600;
  text-decoration: none;
}

.sale-phone:hover {
  color: var(--link);
  text-decoration: none;
}

.phone-chip .icon-btn {
  width: 38px;
  height: 38px;
  background: var(--wash);
}

.phone-chip .icon-btn:hover {
  background: var(--primary);
  color: var(--on-primary);
}

.phone-chip .icon-btn .icon {
  width: 18px;
  height: 18px;
}

/* ===== صفحات القوائم العامة ===== */
.page-band {
  padding: 56px 0 44px;
  background: var(--canvas-warm);
}

.page-band .breadcrumb a {
  color: var(--body);
}

.page-band .gold-rule {
  margin-top: 18px;
}

.page-band .filters {
  margin: 28px 0 0;
}

.result-count {
  margin-top: 14px;
  color: var(--body);
}

/* ===== شريطين جنب بعض ===== */
.split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: center;
  gap: 48px;
}

.split .actions {
  margin-top: 28px;
}

.channels {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.channel {
  padding: 8px 32px;
  border-inline-start: 2px solid var(--divider);
}

.channel:first-child {
  padding-inline-start: 0;
  border-inline-start: 0;
}

.channel .icon {
  width: 28px;
  height: 28px;
  margin-bottom: 14px;
  color: var(--ink);
}

.channel h3 {
  margin-bottom: 10px;
  font-size: 20px;
  font-weight: 800;
}

.channel p {
  color: var(--body);
}

/* ===== الفوتر: هادي، سطر روابط ===== */
.site-footer {
  padding: 36px 0;
  border-top: 1px solid var(--hairline);
  background: var(--canvas);
  font-size: 13px;
}

.footer-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
}

.footer-links a {
  color: var(--ink);
}

.footer-note {
  margin-top: 18px;
  color: var(--mute);
}

/* ===================== الحركة ===================== */
@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.98);
  }
}

@keyframes grow-x {
  from {
    transform: scaleX(0);
  }
}

@keyframes pulse {
  50% {
    opacity: 0.3;
  }
}

@keyframes caret {
  50% {
    opacity: 0;
  }
}

/* الاتجاه من الشمال لليمين = أسماء بتعدّي في اتجاه القراية العربي */
@keyframes marquee {
  to {
    transform: translateX(100%);
  }
}

@keyframes drift {
  to {
    transform: translate3d(-3%, 2%, 0) rotate(1.5deg);
  }
}

@keyframes build-up {
  from {
    transform: scaleY(0);
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}

@keyframes flicker {
  50% {
    opacity: 0.35;
  }
}

@keyframes pop {
  from {
    opacity: 0;
    transform: scale(0.4);
  }
}

@keyframes ring {
  from {
    opacity: 0.6;
    transform: scale(1);
  }
  to {
    opacity: 0;
    transform: scale(1.9);
  }
}

@keyframes draw {
  from {
    width: 0;
  }
}

@keyframes word-up {
  to {
    transform: none;
  }
}

/* ظهور مع السكرول: app.js بيحط is-in لما العنصر يدخل الشاشة — وبالترتيب حسب --i */
.js [data-anim] {
  opacity: 0;
  transform: translateY(28px);
  transition:
    opacity 0.9s var(--ease),
    transform 0.9s var(--ease);
  transition-delay: calc(var(--i, 0) * 70ms);
}

.js [data-anim].is-in {
  opacity: 1;
  transform: none;
}

/* العنوان الكبير: كل كلمة بتطلع من ورا خط (من غير تقسيم حروف — العربي لازم يفضل متصل) */
.words .w {
  display: inline-block;
  overflow: hidden;
  padding-bottom: 0.14em;
  margin-bottom: -0.14em;
  vertical-align: bottom;
}

.words .w > span {
  display: inline-block;
}

.js .words .w > span {
  transform: translateY(115%);
  animation: word-up 1s var(--ease) both;
  animation-delay: calc(var(--i, 0) * 90ms + 120ms);
}

.js .gold-rule.draw {
  animation: draw 0.9s var(--ease) 0.8s both;
}

/* لوحة التحكم: المحتوى بيظهر بالترتيب أول ما الصفحة تفتح */
.main > * {
  animation: rise 0.55s var(--ease) both;
}

.main > *:nth-child(2) {
  animation-delay: 60ms;
}

.main > *:nth-child(3) {
  animation-delay: 120ms;
}

.main > *:nth-child(4) {
  animation-delay: 180ms;
}

.main > *:nth-child(n + 5) {
  animation-delay: 240ms;
}

.stats .stat {
  animation: rise 0.6s var(--ease) both;
}

.stats .stat:nth-child(2) {
  animation-delay: 80ms;
}

.stats .stat:nth-child(3) {
  animation-delay: 160ms;
}

.stats .stat:nth-child(4) {
  animation-delay: 240ms;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    animation-delay: 0ms !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0ms !important;
    scroll-behavior: auto !important;
  }

  .js [data-anim],
  .js .words .w > span {
    opacity: 1;
    transform: none;
  }

  .marquee-track,
  .hero-contours {
    animation: none !important;
  }
}

/* ===================== الشاشات الأصغر ===================== */
@media (max-width: 1180px) {
  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .main {
    padding: 32px 32px 56px;
  }
}

@media (max-width: 974px) {
  .hero-grid,
  .split {
    grid-template-columns: minmax(0, 1fr);
    gap: 40px;
  }

  .channels,
  .figures {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }

  .hero-art {
    max-width: 460px;
    margin: 0 auto;
  }

  /* الأعمدة لما تترص فوق بعض الخطوط الرأسية بتتشال (زي DESIGN.md) */
  .channel,
  .figure,
  .channel:first-child,
  .figure:first-child {
    padding: 20px 0;
    border-inline-start: 0;
    border-top: 1px solid var(--divider);
  }

  .channel:first-child,
  .figure:first-child {
    border-top: 0;
  }
}

/* لوحة التحكم: القائمة الجانبية بتبقى درج */
@media (max-width: 1023px) {
  .topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 64px;
    padding: 0 16px;
    border-bottom: 1px solid var(--hairline);
    background: var(--canvas);
  }

  .shell {
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar {
    position: fixed;
    inset-block: 0;
    inset-inline-start: 0;
    z-index: 50;
    width: 288px;
    transform: translateX(100%);
    transition: transform 0.35s var(--ease);
  }

  .nav-open .sidebar {
    transform: none;
  }

  .main {
    padding: 28px 20px 48px;
  }

  .grid-2,
  .grid-3 {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 767px) {
  .card {
    padding: 22px 18px;
  }

  .stat {
    padding: 18px;
  }

  .stat-value {
    font-size: 34px;
  }

  .kv {
    grid-template-columns: minmax(0, 1fr);
    gap: 2px;
  }

  .kv dd {
    margin-bottom: 10px;
  }

  .bar-row {
    grid-template-columns: minmax(0, 1fr) 48px;
  }

  .bar-row .bar-track {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .modal-body {
    padding: 24px 18px;
  }

  /* الجداول بتتحول لكروت: كل خلية بعنوانها */
  .table-wrap {
    border: 0;
  }

  table.data.stack-mobile thead {
    display: none;
  }

  table.data.stack-mobile,
  table.data.stack-mobile tbody,
  table.data.stack-mobile tr,
  table.data.stack-mobile td {
    display: block;
    width: 100%;
  }

  table.data.stack-mobile tr {
    margin-bottom: 12px;
    padding: 6px 0;
    border: 1px solid var(--hairline);
    border-radius: var(--r-md);
  }

  table.data.stack-mobile td {
    display: grid;
    grid-template-columns: 110px minmax(0, 1fr);
    gap: 12px;
    padding: 8px 16px;
    border: 0;
  }

  table.data.stack-mobile td::before {
    content: attr(data-label);
    color: var(--mute);
    font-size: 13px;
  }

  table.data.stack-mobile td.cell-actions {
    display: flex;
    justify-content: flex-start;
    border-top: 1px solid var(--hairline);
  }

  table.data.stack-mobile td.cell-actions::before {
    display: none;
  }

  .scrape-bar .field {
    flex: 1 1 100%;
  }

  /* الموقع العام */
  .site-wrap {
    padding: 0 16px;
  }

  .site-header-inner {
    min-height: 64px;
  }

  .site-nav > a:not(.btn) {
    padding: 8px;
    font-size: 14px;
  }

  .site-nav > a:not(.btn)::after {
    inset-inline: 8px;
    bottom: -13px;
  }

  .site-nav .btn,
  .long-label {
    display: none;
  }

  .short-label {
    display: inline;
  }

  .site-header-inner {
    gap: 8px;
  }

  .brand-text {
    font-size: 17px;
  }

  .brand-text small {
    font-size: 11px;
  }

  .brand-logo {
    width: auto;
    height: 56px;
  }

  .hero {
    padding: 48px 0 96px;
    clip-path: polygon(0 0, 100% 0, 100% calc(100% - 32px), 0 100%);
  }

  .hero-search {
    flex-direction: column;
  }

  .band {
    padding: 56px 0;
  }

  .dev-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .dev-card {
    min-height: 0;
    padding: 16px;
  }

  .dev-arrow {
    display: none;
  }

  .dev-name {
    font-size: 15px;
  }

  .sale-card {
    padding: 16px 0;
  }

  .marquee a {
    font-size: 20px;
  }

}
