body { font-size: 17px; background: var(--bg); overflow-x: clip; }

.topbar { background: var(--blue-800); color: #fff; }
.topbar-in { max-width: 680px; margin: 0 auto; padding: 0 16px; height: 60px; display: flex; align-items: center; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; }
.brand-logo { width: 32px; height: auto; display: block; }
.topbar-phone { color: #fff; display: inline-flex; align-items: center; gap: 6px; font-weight: 600; background: rgba(255,255,255,.12); padding: 6px 12px; border-radius: 8px; }

.wrap { max-width: 680px; margin: 0 auto; padding: 0 16px 140px; }


/* ---------- progress ---------- */
.progress { position: sticky; top: 0; z-index: 5; background: var(--bg); padding: 14px 0 12px; }
.progress-meta { display: flex; justify-content: space-between; font-size: 14px; color: var(--muted); margin-bottom: 8px; font-weight: 500; }
.progress-bar { height: 6px; background: var(--line); border-radius: 99px; overflow: hidden; }
.progress-bar i { display: block; height: 100%; background: var(--orange-500); border-radius: 99px; transition: width .3s ease; }

.step-head { margin: 10px 0 18px; }
.step-head h2 { font-size: 25px; }
.step-head p { color: var(--muted); margin-top: 4px; }

.step-body { display: grid; gap: 22px; }
.section { padding: 18px; display: grid; gap: 14px; }
.section-title { font-weight: 700; font-size: 17px; display: flex; align-items: center; gap: 8px; }
.section-title .i { color: var(--blue-600); }
.opt { font-weight: 500; color: var(--faint); font-size: 14px; }
.err-msg { color: var(--red-600); font-size: 14px; font-weight: 600; display: flex; gap: 6px; align-items: center; }

/* type tiles */
/* أنواع العقار: عمود واحد، كل نوع صف كامل (الأيقونة بجانب الاسم) */
.tiles { display: grid; grid-template-columns: 1fr; gap: 12px; }
.tile {
  display: flex; flex-direction: row; align-items: center; justify-content: flex-start; gap: 16px;
  padding: 18px 20px; min-height: 88px; border-radius: var(--r-lg); text-align: start;
  border: 2px solid var(--line); background: #fff; font-weight: 700; font-size: 20px; color: var(--ink);
  transition: border-color .12s, background .12s; position: relative;
}
.tile .i { width: 44px; height: 44px; padding: 8px; box-sizing: content-box; border-radius: 12px; background: var(--blue-50); color: var(--blue-600); stroke-width: 1.5; flex: none; }
.tile:hover { border-color: var(--blue-300); }
.tile.on { border-color: var(--blue-600); background: var(--blue-50); }
.tile.on .i { background: #fff; }
.tile.on::after { content: ""; position: absolute; top: 50%; margin-top: -13px; inset-inline-end: 20px; width: 26px; height: 26px; border-radius: 50%; background: var(--blue-600) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 12.5l4 4L18 8' stroke='white' stroke-width='3' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") center/14px no-repeat; }

/* area picker */
.area-search { margin-bottom: 4px; }
.area-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; max-height: 320px; overflow: auto; padding: 2px; }
.area-grid .chip { justify-content: center; border-radius: var(--r); }
.area-empty { color: var(--muted); padding: 8px 0; }

/* steppers row */
.counters { display: grid; gap: 14px; }
.counter { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.counter .label { display: flex; align-items: center; gap: 8px; font-size: 16px; }
.counter .label .i { color: var(--blue-600); }

/* photos */
.photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.photo { position: relative; aspect-ratio: 1; border-radius: var(--r); overflow: hidden; background: var(--line-2); }
.photo img { width: 100%; height: 100%; object-fit: cover; }
.photo button { position: absolute; top: 6px; inset-inline-end: 6px; width: 30px; height: 30px; border-radius: 50%; border: 0; background: rgba(6,31,63,.75); color: #fff; display: grid; place-items: center; }
.photo button .i { width: 16px; height: 16px; }
.photo-add { aspect-ratio: 1; border: 2px dashed var(--blue-300); border-radius: var(--r); background: var(--blue-50); color: var(--blue-700); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; font-weight: 600; font-size: 15px; cursor: pointer; }
.photo-add .i { width: 30px; height: 30px; }
.photo-add input { display: none; }

/* review */
.review { display: grid; gap: 12px; }
.review-block { padding: 16px 18px; }
.review-block header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.review-block h3 { font-size: 16px; color: var(--blue-800); }
.review-rows { display: grid; gap: 6px; margin: 0; }
.review-rows div { display: flex; justify-content: space-between; gap: 16px; font-size: 16px; border-bottom: 1px dashed var(--line-2); padding-bottom: 6px; }
.review-rows div:last-child { border: 0; padding: 0; }
.review-rows dt { color: var(--muted); }
.review-rows dd { margin: 0; font-weight: 600; text-align: left; }
.review-thumbs { display: flex; gap: 6px; flex-wrap: wrap; }
.review-thumbs img { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; }

/* bottom bar */
.actions { position: fixed; bottom: 0; inset-inline: 0; background: #fff; border-top: 1px solid var(--line); padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); z-index: 10; }
.actions-in { max-width: 680px; margin: 0 auto; display: flex; gap: 10px; }
.actions .btn-cta { flex: 1; }
.actions .btn-back { width: 110px; }

/* done */
.done { text-align: center; padding: 48px 8px 0; }
.done-ic { width: 88px; height: 88px; border-radius: 50%; background: var(--green-100); color: var(--green-600); display: grid; place-items: center; margin: 0 auto 20px; }
.done-ic .i { width: 46px; height: 46px; stroke-width: 2.4; }
.done h2 { font-size: 27px; }
.done p { color: var(--muted); margin-top: 10px; font-size: 18px; }
.done .ref { display: inline-block; margin-top: 18px; padding: 10px 18px; border-radius: 10px; background: var(--blue-50); color: var(--blue-800); font-weight: 700; }
.done .btn { margin-top: 28px; }

.fade-in { animation: fadeIn .22s ease both; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

@media (max-width: 380px) {
  .tile { min-height: 76px; font-size: 18px; }
  .step-head h2 { font-size: 22px; }
}

/* السعر والتنبيهات */
.q-note { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r); background: var(--orange-50); border: 1px solid #f9d3ad; color: var(--orange-700); font-weight: 600; font-size: 15px; line-height: 1.5; }
.q-note .i { flex: none; margin-top: 2px; }
.price-mode { display: flex; width: 100%; }
.price-mode button { flex: 1; padding: 10px 12px; font-size: 15px; }
.price-calc:empty { display: none; }
.price-calc { padding: 10px 14px; border-radius: var(--r); background: var(--blue-50); color: var(--blue-900); font-size: 15px; }
.price-calc b { font-size: 17px; }
.hint.human { color: var(--blue-700); font-weight: 600; margin-top: -4px; }
.hint.human:empty { display: none; }
.section .counter { min-height: 52px; }

/* وضع المعاينة داخل منشئ النموذج */
.is-preview .topbar { height: 48px; }
.is-preview .topbar-in { height: 48px; }
.is-preview .wrap { padding-bottom: 110px; }


/* ---------- الشاشة الأولى: كلها أزرق، الشعار في الأعلى ---------- */
body.is-welcome { background: var(--blue-800); }
body.is-welcome .topbar { display: none; }
body.is-welcome .wrap { padding-bottom: 40px; }
.welcome { max-width: 420px; margin: 0 auto; padding: 36px 4px 8px; display: grid; gap: 18px; color: #fff; }
.welcome-logo { width: min(200px, 52vw); height: auto; margin: 0 auto 2px; filter: drop-shadow(0 10px 24px rgba(0,0,0,.28)); animation: logoIn .7s cubic-bezier(.2,.8,.2,1) both; }
.welcome-title { text-align: center; font-size: 24px; font-weight: 700; letter-spacing: -.2px; margin-bottom: 6px; animation: rise .5s .12s both; }
.welcome > .w-field, .welcome > .w-note, .welcome > .btn-start, .welcome > .w-private { animation: rise .5s both; }
.welcome > .w-field:nth-of-type(1) { animation-delay: .18s; }
.welcome > .w-field:nth-of-type(2) { animation-delay: .24s; }
.welcome > .w-field:nth-of-type(3) { animation-delay: .30s; }
.welcome > .w-note { animation-delay: .36s; }
.welcome > .btn-start { animation-delay: .42s; }
.welcome > .w-private { animation-delay: .48s; }
/* بعد أول ظهور (مثلاً عند عرض خطأ) لا نعيد الحركة */
.welcome.settled, .welcome.settled * { animation: none !important; }
@keyframes logoIn { from { opacity: 0; transform: translateY(-10px) scale(.92); } to { opacity: 1; transform: none; } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.w-field { display: grid; gap: 8px; }
.w-field > label, .w-label { font-weight: 600; font-size: 15px; color: var(--blue-100); }
.w-input { width: 100%; height: 56px; padding: 0 16px; border: 2px solid transparent; border-radius: 14px; background: #fff; color: var(--ink); font-size: 18px; transition: border-color .15s, box-shadow .15s; }
.w-input::placeholder { color: var(--faint); }
.w-input:focus { outline: none; border-color: var(--orange-500); box-shadow: 0 0 0 4px rgba(245,135,31,.28); }
.w-input.err { border-color: #ff8a80; }
.w-input-wrap { position: relative; display: flex; align-items: center; }
.w-input-wrap > .i { position: absolute; right: 16px; color: var(--faint); pointer-events: none; }
.w-input-wrap .w-input { padding-right: 48px; padding-left: 16px; text-align: right; }
.w-err { display: flex; gap: 6px; align-items: center; color: #ffd3cf; font-size: 14px; font-weight: 600; }

/* مفتاح مالك / وسيط — مؤشر ينزلق بين الخيارين */
.role-toggle { position: relative; display: grid; grid-template-columns: 1fr 1fr; padding: 5px; border-radius: 16px; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.18); isolation: isolate; }
.role-thumb { position: absolute; top: 5px; bottom: 5px; inset-inline-start: 5px; width: calc(50% - 5px); border-radius: 12px; background: #fff; box-shadow: 0 4px 14px rgba(6,31,63,.3); transition: transform .38s cubic-bezier(.34,1.4,.5,1); z-index: -1; }
.role-toggle[data-role="broker"] .role-thumb { transform: translateX(-100%); }
[dir="ltr"] .role-toggle[data-role="broker"] .role-thumb { transform: translateX(100%); }
.role-opt { display: flex; align-items: center; justify-content: center; gap: 8px; height: 52px; border: 0; background: none; border-radius: 12px; color: var(--blue-100); font-weight: 600; font-size: 16px; transition: color .25s; }
.role-opt .i { transition: transform .38s cubic-bezier(.34,1.4,.5,1); }
.role-opt[aria-checked="true"] { color: var(--blue-800); }
.role-opt[aria-checked="true"] .i { transform: scale(1.15); color: var(--blue-600); }
.role-opt:active { transform: scale(.97); }
.role-opt:focus-visible { outline: 3px solid var(--orange-500); outline-offset: 2px; }

/* ملاحظة العمولة: باللون الأحمر لتكون واضحة */
.w-note { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; background: #fdecec; border: 1.5px solid #f5a9a5; color: #b42318; font-size: 15.5px; font-weight: 700; line-height: 1.55; }
.w-note .i { flex: none; margin-top: 2px; color: #d92d20; }

/* مالك / وسيط: خياران بمربع اختيار، لا اختيار مسبق */
.role-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; border-radius: 16px; }
.role-choice { display: flex; align-items: center; gap: 12px; min-height: 58px; padding: 10px 16px; border: 2px solid rgba(255,255,255,.25); border-radius: 14px; background: rgba(255,255,255,.08); color: #fff; font-weight: 600; font-size: 16px; text-align: start; transition: background .15s, border-color .15s, color .15s, transform .1s; }
.role-choice:hover { border-color: rgba(255,255,255,.5); }
.role-choice:active { transform: scale(.98); }
.role-choice:focus-visible { outline: 3px solid var(--orange-500); outline-offset: 2px; }
.role-choice > .i { color: var(--blue-200); flex: none; }
.role-box { width: 24px; height: 24px; flex: none; border-radius: 6px; border: 2px solid rgba(255,255,255,.7); background: transparent; display: grid; place-items: center; transition: background .15s, border-color .15s; }
.role-box::after { content: ""; width: 12px; height: 7px; border: solid #fff; border-width: 0 0 3px 3px; transform: rotate(-45deg) scale(0); margin-top: -3px; transition: transform .2s cubic-bezier(.34,1.6,.5,1); }
.role-choice[aria-checked="true"] { background: #fff; border-color: #fff; color: var(--blue-800); }
.role-choice[aria-checked="true"] > .i { color: var(--blue-600); }
.role-choice[aria-checked="true"] .role-box { background: var(--blue-600); border-color: var(--blue-600); }
.role-choice[aria-checked="true"] .role-box::after { transform: rotate(-45deg) scale(1); }
.role-choices.err .role-choice { border-color: #ff8a80; }
.btn-start { display: flex; align-items: center; justify-content: center; gap: 10px; height: 58px; border: 0; border-radius: 14px; background: #fff; color: var(--blue-800); font-size: 19px; font-weight: 700; box-shadow: 0 8px 24px rgba(6,31,63,.35); transition: transform .12s, box-shadow .15s, background .15s; }
.btn-start:hover { background: var(--blue-50); }
.btn-start:active { transform: translateY(1px) scale(.99); box-shadow: 0 4px 12px rgba(6,31,63,.3); }
.btn-start:focus-visible { outline: 3px solid var(--orange-500); outline-offset: 3px; }
.w-private { display: flex; gap: 8px; align-items: center; justify-content: center; color: var(--blue-200); font-size: 14px; }
@media (min-height: 760px) { .welcome { padding-top: 56px; } }

/* وسائل تواصل المكتب أسفل الشاشة الأولى */
.w-contacts { display: grid; gap: 8px; margin-top: 6px; padding-top: 16px; border-top: 1px solid rgba(255,255,255,.15); }
.w-contact { display: flex; align-items: center; gap: 10px; color: #fff; font-size: 15px; }
a.w-contact:hover { color: var(--orange-100); }
.w-contact .i { color: var(--orange-500); flex: none; }
.w-contact small { display: block; color: var(--blue-200); font-size: 12.5px; }

/* مالك / وسيط جنباً إلى جنب */
.role-choices .role-choice { min-width: 0; }
@media (max-width: 340px) { .role-choices { grid-template-columns: 1fr; } }

/* الشعار وحده بدون كتابة */
.welcome-logo { width: min(300px, 70vw); height: auto; }
header .brand .brand-logo { width: 56px; height: auto; }

/* ظل تحت الشعار */
.welcome-logo { filter: drop-shadow(0 14px 18px rgba(0, 0, 0, .45)) drop-shadow(0 4px 6px rgba(0, 0, 0, .25)); }
header .brand .brand-logo { filter: drop-shadow(0 3px 4px rgba(0, 0, 0, .35)); }
