/* ============================================
   لوحة ألوان مريحة للعين — Warm Sage Palette
   ============================================ */
:root {
  --bg: #F5F1EA;
  --bg-soft: #EFE9DF;
  --surface: #FFFDF8;
  --surface-2: #FAF6EE;
  --ink: #2E3A36;
  --ink-soft: #5C6B65;
  --muted: #8A958F;
  --line: #E4DDCF;

  --primary: #6B8E7F;
  --primary-dark: #557364;
  --primary-soft: #DCE7DF;
  --accent: #C8956D;
  --accent-soft: #F0E1D0;
  --gold: #B8945A;

  --danger: #B85C50;
  --danger-soft: #F4DDD8;
  --success: #5C8A6E;

  --shadow-sm: 0 2px 8px rgba(46, 58, 54, 0.06);
  --shadow-md: 0 8px 24px rgba(46, 58, 54, 0.08);
  --shadow-lg: 0 20px 60px rgba(46, 58, 54, 0.12);

  --radius: 14px;
  --radius-lg: 22px;
  --radius-md: 12px;
  --radius-sm: 8px;

  --font: "Tajawal", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

.page-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(circle at 15% 10%, rgba(107, 142, 127, 0.12), transparent 45%),
    radial-gradient(circle at 90% 30%, rgba(200, 149, 109, 0.10), transparent 45%),
    radial-gradient(circle at 50% 100%, rgba(107, 142, 127, 0.08), transparent 50%),
    var(--bg);
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
em { color: var(--accent); font-style: normal; }

/* ============================================
   Topbar
   ============================================ */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 48px;
  max-width: 1400px;
  margin: 0 auto;
  gap: 20px;
}
.topbar-side {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* رابط المالك في الـ topnav */
.topnav-owner {
  background: linear-gradient(135deg, var(--accent-soft), #FFF6E5);
  border: 1px solid var(--accent);
  color: var(--accent) !important;
  padding: 6px 14px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 800;
  transition: all .2s;
}
.topnav-owner:hover {
  background: var(--accent);
  color: #fff !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(200, 149, 109, 0.3);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 900;
  font-size: 22px;
  letter-spacing: -0.5px;
}
.logo-dot {
  width: 14px;
  height: 14px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 0 4px var(--primary-soft);
}
.brand-accent { color: var(--accent); }
.topnav { display: flex; gap: 28px; }
.topnav a {
  color: var(--ink-soft);
  font-weight: 500;
  font-size: 15px;
  transition: color .2s;
}
.topnav a:hover { color: var(--primary); }

.badge-free {
  display: inline-block;
  background: var(--bg-soft);
  color: var(--ink-soft);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
}
.badge-pro {
  display: inline-block;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(107,142,127,.3);
}
.badge-link {
  border: none;
  background: none;
  color: var(--muted);
  font-size: 12px;
  text-decoration: underline;
  margin-right: 4px;
}

/* ============================================
   Hero
   ============================================ */
.hero {
  max-width: 1400px;
  margin: 0 auto;
  padding: 48px 48px 64px;
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 56px;
  align-items: center;
}
.eyebrow {
  display: inline-block;
  background: var(--primary-soft);
  color: var(--primary-dark);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 18px;
}
.hero h1 {
  font-size: clamp(36px, 5vw, 58px);
  line-height: 1.2;
  margin: 0 0 18px;
  font-weight: 900;
  letter-spacing: -1px;
}
.grad {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.lead {
  color: var(--ink-soft);
  font-size: 18px;
  max-width: 540px;
  margin: 0 0 28px;
}
.hero-cta { display: flex; gap: 14px; flex-wrap: wrap; }
.hero-trust {
  list-style: none;
  padding: 0;
  margin: 28px 0 0;
  display: flex;
  gap: 22px;
  flex-wrap: wrap;
  color: var(--ink-soft);
  font-size: 14px;
}
.hero-trust li { display: flex; align-items: center; gap: 8px; }
.check {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary-soft);
  position: relative;
  flex-shrink: 0;
}
.check::after {
  content: "✓";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--primary-dark);
  font-size: 12px;
  font-weight: 900;
}

.hero-visual { display: grid; place-items: center; }
.card-stack { position: relative; width: 360px; height: 440px; }
.mini-card {
  position: absolute;
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-md);
}
.mc1 { width: 280px; height: 380px; top: 30px; right: 60px; transform: rotate(-7deg); background: var(--accent-soft); }
.mc2 { width: 290px; height: 390px; top: 20px; right: 35px; transform: rotate(-2deg); background: var(--primary-soft); }
.mc3 {
  width: 300px; height: 400px; top: 10px; right: 0;
  padding: 32px; display: flex; flex-direction: column; gap: 14px;
  transform: rotate(3deg); box-shadow: var(--shadow-lg);
}
.mc-avatar { width: 72px; height: 72px; border-radius: 50%; background: linear-gradient(135deg, var(--primary), var(--accent)); margin-bottom: 8px; }
.mc-line { height: 10px; background: var(--line); border-radius: 5px; }
.mc-line.w90 { width: 90%; }
.mc-line.w70 { width: 70%; background: var(--ink); height: 14px; }
.mc-line.w60 { width: 60%; }
.mc-line.w40 { width: 40%; background: var(--accent); }
.mc-block { height: 60px; background: var(--bg-soft); border-radius: 10px; margin: 8px 0; }

