/* ============================================
   مساعد البيع الذكي | Design System v5
   ============================================ */

:root {
  /* Brand - أزرق داكن */
  --brand-900: #071a3a;
  --brand-800: #0d2855;
  --brand-700: #1a3f7c;
  --brand-600: #2050a0;
  --brand-500: #2d6bc4;
  --brand-100: #dbeafe;
  --brand-50:  #eff6ff;

  /* Gold */
  --gold-700: #b8860b;
  --gold-500: #d4a017;
  --gold-300: #f0c040;
  --gold-100: #fef3c7;
  --gold-50:  #fffbeb;

  /* Neutrals */
  --ink-900: #111827;
  --ink-700: #374151;
  --ink-500: #6b7280;
  --ink-300: #d1d5db;
  --ink-200: #e5e7eb;
  --ink-100: #f3f4f6;
  --bg:      #f0f4f8;
  --surface: #ffffff;

  /* Semantic */
  --success: #16a34a;
  --warning: #d4a017;
  --danger:  #dc2626;
  --info:    #2563eb;

  /* Layout */
  --radius-sm: 10px;
  --radius:    14px;
  --radius-lg: 18px;
  --radius-xl: 24px;

  --shadow-sm:  0 1px 3px rgba(13,40,85,.07), 0 1px 2px rgba(13,40,85,.04);
  --shadow:     0 4px 14px rgba(13,40,85,.11), 0 2px 4px rgba(13,40,85,.06);
  --shadow-lg:  0 12px 32px rgba(13,40,85,.15), 0 4px 8px rgba(13,40,85,.08);

  --header-h: 64px;
  --nav-h: 68px;
  --ease: cubic-bezier(.22,.61,.36,1);
  --ease-bounce: cubic-bezier(.34,1.56,.64,1);

  /* أكسنت النص/الأيقونات (كحلي على الفاتح) — يتغيّر في الوضع الليلي */
  --brand-accent: var(--brand-700);
  color-scheme: light;
}

/* ============================================
   الوضع الليلي — يعيد تعريف الـ design tokens
   يتفعّل بـ data-theme="dark" على <html>
   (الافتراضي بياخد من prefers-color-scheme عبر JS في app.js)
   ============================================ */
[data-theme="dark"] {
  /* الكحلي محفوظ كخلفيات (gradients بنص أبيض فوقها) */
  --brand-900: #0a1f42;
  --brand-800: #0d2855;
  --brand-700: #1a3f7c;
  --brand-600: #2456ad;
  --brand-500: #2d6bc4;
  /* الأكسنت الفاتح (50/100) يبقى تينت غامق لأنه بيُستخدم كـ fill */
  --brand-100: #1e3458;
  --brand-50:  #16243d;
  --brand-accent: #6ea8f0;   /* نص/أيقونة أكسنت مقروء على الغامق */

  --gold-700: #e6b552;       /* مرفوع للسطوع — بيُستخدم كنص */
  --gold-500: #d4a017;
  --gold-300: #f0c040;
  --gold-100: #fef3c7;       /* محفوظ فاتح — بيُستخدم كنص على الهيرو الغامق */
  --gold-50:  #2a2410;       /* تينت غامق كـ fill */

  /* المحايدات تتقلب: النص يفتح، الخلفيات تغمق */
  --ink-900: #eef2f8;
  --ink-700: #c3ccd9;
  --ink-500: #8c96a6;
  --ink-300: #525e73;
  --ink-200: #2b3750;
  --ink-100: #1c2840;
  --bg:      #0a1322;
  --surface: #141f34;

  --success: #22c55e;
  --warning: #eab308;
  --danger:  #f04444;
  --info:    #3b82f6;

  --shadow-sm: 0 1px 3px rgba(0,0,0,.45), 0 1px 2px rgba(0,0,0,.3);
  --shadow:    0 4px 14px rgba(0,0,0,.5), 0 2px 4px rgba(0,0,0,.35);
  --shadow-lg: 0 12px 32px rgba(0,0,0,.6), 0 4px 8px rgba(0,0,0,.4);

  color-scheme: dark;
}

/* أكسنت النص/الأيقونات اللي كان كحلي غامق → يبقى مضيء على الغامق */
[data-theme="dark"] .nav-item.active,
[data-theme="dark"] .nav-item:active,
[data-theme="dark"] .action-card .icon-wrap,
[data-theme="dark"] .choice-card .choice-icon,
[data-theme="dark"] .btn-secondary,
[data-theme="dark"] .btn-text,
[data-theme="dark"] .info-block h4,
[data-theme="dark"] .stat-cell .value,
[data-theme="dark"] .action-card.ai h3,
[data-theme="dark"] .menu-ico,
[data-theme="dark"] .menu-credit,
[data-theme="dark"] .brief-ico,
[data-theme="dark"] .brief-toggle,
[data-theme="dark"] .brief-angle .brief-mission-ico,
[data-theme="dark"] .brief-angle .brief-mission-v,
[data-theme="dark"] .brief-rand,
[data-theme="dark"] .sim-eval-title,
[data-theme="dark"] .pinfo-section h4,
[data-theme="dark"] .coming-soon-block h3,
[data-theme="dark"] .scenario-ai-tag,
[data-theme="dark"] .scn-qa,
[data-theme="dark"] .edit-banner .btn-text,
[data-theme="dark"] .chip svg,
[data-theme="dark"] .form-label svg,
[data-theme="dark"] .mode-card-title svg {
  color: var(--brand-accent);
}

