/* ==========================================================================
   Wakeel UI — المنظومة البصرية الفائقة لمنصة الوكلاء الذكيين لأودو
   Next-Generation Executive Luxury Design System (A to Z)
   Fonts: Tajawal (Headers/Brand), IBM Plex Sans Arabic (Body/UI), IBM Plex Mono (Code/Data)
   ========================================================================== */

:root,
[data-bs-theme="light"] {
  --wk-font-sans: 'IBM Plex Sans Arabic', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --wk-font-display: 'Tajawal', 'IBM Plex Sans Arabic', sans-serif;
  --wk-font-mono: 'IBM Plex Mono', SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  /* لوحة الألوان الأساسية: نيلي ملكي وبنفسجي مؤسسي فخم */
  --wk-brand-50:  #eef2ff;
  --wk-brand-100: #e0e7ff;
  --wk-brand-200: #c7d2fe;
  --wk-brand-300: #a5b4fc;
  --wk-brand-400: #818cf8;
  --wk-brand-500: #6366f1;
  --wk-brand-600: #4f46e5;
  --wk-brand-700: #4338ca;
  --wk-brand-800: #3730a3;
  --wk-brand-900: #312e81;
  --wk-brand-rgb: 79, 70, 229;

  /* الألوان الدلالية الفاخرة المحدثة */
  --wk-success: #10b981;
  --wk-success-rgb: 16, 185, 129;
  --wk-success-bg: rgba(16, 185, 129, 0.08);
  --wk-success-border: rgba(16, 185, 129, 0.28);

  --wk-warning: #f59e0b;
  --wk-warning-rgb: 245, 158, 11;
  --wk-warning-bg: rgba(245, 158, 11, 0.08);
  --wk-warning-border: rgba(245, 158, 11, 0.28);

  --wk-danger: #f43f5e;
  --wk-danger-rgb: 244, 63, 94;
  --wk-danger-bg: rgba(244, 63, 94, 0.08);
  --wk-danger-border: rgba(244, 63, 94, 0.28);

  --wk-info: #0ea5e9;
  --wk-info-rgb: 14, 165, 233;
  --wk-info-bg: rgba(14, 165, 233, 0.08);
  --wk-info-border: rgba(14, 165, 233, 0.28);

  --wk-accent: #d97706;
  --wk-accent-rgb: 217, 119, 6;

  /* مساحات وخلفيات التصميم الفاتح */
  --wk-bg-app: #f8fafc;
  --wk-bg-surface: #ffffff;
  --wk-bg-surface-2: #f1f5f9;
  --wk-bg-surface-3: #e2e8f0;
  --wk-border: #e2e8f0;
  --wk-border-subtle: #f1f5f9;
  --wk-text-main: #0f172a;
  --wk-text-muted: #64748b;
  --wk-text-dim: #94a3b8;

  /* تدرجات لونية ملكية وعصرية */
  --wk-grad-brand: linear-gradient(135deg, #6366f1 0%, #4f46e5 55%, #3730a3 100%);
  --wk-grad-brand-glow: linear-gradient(135deg, rgba(99, 102, 241, 0.12) 0%, rgba(79, 70, 229, 0.04) 100%);
  --wk-grad-brand-subtle: linear-gradient(135deg, rgba(99, 102, 241, 0.07) 0%, rgba(79, 70, 229, 0.02) 100%);
  --wk-grad-user-msg: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
  --wk-grad-success: linear-gradient(135deg, #10b981 0%, #059669 100%);
  --wk-grad-warning: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  --wk-grad-danger: linear-gradient(135deg, #f43f5e 0%, #e11d48 100%);
  --wk-grad-card: linear-gradient(180deg, #ffffff 0%, #fbfcfe 100%);

  /* زجاج وظلال طبقية ثلاثية الأبعاد */
  --wk-glass-bg: rgba(255, 255, 255, 0.88);
  --wk-glass-border: rgba(226, 232, 240, 0.85);
  --wk-blur: blur(20px);

  --wk-shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
  --wk-shadow-sm: 0 2px 6px -1px rgba(15, 23, 42, 0.06), 0 1px 3px rgba(15, 23, 42, 0.04);
  --wk-shadow-md: 0 8px 24px -4px rgba(15, 23, 42, 0.08), 0 2px 6px -1px rgba(15, 23, 42, 0.04);
  --wk-shadow-lg: 0 18px 40px -6px rgba(15, 23, 42, 0.12), 0 6px 14px -2px rgba(15, 23, 42, 0.06);
  --wk-shadow-xl: 0 26px 60px -10px rgba(15, 23, 42, 0.18);
  --wk-shadow-brand: 0 8px 25px -3px rgba(79, 70, 229, 0.35);
  --wk-shadow-brand-sm: 0 4px 14px -2px rgba(79, 70, 229, 0.25);

  --wk-radius-xs: 7px;
  --wk-radius-sm: 10px;
  --wk-radius-md: 14px;
  --wk-radius-lg: 18px;
  --wk-radius-xl: 26px;
  --wk-radius-full: 9999px;

  /* توحيد متغيرات Bootstrap/AdminLTE */
  --bs-primary: var(--wk-brand-600);
  --bs-primary-rgb: var(--wk-brand-rgb);
  --bs-primary-text-emphasis: var(--wk-brand-800);
  --bs-primary-bg-subtle: var(--wk-brand-50);
  --bs-primary-border-subtle: var(--wk-brand-200);
  --bs-body-bg: var(--wk-bg-app);
  --bs-body-color: var(--wk-text-main);
  --bs-secondary-color: var(--wk-text-muted);
  --bs-tertiary-bg: var(--wk-bg-surface-2);
  --bs-border-color: var(--wk-border);
}

[data-bs-theme="dark"] {
  /* ألوان الوضع الداكن الفاخر (Obsidian / Deep Slate Luxury) */
  --wk-brand-50:  #1e1b4b;
  --wk-brand-100: #2e287a;
  --wk-brand-200: #3730a3;
  --wk-brand-300: #4338ca;
  --wk-brand-400: #6366f1;
  --wk-brand-500: #818cf8;
  --wk-brand-600: #818cf8;
  --wk-brand-700: #a5b4fc;
  --wk-brand-800: #c7d2fe;
  --wk-brand-900: #e0e7ff;
  --wk-brand-rgb: 129, 140, 248;

  --wk-success: #34d399;
  --wk-success-rgb: 52, 211, 153;
  --wk-success-bg: rgba(16, 185, 129, 0.12);
  --wk-success-border: rgba(16, 185, 129, 0.28);

  --wk-warning: #fbbf24;
  --wk-warning-rgb: 251, 191, 36;
  --wk-warning-bg: rgba(245, 158, 11, 0.12);
  --wk-warning-border: rgba(245, 158, 11, 0.28);

  --wk-danger: #fb7185;
  --wk-danger-rgb: 251, 113, 133;
  --wk-danger-bg: rgba(244, 63, 94, 0.12);
  --wk-danger-border: rgba(244, 63, 94, 0.28);

  --wk-info: #38bdf8;
  --wk-info-rgb: 56, 189, 248;
  --wk-info-bg: rgba(14, 165, 233, 0.12);
  --wk-info-border: rgba(14, 165, 233, 0.28);

  --wk-accent: #fbbf24;

  --wk-bg-app: #080c14;
  --wk-bg-surface: #0f172a;
  --wk-bg-surface-2: #151f33;
  --wk-bg-surface-3: #1c2a44;
  --wk-border: #1e293b;
  --wk-border-subtle: #141e30;
  --wk-text-main: #f8fafc;
  --wk-text-muted: #94a3b8;
  --wk-text-dim: #64748b;

  --wk-grad-brand: linear-gradient(135deg, #818cf8 0%, #6366f1 50%, #4f46e5 100%);
  --wk-grad-brand-glow: linear-gradient(135deg, rgba(129, 140, 248, 0.16) 0%, rgba(99, 102, 241, 0.05) 100%);
  --wk-grad-brand-subtle: linear-gradient(135deg, rgba(129, 140, 248, 0.1) 0%, rgba(99, 102, 241, 0.03) 100%);
  --wk-grad-user-msg: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  --wk-grad-card: linear-gradient(180deg, #0f172a 0%, #0c1322 100%);

  --wk-glass-bg: rgba(15, 23, 42, 0.88);
  --wk-glass-border: rgba(255, 255, 255, 0.09);

  --wk-shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.35);
  --wk-shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.45);
  --wk-shadow-md: 0 8px 24px rgba(0, 0, 0, 0.55);
  --wk-shadow-lg: 0 18px 45px rgba(0, 0, 0, 0.7);
  --wk-shadow-xl: 0 28px 70px rgba(0, 0, 0, 0.85);
  --wk-shadow-brand: 0 8px 28px rgba(99, 102, 241, 0.35);
  --wk-shadow-brand-sm: 0 4px 16px rgba(99, 102, 241, 0.25);

  --bs-primary: var(--wk-brand-600);
  --bs-primary-rgb: var(--wk-brand-rgb);
  --bs-primary-text-emphasis: #c7d2fe;
  --bs-primary-bg-subtle: #1e1b4b;
  --bs-primary-border-subtle: #3730a3;
  --bs-body-bg: var(--wk-bg-app);
  --bs-body-color: var(--wk-text-main);
  --bs-secondary-color: var(--wk-text-muted);
  --bs-tertiary-bg: var(--wk-bg-surface-2);
  --bs-border-color: var(--wk-border);
}

/* ==========================================================================
   قواعد التنسيق العامة والخطوط
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
}

body {
  font-family: var(--wk-font-sans);
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--wk-text-main);
  background-color: var(--wk-bg-app);
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  margin: 0;
  overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6, .brand-text, .brand-mark {
  font-family: var(--wk-font-display);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--wk-text-main);
}

h1 { font-size: 1.55rem; margin-bottom: 1rem; font-weight: 800; }
h2 { font-size: 1.15rem; color: var(--wk-brand-600); margin: 1.5rem 0 0.85rem; display: flex; align-items: center; gap: 0.6rem; font-weight: 700; }
h3 { font-size: 0.98rem; color: var(--wk-brand-600); margin: 1.2rem 0 0.55rem; font-weight: 700; }

a {
  color: var(--wk-brand-600);
  text-decoration: none;
  transition: color 0.18s ease;
}
a:hover {
  color: var(--wk-brand-500);
}

::selection {
  background: rgba(var(--wk-brand-rgb), 0.28);
  color: inherit;
}

.hidden { display: none !important; }

/* شريط التمرير الفاخر */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(var(--wk-brand-rgb), 0.28) transparent;
}
*::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
*::-webkit-scrollbar-thumb {
  background: rgba(var(--wk-brand-rgb), 0.25);
  border-radius: var(--wk-radius-full);
}
*::-webkit-scrollbar-thumb:hover {
  background: rgba(var(--wk-brand-rgb), 0.45);
}
*::-webkit-scrollbar-track {
  background: transparent;
}

/* نصوص التنبيهات والأخطاء */
.err {
  color: var(--wk-danger);
  font-size: 0.85rem;
  font-weight: 600;
  min-height: 1.2em;
  margin-top: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.ok-msg {
  color: var(--wk-success);
  font-size: 0.85rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.hint {
  color: var(--wk-text-muted);
  font-size: 0.84rem;
  margin-bottom: 0.9rem;
  line-height: 1.55;
}
.row-actions {
  display: flex;
  gap: 0.55rem;
  align-items: center;
  flex-wrap: wrap;
}
.page-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.4rem;
  flex-wrap: wrap;
  gap: 0.8rem;
}
.page-head h1 {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

/* ==========================================================================
   منظومة الأزرار وعناصر التحكم التفاعلية الفاخرة
   ========================================================================== */
.btn {
  font-family: var(--wk-font-sans);
  font-weight: 600;
  font-size: 0.88rem;
  padding: 0.5rem 1.05rem;
  border-radius: var(--wk-radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.48rem;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  border: 1px solid transparent;
  cursor: pointer;
  user-select: none;
  line-height: 1.4;
  position: relative;
  overflow: hidden;
}
.btn:active {
  transform: scale(0.975);
}
.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(var(--wk-brand-rgb), 0.3);
}

.btn-primary {
  background: var(--wk-grad-brand) !important;
  color: #ffffff !important;
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
  box-shadow: var(--wk-shadow-brand-sm);
}
.btn-primary:hover, .btn-primary:focus {
  background: var(--wk-grad-brand) !important;
  filter: brightness(1.06);
  box-shadow: var(--wk-shadow-brand);
  transform: translateY(-1.5px);
  color: #ffffff !important;
}

.btn-outline-primary {
  background: rgba(var(--wk-brand-rgb), 0.05);
  border-color: rgba(var(--wk-brand-rgb), 0.35);
  color: var(--wk-brand-600) !important;
}
.btn-outline-primary:hover {
  background: var(--wk-grad-brand);
  border-color: transparent;
  color: #ffffff !important;
  box-shadow: var(--wk-shadow-brand-sm);
  transform: translateY(-1.5px);
}

.btn-outline-secondary {
  background: var(--wk-bg-surface);
  color: var(--wk-text-muted) !important;
  border-color: var(--wk-border);
  box-shadow: var(--wk-shadow-xs);
}
.btn-outline-secondary:hover {
  background: var(--wk-bg-surface-2);
  color: var(--wk-text-main) !important;
  border-color: rgba(var(--wk-brand-rgb), 0.35);
  transform: translateY(-1px);
}

.btn-success {
  background: var(--wk-grad-success);
  color: #ffffff !important;
  border: none;
  box-shadow: 0 3px 10px rgba(16, 185, 129, 0.28);
}
.btn-success:hover {
  filter: brightness(1.08);
  box-shadow: 0 6px 18px rgba(16, 185, 129, 0.38);
  transform: translateY(-1.5px);
  color: #ffffff !important;
}

.btn-danger {
  background: var(--wk-grad-danger);
  color: #ffffff !important;
  border: none;
  box-shadow: 0 3px 10px rgba(244, 63, 94, 0.28);
}
.btn-danger:hover {
  filter: brightness(1.08);
  box-shadow: 0 6px 18px rgba(244, 63, 94, 0.38);
  transform: translateY(-1.5px);
  color: #ffffff !important;
}

.btn-outline-danger {
  background: rgba(var(--wk-danger-rgb), 0.04);
  color: var(--wk-danger) !important;
  border-color: var(--wk-danger-border);
}
.btn-outline-danger:hover {
  background: var(--wk-grad-danger);
  color: #ffffff !important;
  border-color: transparent;
  box-shadow: 0 4px 14px rgba(var(--wk-danger-rgb), 0.3);
  transform: translateY(-1px);
}

.btn-outline-warning {
  background: rgba(var(--wk-warning-rgb), 0.04);
  color: var(--wk-warning) !important;
  border-color: var(--wk-warning-border);
}
.btn-outline-warning:hover {
  background: var(--wk-grad-warning);
  color: #ffffff !important;
  border-color: transparent;
  box-shadow: 0 4px 14px rgba(var(--wk-warning-rgb), 0.3);
  transform: translateY(-1px);
}

.btn-outline-success {
  background: rgba(var(--wk-success-rgb), 0.04);
  color: var(--wk-success) !important;
  border-color: var(--wk-success-border);
}
.btn-outline-success:hover {
  background: var(--wk-grad-success);
  color: #ffffff !important;
  border-color: transparent;
  box-shadow: 0 4px 14px rgba(var(--wk-success-rgb), 0.3);
  transform: translateY(-1px);
}

.btn-sm {
  font-size: 0.8rem;
  padding: 0.34rem 0.75rem;
  border-radius: var(--wk-radius-xs);
  gap: 0.35rem;
}
.btn-lg {
  font-size: 0.98rem;
  padding: 0.68rem 1.45rem;
  border-radius: var(--wk-radius-md);
}
.btn-icon-only {
  padding: 0.45rem;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: var(--wk-radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* حقول الإدخال والاختيار الفاخرة */
.form-control, .form-select,
label > input:not([type=checkbox]):not([type=radio]),
label > select, label > textarea {
  display: block;
  width: 100%;
  padding: 0.58rem 0.9rem;
  font-size: 0.88rem;
  font-family: inherit;
  color: var(--wk-text-main);
  background-color: var(--wk-bg-surface);
  border: 1px solid var(--wk-border);
  border-radius: var(--wk-radius-sm);
  transition: all 0.18s ease;
  margin-top: 0.35rem;
  box-shadow: var(--wk-shadow-xs);
  min-height: 2.6rem;
}
.form-control:focus, .form-select:focus,
label > input:focus, label > select:focus, label > textarea:focus {
  outline: 0;
  border-color: var(--wk-brand-500);
  box-shadow: 0 0 0 3px rgba(var(--wk-brand-rgb), 0.18);
  background-color: var(--wk-bg-surface);
}

/* مجموعات الحقول مع الأزرار (لتطابق الارتفاع التام ومحاذاة بكسلية) */
.field-action-group,
label > span.d-flex,
label > div.d-flex {
  display: flex !important;
  align-items: stretch !important;
  gap: 0.45rem !important;
  margin-top: 0.35rem !important;
}
.field-action-group > .form-control,
.field-action-group > .form-select,
.field-action-group > input,
.field-action-group > select,
label > span.d-flex > .form-control,
label > span.d-flex > .form-select,
label > span.d-flex > input,
label > span.d-flex > select,
label > div.d-flex > .form-control,
label > div.d-flex > .form-select,
label > div.d-flex > input,
label > div.d-flex > select {
  margin-top: 0 !important;
  height: 2.6rem !important;
  min-height: 2.6rem !important;
  flex: 1 1 auto;
}
.field-action-group > .btn,
label > span.d-flex > .btn,
label > div.d-flex > .btn {
  margin-top: 0 !important;
  height: 2.6rem !important;
  min-height: 2.6rem !important;
  padding: 0 1.05rem !important;
  font-size: 0.85rem !important;
  font-weight: 600 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  white-space: nowrap !important;
  border-radius: var(--wk-radius-sm) !important;
  flex-shrink: 0 !important;
  box-shadow: var(--wk-shadow-xs) !important;
}

label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--wk-text-muted);
  margin-bottom: 1rem;
}
label.check {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--wk-text-main);
  cursor: pointer;
  user-select: none;
}
label.check input {
  margin: 0;
  width: auto;
  accent-color: var(--wk-brand-600);
}

.grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 1.2rem;
}
.grid-col-full {
  grid-column: 1 / -1;
}
@media (max-width: 640px) {
  .grid2 { grid-template-columns: 1fr; }
}

.cache-badge {
  background: var(--wk-bg-surface-2);
  border: 1px solid var(--wk-border);
  color: var(--wk-text-muted);
  border-radius: var(--wk-radius-full);
  padding: 0.35rem 0.85rem;
  font-size: 0.82rem;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.cache-badge strong {
  color: var(--wk-brand-600);
}

/* مفاتيح التبديل العصرية (Modern Switch) */
.form-switch {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  cursor: pointer;
}
.form-switch input {
  appearance: none;
  width: 2.6rem;
  height: 1.4rem;
  background: var(--wk-bg-surface-3);
  border-radius: 999px;
  position: relative;
  outline: none;
  cursor: pointer;
  transition: background 0.2s ease;
  border: 1px solid var(--wk-border);
}
.form-switch input::before {
  content: '';
  position: absolute;
  top: 2px;
  inset-inline-start: 2px;
  width: calc(1.4rem - 6px);
  height: calc(1.4rem - 6px);
  background: #ffffff;
  border-radius: 50%;
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--wk-shadow-xs);
}
.form-switch input:checked {
  background: var(--wk-brand-600);
  border-color: var(--wk-brand-600);
}
.form-switch input:checked::before {
  transform: translateX(-1.2rem);
}
[dir="ltr"] .form-switch input:checked::before {
  transform: translateX(1.2rem);
}

/* ==========================================================================
   شاشة تسجيل الدخول
   ========================================================================== */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  position: relative;
  background:
    radial-gradient(1200px 600px at 15% -10%, rgba(var(--wk-brand-rgb), 0.2), transparent 70%),
    radial-gradient(900px 500px at 90% 110%, rgba(var(--wk-info-rgb), 0.15), transparent 60%),
    var(--wk-bg-app);
}
.login-card {
  background: var(--wk-glass-bg);
  backdrop-filter: var(--wk-blur);
  border: 1px solid var(--wk-glass-border);
  border-radius: var(--wk-radius-xl);
  padding: 3rem 2.5rem;
  width: min(440px, 94vw);
  text-align: center;
  box-shadow: var(--wk-shadow-xl);
  position: relative;
  z-index: 1;
}
.login-logo-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 1.25rem;
}
.login-brand-logo {
  max-width: 200px;
  max-height: 120px;
  width: auto;
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 8px 24px rgba(var(--wk-brand-rgb), 0.4));
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.login-brand-logo:hover {
  transform: scale(1.06);
}
.brand-mark {
  font-size: 2.6rem;
  font-weight: 900;
  background: var(--wk-grad-brand);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.2rem;
}
.brand-sub {
  color: var(--wk-text-muted);
  font-size: 0.95rem;
  font-weight: 500;
  margin-bottom: 2rem;
}

/* ==========================================================================
   الترويسة الرئيسية والشريط الجانبي (Header & Sidebar)
   ========================================================================== */
.app-header {
  background: var(--wk-glass-bg) !important;
  backdrop-filter: var(--wk-blur);
  border-bottom: 1px solid var(--wk-border);
  position: sticky;
  top: 0;
  z-index: 1020;
  height: 4.1rem;
  box-shadow: 0 4px 20px -2px rgba(15, 23, 42, 0.03);
  transition: background-color 0.2s ease, border-color 0.2s ease;
}
.app-header .container-fluid {
  height: 100%;
  padding: 0 1.25rem;
}

/* زر البحث والأوامر السريعة الفاخر */
.header-search-btn {
  background: var(--wk-bg-surface-2);
  border: 1px solid var(--wk-border);
  color: var(--wk-text-muted);
  padding: 0.42rem 1rem;
  border-radius: var(--wk-radius-full);
  font-size: 0.83rem;
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: var(--wk-shadow-xs);
}
.header-search-btn:hover {
  border-color: rgba(var(--wk-brand-rgb), 0.45);
  color: var(--wk-text-main);
  background: var(--wk-bg-surface);
  box-shadow: 0 3px 12px rgba(var(--wk-brand-rgb), 0.12);
  transform: translateY(-1px);
}
.header-search-btn:hover i {
  color: var(--wk-brand-600);
}
.header-search-btn kbd {
  background: var(--wk-bg-surface);
  border: 1px solid var(--wk-border);
  color: var(--wk-text-muted);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.12rem 0.45rem;
  border-radius: 5px;
  font-family: var(--wk-font-mono);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

/* أزرار الأيقونات العلوية */
.header-icon-btn {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  width: 2.35rem;
  height: 2.35rem;
  border-radius: var(--wk-radius-full);
  color: var(--wk-text-muted) !important;
  border: 1px solid var(--wk-border);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
  padding: 0;
  background: var(--wk-bg-surface-2);
  box-shadow: var(--wk-shadow-xs);
}
.header-icon-btn:hover {
  background: var(--wk-bg-surface);
  color: var(--wk-brand-600) !important;
  border-color: rgba(var(--wk-brand-rgb), 0.35);
  transform: translateY(-1.5px);
  box-shadow: 0 3px 12px rgba(var(--wk-brand-rgb), 0.14);
}
.header-icon-btn:active {
  transform: scale(0.95);
}

/* زر محدد اللغة */
.lang-toggle {
  gap: 0.35rem;
  width: auto !important;
  padding: 0 0.65rem !important;
}
.lang-toggle-label {
  font-size: 0.75rem;
  font-weight: 800;
  font-family: var(--wk-font-mono);
  color: var(--wk-brand-600);
}

/* زر المرشد الذكي الفاخر */
.header-wizard-btn {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.08) 0%, rgba(79, 70, 229, 0.18) 100%);
  border: 1px solid rgba(var(--wk-brand-rgb), 0.4);
  color: var(--wk-brand-600) !important;
  border-radius: var(--wk-radius-full);
  font-weight: 700;
  padding: 0.38rem 0.95rem;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  box-shadow: 0 2px 10px rgba(var(--wk-brand-rgb), 0.12);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.header-wizard-btn:hover {
  background: var(--wk-grad-brand) !important;
  color: #ffffff !important;
  border-color: transparent;
  box-shadow: var(--wk-shadow-brand);
  transform: translateY(-1.5px);
}
.header-wizard-btn i {
  transition: transform 0.25s ease;
}
.header-wizard-btn:hover i {
  transform: rotate(15deg) scale(1.15);
}

/* كبسولة حالة الخادم مع تأثير الرادار الحي */
.health-dot {
  font-size: 0.8rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.35rem 0.85rem;
  border-radius: var(--wk-radius-full);
  background: var(--wk-success-bg);
  color: var(--wk-success);
  border: 1px solid var(--wk-success-border);
  box-shadow: var(--wk-shadow-xs);
  transition: all 0.2s ease;
}
.health-dot i {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.health-dot.ok i {
  animation: radarPulse 2.2s infinite;
}
.health-dot.bad {
  background: var(--wk-danger-bg);
  color: var(--wk-danger);
  border-color: var(--wk-danger-border);
  animation: alertPulse 1.5s infinite;
}

@keyframes radarPulse {
  0% { transform: scale(0.95); opacity: 0.8; filter: drop-shadow(0 0 0 rgba(16, 185, 129, 0.6)); }
  50% { transform: scale(1.15); opacity: 1; filter: drop-shadow(0 0 6px rgba(16, 185, 129, 0.9)); }
  100% { transform: scale(0.95); opacity: 0.8; filter: drop-shadow(0 0 0 rgba(16, 185, 129, 0.6)); }
}
@keyframes alertPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.65; }
}