/* ============================================
   Buttons
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 24px;
  border-radius: var(--radius);
  font-weight: 700;
  font-size: 15px;
  border: 1px solid transparent;
  transition: transform .15s ease, box-shadow .2s ease, background .2s ease;
}
.btn-primary {
  background: var(--primary);
  color: white;
  box-shadow: 0 6px 18px rgba(107, 142, 127, 0.35);
}
.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(107, 142, 127, 0.4);
}
.btn-ghost {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--line);
}
.btn-ghost:hover {
  background: var(--surface-2);
  border-color: var(--primary);
  color: var(--primary-dark);
}
.btn-large { width: 100%; padding: 16px; font-size: 16px; margin-top: 8px; }
.btn-block { width: 100%; }

/* ============================================
   Section Title
   ============================================ */
.section-title {
  text-align: center;
  font-size: 36px;
  margin: 0 0 40px;
  font-weight: 900;
  letter-spacing: -0.5px;
}

/* ============================================
   How It Works
   ============================================ */
.how {
  max-width: 1400px;
  margin: 0 auto;
  padding: 64px 48px;
}
.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}
.step {
  background: var(--surface);
  padding: 32px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
}
.step-num {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white;
  font-weight: 900;
  font-size: 18px;
  margin-bottom: 16px;
}
.step h4 { margin: 0 0 6px; font-size: 18px; }
.step p { color: var(--ink-soft); margin: 0; font-size: 15px; }

/* ============================================
   Pricing
   ============================================ */
.pricing {
  max-width: 1400px;
  margin: 0 auto;
  padding: 32px 48px 64px;
}
.plans {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 28px;
  max-width: 900px;
  margin: 0 auto;
}
.plan {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  padding: 36px;
  position: relative;
  transition: transform .25s, box-shadow .25s;
}
.plan:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }
.plan-premium {
  border: 2px solid var(--primary);
  background: linear-gradient(180deg, var(--surface), var(--primary-soft) 250%);
}
.plan-tag {
  position: absolute;
  top: -12px;
  right: 24px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}
.plan header { text-align: center; margin-bottom: 24px; padding-bottom: 24px; border-bottom: 1px dashed var(--line); }
.plan h3 { margin: 0 0 8px; font-size: 22px; }
.plan-price {
  font-size: 48px;
  font-weight: 900;
  margin: 8px 0;
  color: var(--ink);
  line-height: 1;
}
.plan-price span { font-size: 16px; color: var(--muted); font-weight: 500; }
.plan-features {
  list-style: none;
  padding: 0;
  margin: 0 0 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.plan-features li { color: var(--ink); font-size: 15px; }
.plan-features li.off { color: var(--muted); text-decoration: line-through; }

/* ============================================
   Builder
   ============================================ */
.builder {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px 48px 64px;
  display: grid;
  grid-template-columns: 420px 1fr;
  gap: 32px;
  align-items: start;
}

.form-card {
  background: var(--surface);
  padding: 32px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 24px;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
}
.muted { color: var(--muted); font-size: 14px; margin: 0; }

.step-block { margin-bottom: 28px; }
.step-h {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.step-badge {
  width: 32px; height: 32px;
  background: var(--primary);
  color: white;
  border-radius: 50%;
  display: grid; place-items: center;
  font-weight: 900;
  flex-shrink: 0;
}
.step-h h3 { margin: 0; font-size: 16px; }

/* صندوق البحث */
.search-box {
  position: relative;
  margin-bottom: 12px;
}
.search-box input {
  width: 100%;
  padding: 12px 40px 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  font-family: inherit;
  font-size: 14px;
  color: var(--ink);
  transition: all .2s;
}
.search-box input:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: 0 0 0 4px var(--primary-soft);
}
.search-icon {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 16px;
  pointer-events: none;
  opacity: .6;
}

/* تبويبات الفئات */
.category-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px dashed var(--line);
}
.cat-tab {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-soft);
  cursor: pointer;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all .2s;
  white-space: nowrap;
}
.cat-tab:hover {
  border-color: var(--primary);
  color: var(--primary-dark);
  background: var(--primary-soft);
}
.cat-tab.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}
.cat-tab span { font-size: 13px; }