/* خلفيات الحالة (نجاح/خطأ/تحذير) — نسخة غامقة بدل الباستيل الفاتح */
[data-theme="dark"] .sim-run-header { background: rgba(15,23,40,.92); }
[data-theme="dark"] .bubble-feedback.good,
[data-theme="dark"] .scn-close { background: #11271b; color: #86efac; }
[data-theme="dark"] .bubble-feedback.bad,
[data-theme="dark"] .scenario-error,
[data-theme="dark"] .scn-obj { background: #2a1517; color: #fca5a5; }
[data-theme="dark"] .bubble-feedback.mid { color: #fcd34d; }
[data-theme="dark"] .scn-obj-line { background: #2a2113; color: #fcd34d; }
[data-theme="dark"] .choice-prompt { color: var(--gold-700); }

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html, body {
  font-family: 'Cairo', 'Tajawal', 'Arabic Typesetting', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--ink-900);
  font-size: 16px;
  line-height: 1.6;
  min-height: 100vh;
  overscroll-behavior-y: none;
}

body {
  padding-top: var(--header-h);
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom));
}

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
a { color: inherit; text-decoration: none; }
svg { display: block; }

/* ============================================
   Header
   ============================================ */
.app-header {
  position: fixed; top: 0; right: 0; left: 0; z-index: 100;
  height: var(--header-h);
  background: linear-gradient(135deg, var(--brand-900) 0%, var(--brand-700) 100%);
  color: white;
  box-shadow: 0 2px 14px rgba(13,40,85,.28);
  padding-top: env(safe-area-inset-top);
}
.header-inner {
  height: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 0 16px;
  display: flex; align-items: center; gap: 12px;
}
.header-title { flex: 1; min-width: 0; }
.header-title h1 {
  font-size: 18px; font-weight: 800;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.header-subtitle {
  font-size: 12px; opacity: .70; font-weight: 500;
}
.back-btn, .menu-btn {
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 10px;
  transition: background .2s var(--ease);
}
.back-btn svg, .menu-btn svg { width: 22px; height: 22px; }
.back-btn:active, .menu-btn:active { background: rgba(255,255,255,.18); }
.back-btn[hidden] { display: none; }

/* ============================================
   Main / Views
   ============================================ */
.app-main {
  max-width: 720px;
  margin: 0 auto;
  padding: 16px 16px calc(var(--nav-h) + 24px + env(safe-area-inset-bottom));
  min-height: calc(100vh - var(--header-h) - var(--nav-h));
}

.view {
  animation: viewIn .35s var(--ease);
}
@keyframes viewIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ============================================
   Bottom Navigation
   ============================================ */
.bottom-nav {
  position: fixed; bottom: 0; right: 0; left: 0; z-index: 100;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--surface);
  border-top: 1px solid var(--ink-200);
  display: flex;
  box-shadow: 0 -4px 20px rgba(0,0,0,.08);
}
.nav-item {
  flex: 1;
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px;
  font-size: 11px; font-weight: 600;
  color: var(--ink-500);
  transition: color .2s var(--ease);
  padding: 8px 4px;
}
.nav-item svg { width: 24px; height: 24px; }
.nav-item.active {
  color: var(--brand-700);
  font-weight: 700;
}
.nav-item.active::after {
  content: '';
  position: absolute;
  top: 0; left: 50%;
  transform: translateX(-50%);
  width: 28px; height: 3px;
  background: var(--brand-600);
  border-radius: 0 0 4px 4px;
}
.nav-item:active { color: var(--brand-800); }

/* ============================================
   Hero / Welcome card
   ============================================ */
.hero {
  background: linear-gradient(135deg, var(--brand-900) 0%, var(--brand-700) 60%, var(--brand-600) 100%);
  color: white;
  border-radius: var(--radius-xl);
  padding: 26px 22px;
  margin-bottom: 20px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}
.hero::before {
  content: ''; position: absolute;
  top: -40%; left: -20%;
  width: 220px; height: 220px;
  background: radial-gradient(circle, rgba(212,160,23,.22) 0%, transparent 70%);
  border-radius: 50%;
}
.hero::after {
  content: ''; position: absolute;
  bottom: -30%; right: -10%;
  width: 180px; height: 180px;
  background: radial-gradient(circle, rgba(45,107,196,.28) 0%, transparent 70%);
  border-radius: 50%;
}
.hero-content { position: relative; z-index: 1; }
.hero-greeting { font-size: 13px; opacity: .85; margin-bottom: 4px; font-weight: 500; }
.hero-title { font-size: 22px; font-weight: 800; line-height: 1.3; margin-bottom: 14px; }
.hero-subtitle { font-size: 14px; opacity: .9; line-height: 1.6; }

/* ============================================
   Section title
   ============================================ */
.section-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--ink-700);
  margin: 24px 4px 12px;
  display: flex; align-items: center; gap: 8px;
}
.section-title::before {
  content: ''; width: 4px; height: 18px;
  background: linear-gradient(180deg, var(--brand-600), var(--gold-500));
  border-radius: 2px;
  flex-shrink: 0;
}

/* ============================================
   Cards
   ============================================ */
.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--ink-100);
  transition: transform .2s var(--ease), box-shadow .2s var(--ease);
}
.card:active { transform: scale(.98); }

.action-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.action-card {
  background: var(--surface);
  border-radius: 18px;
  padding: 18px 16px;
  border: 1.5px solid var(--ink-100);
  box-shadow: 0 2px 12px rgba(0,0,0,.06), 0 1px 3px rgba(0,0,0,.04);
  display: flex; flex-direction: column; gap: 10px;
  text-align: right;
  transition: transform .2s var(--ease), box-shadow .2s var(--ease);
  position: relative;
  overflow: hidden;
}
.action-card:active {
  transform: scale(.97);
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.action-card .icon-wrap {
  width: 52px; height: 52px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  background: var(--brand-50);
  color: var(--brand-700);
  box-shadow: 0 2px 8px rgba(26,63,124,.12);
}
.action-card .icon-wrap svg { width: 26px; height: 26px; }
.action-card.gold .icon-wrap { background: var(--gold-50); color: var(--gold-700); box-shadow: 0 2px 8px rgba(184,134,11,.15); }
.action-card.gold { background: linear-gradient(135deg, var(--gold-50), var(--surface)); border-color: var(--gold-100); }
.action-card.ai {
  background: linear-gradient(135deg, var(--brand-50), var(--surface));
  border-color: var(--brand-100);
}
.action-card.ai .icon-wrap {
  background: linear-gradient(135deg, var(--brand-700), var(--brand-500));
  color: #fff;
  box-shadow: 0 4px 12px rgba(26,63,124,.3);
}
.action-card.ai h3 { color: var(--brand-800); }
.action-card h3 { font-size: 14px; font-weight: 700; color: var(--ink-900); }
.action-card p { font-size: 12px; color: var(--ink-500); line-height: 1.5; }

/* ============================================
   Choice cards (selection screens)
   ============================================ */
.choice-grid {
  display: flex; flex-direction: column; gap: 10px;
}
.choice-card {
  width: 100%;
  background: var(--surface);
  border: 1.5px solid var(--ink-200);
  border-radius: 16px;
  padding: 14px 16px;
  display: flex; align-items: center; gap: 14px;
  text-align: right;
  box-shadow: 0 1px 6px rgba(0,0,0,.05);
  transition: all .2s var(--ease);
}
.choice-card:active { transform: scale(.98); }
.choice-card.selected,
.choice-card:focus {
  border-color: var(--brand-600);
  background: var(--brand-50);
  box-shadow: 0 0 0 3px rgba(45,107,196,.15);
  outline: none;
}
.choice-card .choice-icon {
  width: 52px; height: 52px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--brand-100), var(--brand-50));
  color: var(--brand-700);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-size: 26px;
}
.choice-card .choice-icon svg { width: 26px; height: 26px; }
.choice-card .choice-text { flex: 1; min-width: 0; }
.choice-card h4 { font-size: 15px; font-weight: 700; color: var(--ink-900); margin-bottom: 3px; }
.choice-card p { font-size: 13px; color: var(--ink-500); line-height: 1.4; }
.choice-card .choice-arrow {
  color: var(--ink-300);
  transition: transform .2s var(--ease), color .2s var(--ease);
}
.choice-card .choice-arrow svg { width: 18px; height: 18px; }
.choice-card:active .choice-arrow { color: var(--brand-600); transform: translateX(-4px); }

/* ============================================
   Buttons
   ============================================ */