/* الشريط الجانبي الفخم */
.app-sidebar {
  background: var(--wk-bg-surface) !important;
  border-inline-end: 1px solid var(--wk-border);
  box-shadow: var(--wk-shadow-sm);
}
.sidebar-brand {
  height: 6.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1.25rem;
  border-bottom: 1px solid var(--wk-border);
  background-color: var(--wk-bg-surface) !important;
  transition: background-color 0.25s ease, border-color 0.25s ease;
}
[data-bs-theme="light"] .sidebar-brand {
  background-color: #ffffff !important;
  border-bottom-color: var(--wk-border);
}
[data-bs-theme="dark"] .sidebar-brand {
  background-color: #0f172a !important;
  border-bottom-color: rgba(255, 255, 255, 0.08);
}

.sidebar-brand .brand-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  text-decoration: none;
  cursor: pointer;
}
.brand-logo-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 5.4rem;
  max-width: 220px;
  width: 100%;
  margin: 0 auto;
}
.brand-logo-img {
  max-height: 100%;
  max-width: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 4px 12px rgba(var(--wk-brand-rgb), 0.25));
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.sidebar-brand .brand-link:hover .brand-logo-img {
  transform: scale(1.05);
}

/* تبديل الشعار بحسب الثيم النهاري / الليلي */
.logo-dark-mode {
  display: none !important;
}
.logo-light-mode {
  display: block !important;
}
[data-bs-theme="dark"] .logo-light-mode {
  display: none !important;
}
[data-bs-theme="dark"] .logo-dark-mode {
  display: block !important;
}

