:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --tile: #f5f5f5;
  --tile-2: #eeeeee;
  --text: #0b0b0b;
  --muted: #6c6c6c;
  --muted-strong: #2b2b2b;
  --line: #ececec;
  --line-strong: #d7d7d7;
  --black: #000000;
  --brand: #720062;
  --brand-soft: rgba(114, 0, 98, .055);
  --brand-press: #5f0053;
  --green: #17874a;
  --green-soft: #f1faf5;
  --success: #14804a;
  --success-bg: #edf8f1;
  --warning: #9b5a00;
  --warning-bg: #fff5e4;
  --danger: #c4312a;
  --danger-bg: #fdeceb;
  --app-max: 520px;
  --header-h: 68px;
  --dock-h: 98px;
  --radius: 10px;
  --radius-lg: 12px;
  --shadow-soft: 0 12px 34px rgba(0, 0, 0, .08);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body {
  margin: 0;
  min-height: 100%;
  color: var(--text);
  background: var(--bg);
  font-family: 'Tajawal', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button, input, textarea, select { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
img, svg { display: block; max-width: 100%; }


.splash-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: block;
  overflow: hidden;
  background: #fff;
  color: var(--text);
  opacity: 1;
  transform: translateZ(0);
  transition: opacity .48s cubic-bezier(.22,1,.36,1), visibility .48s cubic-bezier(.22,1,.36,1);
  pointer-events: auto;
  will-change: opacity;
}
.splash-screen.exiting {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .48s cubic-bezier(.22,1,.36,1), visibility 0s linear .48s;
}
.splash-screen::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: image-set(url('/assets/splashscreen.webp') type('image/webp'), url('/assets/splashscreen.png') type('image/png'));
  background-repeat: no-repeat;
  background-position: center center;
  background-size: min(88vw, 430px) auto;
  transform: scale(.988);
  opacity: 0;
  animation: splashImageIn .72s cubic-bezier(.16,1,.3,1) .05s both;
  will-change: opacity, transform;
}
@media (max-height: 720px) {
  .splash-screen::before { background-size: auto min(84dvh, 720px); }
}
@media (min-width: 640px) {
  .splash-screen::before { background-size: min(64vw, 430px) auto; }
}
@keyframes splashImageIn {
  from { opacity: 0; transform: scale(.972) translateY(8px); filter: blur(5px); }
  to { opacity: 1; transform: scale(.988) translateY(0); filter: blur(0); }
}
.app-shell {
  min-height: 100dvh;
  background: #fff;
  opacity: 1;
  transform: translateY(0);
}
.app-shell.booting {
  opacity: 0;
  transform: translateY(4px);
}
.app-shell.ready {
  opacity: 1;
  transform: translateY(0);
  transition: opacity .5s cubic-bezier(.22,1,.36,1), transform .5s cubic-bezier(.22,1,.36,1);
}
.mobile-frame {
  width: 100%;
  max-width: var(--app-max);
  min-height: 100dvh;
  margin: 0 auto;
  position: relative;
  background: var(--surface);
  overflow-x: hidden;
}
.app-header {
  position: fixed;
  z-index: 40;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: var(--app-max);
  height: calc(var(--header-h) + env(safe-area-inset-top));
  padding: calc(17px + env(safe-area-inset-top)) 18px 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, .97);
  border-bottom: 1px solid rgba(0,0,0,.055);
  backdrop-filter: blur(16px);
}
.brand-logo { width: 78px; height: 34px; object-fit: contain; object-position: center; padding: 2px 0; }
.main-flow {
  min-height: 100dvh;
  padding: calc(var(--header-h) + 26px + env(safe-area-inset-top)) 16px calc(var(--dock-h) + 34px + env(safe-area-inset-bottom));
}