.btn-primary {
  background: linear-gradient(135deg, var(--brand-700), var(--brand-600));
  color: white;
  padding: 14px 24px;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 700;
  box-shadow: 0 4px 14px rgba(26,63,124,.35);
  transition: all .2s var(--ease);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.btn-primary:active { transform: scale(.97); box-shadow: 0 2px 6px rgba(26,63,124,.2); }
.btn-primary.full { width: 100%; }
.btn-primary.btn-sm { padding: 10px 18px; font-size: 14px; }

.btn-secondary {
  background: var(--surface);
  color: var(--brand-700);
  padding: 14px 24px;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 700;
  border: 2px solid var(--brand-600);
  transition: all .2s var(--ease);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.btn-secondary:active { background: var(--brand-50); }
.btn-secondary.full { width: 100%; }

.btn-text {
  color: var(--brand-700);
  font-weight: 600;
  padding: 8px 12px;
  font-size: 14px;
}

/* ============================================
   Product detail / script display
   ============================================ */
.product-hero {
  background: linear-gradient(135deg, var(--brand-900), var(--brand-700));
  color: white;
  border-radius: var(--radius-xl);
  padding: 22px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.product-hero .tag {
  display: inline-block;
  background: rgba(212,160,23,.22);
  color: var(--gold-100);
  font-size: 11px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 20px;
  margin-bottom: 10px;
  letter-spacing: .3px;
}
.product-hero h2 { font-size: 22px; font-weight: 800; margin-bottom: 6px; }
.product-hero p { font-size: 13px; opacity: .9; line-height: 1.6; }

.info-block {
  background: var(--surface);
  border-radius: 16px;
  padding: 16px 18px;
  margin-bottom: 12px;
  border-right: 4px solid var(--brand-500);
  border: 1px solid var(--ink-100);
  border-right: 4px solid var(--brand-500);
  box-shadow: 0 1px 4px rgba(0,0,0,.04);
}
.info-block.gold {
  border-right-color: var(--gold-500);
  background: linear-gradient(135deg, var(--gold-50), var(--surface));
  border-color: var(--gold-100);
  border-right: 4px solid var(--gold-500);
}
.info-block h4 {
  font-size: 14px; font-weight: 700; color: var(--brand-800);
  margin-bottom: 8px;
  display: flex; align-items: center; gap: 6px;
}
.info-block h4 svg { width: 18px; height: 18px; flex-shrink: 0; }
.section-title svg { width: 18px; height: 18px; flex-shrink: 0; }
.btn-primary svg, .btn-secondary svg { width: 18px; height: 18px; flex-shrink: 0; }
.choice-card h4 svg { width: 16px; height: 16px; flex-shrink: 0; display: inline-block; vertical-align: middle; }
.product-hero h2 svg { width: 26px; height: 26px; flex-shrink: 0; display: inline-block; vertical-align: middle; }
.info-block p, .info-block li { font-size: 14px; color: var(--ink-700); line-height: 1.7; }
.info-block ul { padding-right: 18px; }
.info-block li { margin-bottom: 4px; }

.stat-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}
.stat-cell {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 14px;
  border: 1px solid var(--ink-100);
  box-shadow: var(--shadow-sm);
}
.stat-cell .label { font-size: 11px; color: var(--ink-500); font-weight: 600; margin-bottom: 4px; text-transform: uppercase; letter-spacing: .3px; }
.stat-cell .value { font-size: 20px; color: var(--brand-800); font-weight: 800; }

/* Script card */
.script-card {
  background: linear-gradient(180deg, var(--gold-50), var(--surface));
  border: 1px solid var(--gold-100);
  border-radius: var(--radius-lg);
  padding: 18px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
  position: relative;
}
.script-card::before {
  content: '"';
  position: absolute;
  top: -10px; right: 16px;
  font-size: 56px;
  color: var(--gold-300);
  font-family: serif;
  line-height: 1;
}
.script-card .script-label {
  font-size: 11px;
  color: var(--gold-700);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .6px;
  margin-bottom: 8px;
}
.script-card .script-text {
  font-size: 15px;
  line-height: 1.9;
  color: var(--ink-900);
  white-space: pre-wrap;
  word-break: break-word;
}

/* ============================================
   Form elements
   ============================================ */
.form-group { margin-bottom: 20px; }
.form-label {
  display: block;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink-700);
  margin-bottom: 8px;
}
.form-input, .form-select {
  width: 100%;
  padding: 13px 14px;
  border: 2px solid var(--ink-200);
  border-radius: 12px;
  font-size: 15px;
  font-family: inherit;
  background: var(--surface);
  color: var(--ink-900);
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.form-input:focus, .form-select:focus {
  outline: none;
  border-color: var(--brand-600);
  box-shadow: 0 0 0 3px rgba(45,107,196,.15);
}

.chip-group {
  display: flex; flex-wrap: wrap; gap: 8px;
}
.chip {
  padding: 10px 16px;
  border-radius: 22px;
  background: var(--surface);
  border: 2px solid var(--ink-200);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-700);
  transition: all .2s var(--ease);
}
.chip:active { transform: scale(.95); }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
}
.chip svg { width: 16px; height: 16px; flex-shrink: 0; color: var(--brand-600); }
.chip.selected {
  background: var(--brand-700);
  color: white;
  border-color: var(--brand-700);
  box-shadow: 0 2px 8px rgba(26,63,124,.3);
}
.chip.selected svg { color: #fff; }
.diff-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; display: inline-block; }
/* أيقونات عناوين الأقسام */
.form-label { display: flex; align-items: center; gap: 7px; }
.form-label svg { width: 17px; height: 17px; color: var(--brand-600); flex-shrink: 0; }

/* Progress */
.progress-bar {
  background: var(--ink-100);
  height: 6px;
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 18px;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--brand-600), var(--gold-500));
  border-radius: 3px;
  transition: width .4s var(--ease);
}

.step-indicator {
  font-size: 12px;
  color: var(--ink-500);
  font-weight: 600;
  margin-bottom: 6px;
}

/* ============================================
   Install prompt
   ============================================ */
.install-prompt {
  position: fixed;
  bottom: calc(var(--nav-h) + 16px + env(safe-area-inset-bottom));
  right: 16px; left: 16px;
  max-width: 600px;
  margin: 0 auto;
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--ink-100);
  display: flex; align-items: center; gap: 12px;
  z-index: 90;
  animation: slideUp .4s var(--ease);
}
@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}
.install-content { flex: 1; display: flex; flex-direction: column; }
.install-content strong { font-size: 14px; color: var(--ink-900); }
.install-content span { font-size: 12px; color: var(--ink-500); }
.install-actions { display: flex; gap: 4px; }

/* ============================================
   Simulator (Chat bubbles)
   ============================================ */
.bubbles {
  display: flex; flex-direction: column; gap: 12px;
  margin: 20px 0;
}
.bubble {
  max-width: 88%;
  padding: 12px 16px;
  border-radius: 18px;
  font-size: 14.5px;
  line-height: 1.7;
  box-shadow: var(--shadow-sm);
  animation: bubbleIn .32s var(--ease) both;
  word-break: break-word;
}
@keyframes bubbleIn {
  from { opacity: 0; transform: translateY(10px) scale(.97); }
  to   { opacity: 1; transform: none; }
}
.bubble-agent    { animation-name: bubbleInStart; }
.bubble-customer { animation-name: bubbleInEnd; }
@keyframes bubbleInStart {
  from { opacity: 0; transform: translateX(14px) translateY(6px); }
  to   { opacity: 1; transform: none; }
}
@keyframes bubbleInEnd {
  from { opacity: 0; transform: translateX(-14px) translateY(6px); }
  to   { opacity: 1; transform: none; }
}
.bubble-meta {
  font-size: 11px;
  font-weight: 700;
  opacity: .7;
  margin-bottom: 4px;
}
.bubble-text { white-space: pre-wrap; word-break: break-word; }