.sidebar-wrapper {
  display: flex !important;
  flex-direction: column !important;
  height: calc(100vh - 6.2rem) !important;
  justify-content: space-between !important;
}
.sidebar-footer-version {
  padding: 0.9rem 1.25rem;
  margin-top: auto;
  text-align: center;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--wk-text-muted);
  border-top: 1px solid var(--wk-border);
  letter-spacing: 0.05em;
  font-family: var(--wk-font-mono), var(--wk-font-sans);
  opacity: 0.85;
  transition: opacity 0.2s ease, color 0.2s ease;
}
.sidebar-footer-version:hover {
  opacity: 1;
  color: var(--wk-brand-500);
}

.sidebar-heading {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 800;
  color: var(--wk-text-dim);
  padding: 1.2rem 1.1rem 0.35rem;
}

.nav-sidebar .nav-item {
  margin-bottom: 4px;
  padding: 0 0.65rem;
}
.nav-sidebar .nav-link {
  border-radius: var(--wk-radius-md);
  padding: 0.6rem 0.9rem;
  color: var(--wk-text-muted);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  font-size: 0.88rem;
}
.nav-sidebar .nav-link .nav-icon {
  font-size: 1.15rem;
  width: 1.4rem;
  text-align: center;
  color: var(--wk-text-muted);
  transition: color 0.18s ease, transform 0.18s ease;
}
.nav-sidebar .nav-link:hover {
  background: var(--wk-bg-surface-2);
  color: var(--wk-brand-600);
  transform: translateX(-2px);
}
[dir="rtl"] .nav-sidebar .nav-link:hover {
  transform: translateX(2px);
}
.nav-sidebar .nav-link:hover .nav-icon {
  color: var(--wk-brand-600);
  transform: scale(1.1);
}
.nav-sidebar .nav-link.active {
  background: var(--wk-grad-brand) !important;
  color: #ffffff !important;
  box-shadow: 0 4px 16px rgba(var(--wk-brand-rgb), 0.35);
  font-weight: 700;
}
.nav-sidebar .nav-link.active .nav-icon {
  color: #ffffff !important;
}
#badge-approvals {
  margin-inline-start: auto;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 0.22rem 0.6rem;
  border-radius: var(--wk-radius-full);
  box-shadow: 0 2px 6px rgba(244, 63, 94, 0.35);
}

/* ==========================================================================
   لوحة القيادة والبطاقات (Dashboard, Stats & Alerts)
   ========================================================================== */