.no-results {
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  padding: 20px;
  margin: 0;
}

/* المهن */
.prof-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  max-height: 320px;
  overflow-y: auto;
  padding: 4px;
}
.prof-grid::-webkit-scrollbar { width: 6px; }
.prof-grid::-webkit-scrollbar-track { background: var(--bg-soft); border-radius: 3px; }
.prof-grid::-webkit-scrollbar-thumb { background: var(--line); border-radius: 3px; }
.prof-grid::-webkit-scrollbar-thumb:hover { background: var(--primary); }
.prof-card {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all .2s;
  font-family: inherit;
}
.prof-card:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
}
.prof-card.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border-color: var(--primary);
  color: white;
  box-shadow: 0 6px 16px rgba(107,142,127,.3);
}
.prof-icon { font-size: 22px; }
.prof-name { font-size: 13px; font-weight: 700; }

/* رفع الصورة الشخصية */
.photo-upload {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.photo-label { cursor: pointer; }
.photo-preview {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 2px dashed var(--line);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  overflow: hidden;
  transition: all .2s;
}
.photo-preview:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
}
.photo-icon { font-size: 24px; }
.photo-text { font-size: 11px; color: var(--ink-soft); text-align: center; padding: 0 8px; }
.photo-preview-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}
.photo-remove {
  background: none;
  border: none;
  color: var(--danger);
  font-size: 12px;
  cursor: pointer;
  text-decoration: underline;
  padding: 4px;
}

/* اختيار لغة السيرة الذاتية */
.lang-selector {
  background: linear-gradient(135deg, var(--primary-soft), rgba(255,255,255,0.5));
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 4px;
}
.lang-selector-title {
  display: block;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 10px;
}
.lang-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.lang-option {
  cursor: pointer;
  position: relative;
}
.lang-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.lang-pill {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 14px;
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 700;
  color: var(--ink-soft);
  transition: all .2s;
  user-select: none;
}
.lang-option input[type="radio"]:checked + .lang-pill {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 4px 12px rgba(107, 142, 127, 0.25);
}
.lang-option:hover .lang-pill {
  border-color: var(--primary);
}
.lang-hint {
  font-size: 12px;
  color: var(--ink-soft);
  margin-top: 8px;
  margin-bottom: 0;
}

/* أزرار تبديل اللغة في شريط الإجراءات */
.lang-toggle-results {
  display: inline-flex;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 3px;
  gap: 2px;
  margin-inline-end: auto;
}
.lang-toggle-btn {
  background: transparent;
  border: none;
  padding: 7px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
  cursor: pointer;
  transition: all .2s;
  font-family: inherit;
}
.lang-toggle-btn:hover {
  color: var(--ink);
  background: var(--surface);
}
.lang-toggle-btn.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 6px rgba(107, 142, 127, 0.25);
}

/* الأقسام الفرعية في النموذج */
.subsection {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 16px;
  margin: 4px 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.subsection-title {
  margin: 0;
  font-size: 15px;
  font-weight: 800;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.optional-tag {
  font-size: 11px;
  font-weight: 500;
  color: var(--ink-soft);
  background: var(--surface);
  padding: 2px 8px;
  border-radius: 6px;
  border: 1px solid var(--line);
}

/* صفوف الخبرات الديناميكية */
.experiences-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.exp-row {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
  animation: expSlideIn 0.25s ease;
}
@keyframes expSlideIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}
.exp-row-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px dashed var(--line);
  padding-bottom: 8px;
}
.exp-row-num {
  font-size: 13px;
  font-weight: 700;
  color: var(--primary);
  background: var(--primary-soft);
  padding: 4px 10px;
  border-radius: 6px;
}
.exp-remove {
  background: none;
  border: 1px solid var(--line);
  color: var(--danger);
  width: 28px;
  height: 28px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
  transition: all .2s;
}
.exp-remove:hover {
  background: var(--danger);
  color: white;
  border-color: var(--danger);
}

.btn-add-exp {
  background: var(--primary-soft);
  border: 2px dashed var(--primary);
  color: var(--primary);
  padding: 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all .2s;
  font-family: inherit;
}
.btn-add-exp:hover {
  background: var(--primary);
  color: white;
}