.bubble-customer {
  background: var(--surface);
  border: 1px solid var(--ink-200);
  border-bottom-right-radius: 4px;
  align-self: flex-end;
  color: var(--ink-900);
}
.bubble-agent {
  background: linear-gradient(135deg, var(--brand-700), var(--brand-600));
  color: white;
  border-bottom-left-radius: 4px;
  align-self: flex-start;
}
.bubble-feedback {
  align-self: center;
  max-width: 95%;
  border-radius: 12px;
  border-right: 4px solid;
  font-size: 13.5px;
}
.bubble-feedback.good { background: #f0fdf4; border-color: var(--success); color: #14532d; }
.bubble-feedback.mid  { background: var(--gold-50); border-color: var(--warning); color: #713f12; }
.bubble-feedback.bad  { background: #fef2f2; border-color: var(--danger); color: #7f1d1d; }

.choice-prompt {
  background: var(--gold-50);
  color: var(--gold-700);
  border: 1px solid var(--gold-100);
  padding: 12px 16px;
  border-radius: 12px;
  margin-bottom: 12px;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
}

.sim-option {
  width: 100%;
  background: var(--surface);
  border: 2px solid var(--ink-200);
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 10px;
  text-align: right;
  font-size: 14px;
  line-height: 1.7;
  color: var(--ink-900);
  transition: all .2s var(--ease);
}
.sim-option:active {
  transform: scale(.98);
  border-color: var(--brand-600);
  background: var(--brand-50);
}

/* ============================================
   Empty / Coming soon
   ============================================ */
.empty-state {
  text-align: center;
  padding: 60px 20px 40px;
  color: var(--ink-500);
}
.empty-state .icon {
  width: 80px; height: 80px;
  margin: 0 auto 20px;
  background: var(--brand-50);
  color: var(--brand-600);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 14px rgba(26,63,124,.12);
}
.empty-state .icon svg { width: 36px; height: 36px; }
.empty-state h3 { font-size: 18px; font-weight: 700; color: var(--ink-700); margin-bottom: 8px; }
.empty-state p { font-size: 14px; }

/* ============================================
   AI Simulator Page
   ============================================ */
.sim-run-header {
  position: sticky;
  top: var(--header-h);
  z-index: 50;
  margin: -16px -16px 12px;
  padding: 12px 16px 10px;
  background: rgba(240, 244, 248, .92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--ink-200);
  box-shadow: 0 2px 8px rgba(13,40,85,.06);
  display: flex; flex-direction: column; gap: 8px;
}
.sim-run-row {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 8px;
}
.sim-run-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.sim-tag {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  background: var(--ink-100);
  color: var(--ink-700);
  border: 1px solid var(--ink-200);
}
.sim-tag svg { width: 13px; height: 13px; flex-shrink: 0; }
.sim-run-actions { display: flex; gap: 4px; }

/* مؤشر مزاج العميل */
.mood-meter {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 12px;
  background: var(--surface);
  border-radius: 12px;
  border: 1px solid var(--ink-100);
}
.mood-emoji {
  font-size: 22px;
  transition: transform .3s var(--ease-bounce);
  flex-shrink: 0;
}
.mood-emoji.bump { transform: scale(1.25); }
.mood-bar {
  flex: 1;
  height: 8px;
  background: linear-gradient(90deg, #dc2626 0%, #d4a017 50%, #16a34a 100%);
  border-radius: 4px;
  position: relative;
  min-width: 80px;
}
.mood-marker {
  position: absolute;
  top: 50%;
  width: 16px; height: 16px;
  background: #fff;
  border-radius: 50%;
  border: 2.5px solid var(--ink-900);
  box-shadow: 0 2px 6px rgba(0,0,0,.25);
  transform: translate(-50%, -50%);
  transition: left .55s var(--ease), background-color .3s;
  left: 50%;
}
.mood-label {
  font-size: 11.5px; font-weight: 700;
  min-width: 56px; text-align: center;
  color: var(--ink-700);
  flex-shrink: 0;
}

/* dock ثابت أسفل الشاشة لإدخال المحاكي (فوق الناف، وبيطلع مع الكيبورد) */
.sim-dock {
  position: fixed;
  left: 0; right: 0;
  bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + var(--kb-offset, 0px));
  max-width: 720px;
  margin: 0 auto;
  z-index: 95;
  transition: bottom .15s ease-out;
}
body.kb-open .bottom-nav { transform: translateY(110%); }
body.kb-open .sim-dock { bottom: calc(env(safe-area-inset-bottom) + var(--kb-offset, 0px)); }
.bottom-nav { transition: transform .2s var(--ease); }

.sim-dock .edit-banner { margin: 0; }
.sim-footer {
  padding: 10px 16px;
  border-top: 1px solid var(--ink-200);
  background: var(--surface);
  box-shadow: 0 -2px 8px rgba(0,0,0,.04);
}
/* مساحة تحت المحادثة عشان الـ dock الثابت ميغطيش آخر رسالة */
.sim-page-pad { padding-bottom: 90px; }

.sim-start-msg {
  text-align: center;
  padding: 16px;
  color: var(--ink-500);
  font-size: 14px;
  background: var(--ink-100);
  border-radius: 12px;
  border: 1px solid var(--ink-200);
}

.sim-eval-card {
  background: var(--surface);
  border: 2px solid var(--brand-500);
  border-radius: 18px;
  padding: 20px;
  margin-top: 8px;
  box-shadow: 0 4px 16px rgba(26,63,124,.1);
}
.sim-eval-title {
  font-size: 16px; font-weight: 700; color: var(--brand-700);
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--ink-100);
}
.sim-eval-body {
  font-size: 14px; line-height: 1.9; color: var(--ink-700);
  white-space: pre-wrap;
  overflow-wrap: break-word;
}

/* AI input / send (Simulator footer) */
.ai-footer {
  display: flex; align-items: flex-end; gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--ink-200);
  flex-shrink: 0;
}
.ai-input {
  flex: 1;
  padding: 10px 12px;
  border: 2px solid var(--ink-200);
  border-radius: 12px;
  font-size: 14px;
  font-family: inherit;
  resize: none;
  line-height: 1.5;
  color: var(--ink-900);
  background: var(--surface);
  transition: border-color .2s;
}
.ai-input:focus { outline: none; border-color: var(--brand-600); }
.ai-send {
  width: 42px; height: 42px;
  background: linear-gradient(135deg, var(--brand-700), var(--brand-600));
  color: white;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: opacity .2s, transform .15s var(--ease);
  box-shadow: 0 3px 10px rgba(26,63,124,.3);
}
.ai-send svg { width: 18px; height: 18px; }
.ai-send:active { transform: scale(.93); }
.ai-send:disabled { opacity: .45; }

/* Typing animation */
.ai-typing {
  display: flex; gap: 5px; padding: 12px 16px;
  align-items: center;
}
.ai-typing span {
  width: 8px; height: 8px;
  background: var(--ink-300);
  border-radius: 50%;
  animation: typing 1.4s infinite;
}
.ai-typing span:nth-child(2) { animation-delay: .2s; }
.ai-typing span:nth-child(3) { animation-delay: .4s; }
@keyframes typing {
  0%, 60%, 100% { transform: translateY(0); opacity: .4; }
  30% { transform: translateY(-6px); opacity: 1; }
}

/* ============================================
   Utility
   ============================================ */
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.mt-12  { margin-top: 12px; }
.mt-16  { margin-top: 16px; }
.mt-24  { margin-top: 24px; }
.mb-12  { margin-bottom: 12px; }
.text-center { text-align: center; }
.flex-col { display: flex; flex-direction: column; }
.row-actions { display: flex; gap: 10px; }
.row-actions > * { flex: 1; }

/* ============================================
   القائمة الجانبية (Drawer)
   ============================================ */
.menu-overlay {
  position: fixed; inset: 0; z-index: 300;
}
.menu-backdrop {
  position: absolute; inset: 0;
  background: rgba(7,26,58,.5);
  opacity: 0; transition: opacity .25s var(--ease);
}
.menu-overlay.open .menu-backdrop { opacity: 1; }
.menu-sheet {
  position: absolute; top: 0; bottom: 0; left: 0;
  width: min(82%, 320px);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column;
  transform: translateX(-100%);
  transition: transform .28s var(--ease);
  padding-top: env(safe-area-inset-top);
}
.menu-overlay.open .menu-sheet { transform: translateX(0); }
.menu-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 18px 14px;
  background: linear-gradient(135deg, var(--brand-900), var(--brand-700));
  color: #fff;
}
.menu-head-title { font-size: 17px; font-weight: 800; }
.menu-close {
  width: 36px; height: 36px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; background: rgba(255,255,255,.12);
}
.menu-close svg { width: 20px; height: 20px; }
.menu-list { flex: 1; overflow-y: auto; padding: 12px; }
.menu-link {
  display: flex; align-items: center; gap: 12px;
  width: 100%; text-align: right;
  padding: 13px 14px; margin-bottom: 4px;
  border-radius: var(--radius);
  font-size: 15px; font-weight: 600; color: var(--ink-900);
  transition: background .15s var(--ease);
}
.menu-link:active { background: var(--brand-50); }
.menu-ico {
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  background: var(--brand-50);
  color: var(--brand-700);
  border-radius: 9px;
  flex-shrink: 0;
}
.menu-ico svg { width: 18px; height: 18px; }
.menu-divider { height: 1px; background: var(--ink-100); margin: 10px 4px; }
.menu-foot {
  padding: 16px 18px calc(16px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--ink-100);
  text-align: center;
}
.menu-ver { font-size: 12px; color: var(--ink-500); font-weight: 600; }
.menu-credit { font-size: 12px; color: var(--brand-700); font-weight: 700; margin-top: 3px; }

