/* شغلانة — شاشة موبايل حقيقية RTL */
:root {
  --green: #0f6a4a;
  --green-dark: #0a4f37;
  --green-soft: #e6f4ee;
  --ink: #1f2933;
  --ink-2: #52606d;
  --ink-3: #7b8794;
  --line: #e4e9ee;
  --bg: #f4f6f8;
  --card: #ffffff;
  --amber: #b7791f;
  --amber-soft: #fdf3e0;
  --red: #c0392b;
  --red-soft: #fdecea;
  --blue: #1d4ed8;
  --blue-soft: #e8effd;
  --radius: 16px;
  --shadow: 0 1px 3px rgba(16, 24, 40, .08), 0 4px 14px rgba(16, 24, 40, .05);
  --tabbar-h: 62px;
  --appbar-h: 60px;
  font-size: 16px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
html { scroll-padding-bottom: calc(var(--tabbar-h) + 24px); scroll-padding-top: calc(var(--appbar-h) + 8px); }
body {
  font-family: "Segoe UI", Tahoma, "Noto Kufi Arabic", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  overscroll-behavior-y: none;
}

.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100dvh;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  position: relative;
}

/* ===== App bar ===== */
.appbar {
  position: sticky; top: 0; z-index: 30;
  height: var(--appbar-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 14px;
  background: var(--green);
  color: #fff;
  border-radius: 0 0 18px 18px;
  box-shadow: var(--shadow);
}
.appbar-brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.appbar-logo { width: 38px; height: 38px; display: grid; place-items: center; background: rgba(255,255,255,.14); border-radius: 12px; }
.appbar-logo svg { width: 24px; height: 24px; }
.appbar-title { margin: 0; font-size: 1.15rem; font-weight: 800; line-height: 1.1; }
.appbar-sub { margin: 0; font-size: .68rem; opacity: .85; }
.appbar-actions { display: flex; gap: 6px; }
.iconbtn {
  width: 38px; height: 38px; border: 0; border-radius: 12px;
  background: rgba(255,255,255,.14); color: #fff; cursor: pointer;
  display: grid; place-items: center;
}
.iconbtn svg { width: 20px; height: 20px; }
.iconbtn:active { transform: scale(.94); }

/* ===== Main view ===== */
.view {
  flex: 1;
  padding: 14px 14px calc(var(--tabbar-h) + 24px);
  animation: viewin .18s ease;
}
@keyframes viewin { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ===== Tab bar ===== */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
  max-width: 480px; margin: 0 auto;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: flex;
  background: var(--card);
  border-top: 1px solid var(--line);
  box-shadow: 0 -4px 16px rgba(16,24,40,.06);
}
.tabbar button {
  flex: 1; border: 0; background: none; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--ink-3); font-size: .64rem; font-family: inherit; font-weight: 600;
  position: relative;
}
.tabbar button svg { width: 22px; height: 22px; }
.tabbar button.active { color: var(--green); }
.tabbar button.active::before {
  content: ""; position: absolute; top: 0; width: 28px; height: 3px;
  background: var(--green); border-radius: 0 0 4px 4px;
}
.tabbar .badge-dot {
  position: absolute; top: 8px; left: calc(50% - 16px);
  min-width: 16px; height: 16px; padding: 0 4px;
  background: var(--red); color: #fff; border-radius: 999px;
  font-size: .6rem; display: grid; place-items: center;
}

/* ===== Cards ===== */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 12px;
}
.card-title { margin: 0 0 4px; font-size: 1rem; font-weight: 800; }
.card-sub { margin: 0 0 12px; font-size: .8rem; color: var(--ink-2); }

.hero {
  background: linear-gradient(135deg, var(--green), var(--green-dark));
  color: #fff;
  border-radius: var(--radius);
  padding: 20px 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}
.hero h2 { margin: 0 0 4px; font-size: 1.25rem; }
.hero p { margin: 0 0 14px; font-size: .82rem; opacity: .9; }