/* select styled مثل input */
.field select {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  font-family: inherit;
  font-size: 14px;
  color: var(--ink);
  cursor: pointer;
  transition: border .2s, background .2s, box-shadow .2s;
}
.field select:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: 0 0 0 4px var(--primary-soft);
}

/* الفورم */
.form { display: flex; flex-direction: column; gap: 14px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field span { font-size: 13px; font-weight: 700; color: var(--ink-soft); }
.field input, .field textarea, .field select {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  font-family: inherit;
  font-size: 14px;
  color: var(--ink);
  transition: border .2s, background .2s, box-shadow .2s;
}
.field input:focus, .field textarea:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: 0 0 0 4px var(--primary-soft);
}
.field textarea { resize: vertical; min-height: 60px; }

.form-hint {
  font-size: 12px;
  color: var(--ink-soft);
  text-align: center;
  margin: 8px 0 0;
  padding: 10px 14px;
  background: var(--primary-soft);
  border-radius: var(--radius-sm);
  line-height: 1.6;
}

/* ============================================
   Output
   ============================================ */
.output { display: flex; flex-direction: column; gap: 24px; }

.placeholder {
  background: var(--surface);
  border: 2px dashed var(--line);
  border-radius: var(--radius-lg);
  padding: 80px 32px;
  text-align: center;
  color: var(--ink-soft);
}
.placeholder-icon { font-size: 48px; margin-bottom: 16px; }
.placeholder h3 { margin: 0 0 8px; color: var(--ink); }
.placeholder p { margin: 0; font-size: 15px; }