/* ============================================
   صفحة عن التطبيق
   ============================================ */
.dev-card {
  margin-top: 24px;
  padding: 26px 20px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--brand-900), var(--brand-700));
  color: #fff;
  text-align: center;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.dev-card::before {
  content: ''; position: absolute;
  top: -50%; left: -20%;
  width: 180px; height: 180px;
  background: radial-gradient(circle, rgba(212,160,23,.20) 0%, transparent 70%);
  border-radius: 50%;
}
.dev-avatar {
  position: relative; z-index: 1;
  width: 56px; height: 56px; margin: 0 auto 12px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 800; letter-spacing: 1px;
  color: var(--brand-900);
  background: linear-gradient(135deg, var(--gold-300), var(--gold-500));
  box-shadow: 0 4px 12px rgba(212,160,23,.35);
}
.dev-label {
  position: relative; z-index: 1;
  font-size: 12px; font-weight: 500; opacity: .8;
  letter-spacing: .5px; text-transform: uppercase;
}
.dev-name {
  position: relative; z-index: 1;
  font-size: 19px; font-weight: 800; margin-top: 2px;
  color: var(--gold-300);
  cursor: pointer; user-select: none;
  display: inline-block;
}
.dev-version {
  position: relative; z-index: 1;
  margin-top: 12px; font-size: 12px; font-weight: 600;
  opacity: .75;
}

/* ============================================
   AI Simulator — بطاقة العميل (Briefing)
   ============================================ */
.brief-card {
  background: var(--surface);
  border: 1.5px solid var(--brand-100);
  border-radius: 18px;
  padding: 14px 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}
.brief-head {
  width: 100%;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  text-align: right;
  background: transparent;
}
.brief-head-text { flex: 1; min-width: 0; }
.brief-avatar {
  width: 42px; height: 42px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--brand-700), var(--brand-500));
  color: #fff; border-radius: 12px;
  box-shadow: 0 3px 8px rgba(26,63,124,.25);
}
.brief-avatar svg { width: 22px; height: 22px; }
.brief-title { font-size: 16px; font-weight: 800; color: var(--ink-900); }
.brief-sub   { font-size: 12px; color: var(--ink-500); margin-top: 3px; line-height: 1.5; }
.brief-toggle {
  font-size: 18px; color: var(--brand-700); font-weight: 800;
  transition: transform .25s var(--ease);
}
.brief-card.collapsed .brief-toggle { transform: rotate(-90deg); }
.brief-card.collapsed .brief-body { display: none; }

.brief-body { margin-top: 14px; }
.brief-grid {
  display: flex; flex-direction: column; gap: 10px;
  padding-bottom: 14px;
  border-bottom: 1px dashed var(--ink-200);
}
.brief-row { display: flex; gap: 10px; align-items: flex-start; }
.brief-ico {
  flex-shrink: 0;
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  background: var(--brand-50); color: var(--brand-700); border-radius: 8px;
}
.brief-ico svg { width: 15px; height: 15px; }
.brief-k {
  font-size: 11px; font-weight: 800;
  color: var(--ink-500); letter-spacing: .3px;
  text-transform: uppercase;
}
.brief-v { font-size: 13.5px; color: var(--ink-900); line-height: 1.6; margin-top: 2px; }
.brief-v ul { list-style: none; padding: 0; margin-top: 2px; }
.brief-v li { font-size: 13px; line-height: 1.7; padding-right: 14px; position: relative; }
.brief-v li::before {
  content: '•';
  position: absolute; right: 0; top: -2px;
  color: var(--brand-600);
  font-weight: 800; font-size: 16px;
}

.brief-mission {
  margin-top: 14px;
  padding: 14px;
  background: linear-gradient(135deg, var(--gold-50), var(--surface));
  border: 1.5px solid var(--gold-300);
  border-radius: 14px;
}
.brief-mission-row { display: flex; gap: 10px; align-items: flex-start; }
.brief-mission-row + .brief-mission-row {
  margin-top: 12px; padding-top: 12px;
  border-top: 1px dashed var(--gold-300);
}
.brief-mission-ico { flex-shrink: 0; color: var(--gold-700); }
.brief-mission-ico svg { width: 20px; height: 20px; }
.brief-angle .brief-mission-ico { color: var(--brand-700); }
.brief-prod-btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.brief-mission-k {
  font-size: 11px; font-weight: 800;
  color: var(--gold-700); letter-spacing: .3px;
  text-transform: uppercase;
}
.brief-mission-v { font-size: 14px; color: var(--ink-900); line-height: 1.7; margin-top: 3px; }
.brief-angle .brief-mission-v { color: var(--brand-800); font-weight: 500; }
.brief-rand {
  display: inline-block;
  font-size: 10px; font-weight: 800;
  color: var(--brand-700); background: var(--brand-50);
  padding: 2px 8px; border-radius: 10px;
  margin-right: 6px; vertical-align: middle;
}