.hero-welcome-banner {
  background: var(--wk-grad-brand-glow);
  border: 1px solid rgba(var(--wk-brand-rgb), 0.2);
  border-radius: var(--wk-radius-lg);
  padding: 1.6rem 2rem;
  margin-bottom: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.2rem;
  position: relative;
  overflow: hidden;
  box-shadow: var(--wk-shadow-sm);
}
.hero-welcome-banner::before {
  content: '';
  position: absolute;
  top: -50px;
  inset-inline-end: -50px;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(var(--wk-brand-rgb), 0.22), transparent 70%);
  pointer-events: none;
}
.hero-title {
  font-size: 1.45rem;
  font-weight: 900;
  margin: 0 0 0.3rem;
  background: var(--wk-grad-brand);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.hero-sub {
  color: var(--wk-text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  margin: 0;
  max-width: 680px;
}

/* التنبيهات والأشرطة التحذيرية العصرية */
.alert {
  border-radius: var(--wk-radius-md) !important;
  padding: 0.95rem 1.35rem !important;
  margin-bottom: 1rem !important;
  box-shadow: var(--wk-shadow-xs);
  border: 1px solid var(--wk-border) !important;
  position: relative;
  overflow: hidden;
  background: var(--wk-bg-surface) !important;
  color: var(--wk-text-main) !important;
}
.alert::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  inset-inline-start: 0;
  width: 4px;
}
.alert-warning {
  background: var(--wk-warning-bg) !important;
  border-color: var(--wk-warning-border) !important;
}
.alert-warning::before {
  background: var(--wk-warning);
}
.alert-warning i {
  color: var(--wk-warning);
}
.alert-danger {
  background: var(--wk-danger-bg) !important;
  border-color: var(--wk-danger-border) !important;
}
.alert-danger::before {
  background: var(--wk-danger);
}
.alert-danger i {
  color: var(--wk-danger);
}
.alert-info {
  background: var(--wk-info-bg) !important;
  border-color: var(--wk-info-border) !important;
}
.alert-info::before {
  background: var(--wk-info);
}
.alert-info i {
  color: var(--wk-info);
}

/* قائمة الأعطال التفاعلية الفاخرة */
.fail-list .card {
  background: var(--wk-danger-bg) !important;
  border: 1px solid var(--wk-danger-border) !important;
  border-radius: var(--wk-radius-md);
  box-shadow: var(--wk-shadow-xs);
  position: relative;
  overflow: hidden;
  transition: all 0.2s ease;
}
.fail-list .card::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  inset-inline-start: 0;
  width: 4px;
  background: var(--wk-danger);
}
.fail-list .card:hover {
  transform: translateY(-2px);
  box-shadow: var(--wk-shadow-sm);
  border-color: rgba(var(--wk-danger-rgb), 0.5) !important;
}
.fail-list .card .text-secondary {
  color: var(--wk-text-muted) !important;
}
.fail-list .card .hint {
  color: var(--wk-text-dim);
}

/* كروت الإحصائيات الفاخرة المحدثة */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(215px, 1fr));
  gap: 1.15rem;
  margin-bottom: 1.8rem;
}
.stats .small-box {
  background: var(--wk-grad-card) !important;
  border: 1px solid var(--wk-border);
  border-radius: var(--wk-radius-lg);
  padding: 1.35rem 1.45rem;
  position: relative;
  overflow: hidden;
  box-shadow: var(--wk-shadow-xs);
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 110px;
}
.stats .small-box:hover {
  transform: translateY(-4px);
  box-shadow: var(--wk-shadow-md);
  border-color: var(--stat-c, var(--wk-brand-400));
}
.stats .small-box::after {
  content: '';
  position: absolute;
  top: 0;
  inset-inline-start: 0;
  width: 4px;
  height: 100%;
  background: var(--stat-c, var(--wk-brand-600));
  border-radius: 4px 0 0 4px;
}
[dir="rtl"] .stats .small-box::after {
  border-radius: 0 4px 4px 0;
}
.stats .small-box .inner h3 {
  font-size: 2rem !important;
  font-weight: 900;
  margin: 0 0 0.25rem;
  letter-spacing: -0.03em;
  color: var(--stat-c, var(--wk-text-main)) !important;
  font-family: var(--wk-font-display);
}
.stats .small-box .inner p {
  font-size: 0.85rem !important;
  font-weight: 600;
  color: var(--wk-text-muted) !important;
  margin: 0;
}
.stats .small-box .small-box-icon {
  position: absolute;
  inset-inline-end: 1.1rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 2.6rem !important;
  color: var(--stat-c, var(--wk-brand-600)) !important;
  opacity: 0.12;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.25s ease;
  pointer-events: none;
}
.stats .small-box:hover .small-box-icon {
  transform: translateY(-50%) scale(1.18);
  opacity: 0.25;
}

.stats .small-box.text-bg-primary   { --stat-c: var(--wk-brand-600); }
.stats .small-box.text-bg-success   { --stat-c: var(--wk-success); }
.stats .small-box.text-bg-info      { --stat-c: var(--wk-info); }
.stats .small-box.text-bg-warning   { --stat-c: var(--wk-warning); }
.stats .small-box.text-bg-danger    { --stat-c: var(--wk-danger); }
.stats .small-box.text-bg-secondary { --stat-c: var(--wk-text-muted); }

/* ==========================================================================
   بطاقات الوكلاء الفاخرة (Agent Persona Cards)
   ========================================================================== */
.agent-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(315px, 1fr));
  gap: 1.3rem;
  margin-bottom: 1.6rem;
}
.agent-card {
  background: var(--wk-grad-card);
  border: 1px solid var(--wk-border);
  border-radius: var(--wk-radius-lg);
  padding: 1.45rem;
  box-shadow: var(--wk-shadow-xs);
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  display: flex;
  flex-direction: column;
}
.agent-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--wk-shadow-md);
  border-color: rgba(var(--wk-brand-rgb), 0.45);
}
.agent-card.paused {
  opacity: 0.72;
  border-style: dashed;
}
.agent-card .name {
  font-size: 1.1rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin-bottom: 0.35rem;
}
.agent-card .meta {
  color: var(--wk-text-muted);
  font-size: 0.83rem;
  margin-bottom: 0.5rem;
}

.avatar-circle {
  width: 2.35rem;
  height: 2.35rem;
  border-radius: 50%;
  background: var(--wk-grad-brand-glow);
  color: var(--wk-brand-600);
  border: 1px solid rgba(var(--wk-brand-rgb), 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  font-weight: 800;
  flex-shrink: 0;
  box-shadow: var(--wk-shadow-xs);
}
.avatar-sm {
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 50%;
  background: var(--wk-grad-brand);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  box-shadow: var(--wk-shadow-sm);
  flex-shrink: 0;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.74rem;
  font-weight: 700;
  padding: 0.2rem 0.65rem;
  border-radius: var(--wk-radius-full);
  background: var(--wk-bg-surface-2);
  color: var(--wk-text-muted);
  border: 1px solid var(--wk-border);
  transition: all 0.15s ease;
}
.pill.gold {
  background: rgba(var(--wk-brand-rgb), 0.08);
  color: var(--wk-brand-600);
  border-color: rgba(var(--wk-brand-rgb), 0.28);
  font-weight: 800;
}
.pill.bad {
  background: var(--wk-danger-bg);
  color: var(--wk-danger);
  border-color: var(--wk-danger-border);
}
.pill.live {
  background: var(--wk-success-bg);
  color: var(--wk-success);
  border-color: var(--wk-success-border);
  font-weight: 800;
}

.dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dot.on {
  background: var(--wk-success);
  box-shadow: 0 0 8px var(--wk-success);
  animation: pulse 2s infinite;
}
.dot.off {
  background: var(--wk-danger);
}

.agent-actions-primary {
  display: flex;
  gap: 0.6rem;
  margin-top: 1.1rem;
}
.agent-actions-primary .btn {
  flex: 1;
}
.agent-actions-secondary {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--wk-border);
}
.agent-actions-secondary .btn {
  flex: 1;
  padding: 0.42rem 0;
  color: var(--wk-text-muted);
}
.agent-actions-secondary .btn:hover {
  color: var(--wk-brand-600);
  background: var(--wk-bg-surface-2);
}

/* ==========================================================================
   المحادثات العصرية المتقدمة (Chat Experience)
   ========================================================================== */
.chat-page {
  display: flex;
  gap: 1.2rem;
  height: calc(100vh - 8.2rem);
}
.chat-side {
  width: 290px;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  flex-shrink: 0;
  background: var(--wk-bg-surface);
  border: 1px solid var(--wk-border);
  border-radius: var(--wk-radius-md);
  padding: 1rem;
  box-shadow: var(--wk-shadow-xs);
}
.chat-side-search {
  position: relative;
}
.chat-side-search input {
  padding-inline-start: 2rem;
  font-size: 0.82rem;
  border-radius: var(--wk-radius-full);
}
.chat-side-search i {
  position: absolute;
  inset-inline-start: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--wk-text-dim);
  font-size: 0.85rem;
}

.conv-list {
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.conv-item {
  display: flex;
  align-items: center;
  border-radius: var(--wk-radius-sm);
  position: relative;
  transition: all 0.15s ease;
}
.conv-item a {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.6rem 0.8rem;
  border-radius: var(--wk-radius-sm);
  color: var(--wk-text-muted);
  font-size: 0.84rem;
  overflow: hidden;
  text-decoration: none;
  min-width: 0;
  transition: all 0.15s ease;
}
.conv-item a:hover {
  background: var(--wk-bg-surface-2);
  color: var(--wk-text-main);
}
.conv-item a.active {
  background: rgba(var(--wk-brand-rgb), 0.08);
  color: var(--wk-brand-600);
  font-weight: 700;
  border-inline-start: 3px solid var(--wk-brand-600);
}
.conv-item .conv-title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.conv-item .conv-actions {
  position: absolute;
  inset-inline-end: 0.35rem;
  display: flex;
  gap: 0.2rem;
  opacity: 0;
  transition: opacity 0.15s ease;
}
.conv-item:hover .conv-actions {
  opacity: 1;
}
.conv-item .conv-btn {
  padding: 0.2rem 0.4rem;
  font-size: 0.78rem;
  border-radius: var(--wk-radius-xs);
  color: var(--wk-text-muted);
  border: none;
  background: transparent;
  cursor: pointer;
}
.conv-item .conv-btn:hover {
  color: var(--wk-danger);
  background: var(--wk-danger-bg);
}

/* المنطقة الرئيسية للشات */
.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--wk-bg-surface);
  border: 1px solid var(--wk-border);
  border-radius: var(--wk-radius-md);
  box-shadow: var(--wk-shadow-xs);
  overflow: hidden;
  min-width: 0;
  position: relative;
}
.chat-main-header {
  padding: 0.85rem 1.4rem;
  border-bottom: 1px solid var(--wk-border);
  background: var(--wk-bg-surface);
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 5;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.6rem 1.8rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  background:
    radial-gradient(900px 400px at 50% 0%, rgba(var(--wk-brand-rgb), 0.03), transparent 60%),
    var(--wk-bg-surface);
}
.chat-empty {
  margin: auto;
  text-align: center;
  max-width: 620px;
  color: var(--wk-text-muted);
  font-size: 0.96rem;
  line-height: 1.65;
  padding: 2.5rem 1.5rem;
  background: var(--wk-grad-brand-subtle);
  border: 1px dashed rgba(var(--wk-brand-rgb), 0.25);
  border-radius: var(--wk-radius-lg);
}