/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 14px; cursor: pointer;
  font-family: inherit; font-weight: 700; font-size: .9rem;
  padding: 13px 18px; min-height: 48px;
  transition: transform .06s ease, filter .12s ease;
  text-decoration: none;
}
.btn:active { transform: scale(.97); }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn-primary { background: var(--green); color: #fff; }
.btn-primary:hover { filter: brightness(1.06); }
.btn-white { background: #fff; color: var(--green-dark); }
.btn-soft { background: var(--green-soft); color: var(--green-dark); }
.btn-ghost { background: transparent; color: var(--green-dark); border: 1.5px solid var(--line); }
.btn-amber { background: var(--amber-soft); color: var(--amber); }
.btn-danger { background: var(--red-soft); color: var(--red); }
.btn-block { width: 100%; }
.btn-sm { min-height: 38px; padding: 8px 14px; font-size: .8rem; border-radius: 11px; }
.btn[disabled] { opacity: .55; pointer-events: none; }

/* ===== Chips ===== */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--green-soft); color: var(--green-dark);
  border-radius: 999px; padding: 5px 12px; font-size: .75rem; font-weight: 700;
}
.chip-muted { background: #eef1f4; color: var(--ink-2); }
.chip-amber { background: var(--amber-soft); color: var(--amber); }
.chip-blue { background: var(--blue-soft); color: var(--blue); }
.chip-red { background: var(--red-soft); color: var(--red); }

/* ===== Stats ===== */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 12px; }
.stat {
  background: var(--card); border-radius: 14px; box-shadow: var(--shadow);
  padding: 12px 8px; text-align: center;
}
.stat b { display: block; font-size: 1.3rem; color: var(--green); }
.stat span { font-size: .68rem; color: var(--ink-2); font-weight: 600; }