/* Chip التحدّي العشوائي */
.chip.chip-random {
  border-style: dashed;
  border-color: var(--brand-500);
}

/* هيرو المحاكي + شارة الذكاء الاصطناعي */
.sim-hero {
  background: linear-gradient(135deg, var(--brand-900), var(--brand-700) 70%, var(--brand-600)) !important;
}
.sim-ai-tag {
  display: inline-flex; align-items: center; gap: 5px;
  background: rgba(255,255,255,.15) !important;
  color: #fff !important;
}
.sim-ai-tag svg { width: 14px; height: 14px; }

/* أيقونات أزرار المحاكي */
.mode-card-title { display: flex; align-items: center; gap: 7px; }
.mode-card-title svg { width: 18px; height: 18px; flex-shrink: 0; color: var(--brand-600); }
.mode-card.selected .mode-card-title svg { color: var(--brand-700); }
.sim-run-actions .btn-text { display: inline-flex; align-items: center; gap: 4px; }
.sim-run-actions .btn-text svg { width: 15px; height: 15px; }
#startAISim, .btn-secondary.full { display: inline-flex; align-items: center; justify-content: center; gap: 7px; }
#startAISim svg, .btn-secondary.full svg { width: 17px; height: 17px; flex-shrink: 0; }
.edit-banner span { display: inline-flex; align-items: center; gap: 5px; }
.edit-banner svg { width: 14px; height: 14px; flex-shrink: 0; }

/* ============================================
   السكريبتات الذكية — سيناريو الإقناع المخصص
   ============================================ */