/* فقاعات الرسائل (Message Bubbles) */
.msg {
  position: relative;
  max-width: 86%;
  padding: 0.95rem 1.35rem;
  border-radius: var(--wk-radius-md);
  word-break: break-word;
  font-size: 0.94rem;
  line-height: 1.7;
  animation: fadeInMsg 0.22s ease-out;
}
@keyframes fadeInMsg {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.msg.user {
  background: var(--wk-grad-user-msg);
  color: #ffffff;
  /* احترام أسطر المستخدم (Shift+Enter) */
  white-space: pre-wrap;
  align-self: flex-start;
  border-radius: 18px 4px 18px 18px;
  box-shadow: var(--wk-shadow-sm), 0 4px 16px rgba(var(--wk-brand-rgb), 0.25);
  font-weight: 500;
}
/* بطاقة «#مشاركة_الشاشة» القادمة من أودو داخل فقاعة المستخدم */
.msg.user .ctx-card {
  white-space: normal;
  margin: 0 0 0.6rem;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 12px;
  overflow: hidden;
  font-size: 0.86rem;
}
.msg.user .ctx-card summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.85rem;
  font-weight: 700;
  user-select: none;
}
.msg.user .ctx-card summary::-webkit-details-marker { display: none; }
.msg.user .ctx-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #fca5a5;
  box-shadow: 0 0 0 2px rgba(252, 165, 165, 0.35);
  animation: ctxPulse 1.4s ease-in-out infinite;
  flex-shrink: 0;
}
@keyframes ctxPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(1.3); }
}
.msg.user .ctx-title {
  font-weight: 500;
  opacity: 0.85;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.msg.user .ctx-caret {
  margin-inline-start: auto;
  opacity: 0.75;
  transition: transform 0.2s ease;
}
.msg.user .ctx-card[open] .ctx-caret { transform: rotate(180deg); }
.msg.user .ctx-rows {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.25rem 0.9rem;
  padding: 0.4rem 0.9rem 0.7rem;
  border-top: 1px solid rgba(255, 255, 255, 0.22);
}
.msg.user .ctx-k { opacity: 0.78; font-weight: 500; }
.msg.user .ctx-v {
  font-weight: 600;
  unicode-bidi: plaintext;
  text-align: start;
  word-break: break-word;
}
.msg.user .ctx-question { white-space: pre-wrap; }

.msg.assistant {
  background: var(--wk-bg-surface);
  align-self: flex-end;
  border: 1px solid var(--wk-border);
  border-radius: 4px 18px 18px 18px;
  box-shadow: var(--wk-shadow-sm);
  max-width: 93%;
}
.msg.error {
  align-self: center;
  color: var(--wk-danger);
  background: var(--wk-danger-bg);
  border: 1px dashed var(--wk-danger-border);
  border-radius: var(--wk-radius-md);
  font-size: 0.88rem;
  display: flex;
  gap: 0.6rem;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
}
.msg.typing {
  color: var(--wk-text-muted);
  align-self: flex-end;
  font-size: 0.85rem;
  background: transparent;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* شريط الإجراءات لكل رسالة — ثابت وسهل النقر مع جسر وهمي لمنع ضياع الهوفر */
.msg-actions {
  position: absolute;
  top: -12px;
  inset-inline-start: 12px;
  display: flex;
  gap: 0.2rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
  background: var(--wk-bg-surface);
  border: 1px solid var(--wk-border);
  border-radius: var(--wk-radius-sm);
  padding: 0.2rem 0.35rem;
  box-shadow: var(--wk-shadow-md);
  z-index: 20;
}
.msg.user .msg-actions {
  inset-inline-start: auto;
  inset-inline-end: 12px;
  background: #1e1b4b;
  border-color: rgba(255, 255, 255, 0.2);
}
.msg.user .msg-actions .btn {
  color: #e0e7ff;
}
.msg.user .msg-actions .btn:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.2);
}
.msg:hover .msg-actions,
.msg:focus-within .msg-actions,
.msg-actions:hover {
  opacity: 1;
  pointer-events: auto;
}
/* جسر هوفر وهمي يضمن بقاء الفأرة داخل العنصر */
.msg-actions::after {
  content: '';
  position: absolute;
  inset: -12px;
  z-index: -1;
}
.msg-actions .btn {
  padding: 0.25rem 0.45rem;
  color: var(--wk-text-muted);
  font-size: 0.82rem;
  border-radius: var(--wk-radius-xs);
  border: none;
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.12s ease;
}
.msg-actions .btn:hover {
  color: var(--wk-brand-600);
  background: var(--wk-bg-surface-2);
}

/* حاوية التفكير والعمليات الحية الهرمية */
.thinking-hierarchy {
  margin: 0.4rem 0 0.85rem;
  border: 1px solid var(--wk-border);
  border-radius: var(--wk-radius-md);
  background: var(--wk-bg-surface);
  font-size: 0.83rem;
  overflow: hidden;
  box-shadow: var(--wk-shadow-xs);
  transition: all 0.2s ease;
}
.thinking-hierarchy.live {
  border-color: rgba(var(--wk-brand-rgb), 0.45);
  box-shadow: 0 0 20px rgba(var(--wk-brand-rgb), 0.14);
}
.thinking-hierarchy summary {
  padding: 0.65rem 1rem;
  cursor: pointer;
  color: var(--wk-text-main);
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  background: var(--wk-bg-surface-2);
  user-select: none;
  list-style: none;
  transition: background 0.15s ease;
}
.thinking-hierarchy summary::-webkit-details-marker { display: none; }
.thinking-hierarchy summary:hover { background: var(--wk-bg-surface-3); }
.thinking-hierarchy[open] > summary { border-bottom: 1px solid var(--wk-border); }

.thinking-summary-main {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
  flex: 1;
}
.thinking-pulse {
  width: 0.8rem;
  height: 0.8rem;
  border-radius: 50%;
  background: var(--wk-brand-600);
  box-shadow: 0 0 10px var(--wk-brand-600);
  flex-shrink: 0;
  animation: wkPulse 1.2s ease-in-out infinite;
}
@keyframes wkPulse {
  0%, 100% { opacity: 0.4; transform: scale(0.85); }
  50% { opacity: 1; transform: scale(1.15); }
}

.thinking-reasoning-body {
  padding: 0.85rem 1.1rem;
  font-size: 0.82rem;
  color: var(--wk-text-muted);
  white-space: pre-wrap;
  max-height: 260px;
  overflow-y: auto;
  line-height: 1.65;
  background: var(--wk-bg-surface);
  font-family: var(--wk-font-mono);
}

.tool-item {
  border: 1px solid var(--wk-border);
  border-radius: var(--wk-radius-sm);
  overflow: hidden;
  background: var(--wk-bg-surface);
  margin-bottom: 0.45rem;
}
.tool-item summary {
  padding: 0.5rem 0.85rem;
  font-size: 0.81rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--wk-bg-surface-2);
}
.tool-item .tool-io {
  padding: 0.75rem 1rem;
  background: var(--wk-bg-surface);
}
.tool-item .tool-io pre {
  font-family: var(--wk-font-mono);
  font-size: 0.76rem;
  background: var(--wk-bg-surface-2);
  padding: 0.6rem 0.85rem;
  border-radius: var(--wk-radius-xs);
  border: 1px solid var(--wk-border);
  direction: ltr;
  text-align: left;
}

/* Markdown وكتل الكود بنمط macOS */
.md-body {
  line-height: 1.75;
}
.md-body p { margin: 0.5rem 0; }
.md-body code {
  font-family: var(--wk-font-mono);
  background: var(--wk-bg-surface-2);
  padding: 2px 6px;
  border-radius: var(--wk-radius-xs);
  font-size: 0.88em;
  border: 1px solid var(--wk-border);
}