/* ===== Forms ===== */
.field { margin-bottom: 12px; }
.field label { display: block; font-size: .8rem; font-weight: 700; margin-bottom: 6px; color: var(--ink-2); }
.field input, .field select, .field textarea {
  width: 100%; border: 1.5px solid var(--line); border-radius: 12px;
  padding: 12px 14px; font-family: inherit; font-size: .9rem; color: var(--ink);
  background: #fff; outline: none; transition: border-color .15s ease;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--green); }
.field textarea { min-height: 84px; resize: vertical; }
.field .hint { font-size: .7rem; color: var(--ink-3); margin-top: 4px; }
.checks { display: flex; flex-wrap: wrap; gap: 8px; }
.check {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1.5px solid var(--line); border-radius: 999px; padding: 8px 14px;
  font-size: .8rem; font-weight: 600; cursor: pointer; background: #fff;
  color: var(--ink-2); user-select: none;
}
.check input { display: none; }
.check.on { border-color: var(--green); background: var(--green-soft); color: var(--green-dark); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ===== Jobs ===== */
.job {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 14px; margin-bottom: 10px;
}
.job-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.job-title { margin: 0; font-size: .95rem; font-weight: 800; line-height: 1.45; }
.job-company { margin: 2px 0 0; font-size: .78rem; color: var(--ink-2); font-weight: 600; }
.job-meta { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.job-snippet { font-size: .78rem; color: var(--ink-2); margin: 0 0 10px; line-height: 1.6; }
.job-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.job-score {
  flex: none; width: 44px; height: 44px; border-radius: 13px;
  display: grid; place-items: center; font-weight: 800; font-size: .82rem;
  background: var(--green-soft); color: var(--green-dark);
}
.job-score.mid { background: var(--amber-soft); color: var(--amber); }
.job-score.low { background: #eef1f4; color: var(--ink-3); }
.job-new {
  position: relative;
}
.job-new::after {
  content: "جديد"; position: absolute; top: -8px; left: -6px;
  background: var(--red); color: #fff; font-size: .6rem; font-weight: 800;
  padding: 3px 8px; border-radius: 999px; box-shadow: var(--shadow);
}

/* ===== Source status ===== */
.srcline { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px dashed var(--line); font-size: .82rem; }
.srcline:last-child { border-bottom: 0; }
.srcline .spin { width: 16px; height: 16px; flex: none; }
.srcline .ok { color: var(--green); font-weight: 700; }
.srcline .bad { color: var(--red); font-weight: 700; }
.srcline .cnt { margin-inline-start: auto; color: var(--ink-3); font-size: .72rem; }

.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Pipeline ===== */
.pipe-tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 8px; margin-bottom: 10px; scrollbar-width: none; }
.pipe-tabs::-webkit-scrollbar { display: none; }
.pipe-tab {
  flex: none; border: 1.5px solid var(--line); background: #fff; border-radius: 999px;
  padding: 8px 14px; font-size: .76rem; font-weight: 700; color: var(--ink-2); cursor: pointer;
  font-family: inherit;
}
.pipe-tab.on { background: var(--green); border-color: var(--green); color: #fff; }
.pipe-tab .n { opacity: .75; font-weight: 600; }

/* ===== Empty states ===== */
.empty { text-align: center; padding: 40px 20px; color: var(--ink-3); }
.empty svg { width: 64px; height: 64px; opacity: .4; margin-bottom: 10px; }
.empty h3 { margin: 0 0 6px; color: var(--ink-2); font-size: .95rem; }
.empty p { margin: 0 0 16px; font-size: .78rem; }

/* ===== Sheet (bottom sheet) ===== */
.sheet-backdrop {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .45); z-index: 40;
  animation: fadein .15s ease;
}
.sheet {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 41;
  max-width: 480px; margin: 0 auto; max-height: 86dvh; overflow-y: auto;
  background: var(--card); border-radius: 22px 22px 0 0; padding: 10px 16px calc(20px + env(safe-area-inset-bottom));
  animation: sheetup .22s cubic-bezier(.2,.9,.3,1);
}
.sheet-grip { width: 40px; height: 4px; background: var(--line); border-radius: 4px; margin: 6px auto 12px; }
.sheet h3 { margin: 0 0 12px; font-size: 1rem; }
@keyframes fadein { from { opacity: 0; } }
@keyframes sheetup { from { transform: translateY(40%); } }

/* ===== Toast ===== */
#toast-root { position: fixed; bottom: calc(var(--tabbar-h) + 14px); left: 0; right: 0; z-index: 60; display: grid; place-items: center; pointer-events: none; }
.toast {
  background: #10231b; color: #fff; border-radius: 12px; padding: 11px 18px;
  font-size: .82rem; font-weight: 600; box-shadow: var(--shadow);
  animation: toastin .2s ease; max-width: 86%; text-align: center;
}
@keyframes toastin { from { opacity: 0; transform: translateY(10px); } }

/* ===== Misc ===== */
.notice {
  border-radius: 14px; padding: 12px 14px; font-size: .78rem; line-height: 1.7;
  margin-bottom: 12px; display: flex; gap: 10px; align-items: flex-start;
}
.notice svg { width: 18px; height: 18px; flex: none; margin-top: 2px; }
.notice-amber { background: var(--amber-soft); color: #7a5310; }
.notice-blue { background: var(--blue-soft); color: #1e3a8a; }
.notice-green { background: var(--green-soft); color: var(--green-dark); }
.muted { color: var(--ink-3); }
.small { font-size: .75rem; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.mt8 { margin-top: 8px; } .mt12 { margin-top: 12px; }
.divider { height: 1px; background: var(--line); margin: 14px 0; }
.linkbtn { background: none; border: 0; color: var(--green); font-weight: 700; font-size: .8rem; cursor: pointer; font-family: inherit; padding: 4px; }

.progress-track { height: 8px; border-radius: 999px; background: #e8edf1; overflow: hidden; }
.progress-fill { height: 100%; background: var(--green); border-radius: 999px; transition: width .3s ease; }

@media (min-width: 481px) {
  body { background: #e8edf1; }
  .app { box-shadow: 0 0 0 1px var(--line), 0 8px 40px rgba(16,24,40,.08); }
}

/* ================= النسخة ٢.٠ — إضافات ================= */
.chip-green { background: var(--green-soft); color: var(--green-dark); }
.chip-btn { border: 0; cursor: pointer; font-family: inherit; }
.chip-btn:hover { filter: brightness(.97); }

.hero-tools { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 12px; }
.hero-tool {
  background: rgba(255,255,255,.16); border: 0; border-radius: 12px; color: #fff;
  padding: 8px 4px; font-family: inherit; font-size: .62rem; font-weight: 700;
  display: grid; justify-items: center; gap: 4px; cursor: pointer;
}
.hero-tool svg { width: 20px; height: 20px; }
.hero-tool:active { transform: scale(.96); }

.input-row { display: flex; gap: 8px; align-items: stretch; }
.input-row input, .input-row select { flex: 1; }
.input, textarea.input {
  width: 100%; border: 1.5px solid var(--line); border-radius: 12px; padding: 12px 14px;
  font-family: inherit; font-size: .85rem; line-height: 1.7; background: #fff; color: var(--ink);
}
.iconbtn-soft {
  flex: none; width: 48px; border: 1.5px solid var(--line); border-radius: 12px;
  background: #fff; color: var(--green); display: grid; place-items: center; cursor: pointer;
}
.iconbtn-soft svg { width: 22px; height: 22px; }

.bars { display: flex; align-items: flex-end; gap: 6px; height: 64px; margin: 10px 0 6px; }
.bar { flex: 1; background: var(--green-soft); border-radius: 6px 6px 0 0; position: relative; min-height: 4px; }
.bar span { position: absolute; top: -16px; left: 0; right: 0; text-align: center; font-size: .62rem; color: var(--ink-3); }

.card-alert { border: 1.5px solid #f3c6c0; }
.grow { flex: 1; min-width: 0; }
.stats-2 { grid-template-columns: repeat(3, 1fr); }

.meter { height: 8px; background: #e8edf1; border-radius: 999px; overflow: hidden; margin-top: 8px; }
.meter-fill { height: 100%; background: var(--green); border-radius: 999px; transition: width .3s ease; }

.photo-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.avatar { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; border: 2px solid var(--green-soft); }
.avatar-empty { display: grid; place-items: center; background: var(--green-soft); color: var(--green); }
.avatar-empty svg { width: 30px; height: 30px; }
.cert-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.cert-item { position: relative; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); }
.cert-item img { width: 100%; display: block; aspect-ratio: 4/3; object-fit: cover; }
.cert-del {
  position: absolute; top: 2px; inset-inline-start: 2px; width: 22px; height: 22px;
  border: 0; border-radius: 50%; background: rgba(0,0,0,.6); color: #fff; display: grid; place-items: center; cursor: pointer;
}
.cert-del svg { width: 12px; height: 12px; }

.qr-wrap { text-align: center; margin-top: 12px; }
.qr-wrap svg { border-radius: 10px; border: 1px solid var(--line); padding: 6px; background: #fff; }
.cvframe { width: 100%; height: 460px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }

.stars { display: flex; gap: 4px; margin: 4px 0 8px; }
.star { background: none; border: 0; padding: 2px; color: #d3dae0; cursor: pointer; }
.star svg { width: 26px; height: 26px; }
.star.on { color: #d69e2e; }
.stars-inline .star svg { width: 16px; height: 16px; }
.stars-inline .star { cursor: default; }

.chat { display: grid; gap: 8px; max-height: 220px; overflow-y: auto; padding: 6px 0; }
.bubble { padding: 9px 13px; border-radius: 14px; font-size: .8rem; max-width: 82%; line-height: 1.6; }
.bubble.me { background: var(--green-soft); color: var(--green-dark); justify-self: start; }
.bubble.them { background: #eef1f4; color: var(--ink); justify-self: end; }

.sheet-h { font-size: .85rem; color: var(--green-dark); margin: 16px 0 8px; }
.demo-row { border-bottom: 1px dashed var(--line); padding: 10px 0; }
.demo-row:last-child { border-bottom: 0; }
.demo-name { font-size: .82rem; font-weight: 700; margin-bottom: 4px; }
.qa { background: #f8fafb; border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-bottom: 8px; font-size: .8rem; }
.qa p { margin: 6px 0; line-height: 1.7; color: var(--ink-2); }
.link { color: var(--green); font-weight: 700; }
.job-urgent { border-inline-start: 4px solid var(--red); }
.share-img { margin: 10px 0; }

/* ٤٥: وضع النص الكامل — بدون ظلال ولا خطوط تقيلة */
body.textmode .appbar { box-shadow: none; border-radius: 0; }
body.textmode .card, body.textmode .job, body.textmode .stat, body.textmode .hero { box-shadow: none; border: 1px solid var(--line); }
body.textmode .hero { background: #0f6a4a; }
body.textmode .view { animation: none; }
body.textmode .spin { animation-duration: 2s; }

/* ٤٣: النسخة الخفيفة */
body.lite .card, body.lite .job, body.lite .stat, body.lite .sheet { box-shadow: none; border: 1px solid var(--line); }
body.lite .view { animation: none; }
body.lite .hero { box-shadow: none; }
body.lite .chip { padding: 3px 9px; }
body.lite .job-new::after { box-shadow: none; }
body.lite .toast { box-shadow: none; }

@media print {
  .appbar, .tabbar, .appbar-actions { display: none !important; }
  .view { padding: 0; }
}

.line-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px dashed var(--line); font-size: .82rem; }
.line-row:last-child { border-bottom: 0; }
.line-row-2 { align-items: center; }
.line-row-2 .grow { min-width: 0; flex: 1 1 auto; }
.line-row-2 .grow b { font-weight: 700; font-size: .86rem; display: block; line-height: 1.5; }
.line-row-2 .small { margin-top: 2px; }

/* أيقونة صغيرة جوه سطر نصي — من غير المقاس ده الـSVG بيتمدد ويكبر */
.srcline { display: flex; align-items: flex-start; gap: 8px; padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: .82rem; line-height: 1.7; }
.srcline:last-child { border-bottom: 0; }
.srcline svg { width: 18px; height: 18px; flex: none; margin-top: 3px; color: var(--green); }
.srcline span { min-width: 0; }

/* أي عنصر بيتعمله focus أو scroll مايتخباش تحت الشريط العلوي أو التابات */
button, .btn, a, input, select, textarea {
  scroll-margin-top: calc(var(--appbar-h) + 12px);
  scroll-margin-bottom: calc(var(--tabbar-h) + 20px);
}

.notice-compact { padding: 9px 12px; font-size: .74rem; margin-bottom: 10px; }
.checks-compact .check { padding: 5px 11px; font-size: .72rem; }
.checks-compact { gap: 6px; margin-bottom: 8px; }