.scenario-block {
  background: linear-gradient(135deg, var(--brand-50), var(--surface));
  border: 1.5px solid var(--brand-100);
  border-radius: 18px;
  padding: 16px;
  margin-bottom: 12px;
}
.scenario-intro {
  font-size: 13px; color: var(--ink-700); line-height: 1.7;
  margin-bottom: 14px;
}
.scenario-ai-tag {
  display: inline-block;
  font-size: 10px; font-weight: 800;
  color: var(--brand-700); background: var(--brand-100);
  padding: 3px 9px; border-radius: 10px;
  margin-left: 6px; vertical-align: middle;
}
.scenario-output { margin-top: 4px; }
.scenario-loading {
  display: flex; align-items: center; gap: 8px;
  padding: 16px; color: var(--ink-500); font-size: 13px;
  justify-content: center;
}
.scenario-error {
  padding: 14px 16px; border-radius: 12px;
  background: #fef2f2; border-right: 4px solid var(--danger);
  color: #7f1d1d; font-size: 13.5px; font-weight: 600;
}
.scenario-card {
  background: var(--surface);
  border: 1px solid var(--ink-100);
  border-radius: 14px;
  padding: 16px;
  margin-top: 12px;
  box-shadow: var(--shadow-sm);
}
.scn-head {
  font-size: 14px; font-weight: 800;
  margin: 16px 0 10px;
  padding: 8px 12px;
  border-radius: 10px;
}
.scn-head:first-child { margin-top: 0; }
.scn-need  { background: var(--gold-50);  color: var(--gold-700);  border-right: 4px solid var(--gold-500); }
.scn-qa    { background: var(--brand-50); color: var(--brand-700); border-right: 4px solid var(--brand-500); }
.scn-obj   { background: #fef2f2;         color: #b91c1c;          border-right: 4px solid var(--danger); }
.scn-close { background: #f0fdf4;         color: #15803d;          border-right: 4px solid var(--success); }
.scn-p { font-size: 14px; line-height: 1.8; color: var(--ink-800, var(--ink-700)); margin: 6px 2px; }
.scn-line {
  display: flex; flex-direction: column; gap: 3px;
  padding: 10px 12px; margin: 8px 0;
  border-radius: 12px;
  font-size: 14px; line-height: 1.7;
}
.scn-who { font-size: 11px; font-weight: 800; opacity: .8; }
.scn-customer { background: var(--ink-100); color: var(--ink-900); border-bottom-right-radius: 4px; }
.scn-agent {
  background: linear-gradient(135deg, var(--brand-700), var(--brand-600));
  color: #fff; border-bottom-left-radius: 4px;
}
.scn-agent .scn-who { opacity: .9; }
.scn-obj-line { background: #fff7ed; color: #9a3412; border-right: 3px solid var(--gold-500); }
.scenario-regen {
  display: block; margin: 10px auto 2px;
  color: var(--brand-700); font-weight: 700;
}

/* كرت مقفول (Coming Soon) */
.choice-card.locked {
  opacity: .75;
  border-style: dashed;
  background: var(--ink-100);
}
.choice-card.locked .choice-icon {
  background: var(--ink-200);
  color: var(--ink-500);
  filter: grayscale(.4);
}
.choice-card.locked .choice-arrow { opacity: .5; }
.choice-card.locked:active { transform: scale(.99); }

.soon-badge {
  display: inline-block;
  font-size: 10px; font-weight: 800;
  color: var(--gold-700);
  background: var(--gold-100);
  padding: 3px 9px; border-radius: 10px;
  margin-right: 6px;
  vertical-align: middle;
  letter-spacing: .3px;
  border: 1px solid var(--gold-300);
}

/* بنر "قريبًا" في المكتبة */
.coming-soon-block {
  margin: 28px 0 8px;
  padding: 28px 22px;
  background: linear-gradient(135deg, var(--brand-50), var(--surface));
  border: 1.5px dashed var(--brand-500);
  border-radius: 20px;
  text-align: center;
}
.coming-soon-block .cs-ico {
  font-size: 44px; margin-bottom: 10px;
  display: inline-block;
}
.coming-soon-block h3 {
  font-size: 17px; font-weight: 800;
  color: var(--brand-800);
  margin-bottom: 8px;
}
.coming-soon-block p {
  font-size: 13.5px; line-height: 1.75;
  color: var(--ink-700);
}

/* زر "اعرف أكتر عن المنتج" داخل بطاقة العميل */
.brief-prod-btn {
  margin-top: 14px;
  width: 100%;
  padding: 11px 14px;
  background: var(--surface);
  border: 1.5px dashed var(--gold-500);
  border-radius: 12px;
  color: var(--gold-700);
  font-size: 13.5px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  transition: all .18s var(--ease);
}
.brief-prod-btn:active { background: var(--gold-50); transform: scale(.98); }

/* ============================================
   Product Info Popup (ملخص المنتج)
   ============================================ */
.pinfo-overlay {
  position: fixed; inset: 0; z-index: 400;
  display: flex; align-items: flex-end; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity .25s var(--ease);
}
.pinfo-overlay.open { opacity: 1; pointer-events: auto; }
.pinfo-backdrop {
  position: absolute; inset: 0;
  background: rgba(7,26,58,.55);
}
.pinfo-sheet {
  position: relative;
  width: 100%; max-width: 560px;
  max-height: 92vh;
  background: var(--surface);
  border-radius: 24px 24px 0 0;
  display: flex; flex-direction: column;
  box-shadow: 0 -10px 40px rgba(7,26,58,.35);
  transform: translateY(100%);
  transition: transform .3s var(--ease);
}
.pinfo-overlay.open .pinfo-sheet { transform: translateY(0); }
.pinfo-close {
  position: absolute; top: 12px; left: 12px;
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  background: var(--ink-100); color: var(--ink-700);
  border-radius: 10px;
  z-index: 1;
}
.pinfo-close svg { width: 18px; height: 18px; }
.pinfo-close:active { background: var(--ink-200); }
.pinfo-head {
  padding: 26px 20px 18px;
  text-align: center;
  background: linear-gradient(180deg, var(--brand-50), transparent);
  border-radius: 24px 24px 0 0;
  position: relative;
}
.pinfo-head::before {
  content: '';
  position: absolute;
  top: 8px; left: 50%; transform: translateX(-50%);
  width: 40px; height: 4px;
  background: var(--ink-200);
  border-radius: 2px;
}
.pinfo-emoji {
  width: 60px; height: 60px; margin: 6px auto 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 32px;
  background: linear-gradient(135deg, var(--brand-700), var(--brand-500));
  color: #fff;
  border-radius: 16px;
  box-shadow: 0 4px 12px rgba(26,63,124,.25);
}
.pinfo-emoji svg { width: 30px; height: 30px; }
.pinfo-head h2 { font-size: 22px; font-weight: 800; color: var(--ink-900); margin-bottom: 6px; }
.pinfo-head p { font-size: 13px; color: var(--ink-500); line-height: 1.6; padding: 0 8px; }
.pinfo-body {
  flex: 1; overflow-y: auto;
  padding: 8px 20px 16px;
  -webkit-overflow-scrolling: touch;
}
.pinfo-section { margin-bottom: 18px; }
.pinfo-section h4 {
  font-size: 13px; font-weight: 800; color: var(--brand-700);
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1.5px solid var(--brand-100);
}
.pinfo-section p { font-size: 14px; color: var(--ink-700); line-height: 1.75; }
.pinfo-section ul { list-style: none; padding: 0; }
.pinfo-section li {
  font-size: 13.5px; color: var(--ink-900); line-height: 1.7;
  padding: 7px 12px;
  margin-bottom: 6px;
  background: var(--ink-100);
  border-radius: 10px;
  border-right: 3px solid var(--brand-500);
}
.pinfo-foot {
  padding: 14px 20px calc(14px + env(safe-area-inset-bottom));
  background: var(--surface);
  border-top: 1px solid var(--ink-100);
  box-shadow: 0 -4px 14px rgba(0,0,0,.05);
}

/* ============================================
   AI Simulator — وضع التدريب (Mode picker)
   ============================================ */
.mode-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mode-card {
  background: var(--surface);
  border: 2px solid var(--ink-200);
  border-radius: 16px;
  padding: 14px 12px;
  text-align: right;
  transition: all .2s var(--ease);
  display: flex; flex-direction: column; gap: 6px;
}
.mode-card:active { transform: scale(.97); }
.mode-card.selected {
  border-color: var(--brand-600);
  background: var(--brand-50);
  box-shadow: 0 4px 14px rgba(26,63,124,.18);
}
.mode-card-title { font-size: 14px; font-weight: 800; color: var(--ink-900); }
.mode-card-desc  { font-size: 12px; color: var(--ink-500); line-height: 1.5; }
.sim-tag-mode    { background: var(--gold-100); color: var(--gold-700); }

/* ============================================
   AI Simulator — زر التعديل + شريط التعديل
   ============================================ */
.bubble { position: relative; }
.bubble-edit-btn {
  position: absolute;
  top: 6px; left: 6px;
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,.22);
  border-radius: 8px;
  font-size: 14px;
  opacity: .85;
  transition: all .15s var(--ease);
}
.bubble-edit-btn:active { opacity: 1; background: rgba(255,255,255,.4); transform: scale(.92); }
.bubble.editing { outline: 2px dashed var(--gold-500); outline-offset: 2px; }
.edit-banner[hidden] { display: none !important; }
.edit-banner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px;
  margin: 0 -16px;
  padding: 10px 16px;
  background: var(--gold-50);
  border-top: 1px solid var(--gold-100);
  border-bottom: 1px solid var(--gold-100);
  font-size: 13px; font-weight: 600;
  color: var(--gold-700);
}
.edit-banner .btn-text { color: var(--brand-700); }

/* ============================================
   AI Simulator — فقاعة الاقتراحات (ساعدني)
   ============================================ */
.sugg-bubble { padding: 12px; }
.sugg-list { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.sugg-item {
  width: 100%;
  background: var(--surface);
  border: 1.5px solid var(--gold-300);
  border-radius: 12px;
  padding: 10px 12px;
  text-align: right;
  transition: all .15s var(--ease);
}
.sugg-item:active { transform: scale(.98); background: var(--gold-50); }
.sugg-strat {
  display: inline-block;
  font-size: 11px; font-weight: 800;
  color: var(--gold-700);
  background: var(--gold-100);
  padding: 2px 8px;
  border-radius: 10px;
  margin-bottom: 6px;
}
.sugg-reply { font-size: 13.5px; color: var(--ink-900); line-height: 1.6; }

/* ============================================
   AI Simulator — مكتبة التدريبات
   ============================================ */
.lib-grid { display: flex; flex-direction: column; gap: 10px; }
.lib-card {
  position: relative;
  background: var(--surface);
  border: 1.5px solid var(--ink-200);
  border-radius: 16px;
  padding: 14px 16px;
  box-shadow: 0 1px 6px rgba(0,0,0,.05);
  transition: all .2s var(--ease);
  cursor: pointer;
}
.lib-card:active { transform: scale(.99); border-color: var(--brand-500); }
.lib-card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; margin-bottom: 6px;
}
.lib-card-cust { font-size: 15px; font-weight: 700; color: var(--ink-900); }
.lib-score {
  font-size: 13px; font-weight: 800;
  padding: 3px 10px; border-radius: 12px;
}
.lib-card-meta { font-size: 12px; color: var(--ink-500); margin-bottom: 4px; }
.lib-card-date { font-size: 11px; color: var(--ink-500); opacity: .8; }
.lib-card-del {
  position: absolute;
  top: 10px; left: 10px;
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  background: transparent;
  border-radius: 8px;
  font-size: 14px;
  opacity: .5;
  transition: all .15s var(--ease);
}
.lib-card-del:active { opacity: 1; background: var(--ink-100); }

/* ============================================
   Onboarding (أول فتحة)
   ============================================ */
.onb-overlay[hidden] { display: none !important; }
.onb-overlay {
  position: fixed; inset: 0; z-index: 500;
  background: linear-gradient(160deg, var(--brand-900) 0%, var(--brand-700) 55%, var(--brand-600) 100%);
  color: #fff;
  display: flex; flex-direction: column;
  padding: calc(env(safe-area-inset-top) + 18px) 24px calc(env(safe-area-inset-bottom) + 24px);
  animation: fadeIn .3s var(--ease);
  transition: opacity .3s var(--ease);
  overflow: hidden;
}
.onb-overlay::before {
  content: ''; position: absolute;
  top: -15%; right: -20%;
  width: 300px; height: 300px;
  background: radial-gradient(circle, rgba(212,160,23,.18) 0%, transparent 70%);
  border-radius: 50%;
}
.onb-overlay.closing { opacity: 0; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.onb-skip {
  position: relative; z-index: 1;
  align-self: flex-start;
  color: rgba(255,255,255,.7);
  font-size: 14px; font-weight: 600;
  padding: 6px 10px;
}
.onb-body {
  flex: 1; position: relative; z-index: 1;
  display: flex; align-items: center; justify-content: center;
}
.onb-slide { display: none; text-align: center; max-width: 360px; width: 100%; }
.onb-slide.active { display: block; animation: onbSlideIn .45s var(--ease); }
@keyframes onbSlideIn {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: none; }
}
.onb-art {
  width: 130px; height: 130px; margin: 0 auto 28px;
  display: flex; align-items: center; justify-content: center;
  font-size: 66px;
  background: rgba(255,255,255,.10);
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 34px;
  box-shadow: 0 12px 32px rgba(7,26,58,.35);
}
.onb-logo svg { width: 92px; height: 92px; }
.onb-slide h2 { font-size: 24px; font-weight: 800; margin-bottom: 12px; }
.onb-slide p { font-size: 15px; line-height: 1.85; opacity: .9; }
.onb-feats {
  list-style: none; text-align: right;
  display: flex; flex-direction: column; gap: 12px; margin-top: 6px;
}
.onb-feats li {
  font-size: 14.5px; font-weight: 600;
  background: rgba(255,255,255,.10);
  border: 1px solid rgba(255,255,255,.12);
  padding: 14px 16px; border-radius: 14px;
}
.onb-foot {
  position: relative; z-index: 1;
  display: flex; flex-direction: column; gap: 20px;
}
.onb-dots { display: flex; gap: 8px; justify-content: center; }
.onb-dots span {
  width: 8px; height: 8px; border-radius: 50%;
  background: rgba(255,255,255,.30);
  transition: all .3s var(--ease);
}
.onb-dots span.active { width: 26px; border-radius: 4px; background: var(--gold-500); }
.onb-foot .btn-primary {
  background: linear-gradient(135deg, var(--gold-500), var(--gold-700));
  box-shadow: 0 6px 18px rgba(184,134,11,.40);
}

/* ============================================
   Dialog (تأكيد / إدخال)
   ============================================ */
.dlg-overlay {
  position: fixed; inset: 0; z-index: 450;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  opacity: 0; pointer-events: none;
  transition: opacity .2s var(--ease);
}
.dlg-overlay.open { opacity: 1; pointer-events: auto; }
.dlg-backdrop {
  position: absolute; inset: 0;
  background: rgba(7,26,58,.5);
}
.dlg-card {
  position: relative;
  width: 100%; max-width: 340px;
  background: var(--surface);
  border-radius: 20px;
  padding: 22px 20px 18px;
  box-shadow: var(--shadow-lg);
  transform: scale(.94) translateY(8px);
  transition: transform .2s var(--ease);
}
.dlg-overlay.open .dlg-card { transform: none; }
.dlg-title { font-size: 17px; font-weight: 800; color: var(--ink-900); margin-bottom: 8px; }
.dlg-msg { font-size: 14px; color: var(--ink-700); line-height: 1.7; margin-bottom: 14px; }
.dlg-input { margin-bottom: 14px; }
.dlg-actions { display: flex; gap: 10px; }
.dlg-actions > * { flex: 1; }
.dlg-danger {
  background: linear-gradient(135deg, #dc2626, #b91c1c) !important;
  box-shadow: 0 4px 14px rgba(220,38,38,.35) !important;
}

/* ============================================
   Skeleton loading (هياكل تحميل)
   ============================================ */
.skeleton-card {
  background: var(--surface);
  border: 1px solid var(--ink-100);
  border-radius: 14px;
  padding: 16px;
  margin-top: 12px;
}
.sk-line {
  height: 13px;
  border-radius: 7px;
  margin-bottom: 12px;
  background: linear-gradient(90deg, var(--ink-100) 25%, var(--ink-200) 50%, var(--ink-100) 75%);
  background-size: 200% 100%;
  animation: skShimmer 1.4s infinite;
}
.sk-line:last-child { margin-bottom: 0; }
.sk-line.w40 { width: 40%; }
.sk-line.w60 { width: 60%; }
.sk-line.w80 { width: 80%; }
@keyframes skShimmer {
  from { background-position: 200% 0; }
  to   { background-position: -200% 0; }
}

/* ============================================
   Animations & micro-interactions
   ============================================ */

/* دخول متدرّج للكروت في الشبكات */
.action-grid > *,
.choice-grid > * {
  animation: cardPop .45s var(--ease) both;
}
@keyframes cardPop {
  from { opacity: 0; transform: translateY(12px) scale(.98); }
  to   { opacity: 1; transform: none; }
}
.action-grid > *:nth-child(1), .choice-grid > *:nth-child(1) { animation-delay: .04s; }
.action-grid > *:nth-child(2), .choice-grid > *:nth-child(2) { animation-delay: .09s; }
.action-grid > *:nth-child(3), .choice-grid > *:nth-child(3) { animation-delay: .14s; }
.action-grid > *:nth-child(4), .choice-grid > *:nth-child(4) { animation-delay: .19s; }
.action-grid > *:nth-child(5), .choice-grid > *:nth-child(5) { animation-delay: .24s; }
.action-grid > *:nth-child(6), .choice-grid > *:nth-child(6) { animation-delay: .29s; }
.action-grid > *:nth-child(7), .choice-grid > *:nth-child(7) { animation-delay: .34s; }
.action-grid > *:nth-child(n+8), .choice-grid > *:nth-child(n+8) { animation-delay: .38s; }

/* الهيرو يدخل بنعومة */
.hero, .product-hero {
  animation: cardPop .5s var(--ease) both;
}

/* مؤشّر التبويب النشط ينبض */
.nav-item.active::after {
  animation: navPop .3s var(--ease-bounce);
}
@keyframes navPop {
  from { transform: translateX(-50%) scaleX(0); opacity: 0; }
  to   { transform: translateX(-50%) scaleX(1); opacity: 1; }
}

/* اختيار الشيب */
.chip.selected {
  animation: chipPop .28s var(--ease-bounce);
}
@keyframes chipPop {
  0%   { transform: scale(.88); }
  60%  { transform: scale(1.06); }
  100% { transform: scale(1); }
}

/* كارت التقييم يطلع بـ pop */
.sim-eval-card {
  animation: evalPop .45s var(--ease-bounce) both;
}
@keyframes evalPop {
  from { opacity: 0; transform: scale(.95) translateY(10px); }
  to   { opacity: 1; transform: none; }
}

/* زر الإرسال أثناء التحميل ينبض */
.ai-send:disabled { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse {
  0%, 100% { opacity: .45; }
  50%      { opacity: .7; }
}

/* احترام تفضيل تقليل الحركة (Accessibility) */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-delay: 0ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ============================================
   Responsive
   ============================================ */
@media (min-width: 720px) {
  .hero-title { font-size: 26px; }
  .action-grid { grid-template-columns: repeat(4, 1fr); }
}