.md-code-wrap {
  position: relative;
  margin: 0.95rem 0;
  border-radius: var(--wk-radius-md);
  overflow: hidden;
  border: 1px solid #2d264f;
  background: #0d0b18;
  box-shadow: var(--wk-shadow-md);
}
.md-code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 1rem;
  background: #17132c;
  border-bottom: 1px solid #2d264f;
  font-size: 0.78rem;
  color: #a5b4fc;
}
.md-code-dots {
  display: flex;
  gap: 6px;
}
.md-code-dots span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}
.dot-r { background: #f43f5e; }
.dot-y { background: #f59e0b; }
.dot-g { background: #10b981; }

.md-code {
  padding: 1rem 1.2rem;
  font-family: var(--wk-font-mono);
  font-size: 0.84rem;
  color: #f1f5f9;
  background: #0d0b18;
  direction: ltr;
  text-align: left;
  overflow-x: auto;
  margin: 0;
  line-height: 1.6;
}

/* روابط أودو العميقة والتقارير */
.odoo-deep-link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.3rem 0.8rem;
  border-radius: var(--wk-radius-sm);
  background: rgba(var(--wk-accent-rgb), 0.12);
  border: 1px solid rgba(var(--wk-accent-rgb), 0.35);
  color: var(--wk-accent);
  font-weight: 700;
  font-size: 0.84rem;
  text-decoration: none;
  margin: 0.25rem 0.15rem;
  transition: all 0.18s ease;
}
.odoo-deep-link:hover {
  background: rgba(var(--wk-accent-rgb), 0.22);
  transform: translateY(-1px);
  color: var(--wk-accent);
}

/* بطاقات تنزيل التقارير والمرفقات الفاخرة */
.report-download-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.95rem 1.25rem;
  margin: 0.95rem 0;
  background: var(--wk-bg-surface);
  border: 1px solid var(--wk-border);
  border-inline-start: 4px solid var(--wk-brand-500);
  border-radius: var(--wk-radius-md);
  box-shadow: var(--wk-shadow-sm);
  transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  flex-wrap: wrap;
  position: relative;
  overflow: hidden;
}
.report-download-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--wk-grad-brand-subtle);
  opacity: 0.5;
  pointer-events: none;
}
.report-download-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--wk-shadow-md);
  border-color: var(--wk-brand-400);
}
.report-card-main {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  min-width: 0;
  flex: 1;
  position: relative;
  z-index: 1;
}
.report-card-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--wk-radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.45rem;
  flex-shrink: 0;
  background: var(--wk-brand-50);
  color: var(--wk-brand-600);
  border: 1px solid var(--wk-brand-200);
  box-shadow: var(--wk-shadow-xs);
}
.report-card-icon.pdf {
  background: var(--wk-danger-bg);
  color: var(--wk-danger);
  border-color: var(--wk-danger-border);
}
.report-card-icon.sheet {
  background: var(--wk-success-bg);
  color: var(--wk-success);
  border-color: var(--wk-success-border);
}
.report-card-icon.word {
  background: var(--wk-info-bg);
  color: var(--wk-info);
  border-color: var(--wk-info-border);
}
.report-card-icon.code {
  background: var(--wk-brand-50);
  color: var(--wk-brand-600);
  border-color: var(--wk-brand-200);
}
.report-card-icon.archive {
  background: var(--wk-warning-bg);
  color: var(--wk-warning);
  border-color: var(--wk-warning-border);
}
.report-card-info {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.report-card-title {
  font-weight: 700;
  font-size: 0.96rem;
  color: var(--wk-text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-decoration: none;
}
.report-card-sub {
  font-size: 0.78rem;
  color: var(--wk-text-muted);
  display: flex;
  align-items: center;
  gap: 0.45rem;
}
.report-card-ext {
  display: inline-block;
  padding: 0.1rem 0.45rem;
  border-radius: var(--wk-radius-xs);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  background: var(--wk-bg-surface-2);
  color: var(--wk-text-muted);
  font-family: var(--wk-font-mono);
}
.report-download-btn {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.48rem 1.05rem;
  border-radius: var(--wk-radius-sm);
  font-size: 0.85rem;
  font-weight: 700;
  background: var(--wk-brand-600);
  color: #ffffff !important;
  text-decoration: none !important;
  border: none;
  box-shadow: var(--wk-shadow-xs);
  transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
}
.report-download-btn:hover {
  background: var(--wk-brand-700);
  transform: translateY(-1px);
  box-shadow: var(--wk-shadow-brand);
}

/* قائمة الأوامر السريعة العصرية (Slash Commands Menu) */
.slash-menu {
  position: absolute;
  bottom: calc(100% + 10px);
  inset-inline-end: 0;
  inset-inline-start: 0;
  z-index: 1050;
  background: var(--wk-glass-bg);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--wk-border);
  border-radius: var(--wk-radius-lg);
  box-shadow: var(--wk-shadow-xl), 0 0 0 1px rgba(99, 102, 241, 0.12);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: slideUp 0.16s cubic-bezier(0.16, 1, 0.3, 1);
  max-width: 520px;
}
.slash-menu.hidden {
  display: none !important;
}
.slash-menu-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.55rem 0.95rem;
  background: var(--wk-bg-surface-2);
  border-bottom: 1px solid var(--wk-border-subtle);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--wk-brand-600);
}
.slash-menu-hints {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.72rem;
  color: var(--wk-text-dim);
  font-weight: normal;
}
.slash-menu-hints kbd {
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  background: var(--wk-bg-surface-3);
  border: 1px solid var(--wk-border);
  color: var(--wk-text-muted);
  font-family: var(--wk-font-mono);
  font-size: 0.68rem;
}
.slash-menu-list {
  max-height: 250px;
  overflow-y: auto;
  padding: 0.35rem;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.slash-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.6rem 0.85rem;
  border-radius: var(--wk-radius-md);
  border: none;
  background: transparent;
  cursor: pointer;
  width: 100%;
  text-align: start;
  transition: all 0.12s ease;
  color: var(--wk-text-main);
  text-decoration: none;
}
.slash-item:hover, .slash-item.active {
  background: var(--wk-brand-50);
  color: var(--wk-brand-700);
  border-inline-start: 3px solid var(--wk-brand-500);
  padding-inline-start: calc(0.85rem - 3px);
}
[data-bs-theme="dark"] .slash-item:hover,
[data-bs-theme="dark"] .slash-item.active {
  background: rgba(99, 102, 241, 0.16);
  color: #ffffff;
}
.slash-item-main {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-width: 0;
  flex: 1;
}
.slash-item-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--wk-radius-sm);
  background: var(--wk-bg-surface-2);
  color: var(--wk-brand-600);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  flex-shrink: 0;
  transition: transform 0.12s ease;
}
.slash-item:hover .slash-item-icon, .slash-item.active .slash-item-icon {
  background: var(--wk-brand-500);
  color: #ffffff;
  transform: scale(1.06);
}
.slash-item-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.slash-item-cmd {
  font-weight: 800;
  font-size: 0.9rem;
  color: var(--wk-brand-600);
  font-family: var(--wk-font-display);
}
[data-bs-theme="dark"] .slash-item-cmd {
  color: var(--wk-brand-400);
}
.slash-item-desc {
  font-size: 0.78rem;
  color: var(--wk-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.slash-item-badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: var(--wk-radius-full);
  background: var(--wk-bg-surface-2);
  color: var(--wk-text-muted);
  flex-shrink: 0;
}
.slash-item:hover .slash-item-badge, .slash-item.active .slash-item-badge {
  background: var(--wk-brand-100);
  color: var(--wk-brand-700);
}
[data-bs-theme="dark"] .slash-item:hover .slash-item-badge,
[data-bs-theme="dark"] .slash-item.active .slash-item-badge {
  background: rgba(99, 102, 241, 0.3);
  color: #e0e7ff;
}

/* شريط الإدخال ومرفقات الملفات */
.chat-input {
  display: flex;
  gap: 0.75rem;
  padding: 0.95rem 1.3rem;
  border-top: 1px solid var(--wk-border);
  background: var(--wk-bg-surface);
  align-items: flex-end;
  position: relative;
}
.chat-text-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
}
.chat-input textarea {
  resize: none;
  min-height: 44px;
  max-height: 160px;
  border-radius: var(--wk-radius-sm);
  font-size: 0.93rem;
  line-height: 1.5;
  padding: 0.65rem 0.9rem;
  overflow-y: auto;
}

.chat-drop-overlay {
  position: absolute;
  inset: 0;
  background: rgba(var(--wk-brand-rgb), 0.92);
  color: #ffffff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  font-size: 1.15rem;
  font-weight: 800;
  z-index: 50;
  border-radius: var(--wk-radius-md);
  border: 2px dashed #ffffff;
  animation: fadeIn 0.15s ease-out;
}

/* شريحة المرفقات الفاخرة في واجهة المحادثة */
#chat-pending-file {
  padding: 0 1.2rem;
}
#chat-pending-file:not(:empty) {
  margin-bottom: 0.65rem;
  display: flex;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}
.pending-files-counter {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--wk-text-muted, var(--wk-text-main));
  background: var(--wk-bg-surface-2);
  border: 1px solid var(--wk-border);
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
  direction: ltr;
}
.chat-file-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--wk-bg-surface);
  border: 1px solid rgba(var(--wk-brand-rgb), 0.3);
  border-radius: var(--wk-radius-md);
  padding: 0.45rem 0.75rem 0.45rem 0.95rem;
  box-shadow: var(--wk-shadow-sm);
  animation: chipPopIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  max-width: 100%;
  position: relative;
  overflow: hidden;
}
[dir="rtl"] .chat-file-chip {
  padding: 0.45rem 0.95rem 0.45rem 0.75rem;
}
.chat-file-chip::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  inset-inline-start: 0;
  width: 4px;
  background: var(--wk-grad-brand);
}
.chat-file-chip.uploading {
  border-style: dashed;
  padding: 0.5rem 1rem;
  background: var(--wk-bg-surface-2);
}
.chat-file-chip .file-icon-box {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: var(--wk-radius-xs);
  background: rgba(var(--wk-brand-rgb), 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}
.chat-file-chip .file-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  max-width: 320px;
}
.chat-file-chip .file-name {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--wk-text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-file-chip .file-badge {
  font-size: 0.7rem;
  color: var(--wk-success);
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}
.chat-file-chip .file-remove-btn {
  all: unset;
  cursor: pointer;
  width: 1.65rem;
  height: 1.65rem;
  border-radius: 50%;
  background: var(--wk-bg-surface-2);
  color: var(--wk-text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  transition: all 0.15s ease;
  margin-inline-start: 0.4rem;
  flex-shrink: 0;
}
.chat-file-chip .file-remove-btn:hover {
  background: var(--wk-danger);
  color: #ffffff;
  transform: scale(1.1);
}
@keyframes chipPopIn {
  from { opacity: 0; transform: translateY(8px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

#chat-reply-preview:not(:empty) {
  padding: 0 1.2rem;
}
.reply-preview {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  background: var(--wk-bg-surface-2);
  border-inline-start: 3px solid var(--wk-brand-600);
  border-radius: var(--wk-radius-sm);
  padding: 0.5rem 0.9rem;
  margin: 0.5rem 0;
  font-size: 0.83rem;
}
.reply-preview-body {
  flex: 1;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--wk-text-muted);
}

/* ==========================================================================
   معالج الإنشاء التفاعلي (Interactive Agent Creation Wizard)
   ========================================================================== */
.wizard-modal-card {
  width: min(840px, 96vw) !important;
  max-height: 94vh;
  padding: 2.2rem !important;
}
.wizard-steps {
  display: flex;
  justify-content: space-between;
  margin-bottom: 2rem;
  position: relative;
}
.wizard-steps::before {
  content: '';
  position: absolute;
  top: 18px;
  inset-inline-start: 30px;
  inset-inline-end: 30px;
  height: 2px;
  background: var(--wk-border);
  z-index: 1;
}
.wizard-step {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
  cursor: pointer;
  background: transparent;
  border: none;
  padding: 0;
}
.step-number {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--wk-bg-surface);
  border: 2px solid var(--wk-border);
  color: var(--wk-text-muted);
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  transition: all 0.2s ease;
}
.step-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--wk-text-muted);
  transition: color 0.2s ease;
  white-space: nowrap;
}
.wizard-step.active .step-number {
  background: var(--wk-grad-brand);
  border-color: var(--wk-brand-600);
  color: #ffffff;
  box-shadow: 0 0 0 4px rgba(var(--wk-brand-rgb), 0.2);
}
.wizard-step.active .step-label {
  color: var(--wk-brand-600);
}
.wizard-step.completed .step-number {
  background: var(--wk-success);
  border-color: var(--wk-success);
  color: #ffffff;
}