.step-meter { margin: 0 0 24px; }
.step-labels { display: none; }
.step-track { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 5px; }
.step-track span { height: 2px; border-radius: 999px; background: #ededed; }
.step-track span.active { background: var(--brand); }
.question-block { animation: enter .18s ease both; }
@keyframes enter { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.small-title {
  margin: 0 0 10px;
  color: var(--brand);
  font-size: 13px;
  line-height: 1.3;
  font-weight: 500;
}
h1, h2, h3, p { margin-top: 0; }
.question-title {
  margin: 0 0 12px;
  color: var(--text);
  font-size: clamp(30px, 8.2vw, 40px);
  line-height: 1.14;
  letter-spacing: 0;
  font-weight: 700;
}
.question-copy {
  margin: 0 0 24px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.75;
  font-weight: 400;
}

.onboarding-screen {
  min-height: calc(100dvh - var(--header-h) - var(--dock-h) - 44px);
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.onboarding-kicker {
  width: fit-content;
  margin-bottom: 14px;
  color: var(--brand);
  background: var(--brand-soft);
  border-radius: 999px;
  padding: 7px 11px 6px;
  font-size: 12px;
  line-height: 1;
  font-weight: 500;
}
.onboarding-title {
  margin: 0 0 14px;
  color: var(--text);
  font-size: clamp(35px, 9.4vw, 48px);
  line-height: 1.12;
  letter-spacing: 0;
  font-weight: 700;
}
.onboarding-copy {
  margin: 0 0 22px;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.85;
  font-weight: 400;
}
.simple-points {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin: 0 0 22px;
  color: #252525;
}
.simple-points span {
  position: relative;
  padding-inline-start: 15px;
  font-size: 14px;
  line-height: 1.35;
  font-weight: 500;
}
.simple-points span::before {
  content: '';
  position: absolute;
  inset-inline-start: 0;
  top: .48em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--brand);
}
.start-screen .simple-points span::before { background: var(--green); }
.start-note-clean {
  margin: 0 0 22px;
  color: #565656;
  font-size: 14px;
  line-height: 1.6;
}
.onboarding-dots { display: flex; justify-content: center; gap: 7px; margin-top: 6px; }
.onboarding-dots span { width: 6px; height: 6px; border-radius: 999px; background: #d8d8d8; transition: .16s ease; }
.onboarding-dots span.active { width: 22px; background: var(--brand); }

.green-banner {
  border-radius: var(--radius-lg);
  background: var(--green-soft);
  color: #104d2e;
  padding: 14px 15px;
  margin: 0 0 22px;
  display: grid;
  gap: 4px;
  border-inline-start: 3px solid var(--green);
}
.green-banner strong { display: block; font-size: 16px; line-height: 1.35; font-weight: 500; }
.green-banner span { display: block; color: #366b4d; font-size: 13px; line-height: 1.55; font-weight: 400; }

.field { display: block; margin: 0 0 16px; }
.field-label {
  display: block;
  margin: 0 0 8px;
  color: #161616;
  font-size: 13px;
  line-height: 1.35;
  font-weight: 500;
}
.input, .textarea, .phone-field {
  width: 100%;
  border: 1px solid transparent;
  outline: 0;
  border-radius: var(--radius);
  background: var(--tile);
  color: var(--text);
  min-height: 58px;
  padding: 0 15px;
  font-size: 17px;
  font-weight: 400;
  transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}
.input:focus, .textarea:focus, .phone-field:focus-within {
  border-color: #111;
  box-shadow: 0 0 0 1px #111;
  background: #fff;
}
.input::placeholder, .phone-input::placeholder, .textarea::placeholder { color: #9b9b9b; }
.select-input { appearance: none; background-image: linear-gradient(45deg, transparent 50%, #111 50%), linear-gradient(135deg, #111 50%, transparent 50%); background-position: left 18px center, left 11px center; background-size: 7px 7px; background-repeat: no-repeat; padding-left: 42px; }
.textarea { min-height: 118px; padding: 14px 16px; resize: vertical; line-height: 1.7; }
.field-hint { margin: 8px 2px 0; color: var(--muted); font-size: 12px; line-height: 1.5; font-weight: 400; }
.phone-field { display: flex; align-items: center; gap: 10px; direction: ltr; padding: 0 14px; }
.whatsapp-icon { width: 23px; height: 23px; color: #25D366; flex: 0 0 auto; }
.whatsapp-icon svg { width: 23px; height: 23px; }
.country-code { color: #111; font-size: 16px; font-weight: 500; padding-right: 2px; border-right: 1px solid #d8d8d8; padding-inline-end: 10px; }
.phone-input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: #111; font-size: 18px; font-weight: 400; direction: ltr; }

.role-list { display: grid; grid-template-columns: repeat(1, minmax(0, 1fr)); gap: 10px; }
.role-card {
  width: 100%;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: var(--tile);
  color: #111;
  min-height: 96px;
  padding: 12px;
  display: grid;
  grid-template-columns: 52px minmax(0,1fr) 20px;
  align-items: center;
  gap: 12px;
  text-align: right;
  cursor: pointer;
  transition: border-color .16s ease, background .16s ease, transform .16s ease;
}
.role-card:active, .service-card:active, .option-chip:active { transform: scale(.985); }
.role-card.active { background: #fff; border-color: rgba(114, 0, 98, .32); }
.role-icon-wrap { width: 52px; height: 52px; border-radius: 9px; background: #fff; display: grid; place-items: center; }
.role-icon img { width: 32px; height: 32px; object-fit: contain; }
.role-content strong { display: block; color: #111; font-size: 18px; line-height: 1.28; font-weight: 500; }
.role-content span { display: block; margin: 3px 0 4px; color: var(--brand); font-size: 12px; font-weight: 500; }
.role-content p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.45; font-weight: 400; }
.role-check { color: var(--brand); width: 20px; height: 20px; }
.role-check svg { width: 20px; height: 20px; }

.service-section .question-title { font-size: clamp(29px, 8vw, 40px); }
.service-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.service-card {
  position: relative;
  min-height: 104px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: var(--tile);
  color: #111;
  padding: 14px 10px 12px;
  text-align: center;
  display: grid;
  grid-template-rows: 1fr auto;
  align-items: center;
  justify-items: center;
  gap: 8px;
  cursor: pointer;
  transition: border-color .16s ease, background .16s ease, transform .16s ease;
}
.service-card.active { background: #fff; border-color: rgba(114, 0, 98, .32); }
.service-top { width: 100%; display: flex; align-items: center; justify-content: center; gap: 0; }
.service-icon { width: 44px; height: 44px; border-radius: 10px; background: #fff; display: grid; place-items: center; overflow: hidden; }
.service-icon img, .service-icon svg { width: 28px; height: 28px; object-fit: contain; }
.service-check { position: absolute; top: 10px; inset-inline-end: 10px; width: 20px; height: 20px; color: var(--brand); display: grid; place-items: center; }
.service-check svg { width: 20px; height: 20px; }
.service-label { color: #111; font-size: 15px; line-height: 1.35; font-weight: 500; }
.other-field { margin-top: 16px; }

.chip-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
.colors-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.choice-stack { display: grid; gap: 10px; margin-bottom: 16px; }
.option-chip {
  min-height: 55px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: var(--tile);
  color: #111;
  padding: 0 12px;
  font-size: 15px;
  font-weight: 500;
  text-align: center;
  cursor: pointer;
}
.option-chip.active { background: #fff; border-color: rgba(114, 0, 98, .32); color: var(--brand); }

.review-card { border-radius: var(--radius); background: var(--tile); margin-bottom: 18px; overflow: hidden; }
.review-row { min-height: 52px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 11px 13px; border-bottom: 1px solid #e8e8e8; }
.review-row:last-child { border-bottom: 0; }
.review-row span { color: var(--muted); font-size: 13px; font-weight: 400; }
.review-row strong { color: #111; font-size: 15px; line-height: 1.4; font-weight: 500; text-align: left; }

.success-screen {
  min-height: calc(100dvh - var(--header-h) - var(--dock-h) - 36px);
  display: grid;
  place-items: center;
  text-align: center;
}
.success-card {
  width: 100%;
  max-width: 430px;
  background: transparent;
  color: #111;
  padding: 8px 4px 0;
  text-align: center;
  box-shadow: none;
}
.success-symbol {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--success-bg);
  color: var(--success);
  margin: 0 auto 24px;
}
.success-symbol svg { width: 30px; height: 30px; }
.success-screen h1 {
  margin: 0 0 14px;
  color: #111;
  font-size: clamp(32px, 8.6vw, 44px);
  line-height: 1.18;
  letter-spacing: 0;
  font-weight: 700;
}
.success-screen p {
  margin: 0 auto 20px;
  max-width: 390px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.85;
  font-weight: 400;
}
.success-share-copy {
  color: #303030 !important;
  font-size: 15px !important;
}

.toast-stack { position: fixed; z-index: 80; top: calc(var(--header-h) + 10px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); width: min(var(--app-max), 100%); padding: 0 14px; display: grid; gap: 10px; pointer-events: none; }
.toast { display: grid; grid-template-columns: 32px minmax(0,1fr); gap: 10px; align-items: center; border-radius: var(--radius); padding: 12px; box-shadow: var(--shadow-soft); border: 1px solid rgba(0,0,0,.04); pointer-events: auto; }
.toast.success { background: var(--success-bg); color: var(--success); }
.toast.warning { background: var(--warning-bg); color: var(--warning); }
.toast.error { background: var(--danger-bg); color: var(--danger); }
.toast-icon { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: rgba(255,255,255,.58); }
.toast-icon svg { width: 20px; height: 20px; }
.toast-title { color: currentColor; font-size: 14px; font-weight: 500; line-height: 1.2; }
.toast-message { color: #222; font-size: 12px; line-height: 1.45; font-weight: 400; margin-top: 2px; }

.cta-dock { position: fixed; z-index: 50; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: var(--app-max); min-height: calc(var(--dock-h) + env(safe-area-inset-bottom)); padding: 12px 16px calc(14px + env(safe-area-inset-bottom)); background: rgba(255,255,255,.97); border-top: 1px solid rgba(0,0,0,.06); backdrop-filter: blur(16px); }
.btn-primary { width: 100%; height: 58px; border: 0; border-radius: 2px; background: var(--brand); color: #fff; font-size: 17px; font-weight: 500; cursor: pointer; box-shadow: 0 10px 22px rgba(114, 0, 98, .14); transition: background .16s ease, transform .16s ease, box-shadow .16s ease; }
.btn-primary:active:not(:disabled) { background: var(--brand-press); transform: translateY(1px); box-shadow: 0 6px 16px rgba(114, 0, 98, .12); }
.btn-primary.disabled, .btn-primary:disabled { background: #e2e2e2; color: #8d8d8d; cursor: not-allowed; }
.btn-secondary-link { width: 100%; border: 0; background: transparent; color: #3b3b3b; margin-top: 10px; padding: 3px 0 0; font-size: 14px; font-weight: 400; cursor: pointer; }
.cta-hint { margin-top: 7px; text-align: center; color: var(--muted); font-size: 11px; font-weight: 400; }

/* Admin */
.admin-shell { min-height: 100dvh; background: #f4f4f4; color: #111; }
.admin-wrap { width: min(1280px, calc(100% - 28px)); margin: 0 auto; padding: 24px 0 42px; }
.admin-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.admin-brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { width: 44px; height: 44px; border-radius: 12px; background: #000; color: #fff; display: grid; place-items: center; font-size: 26px; font-weight: 700; }
.brand-name { font-size: 28px; line-height: 1; font-weight: 700; letter-spacing: -.04em; }
.header-meta { color: #666; font-size: 12px; font-weight: 500; margin-top: 4px; }
.admin-actions, .admin-toolbar, .admin-search { display: flex; gap: 10px; flex-wrap: wrap; }
.admin-card { border-radius: 18px; background: #fff; padding: 22px; box-shadow: 0 10px 34px rgba(0,0,0,.06); }
.admin-card h1 { margin: 0 0 8px; font-size: 28px; font-weight: 700; }
.admin-card p { margin: 0 0 18px; color: #666; font-weight: 500; }
.admin-input { min-height: 48px; border: 1px solid var(--line); outline: 0; border-radius: 12px; background: #f7f7f7; padding: 0 14px; color: #111; font-weight: 500; min-width: 210px; }
.admin-input:focus { box-shadow: 0 0 0 1px #111; border-color: #111; background: #fff; }
.admin-btn { min-height: 48px; border: 0; border-radius: 12px; background: #111; color: #fff; padding: 0 16px; font-weight: 700; cursor: pointer; }
.admin-btn.secondary { background: #ededed; color: #111; }
.admin-btn.success { background: var(--green); }
.admin-btn.warn { background: var(--brand); }
.admin-btn:disabled { opacity: .5; cursor: not-allowed; }
.admin-ok, .admin-error { border-radius: 12px; padding: 12px 14px; margin: 14px 0; font-weight: 500; }
.admin-ok { background: var(--success-bg); color: var(--success); }
.admin-error { background: var(--danger-bg); color: var(--danger); }
.admin-search { margin: 18px 0 10px; }
.count-line { color: #555; font-size: 13px; font-weight: 500; margin-bottom: 10px; }
.table-wrap { overflow: auto; border: 1px solid #e2e2e2; border-radius: 14px; }
.table-wrap table { width: 100%; min-width: 1100px; border-collapse: collapse; background: #fff; }
th, td { border-bottom: 1px solid #e7e7e7; padding: 12px; text-align: right; vertical-align: top; font-size: 13px; line-height: 1.5; }
th { background: #111; color: #fff; font-weight: 700; position: sticky; top: 0; }
tr:last-child td { border-bottom: 0; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; }
.badge { border-radius: 999px; background: #f0f0f0; padding: 4px 8px; font-size: 11px; font-weight: 500; }
.empty { padding: 26px; color: #666; font-weight: 500; }
.hidden-form { display: none; }
.admin-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 18px 0 4px; }
.admin-stats div { border-radius: 14px; background: #f2f2f2; padding: 14px; }
.admin-stats strong { display: block; color: #111; font-size: 28px; line-height: 1; font-weight: 700; }
.admin-stats span { display: block; margin-top: 6px; color: #666; font-size: 12px; font-weight: 500; }

@media (min-width: 680px) {
  body { background: #f5f5f5; }
  .app-shell { background: #f5f5f5; }
  .mobile-frame { box-shadow: 0 0 0 1px rgba(0,0,0,.06), 0 18px 70px rgba(0,0,0,.08); }
}
@media (max-width: 374px) {
  .main-flow { padding-inline: 14px; }
  .app-header, .cta-dock { padding-inline: 14px; }
  .question-title { font-size: 31px; }
  .service-grid, .chip-grid { gap: 8px; }
  .service-card { min-height: 102px; padding: 11px; }
  .role-card { grid-template-columns: 52px minmax(0,1fr) 20px; gap: 10px; padding: 12px; }
  .role-icon-wrap { width: 52px; height: 52px; }
}
@media (max-width: 720px) {
  .admin-header { align-items: stretch; flex-direction: column; }
  .admin-actions, .admin-toolbar, .admin-search { display: grid; grid-template-columns: 1fr; }
  .admin-input, .admin-btn { width: 100%; }
  .admin-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Security / privacy deterrents */
body.privacy-mask::before {
  content: 'هذه الصفحة محمية';
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  background: #fff;
  color: #111;
  font-size: 18px;
  font-weight: 500;
}
.mobile-frame, .admin-shell { -webkit-touch-callout: none; }
input, textarea { -webkit-touch-callout: default; user-select: text; }

/* Header back control */
.app-header { display: grid; grid-template-columns: 48px 1fr 48px; }
.brand-logo { justify-self: center; width: 88px; height: 38px; }
.header-side { width: 48px; height: 40px; display: block; }
.header-back {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 999px;
  background: #f4f4f4;
  color: #111;
  display: grid;
  place-items: center;
  cursor: pointer;
  justify-self: start;
}
.header-back svg { width: 22px; height: 22px; }
.header-back:active { transform: scale(.97); background: #ededed; }

/* Area suggestions */
.area-field { position: relative; }
.area-suggestions {
  position: absolute;
  z-index: 30;
  inset-inline: 0;
  top: calc(100% - 6px);
  display: grid;
  gap: 2px;
  padding: 6px;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 16px 42px rgba(0,0,0,.12);
  border: 1px solid rgba(0,0,0,.06);
}
.area-suggestions button {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 11px;
  text-align: right;
  cursor: pointer;
  color: #111;
}
.area-suggestions button:active,
.area-suggestions button:hover { background: #f6f6f6; }
.area-suggestions span { font-size: 15px; font-weight: 500; }
.area-suggestions small { color: var(--muted); font-size: 12px; font-weight: 400; }
.app-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