.loading {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  padding: 80px 32px;
  text-align: center;
}
.loader {
  width: 48px;
  height: 48px;
  border: 4px solid var(--primary-soft);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 18px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading p { font-weight: 700; color: var(--ink); margin: 0; }

.error-box {
  background: var(--danger-soft);
  border: 1px solid var(--danger);
  color: var(--danger);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 14px;
}

/* ============================================
   Template selector
   ============================================ */
.template-bar {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  padding: 20px;
}
.template-bar h3 {
  margin: 0 0 12px;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 1px;
}
.tmpl-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
}
.tmpl-thumb {
  background: var(--surface-2);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  padding: 8px;
  cursor: pointer;
  transition: all .2s;
  font-family: inherit;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.tmpl-thumb:hover { border-color: var(--primary); }
.tmpl-thumb.active {
  border-color: var(--primary);
  background: var(--primary-soft);
  box-shadow: 0 4px 12px rgba(107,142,127,.2);
}

/* قالب مقفل (Premium only للمستخدم المجاني) */
.tmpl-thumb.tmpl-locked {
  opacity: 0.6;
  position: relative;
}
.tmpl-thumb.tmpl-locked:hover {
  opacity: 0.85;
  border-color: var(--accent);
}
.tmpl-thumb-preview {
  position: relative;
}
.tmpl-lock {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(46, 58, 54, 0.4);
  border-radius: 4px;
  font-size: 22px;
  backdrop-filter: blur(2px);
}

/* شارات القوالب */
.tmpl-badge-free, .tmpl-badge-pro {
  display: inline-block;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 8px;
  margin-inline-start: 4px;
  vertical-align: middle;
}
.tmpl-badge-free {
  background: var(--primary-soft);
  color: var(--primary-dark);
}
.tmpl-badge-pro {
  background: linear-gradient(135deg, var(--accent), var(--gold));
  color: white;
}
.tmpl-thumb-preview {
  height: 60px;
  background: white;
  border-radius: 4px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  border: 1px solid var(--line);
}
.tt-line { height: 3px; background: #ccc; border-radius: 2px; width: 100%; }
.tt-line.w70 { width: 70%; }
.tt-line.w90 { width: 90%; }
.tt-line.w60 { width: 60%; }
.tt-block { height: 12px; background: #eee; margin: 2px 0; border-radius: 2px; }

.tmpl-thumb-modern .tt-line { background: var(--primary); }
.tmpl-thumb-classic .tt-line { background: #555; }
.tmpl-thumb-creative .tt-line { background: var(--accent); }
.tmpl-thumb-creative .tt-block { background: var(--accent-soft); }
.tmpl-thumb-minimal .tt-line { background: #999; }
.tmpl-thumb-professional .tt-line { background: var(--primary-dark); }
.tmpl-thumb-professional .tt-block { background: var(--primary-soft); }

.tmpl-thumb-info {
  display: flex;
  align-items: center;
  gap: 4px;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
}
.tmpl-thumb-icon { font-size: 14px; }

/* ============================================
   Actions Bar
   ============================================ */
.actions-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.actions-bar .btn { flex: 1; min-width: 130px; }

/* ============================================
   CV Render Container
   ============================================ */
.cv-render {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  animation: fadeUp .5s ease;
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============================================
   Interview Section
   ============================================ */
.interview-card {
  background: linear-gradient(135deg, var(--surface), var(--surface-2));
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  padding: 36px;
  box-shadow: var(--shadow-md);
  animation: fadeUp .5s ease .1s both;
}
.interview-card header { margin-bottom: 24px; }
.interview-card h2 { font-size: 22px; margin: 0 0 6px; }
.qlist {
  list-style: none;
  counter-reset: q;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.qlist li {
  counter-increment: q;
  background: var(--surface);
  padding: 18px 22px 18px 22px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  position: relative;
  padding-right: 64px;
  transition: transform .2s, border-color .2s;
}
.qlist li:hover {
  transform: translateX(-3px);
  border-color: var(--primary);
}
.qlist li::before {
  content: counter(q);
  position: absolute;
  right: 18px;
  top: 18px;
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white;
  font-weight: 900;
  font-size: 13px;
}
.q-text { font-weight: 700; font-size: 15px; color: var(--ink); margin: 0 0 10px; line-height: 1.6; }
.q-label {
  display: inline-block;
  background: var(--primary);
  color: #fff;
  padding: 2px 10px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 700;
  margin-inline-end: 8px;
  vertical-align: middle;
}
.q-tip, .q-answer {
  margin: 0;
  font-size: 14px;
  color: var(--ink);
  background: linear-gradient(135deg, var(--accent-soft), rgba(255,255,255,0.5));
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  border-right: 4px solid var(--accent);
  border-left: none;
  line-height: 1.8;
}
.q-tip strong, .q-answer strong { color: var(--accent); display: block; margin-bottom: 6px; font-size: 13px; }

/* في الإنجليزية: اعكس الحدود */
[dir="ltr"] .q-tip,
[dir="ltr"] .q-answer {
  border-right: none;
  border-left: 4px solid var(--accent);
}

/* تقسيمات قسم المقابلة */
.interview-section-block { margin-bottom: 28px; }
.interview-section-block:last-child { margin-bottom: 0; }
.interview-subhead {
  font-size: 14px;
  font-weight: 800;
  color: var(--primary-dark);
  margin: 0 0 14px;
  padding: 8px 12px;
  background: var(--primary-soft);
  border-radius: var(--radius-sm);
  display: inline-block;
}
.qlist-general li::before {
  background: linear-gradient(135deg, var(--accent), var(--gold));
}

/* قسم مغلق للمستخدم المجاني */
.locked-content {
  background: var(--surface);
  border: 2px dashed var(--line);
  border-radius: var(--radius-lg);
  padding: 50px 32px;
  text-align: center;
}
.lock-icon { font-size: 42px; margin-bottom: 12px; }
.locked-content h3 { margin: 0 0 6px; font-size: 20px; }
.locked-content p { margin: 0 0 18px; }

/* ============================================
   Modal
   ============================================ */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(46, 58, 54, 0.6);
  backdrop-filter: blur(6px);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn .2s ease;
}
.modal.show { display: flex; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 36px;
  max-width: 460px;
  width: 100%;
  position: relative;
  box-shadow: var(--shadow-lg);
  animation: scaleIn .25s ease;
}
@keyframes scaleIn {
  from { transform: scale(.92); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.modal-close {
  position: absolute;
  top: 14px;
  left: 14px;
  width: 36px; height: 36px;
  background: var(--bg-soft);
  border: none;
  border-radius: 50%;
  font-size: 22px;
  color: var(--ink-soft);
  cursor: pointer;
  transition: background .2s;
}
.modal-close:hover { background: var(--line); color: var(--ink); }
.modal-card h2 { margin: 0 0 4px; font-size: 22px; }

.modal-features {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 20px 0;
  padding: 16px;
  background: var(--primary-soft);
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  color: var(--primary-dark);
}

.modal-note {
  background: var(--accent-soft);
  border-right: 3px solid var(--accent);
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--ink-soft);
  margin-bottom: 16px;
}

.upgrade-icon {
  font-size: 56px;
  text-align: center;
  margin-bottom: 8px;
}

/* ============================================
   Toast
   ============================================ */
.toast {
  position: fixed;
  bottom: 30px;
  right: 50%;
  transform: translateX(50%) translateY(100px);
  background: var(--ink);
  color: white;
  padding: 12px 24px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  z-index: 200;
  opacity: 0;
  transition: all .3s ease;
  box-shadow: var(--shadow-lg);
}
.toast.show { transform: translateX(50%) translateY(0); opacity: 1; }

/* ============================================
   Footer
   ============================================ */
.footer {
  text-align: center;
  padding: 36px 24px;
  color: var(--muted);
  font-size: 14px;
  border-top: 1px solid var(--line);
  margin-top: 48px;
  background: var(--surface-2);
}
.footer-content {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
}
.footer-brand { font-weight: 700; margin: 0; color: var(--ink); }
.footer-links {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
  font-size: 13px;
}
.footer-links a {
  color: var(--ink-soft);
  text-decoration: none;
  cursor: pointer;
  transition: color .2s;
}
.footer-links a:hover { color: var(--primary); text-decoration: underline; }
.footer-links span { color: var(--line); }
.footer-legal {
  font-size: 12px;
  color: var(--muted);
  margin: 0;
  padding-top: 8px;
  border-top: 1px dashed var(--line);
  width: 100%;
  max-width: 400px;
}

/* ============================================
   Legal Modals — Refund / Terms / Privacy
   ============================================ */
.modal-large { max-width: 680px !important; }

.legal-content {
  max-height: 50vh;
  overflow-y: auto;
  padding: 16px 20px;
  background: var(--bg-soft);
  border-radius: var(--radius);
  margin: 16px 0;
  text-align: right;
}
.legal-content::-webkit-scrollbar { width: 6px; }
.legal-content::-webkit-scrollbar-track { background: var(--surface); border-radius: 3px; }
.legal-content::-webkit-scrollbar-thumb { background: var(--line); border-radius: 3px; }
.legal-content::-webkit-scrollbar-thumb:hover { background: var(--primary); }

.legal-content h3 {
  font-size: 16px;
  color: var(--primary-dark);
  margin: 16px 0 8px;
  font-weight: 800;
}
.legal-content h3:first-child { margin-top: 0; }
.legal-content p { font-size: 14px; line-height: 1.8; margin: 0 0 10px; color: var(--ink); }
.legal-content ul {
  margin: 8px 0;
  padding-inline-start: 22px;
}
.legal-content li {
  font-size: 14px;
  line-height: 1.8;
  color: var(--ink-soft);
  margin-bottom: 4px;
}
.legal-content strong { color: var(--primary-dark); }
.legal-updated {
  margin-top: 18px !important;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
  font-size: 12px !important;
  color: var(--muted) !important;
  font-style: italic;
  text-align: left;
}

/* Checkbox الموافقة */
.agree-check {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  font-size: 13px;
  color: var(--ink-soft);
  margin: 16px 0;
  padding: 12px 14px;
  background: var(--bg-soft);
  border-radius: var(--radius-sm);
  cursor: pointer;
  user-select: none;
}
.agree-check input[type="checkbox"] {
  margin-top: 4px;
  accent-color: var(--primary);
  flex-shrink: 0;
  cursor: pointer;
}
.agree-check a {
  color: var(--primary-dark);
  text-decoration: underline;
  font-weight: 600;
}
.agree-check a:hover { color: var(--primary); }

/* ============================================
   Responsive
   ============================================ */
/* ============================================
   Responsive — Tablet & Desktop
   ============================================ */
@media (max-width: 1100px) {
  .hero { grid-template-columns: 1fr; }
  .hero-visual { display: none; }
  .builder { grid-template-columns: 1fr; }
  .form-card { position: static; max-height: none; }
  .steps { grid-template-columns: 1fr; }
  .plans { grid-template-columns: 1fr; max-width: 500px; }
  .tmpl-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ============================================
   Mobile (iPhone & Android) — < 768px
   ============================================ */
@media (max-width: 768px) {
  /* Layout عام */
  body { font-size: 15px; }
  .topbar { padding: 14px 16px; flex-wrap: wrap; gap: 10px; }
  .brand { font-size: 18px; }
  .topnav { display: none; }
  .topbar-side { margin-right: auto; }

  /* Hero */
  .hero {
    padding: 24px 16px 32px;
    text-align: center;
  }
  .hero h1 { font-size: clamp(28px, 8vw, 40px); }
  .lead { font-size: 16px; margin: 0 auto 24px; }
  .eyebrow { font-size: 11px; padding: 5px 12px; }
  .hero-cta {
    justify-content: center;
    flex-direction: column;
    width: 100%;
  }
  .hero-cta .btn { width: 100%; }
  .hero-trust { justify-content: center; gap: 14px; font-size: 13px; }

  /* Sections */
  .how, .pricing, .builder { padding: 32px 16px; }
  .section-title { font-size: 26px; margin-bottom: 24px; }

  /* Steps */
  .steps { gap: 16px; }
  .step { padding: 22px; }

  /* Pricing */
  .plan { padding: 24px; }
  .plan-price { font-size: 38px; }

  /* Builder Form */
  .form-card { padding: 20px; border-radius: 16px; }
  .form { gap: 12px; }
  .row { grid-template-columns: 1fr; gap: 10px; }
  .field input, .field textarea, .field select { font-size: 16px; padding: 14px; }
  .step-h h3 { font-size: 15px; }
  .step-badge { width: 28px; height: 28px; font-size: 13px; }

  /* Profession Grid */
  .prof-grid {
    grid-template-columns: repeat(2, 1fr);
    max-height: 280px;
    gap: 6px;
  }
  .prof-card { padding: 12px 8px; min-height: 60px; }
  .prof-icon { font-size: 20px; }
  .prof-name { font-size: 12px; }

  /* Category Tabs */
  .category-tabs {
    gap: 5px;
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 10px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .category-tabs::-webkit-scrollbar { display: none; }
  .cat-tab { font-size: 11px; padding: 6px 10px; flex-shrink: 0; }

  /* Search */
  .search-box input { font-size: 16px; }

  /* Output */
  .placeholder { padding: 50px 20px; }
  .placeholder-icon { font-size: 40px; }
  .loading { padding: 50px 20px; }

  /* Templates Selector */
  .template-bar { padding: 14px; }
  .tmpl-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
  .tmpl-thumb-preview { height: 50px; }
  .tmpl-thumb-info { font-size: 11px; }

  /* Actions Bar */
  .actions-bar { gap: 8px; }
  .actions-bar .btn { font-size: 13px; padding: 10px 12px; min-width: auto; flex: 1; }

  /* Buttons - Touch-friendly */
  .btn { min-height: 44px; padding: 12px 18px; font-size: 14px; }
  .btn-large { padding: 16px; font-size: 15px; }

  /* Modals */
  .modal { padding: 12px; align-items: flex-end; }
  .modal-card {
    padding: 24px 20px;
    max-height: 90vh;
    overflow-y: auto;
    border-radius: 18px 18px 0 0;
    width: 100%;
    -webkit-overflow-scrolling: touch;
  }
  .modal-large { max-width: 100% !important; }
  .legal-content { max-height: 50vh; padding: 12px; font-size: 13px; }
  .legal-content h3 { font-size: 14px; }
  .legal-content p, .legal-content li { font-size: 13px; line-height: 1.6; }

  .modal-features { grid-template-columns: 1fr; }

  /* Photo upload */
  .photo-preview { width: 80px; height: 80px; }
  .photo-icon { font-size: 20px; }

  /* Interview */
  .interview-card { padding: 22px 16px; }
  .qlist li { padding: 14px 14px 14px 14px; padding-right: 50px; }
  .qlist li::before { right: 12px; top: 14px; width: 28px; height: 28px; font-size: 12px; }
  .q-text { font-size: 14px; }
  .q-tip { font-size: 12px; padding: 8px 10px; }

  /* Locked content */
  .locked-content { padding: 32px 20px; }
  .lock-icon { font-size: 36px; }

  /* Footer */
  .footer { padding: 24px 16px; }
  .footer-links { gap: 8px; font-size: 12px; }

  /* Plan Badge */
  #plan-badge { font-size: 11px; }
  .badge-pro, .badge-free { padding: 4px 10px; font-size: 11px; }

  /* Toast */
  .toast {
    bottom: 20px;
    width: calc(100% - 40px);
    right: 20px;
    transform: translateY(100px);
    text-align: center;
    font-size: 13px;
    padding: 10px 16px;
  }
  .toast.show { transform: translateY(0); }
}

/* ============================================
   Mobile صغير جداً — < 380px
   ============================================ */
@media (max-width: 380px) {
  .prof-grid { grid-template-columns: 1fr; }
  .tmpl-grid { grid-template-columns: 1fr; }
  .features { grid-template-columns: 1fr; }
  .modal-card { padding: 20px 16px; }
  .actions-bar { flex-direction: column; }
  .actions-bar .btn { width: 100%; }
}

/* ============================================
   تحسينات Touch Devices
   ============================================ */
@media (hover: none) and (pointer: coarse) {
  .btn:hover { transform: none; }
  .prof-card:hover { transform: none; }
  .feature:hover { transform: none; }
  .step:hover { transform: none; }
  .plan:hover { transform: none; }
  .tmpl-thumb:hover { transform: none; }
  .qlist li:hover { transform: none; }
  /* لمسة كبرى لكل العناصر القابلة للضغط */
  .prof-card, .cat-tab, .tmpl-thumb { min-height: 44px; }
}

/* ============================================
   iOS Safari تحسينات خاصة
   ============================================ */
@supports (-webkit-touch-callout: none) {
  /* منع zoom عند focus على inputs */
  input, textarea, select { font-size: 16px !important; }
  /* تعويض الـ Safe Area للأيفون مع notch */
  .footer { padding-bottom: max(24px, env(safe-area-inset-bottom)); }
  .topbar { padding-top: max(14px, env(safe-area-inset-top)); }
}

/* ============================================
   نظام المصادقة (Auth)
   ============================================ */

/* شارة ثقة Stripe */
.stripe-trust {
  text-align: center;
  font-size: 12px;
  color: var(--ink-soft);
  margin: 8px 0 12px;
  letter-spacing: 0.3px;
}

/* أزرار الدخول/التسجيل في الـ topbar */
.btn-auth {
  padding: 8px 16px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all .2s;
  margin-inline-start: 6px;
}
.btn-auth-ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--line);
}
.btn-auth-ghost:hover {
  background: var(--surface-2);
  border-color: var(--primary);
}
.btn-auth-primary {
  background: var(--primary);
  color: white;
}
.btn-auth-primary:hover {
  background: var(--primary-dark);
}

/* مدخلات حساب المستخدم (اسم + قائمة منسدلة) */
.user-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 6px 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  position: relative;
  transition: all .2s;
  margin-inline-start: 6px;
}
.user-pill:hover {
  border-color: var(--primary);
}
.user-avatar {
  width: 30px;
  height: 30px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: white;
  font-weight: 900;
  font-size: 13px;
}
.user-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  max-width: 120px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-caret {
  font-size: 10px;
  color: var(--ink-soft);
}
.user-menu {
  position: absolute;
  top: calc(100% + 8px);
  inset-inline-end: 0;
  min-width: 240px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  padding: 12px;
  display: none;
  z-index: 100;
}
.user-menu.open { display: block; }
.user-menu-head {
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.user-menu-head strong { font-size: 14px; color: var(--ink); }
.user-menu-head small { font-size: 12px; color: var(--ink-soft); }
.user-menu-stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--ink-soft);
  padding: 4px 0 10px;
}
.user-menu-item {
  width: 100%;
  background: transparent;
  border: none;
  padding: 10px 12px;
  border-radius: 8px;
  text-align: start;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  cursor: pointer;
  transition: all .15s;
}
.user-menu-item:hover {
  background: var(--surface-2);
  color: var(--danger);
}

/* نموذج المصادقة (Login/Register) */
.auth-icon {
  font-size: 38px;
  text-align: center;
  margin-bottom: 8px;
}
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 16px;
}
.auth-error {
  background: var(--danger-soft);
  color: #8E3A30;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  border-inline-start: 3px solid var(--danger);
}

/* تنبيه وضع التطوير (يعرض الكود) */
.auth-dev-hint {
  background: linear-gradient(135deg, #FFF6E5, #FFE7C2);
  border: 1px dashed #B8945A;
  color: #6B4F2A;
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 13px;
  text-align: center;
}
.auth-dev-hint code {
  background: #FFF;
  padding: 2px 8px;
  border-radius: 6px;
  font-family: 'Courier New', monospace;
  font-weight: 800;
  color: var(--primary-dark);
}

/* حقل OTP — أرقام كبيرة في الوسط */
.otp-input {
  text-align: center !important;
  font-size: 28px !important;
  letter-spacing: 12px !important;
  font-weight: 900 !important;
  font-family: 'Courier New', monospace !important;
  padding: 16px !important;
}
.otp-input::placeholder {
  letter-spacing: 8px;
  font-weight: 400;
  opacity: 0.3;
}
.auth-switch {
  text-align: center;
  margin: 18px 0 0;
  font-size: 13px;
  color: var(--ink-soft);
}
.auth-switch a {
  color: var(--primary);
  font-weight: 700;
  text-decoration: underline;
}

/* تكييف الموبايل للأزرار */
@media (max-width: 640px) {
  .btn-auth { padding: 6px 12px; font-size: 12px; }
  .user-name { max-width: 80px; }
  .topbar-side { flex-wrap: wrap; gap: 4px; justify-content: flex-end; }
}

/* ============================================
   Print
   ============================================ */
@media print {
  .page-bg, .topbar, .hero, .how, .pricing, .form-card,
  .footer, .placeholder, .loading, .template-bar,
  .actions-bar, .interview-card, .locked-content,
  .modal, .toast, .no-print { display: none !important; }
  body { background: white; }
  .builder { display: block; padding: 0; max-width: 100%; }
  .cv-render {
    box-shadow: none !important;
    border: none !important;
    border-radius: 0 !important;
  }
  #results, .output { padding: 0; margin: 0; }
}