/* شبكة بطاقات الأدوار في المعالج */
.role-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.9rem;
  max-height: 420px;
  overflow-y: auto;
  padding: 0.3rem;
}
.role-card {
  background: var(--wk-bg-surface);
  border: 1px solid var(--wk-border);
  border-radius: var(--wk-radius-sm);
  padding: 1rem;
  cursor: pointer;
  transition: all 0.18s ease;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.role-card:hover {
  transform: translateY(-2px);
  border-color: var(--wk-brand-400);
  box-shadow: var(--wk-shadow-sm);
}
.role-card.selected {
  border-color: var(--wk-brand-600);
  background: rgba(var(--wk-brand-rgb), 0.05);
  box-shadow: 0 0 0 2px var(--wk-brand-600);
}
.role-card-icon {
  font-size: 1.6rem;
  color: var(--wk-brand-600);
  margin-bottom: 0.2rem;
}
.role-card-title {
  font-weight: 800;
  font-size: 0.94rem;
}
.role-card-desc {
  font-size: 0.78rem;
  color: var(--wk-text-muted);
  line-height: 1.45;
}

/* ==========================================================================
   النوافذ المنبثقة والتأكيدات المتقدمة (Modals & Custom Dialogs)
   ========================================================================== */
.wk-modal {
  position: fixed;
  inset: 0;
  background: rgba(9, 13, 22, 0.72);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1080;
  padding: 1.2rem;
  animation: modalFadeIn 0.2s ease-out;
  cursor: pointer;
}
@keyframes modalFadeIn {
  from { opacity: 0; transform: scale(0.97); }
  to { opacity: 1; transform: scale(1); }
}

.modal-card {
  background: var(--wk-bg-surface);
  border: 1px solid var(--wk-border);
  border-radius: var(--wk-radius-lg);
  padding: 2.2rem;
  width: min(680px, 95vw);
  max-height: 92vh;
  overflow-y: auto;
  box-shadow: var(--wk-shadow-xl);
  cursor: default;
}
.confirm-card {
  max-width: 460px;
  padding: 2.4rem 2.2rem !important;
  text-align: center;
}
.confirm-icon-box {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  margin: 0 auto 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.3rem;
}
.confirm-icon-box.danger {
  background: var(--wk-danger-bg);
  color: var(--wk-danger);
  border: 1px solid var(--wk-danger-border);
}
.confirm-icon-box.info {
  background: var(--wk-brand-50);
  color: var(--wk-brand-600);
  border: 1px solid var(--wk-brand-200);
}
.confirm-icon-box.warning {
  background: var(--wk-warning-bg);
  color: var(--wk-warning);
  border: 1px solid var(--wk-warning-border);
}

.modal-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.6rem;
  justify-content: flex-end;
}

/* لوحة الأوامر السريعة (Ctrl+K Command Palette) */
.command-palette-card {
  width: min(600px, 95vw);
  padding: 1.2rem;
  border-radius: var(--wk-radius-lg);
}
.command-palette-input-wrap {
  position: relative;
  margin-bottom: 0.8rem;
}
.command-palette-input-wrap input {
  padding-inline-start: 2.5rem;
  font-size: 1.05rem;
  padding-top: 0.8rem;
  padding-bottom: 0.8rem;
}
.command-palette-input-wrap i {
  position: absolute;
  inset-inline-start: 1rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.2rem;
  color: var(--wk-brand-600);
}
.command-palette-results {
  max-height: 360px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.command-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 0.95rem;
  border-radius: var(--wk-radius-sm);
  cursor: pointer;
  transition: all 0.12s ease;
  border: none;
  background: transparent;
  color: var(--wk-text-main);
  text-align: start;
  width: 100%;
}
.command-item:hover, .command-item.active {
  background: var(--wk-bg-surface-2);
  color: var(--wk-brand-600);
}
.command-item-main {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* ==========================================================================
   نظام الإشعارات المتقدم (Toasts Notification Stack)
   ========================================================================== */
.wk-toast-container {
  position: fixed;
  bottom: 1.5rem;
  inset-inline-end: 1.5rem;
  z-index: 1090;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  max-width: min(420px, 94vw);
  pointer-events: none;
}
.wk-toast {
  pointer-events: auto;
  background: var(--wk-bg-surface);
  border: 1px solid var(--wk-border);
  border-radius: var(--wk-radius-md);
  padding: 0.85rem 1.2rem;
  font-size: 0.88rem;
  font-weight: 600;
  box-shadow: var(--wk-shadow-lg);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  position: relative;
  overflow: hidden;
  animation: toastSlideIn 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}
@keyframes toastSlideIn {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
.wk-toast.ok {
  border-inline-start: 4px solid var(--wk-success);
}
.wk-toast.bad {
  border-inline-start: 4px solid var(--wk-danger);
}
.wk-toast.warn {
  border-inline-start: 4px solid var(--wk-warning);
}
.wk-toast.hide {
  opacity: 0;
  transform: translateY(16px);
  transition: all 0.22s ease;
}
.wk-toast-progress {
  position: absolute;
  bottom: 0;
  inset-inline-start: 0;
  height: 3px;
  background: var(--wk-brand-600);
  width: 100%;
  animation: toastProgress 4.2s linear forwards;
}
@keyframes toastProgress {
  from { width: 100%; }
  to { width: 0%; }
}

#settings-tabs {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  border-bottom: 1px solid var(--wk-border);
  gap: 0.35rem;
  padding-bottom: 2px;
  margin-bottom: 1.5rem;
}
#settings-tabs::-webkit-scrollbar {
  display: none;
}
#settings-tabs .nav-link {
  color: var(--wk-text-muted);
  font-weight: 600;
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  padding: 0.65rem 1.1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.15s ease;
}
#settings-tabs .nav-link:hover {
  color: var(--wk-brand-600);
  background: rgba(var(--wk-brand-rgb), 0.05);
}
#settings-tabs .nav-link.active {
  color: var(--wk-brand-600);
  border-bottom-color: var(--wk-brand-600);
  background: transparent;
}

/* ==========================================================================
   المستخدمون والصلاحيات — شريحة الحساب، إخفاء عناصر المدير، محدد الوسوم
   ========================================================================== */
body.role-user [data-admin-only] { display: none !important; }

/* شريحة المستخدم الفاخرة وقائمة الحساب في الترويسة */
.user-menu-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

button.user-chip {
  all: unset;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.84rem;
  font-weight: 600;
  padding: 0.28rem 0.75rem 0.28rem 0.38rem;
  border-radius: var(--wk-radius-full);
  background: var(--wk-bg-surface-2);
  color: var(--wk-text-main);
  border: 1px solid var(--wk-border);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--wk-shadow-xs);
  user-select: none;
}

button.user-chip:hover {
  background: var(--wk-bg-surface);
  border-color: rgba(var(--wk-brand-rgb), 0.45);
  box-shadow: 0 2px 10px rgba(var(--wk-brand-rgb), 0.15);
  transform: translateY(-1px);
}

button.user-chip:active {
  transform: scale(0.98);
}

.user-avatar, .user-menu-avatar {
  width: 1.85rem;
  height: 1.85rem;
  border-radius: 50%;
  background: var(--wk-grad-brand);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(var(--wk-brand-rgb), 0.3);
  flex-shrink: 0;
}

.avatar-initial {
  display: inline-block;
  line-height: 1;
}

.user-chip-name {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.user-chip-title {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-chip .role-tag {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.12rem 0.45rem;
  border-radius: var(--wk-radius-full);
  background: rgba(var(--wk-brand-rgb), 0.12);
  color: var(--wk-brand-600);
  border: 1px solid rgba(var(--wk-brand-rgb), 0.2);
}

.user-chip-arrow {
  font-size: 0.7rem;
  color: var(--wk-text-muted);
  transition: transform 0.2s ease;
  margin-inline-start: 0.15rem;
}

.user-menu-wrap:has(.user-menu:not(.hidden)) .user-chip-arrow {
  transform: rotate(180deg);
}

/* القائمة المنسدلة لشريحة المستخدم */
.user-menu {
  position: absolute;
  top: calc(100% + 8px);
  inset-inline-end: 0;
  z-index: 1050;
  min-width: 240px;
  background: var(--wk-glass-bg);
  backdrop-filter: var(--wk-blur);
  border: 1px solid var(--wk-glass-border);
  border-radius: var(--wk-radius-md);
  box-shadow: var(--wk-shadow-lg);
  padding: 0.5rem;
  animation: dropdownIn 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  transform-origin: top left;
}

[dir="rtl"] .user-menu {
  transform-origin: top right;
}

@keyframes dropdownIn {
  from {
    opacity: 0;
    transform: translateY(-8px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.user-menu-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.75rem;
  background: rgba(var(--wk-brand-rgb), 0.05);
  border-radius: var(--wk-radius-sm);
  margin-bottom: 0.3rem;
}

.user-menu-header .user-menu-avatar {
  width: 2.2rem;
  height: 2.2rem;
  font-size: 0.95rem;
}

.user-menu-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.user-menu-name {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--wk-text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-menu-role {
  font-size: 0.72rem;
  color: var(--wk-brand-600);
  font-weight: 600;
}

.user-menu-item {
  all: unset;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  box-sizing: border-box;
  cursor: pointer;
  padding: 0.55rem 0.75rem;
  border-radius: var(--wk-radius-sm);
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--wk-text-main);
  transition: all 0.15s ease;
}

.user-menu-item:hover {
  background: rgba(var(--wk-brand-rgb), 0.08);
  color: var(--wk-brand-600);
  transform: translateX(-2px);
}

[dir="rtl"] .user-menu-item:hover {
  transform: translateX(2px);
}

.user-menu-item.text-danger:hover {
  background: rgba(var(--wk-danger-rgb), 0.1);
  color: var(--wk-danger);
}

.user-menu-sep {
  height: 1px;
  background: var(--wk-border);
  margin: 0.35rem 0.25rem;
}

.tag-select {
  position: relative;
  border: 1px solid var(--wk-border);
  border-radius: var(--wk-radius-md, 10px);
  background: var(--wk-bg-surface, var(--bs-body-bg));
  padding: 0.35rem 0.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
  min-height: 2.8rem;
  transition: border-color .15s, box-shadow .15s;
}
.tag-select:focus-within {
  border-color: var(--wk-brand-600);
  box-shadow: 0 0 0 3px rgba(var(--wk-brand-rgb), 0.15);
}
.tag-select-chips { display: contents; }
.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.22rem 0.35rem 0.22rem 0.65rem;
  border-radius: var(--wk-radius-full);
  background: rgba(var(--wk-brand-rgb), 0.1);
  color: var(--wk-brand-700, var(--wk-brand-600));
  border: 1px solid rgba(var(--wk-brand-rgb), 0.3);
  animation: chipIn .15s ease-out;
}
@keyframes chipIn { from { transform: scale(.85); opacity: 0; } to { transform: none; opacity: 1; } }
.tag-chip button {
  all: unset;
  cursor: pointer;
  width: 1.2rem; height: 1.2rem;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
  font-size: 0.7rem;
}
.tag-chip button:hover { background: rgba(var(--wk-brand-rgb), 0.2); }
.tag-select-input {
  flex: 1 1 8rem;
  min-width: 8rem;
  border: 0 !important;
  outline: 0 !important;
  box-shadow: none !important;
  background: transparent !important;
  padding: 0.25rem 0.2rem !important;
  font-size: 0.88rem;
}
.tag-select-menu {
  position: absolute;
  inset-inline: -1px;
  top: calc(100% + 4px);
  z-index: 30;
  max-height: 220px;
  overflow: auto;
  background: var(--wk-bg-surface, var(--bs-body-bg));
  border: 1px solid var(--wk-border);
  border-radius: var(--wk-radius-md, 10px);
  box-shadow: var(--wk-shadow-lg, 0 12px 30px rgba(0,0,0,.15));
  padding: 0.3rem;
}
.tag-select-menu button {
  all: unset;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  box-sizing: border-box;
  cursor: pointer;
  padding: 0.45rem 0.6rem;
  border-radius: 8px;
  font-size: 0.86rem;
}
.tag-select-menu button:hover, .tag-select-menu button.active { background: rgba(var(--wk-brand-rgb), 0.08); }
.tag-select-menu button.selected { opacity: .55; }
.tag-select-menu .hint { padding: 0.5rem; margin: 0; }

.user-card .role-badge { font-size: 0.72rem; }
.user-card .agent-tags { display: flex; flex-wrap: wrap; gap: 0.3rem; }

/* ==========================================================================
   منظومة التجاوب الذكية لكافة الشاشات والأجهزة (Full Responsive System)
   ========================================================================== */

/* الشاشات الكبيرة والمتوسطة (Desktop / Laptop 1200px) */
@media (max-width: 1200px) {
  .stats {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

/* الشاشات اللوحية الكبيرة وتجاوب الشات (Tablet Landscape / Medium Screens 992px) */
@media (max-width: 992px) {
  .app-main {
    padding-bottom: 1.5rem;
  }
  
  /* واجهة الشات على الشاشات المتوسطة والجوال */
  .chat-page {
    position: relative;
    height: calc(100vh - 6.5rem) !important;
    gap: 0;
  }
  .chat-side {
    width: 100% !important;
    height: 100% !important;
    position: absolute;
    inset: 0;
    z-index: 10;
    display: none;
    border-radius: var(--wk-radius-md);
  }
  .chat-main {
    width: 100% !important;
    height: 100% !important;
    border-radius: var(--wk-radius-md);
  }
  .chat-page.mobile-show-side .chat-side {
    display: flex;
  }
  .chat-page.mobile-show-side .chat-main {
    display: none;
  }
  
  .chat-messages {
    padding: 1.1rem 1rem;
  }
  .msg {
    max-width: 92%;
    padding: 0.85rem 1.1rem;
  }
  .msg.assistant {
    max-width: 96%;
  }
  .chat-mobile-nav-btn {
    display: inline-flex !important;
  }
}

/* الشاشات اللوحية الصغيرة والهواتف (Tablet Portrait / Phablets 768px) */
@media (max-width: 768px) {
  h1 { font-size: 1.35rem; }
  h2 { font-size: 1.05rem; }
  
  .app-header {
    height: 3.5rem;
    padding: 0 0.5rem;
  }
  .header-search-btn {
    display: none;
  }
  
  .user-chip .role-tag {
    display: none;
  }
  .user-chip-title {
    max-width: 85px;
  }
  
  .grid2 {
    grid-template-columns: 1fr !important;
    gap: 0 !important;
  }
  
  .page-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.8rem;
  }
  .page-head .row-actions {
    width: 100%;
    justify-content: flex-start;
  }
  
  .hero-welcome-banner {
    padding: 1.2rem 1.2rem;
    flex-direction: column;
    align-items: flex-start;
  }
  .hero-welcome-banner .d-flex {
    width: 100%;
    flex-wrap: wrap;
  }
  .hero-welcome-banner .d-flex .btn {
    flex: 1 1 auto;
  }
  
  .audit-row {
    grid-template-columns: 1fr !important;
    gap: 0.4rem !important;
    padding: 0.85rem !important;
  }
  
  .modal-card {
    width: calc(100vw - 20px) !important;
    max-width: 100% !important;
    padding: 1.25rem 1rem;
    margin: 10px;
  }
  
  .wizard-steps {
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 0.5rem;
    gap: 0.4rem;
  }
  .wizard-step {
    padding: 0.4rem 0.6rem;
    font-size: 0.76rem;
  }
  .role-cards-grid {
    grid-template-columns: 1fr !important;
  }
}

/* الهواتف الذكية (Mobile Phones 576px) */
@media (max-width: 576px) {
  body {
    font-size: 13.5px;
  }
  
  .app-content {
    padding-top: 0.75rem !important;
    padding-bottom: 1.5rem !important;
  }
  
  .stats {
    grid-template-columns: 1fr !important;
    gap: 0.75rem !important;
  }
  .stat-card {
    padding: 1rem 1.1rem;
  }
  
  .agent-grid {
    grid-template-columns: 1fr !important;
    gap: 0.85rem !important;
  }
  .agent-card {
    padding: 1.1rem;
  }
  
  button.user-chip {
    padding: 0.25rem 0.45rem;
  }
  .user-chip-title {
    display: none;
  }
  
  .user-menu {
    min-width: 210px;
    inset-inline-end: -0.5rem;
  }
  
  .chat-main-header {
    padding: 0.65rem 0.85rem;
  }
  .chat-main-header #chat-header-agent-sub {
    display: none;
  }
  
  .chat-input {
    padding: 0.5rem 0.65rem;
    gap: 0.4rem;
  }
  .chat-input textarea {
    padding: 0.45rem 0.7rem;
    font-size: 0.88rem;
  }
  
  .cron-presets {
    flex-direction: row;
    flex-wrap: wrap;
  }
  .cron-presets .btn {
    flex: 1 1 calc(50% - 0.5rem);
    font-size: 0.75rem;
  }
  
  .modal-actions {
    flex-direction: column;
    gap: 0.5rem;
  }
  .modal-actions .btn {
    width: 100%;
  }
  .modal-actions .d-flex {
    width: 100%;
    flex-direction: column;
  }
  
  .wk-toast {
    max-width: calc(100vw - 2rem);
    font-size: 0.82rem;
  }
}

/* الهواتف الصغيرة جداً (Small Mobile Devices 400px) */
@media (max-width: 400px) {
  .btn {
    font-size: 0.82rem;
    padding: 0.42rem 0.75rem;
  }
  .login-card {
    padding: 2rem 1.25rem;
  }
}

/* ==========================================================================
   زر تبديل اللغة (عربي / English)
   ========================================================================== */
.lang-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}
.lang-toggle-label {
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1;
  padding: 0.16rem 0.34rem;
  border-radius: 0.4rem;
  background: rgba(var(--wk-brand-rgb), 0.12);
  color: var(--wk-brand-600);
}

/* في الوضع الإنجليزي (LTR): محتوى الرسائل يتبع اتجاه نصه (ردود عربية تُعرض RTL بشكل سليم) */
[dir="ltr"] .msg.user,
[dir="ltr"] .md-body p,
[dir="ltr"] .md-body li,
[dir="ltr"] .md-body h3,
[dir="ltr"] .md-body h4,
[dir="ltr"] .md-body h5,
[dir="ltr"] .md-body h6 {
  unicode-bidi: plaintext;
}


/* ==========================================================================
   اقتراحات بدء المحادثة حسب الدور الوظيفي
   ========================================================================== */
.chat-suggest {
  margin-top: 1.5rem;
  text-align: start;
  border-top: 1px dashed rgba(var(--wk-brand-rgb), 0.22);
  padding-top: 1rem;
}
.chat-suggest-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--wk-text-muted);
}
.chat-suggest-head .bi-stars { color: var(--wk-brand-600); }
.chat-suggest-refresh {
  font-size: 0.76rem;
  padding: 0.1rem 0.4rem;
  text-decoration: none;
  color: var(--wk-text-muted);
}
.chat-suggest-refresh:hover { color: var(--wk-brand-600); }
.chat-suggest-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.chat-suggest-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  text-align: start;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--wk-border);
  border-radius: var(--wk-radius-sm);
  background: var(--wk-bg-surface);
  color: var(--wk-text-main);
  font-size: 0.86rem;
  line-height: 1.45;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.12s;
}
.chat-suggest-item:hover {
  border-color: rgba(var(--wk-brand-rgb), 0.55);
  background: var(--wk-grad-brand-subtle);
  transform: translateY(-1px);
}
.chat-suggest-cat {
  flex: 0 0 auto;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  background: rgba(var(--wk-brand-rgb), 0.12);
  color: var(--wk-brand-600);
  white-space: nowrap;
}
.chat-suggest-text { flex: 1 1 auto; min-width: 0; }

[data-bs-theme="dark"] .chat-suggest-item {
  background: rgba(255, 255, 255, 0.03);
}

/* ---------- لافتة الطابور داخل المحادثة ---------- */
.msg.queued { display: flex; align-items: center; gap: 0.5rem; }
.queue-pos {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.5rem;
  height: 1.5rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  background: rgba(var(--wk-brand-rgb), 0.15);
  color: var(--wk-brand-600);
  font-weight: 700;
  font-size: 0.75rem;
}

/* ---------- زر «النتائج» المفتوح في المهام المجدولة ---------- */
[data-act="showRuns"].active {
  background: var(--wk-brand-600);
  border-color: var(--wk-brand-600);
  color: #fff;
}

/* شارة «اقتراحات عامة مؤقتة» — قبل أول توليد لبنك الاقتراحات */
.chat-suggest-seed {
  font-size: 0.66rem;
  font-weight: 700;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  background: rgba(var(--wk-brand-rgb), 0.1);
  color: var(--wk-text-muted);
}

/* ==========================================================================
   الصور المضمّنة في المحادثة (مخططات وخطط عمل أنشأها الوكيل)
   ========================================================================== */
.chat-image-wrap {
  display: block;
  margin: 0.5rem 0;
  max-width: 560px;
}
.chat-inline-image {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--wk-border);
  border-radius: var(--wk-radius-sm);
  background: #fff;           /* SVGات محوّلة بخلفية شفافة تبقى مقروءة */
  cursor: zoom-in;
}
.chat-image-dl {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin-top: 0.3rem;
  font-size: 0.78rem;
  color: var(--wk-text-muted);
  text-decoration: none;
}
.chat-image-dl:hover { color: var(--wk-brand-600); }
