/* ==========================================================================
   دار — نظام التصميم
   لوحة ألوان، مقاييس، ومكوّنات مشتركة. الاتجاه الافتراضي من اليمين لليسار.
   ========================================================================== */

:root {
    /* الهوية — ذهبي إيثاق */
    --brand-50: #fbf6ea;
    --brand-100: #f5e9cd;
    --brand-200: #ecd6a4;
    --brand-300: #dfbd75;
    --brand-400: #cfa452;
    --brand-500: #c0913f;
    --brand-600: #a8823c;
    --brand-700: #8a6a31;
    --brand-800: #6b5226;
    --brand-900: #4a391a;

    /* لهجة ثانوية: أخضر زيتوني مستوحى من أوراق الشعار */
    --leaf-100: #eaf0e2;
    --leaf-400: #8ea36a;
    --leaf-600: #6b8049;
    --leaf-700: #536337;

    /* محايدة دافئة */
    --ink-900: #2b2419;
    --ink-800: #3c3326;
    --ink-700: #544936;
    --ink-600: #6f6350;
    --ink-500: #8b7f6b;
    --ink-400: #a99e8b;
    --ink-300: #c9c0b0;
    --ink-200: #e2dcd0;
    --ink-100: #f0ebe1;
    --ink-50: #f8f5ee;

    --danger: #b8453f;
    --danger-soft: #fbecea;
    --success: #4f7c3f;
    --success-soft: #eef5e8;
    --warning: #a87824;
    --warning-soft: #fcf3e2;

    /* أدوار */
    --bg: #faf8f3;
    --surface: #ffffff;
    --surface-2: #faf7f0;
    --border: #ebe5d9;
    --border-strong: #d9d1c1;
    --text: var(--ink-900);
    --text-muted: var(--ink-500);
    --text-soft: var(--ink-400);
    --primary: var(--brand-600);
    --primary-hover: var(--brand-700);
    --on-primary: #ffffff;
    --ring: rgba(168, 130, 60, .26);

    /* تدرّج الشعار — يُستخدم في العلامة والأزرار المميّزة */
    --gold-grad: linear-gradient(135deg, #e3c179 0%, #c0913f 45%, #8a6a31 100%);

    /* مقاييس */
    --r-xs: 8px;
    --r-sm: 12px;
    --r-md: 16px;
    --r-lg: 22px;
    --r-xl: 30px;
    --r-full: 999px;

    --shadow-xs: 0 1px 2px rgba(74, 57, 26, .05);
    --shadow-sm: 0 2px 10px rgba(74, 57, 26, .07);
    --shadow-md: 0 10px 28px rgba(74, 57, 26, .09);
    --shadow-lg: 0 22px 52px rgba(74, 57, 26, .13);
    --shadow-xl: 0 34px 76px rgba(74, 57, 26, .16);

    --header-h: 96px;
    --container: 1280px;
    --ease: cubic-bezier(.22, .61, .36, 1);
}

/* ---------- الأساسيات ---------- */

*, *::before, *::after { box-sizing: border-box; }

/* السمة hidden يجب أن تتغلّب على أي display تضعه الأصناف أدناه */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: "Tajawal", "Segoe UI", system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5 { margin: 0 0 .5rem; line-height: 1.35; font-weight: 700; letter-spacing: -.01em; }
h1 { font-size: clamp(1.9rem, 3.4vw, 2.85rem); font-weight: 800; }
h2 { font-size: clamp(1.4rem, 2.4vw, 1.9rem); }
h3 { font-size: 1.18rem; }
p { margin: 0 0 1rem; }

a { color: inherit; text-decoration: none; transition: color .18s var(--ease); }
a:hover { color: var(--primary); }

img, svg { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
ul, ol { margin: 0; padding: 0; list-style: none; }

:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 6px; }

::selection { background: var(--brand-200); color: var(--ink-900); }

/* أرقام لاتينية داخل نص عربي تبقى بمحاذاة صحيحة */
.num { font-feature-settings: "tnum"; direction: ltr; display: inline-block; unicode-bidi: isolate; }
/* خلية جدول رقمية: تبقى خلية (inline-block يُخرجها من الجدول فيضيع التوسيط العمودي وخط الصف)
   وتتبع اتجاه الصفحة في المحاذاة، والرقم نفسه يبقى معزولاً من اليسار لليمين */
td.num, th.num { display: table-cell; direction: rtl; }

/* ---------- تخطيط ---------- */

.container { width: min(100% - 2rem, var(--container)); margin-inline: auto; }
.container-wide { width: min(100% - 2rem, 1560px); margin-inline: auto; }

.stack > * + * { margin-top: var(--gap, 1rem); }
.row { display: flex; align-items: center; gap: .75rem; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.spacer { flex: 1; }

.grid { display: grid; gap: 1.25rem; }
.grid-2 { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }

.section { padding: clamp(2.5rem, 5vw, 4.5rem) 0; }
.section-tight { padding: 2rem 0; }

.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.75rem; flex-wrap: wrap; }
.section-head p { color: var(--text-muted); margin: .25rem 0 0; max-width: 60ch; }
.section-head .eyebrow { color: var(--primary); font-weight: 700; font-size: .82rem; letter-spacing: .04em; margin: 0 0 .35rem; }

.text-muted { color: var(--text-muted); }
.text-soft { color: var(--text-soft); }
.text-center { text-align: center; }
.small { font-size: .85rem; }
.tiny { font-size: .78rem; }

/* ---------- الأزرار ---------- */

.btn {
    --btn-bg: var(--surface);
    --btn-fg: var(--text);
    --btn-bd: var(--border-strong);
    display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
    padding: .62rem 1.15rem;
    border: 1px solid var(--btn-bd);
    background: var(--btn-bg);
    color: var(--btn-fg);
    border-radius: var(--r-full);
    font-weight: 600;
    font-size: .92rem;
    cursor: pointer;
    white-space: nowrap;
    transition: transform .16s var(--ease), box-shadow .2s var(--ease), background .18s var(--ease), border-color .18s var(--ease), color .18s var(--ease);
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); color: var(--btn-fg); }
.btn:active { transform: translateY(0); }
.btn svg { width: 18px; height: 18px; flex: none; }

.btn-primary { --btn-bg: var(--primary); --btn-fg: var(--on-primary); --btn-bd: transparent; box-shadow: 0 6px 18px var(--ring); }
.btn-primary:hover { --btn-bg: var(--primary-hover); box-shadow: 0 10px 26px var(--ring); }

.btn-dark { --btn-bg: var(--ink-900); --btn-fg: #fff; --btn-bd: transparent; }

.btn-ghost { --btn-bg: transparent; --btn-bd: transparent; }
.btn-ghost:hover { --btn-bg: var(--ink-50); box-shadow: none; }

.btn-soft { --btn-bg: var(--brand-50); --btn-fg: var(--brand-700); --btn-bd: transparent; }

.btn-danger { --btn-bg: var(--danger-soft); --btn-fg: var(--danger); --btn-bd: transparent; }

.btn-lg { padding: .85rem 1.7rem; font-size: 1rem; }
.btn-sm { padding: .42rem .85rem; font-size: .84rem; }
.btn-icon { padding: .55rem; width: 40px; height: 40px; border-radius: var(--r-full); }
.btn-block { width: 100%; }

/* ---------- الشارات ---------- */

.badge {
    display: inline-flex; align-items: center; gap: .35rem;
    padding: .24rem .65rem;
    border-radius: var(--r-full);
    font-size: .76rem; font-weight: 700;
    background: var(--ink-100); color: var(--ink-700);
    white-space: nowrap;
}
.badge svg { width: 13px; height: 13px; }
.badge-brand { background: var(--brand-600); color: #fff; }
.badge-gold { background: var(--gold-grad); color: #fff; }
.badge-verified { background: var(--success-soft); color: var(--success); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-warn { background: var(--warning-soft); color: var(--warning); }
.badge-glass { background: rgba(11, 23, 32, .55); color: #fff; backdrop-filter: blur(8px); }

/* ---------- البطاقات ---------- */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-xs);
}
.card-pad { padding: 1.35rem; }

/* ---------- رأس الصفحة ---------- */

.site-header {
    position: sticky; top: 0; z-index: 60;
    background: color-mix(in srgb, var(--surface) 86%, transparent);
    backdrop-filter: saturate(180%) blur(14px);
    border-bottom: 1px solid var(--border);
}
.site-header .bar { height: var(--header-h); display: flex; align-items: center; gap: 1.25rem; }

.brand { display: flex; align-items: center; gap: .65rem; font-weight: 800; font-size: 1.22rem; letter-spacing: -.02em; }

/* مقاسات الشعار حسب موضعه */
.brand-logo { height: 68px; width: auto; flex: none; }
.site-header .brand-logo { height: 76px; }
.site-footer .brand-logo { height: 84px; }
.brand-text { line-height: 1.25; }
.brand-text small {
    display: block; font-size: .58rem; font-weight: 700;
    color: var(--brand-600); letter-spacing: .22em; margin-top: -2px;
}
.brand-mark {
    width: 40px; height: 40px; border-radius: 13px; flex: none;
    background: var(--gold-grad);
    display: grid; place-items: center; color: #fff;
    box-shadow: 0 6px 16px var(--ring);
}
.brand-mark svg { width: 21px; height: 21px; }
.site-footer .brand-logo { filter: brightness(1.08); }

.nav { display: flex; align-items: center; gap: .25rem; }
.nav a {
    padding: .5rem .85rem; border-radius: var(--r-full);
    font-weight: 600; font-size: .93rem; color: var(--text-muted);
    transition: background .18s var(--ease), color .18s var(--ease);
}
.nav a:hover { background: var(--ink-50); color: var(--text); }
.nav a.active { color: var(--primary); background: var(--brand-50); }

/* يظهر فقط داخل قائمة الهاتف المنسدلة (انظر @media 860px) — على الكمبيوتر زر
   "تسجيل الدخول" في الرأس مرئي أصلاً فلا داعٍ لتكراره هنا */
.nav-login { display: none; }

.header-actions { display: flex; align-items: center; gap: .5rem; margin-inline-start: auto; }

.avatar {
    width: 36px; height: 36px; border-radius: var(--r-full); flex: none;
    background: linear-gradient(145deg, var(--brand-300), var(--brand-600));
    color: #fff; display: grid; place-items: center; font-weight: 700; font-size: .9rem;
    overflow: hidden;
}
.avatar-lg { width: 76px; height: 76px; font-size: 1.6rem; }
.avatar-xl { width: 104px; height: 104px; font-size: 2.2rem; }

/* قائمة منسدلة */
.menu { position: relative; }
.menu-panel {
    position: absolute; inset-inline-end: 0; top: calc(100% + 10px);
    min-width: 230px; padding: .5rem;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--r-md); box-shadow: var(--shadow-lg);
    opacity: 0; visibility: hidden; transform: translateY(-6px);
    transition: opacity .18s var(--ease), transform .18s var(--ease), visibility .18s;
    z-index: 70;
}
.menu.open .menu-panel { opacity: 1; visibility: visible; transform: translateY(0); }
.menu-panel a, .menu-panel button {
    display: flex; align-items: center; gap: .6rem; width: 100%;
    padding: .55rem .7rem; border-radius: var(--r-xs);
    background: none; border: 0; cursor: pointer; text-align: start;
    font-size: .92rem; font-weight: 600; color: var(--text);
}
.menu-panel a:hover, .menu-panel button:hover { background: var(--ink-50); }
.menu-panel svg { width: 17px; height: 17px; color: var(--text-soft); }
.menu-sep { height: 1px; background: var(--border); margin: .4rem 0; }
.menu-head { padding: .6rem .7rem; border-bottom: 1px solid var(--border); margin-bottom: .4rem; }

.nav-toggle { display: none; }
.nav-toggle > span { display: grid; place-items: center; transition: transform .2s var(--ease); }
.nav-toggle .ic-close { display: none; }
.nav-toggle[aria-expanded="true"] .ic-menu { display: none; }
.nav-toggle[aria-expanded="true"] .ic-close { display: grid; animation: nav-x-in .2s var(--ease); }
@keyframes nav-x-in { from { transform: rotate(-90deg); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- الواجهة الرئيسية ---------- */

.hero {
    position: relative;
    padding: clamp(3.5rem, 8vw, 6rem) 0 clamp(6rem, 10vw, 8rem);
    overflow: hidden;
    /* الطبقات: حجاب داكن ← صورة المستخدم (إن وُجدت) ← الرسم المضمّن */
    background-color: #0b1430;
    background-image:
        linear-gradient(to bottom, rgba(6, 12, 30, .82) 0%, rgba(8, 15, 34, .58) 45%, rgba(10, 18, 38, .88) 100%),
        url("/img/hero.jpg"),
        url("/img/hero.svg");
    background-size: cover, cover, cover;
    background-position: center, center bottom, center bottom;
    background-repeat: no-repeat;
}
.hero::after {
    /* تلاشٍ ناعم نحو خلفية الصفحة الفاتحة */
    content: "";
    position: absolute; inset-inline: 0; bottom: 0; height: 180px;
    background: linear-gradient(to bottom, transparent, var(--bg));
    pointer-events: none;
}
.hero-inner { position: relative; z-index: 2; text-align: center; }
.hero h1 { margin-bottom: .85rem; color: #fff; text-shadow: 0 2px 24px rgba(0, 0, 0, .45); }
.hero h1 .hl {
    background: linear-gradient(135deg, #f7e3b4 0%, #e0b866 45%, #caa155 100%);
    -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-sub {
    color: rgba(255, 255, 255, .86);
    font-size: 1.08rem; max-width: 58ch; margin-inline: auto;
    text-shadow: 0 1px 14px rgba(0, 0, 0, .5);
}
.hero .ribbon {
    background: rgba(255, 255, 255, .12);
    border-color: rgba(255, 255, 255, .22);
    color: #fff;
    backdrop-filter: blur(10px);
    box-shadow: none;
}
.hero .ribbon .dot { background: var(--brand-300); box-shadow: 0 0 0 4px rgba(223, 189, 117, .22); }

/* نسخة مختصرة من البطل: عنوان قصير فقط، فيبدأ شريط الفلترة أعلى الشاشة */
.hero.hero-slim { padding: clamp(1.7rem, 4.5vw, 2.6rem) 0 clamp(1.9rem, 5vw, 2.8rem); }
.hero-slim h1 { font-size: clamp(1.45rem, 5.2vw, 2.2rem); margin-bottom: .5rem; }
.hero-slim .hero-sub { font-size: .95rem; max-width: 48ch; margin-bottom: 0; }
.hero-slim::after { height: 70px; }
.home-filter { padding-bottom: 1rem; }

.hero-stats { display: flex; justify-content: center; gap: clamp(1.5rem, 5vw, 4rem); margin-top: 2.5rem; flex-wrap: wrap; }
.hero-stats div { text-align: center; }
.hero-stats b { display: block; font-size: 1.75rem; font-weight: 800; color: var(--text); line-height: 1.2; }
.hero-stats span { font-size: .85rem; color: var(--text-muted); }

/* شريط إحصاءات على الخلفية الفاتحة أسفل البطل */
.hero-stats.on-light { margin-top: 0; padding: 2.25rem 0 .5rem; }

/* ---------- صندوق البحث ---------- */

.searchbox {
    position: relative; z-index: 3;
    margin: 2.25rem auto -4.5rem; max-width: 940px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-xl);
    box-shadow: var(--shadow-lg);
    padding: .55rem;
}
.search-tabs { display: flex; gap: .25rem; padding: .3rem .4rem .55rem; }
.search-tabs button {
    flex: none; padding: .45rem 1.1rem; border: 0; background: none; cursor: pointer;
    border-radius: var(--r-full); font-weight: 700; font-size: .9rem; color: var(--text-muted);
    transition: background .18s var(--ease), color .18s var(--ease);
}
.search-tabs button:hover { background: var(--ink-50); color: var(--text); }
.search-tabs button.active { background: var(--gold-grad); color: #fff; box-shadow: 0 4px 12px var(--ring); }

.search-fields { display: grid; grid-template-columns: 1.6fr 1fr 1fr auto; gap: .5rem; align-items: stretch; }
.search-field { position: relative; display: flex; flex-direction: column; justify-content: center; padding: .45rem .9rem; border-radius: var(--r-lg); background: var(--surface-2); min-height: 62px; }
.search-field label { font-size: .72rem; font-weight: 700; color: var(--text-soft); }
.search-field input, .search-field select {
    border: 0; background: none; padding: 0; width: 100%;
    font-size: .95rem; font-weight: 600; color: var(--text);
    appearance: none; cursor: pointer;
}
.search-field input { cursor: text; }
.search-field input::placeholder { color: var(--text-soft); font-weight: 500; }
.search-field:focus-within { box-shadow: 0 0 0 2px var(--ring) inset; }
.search-submit { display: grid; place-items: center; }
.search-submit .btn { height: 100%; padding-inline: 1.9rem; }

/* اقتراحات البحث */
.suggest {
    position: absolute; top: calc(100% + 8px); inset-inline: 0;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--r-md); box-shadow: var(--shadow-lg);
    overflow: hidden; z-index: 40; display: none;
}
.suggest.show { display: block; }
.suggest button {
    display: flex; align-items: center; gap: .65rem; width: 100%;
    padding: .65rem .9rem; border: 0; background: none; cursor: pointer; text-align: start;
}
.suggest button:hover, .suggest button.hl { background: var(--ink-50); }
.suggest .s-label { font-weight: 700; font-size: .92rem; }
.suggest .s-sub { font-size: .78rem; color: var(--text-soft); }
.suggest .s-ic { width: 32px; height: 32px; border-radius: 10px; background: var(--brand-50); color: var(--brand-600); display: grid; place-items: center; flex: none; }

/* ---------- شرائح الأنواع ---------- */

.chips { display: flex; gap: .6rem; overflow-x: auto; padding: .25rem .1rem 1rem; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
    display: inline-flex; align-items: center; gap: .45rem; flex: none;
    padding: .5rem 1rem; border-radius: var(--r-full);
    border: 1px solid var(--border); background: var(--surface);
    font-weight: 600; font-size: .88rem; cursor: pointer;
    transition: all .18s var(--ease);
}
.chip:hover { border-color: var(--brand-300); color: var(--brand-600); transform: translateY(-1px); }
.chip.active { background: var(--gold-grad); border-color: transparent; color: #fff; }
.chip svg { width: 16px; height: 16px; }
.chip .count { font-size: .76rem; color: var(--text-soft); font-weight: 600; }
.chip.active .count { color: rgba(255,255,255,.72); }

/* ---------- بطاقة العقار ---------- */

.plist { display: grid; gap: 1.35rem; grid-template-columns: repeat(auto-fill, minmax(305px, 1fr)); }

.pcard {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    overflow: hidden;
    display: flex; flex-direction: column;
    transition: transform .22s var(--ease), box-shadow .22s var(--ease), border-color .22s var(--ease);
}
.pcard:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: transparent; }

.pcard-media { position: relative; aspect-ratio: 4 / 3; overflow: hidden; background: var(--ink-100); }
.pcard-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s var(--ease); }
.pcard:hover .pcard-media img { transform: scale(1.06); }
.pcard-media::after {
    content: ""; position: absolute; inset: auto 0 0 0; height: 45%;
    background: linear-gradient(to top, rgba(6, 15, 21, .62), transparent);
    pointer-events: none;
}

.pcard-tags { position: absolute; top: .7rem; inset-inline-start: .7rem; display: flex; gap: .35rem; flex-wrap: wrap; z-index: 2; }
.pcard-price {
    position: absolute; bottom: .7rem; inset-inline-start: .8rem; z-index: 2;
    color: #fff; font-weight: 800; font-size: 1.12rem; text-shadow: 0 1px 6px rgba(0,0,0,.4);
}
.pcard-price span { font-size: .76rem; font-weight: 600; opacity: .88; }

.pcard-fav {
    position: absolute; top: .65rem; inset-inline-end: .65rem; z-index: 3;
    width: 36px; height: 36px; border-radius: var(--r-full);
    border: 0; cursor: pointer; display: grid; place-items: center;
    background: rgba(255,255,255,.9); color: var(--ink-600);
    backdrop-filter: blur(6px);
    transition: transform .18s var(--ease), color .18s var(--ease), background .18s var(--ease);
}
.pcard-fav:hover { transform: scale(1.1); color: var(--danger); }
.pcard-fav svg { width: 19px; height: 19px; }
.pcard-fav.on { color: var(--danger); }
/* زر "حفظ" في صفحة العقار يتبنّى مظهر btn-soft عند التفعيل (نفس آلية pcard-fav) */
.btn[data-fav].on { --btn-bg: var(--brand-50); --btn-fg: var(--brand-700); --btn-bd: transparent; }
.btn[data-fav].on svg { color: var(--danger); }
.pcard-fav.on svg { fill: currentColor; }

.pcard-count {
    position: absolute; bottom: .7rem; inset-inline-end: .8rem; z-index: 2;
    display: inline-flex; align-items: center; gap: .3rem;
    color: #fff; font-size: .76rem; font-weight: 600; text-shadow: 0 1px 4px rgba(0,0,0,.45);
}
.pcard-count svg { width: 14px; height: 14px; }

.pcard-body { padding: .95rem 1.05rem 1.05rem; display: flex; flex-direction: column; flex: 1; gap: .55rem; }
.pcard-title { font-weight: 700; font-size: 1rem; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pcard-loc { display: flex; align-items: center; gap: .3rem; color: var(--text-muted); font-size: .85rem; }
.pcard-loc svg { width: 15px; height: 15px; flex: none; color: var(--text-soft); }

.pcard-specs { display: flex; gap: .95rem; padding-top: .7rem; border-top: 1px solid var(--border); margin-top: auto; color: var(--text-muted); font-size: .85rem; }
.pcard-specs span { display: inline-flex; align-items: center; gap: .3rem; }
.pcard-specs svg { width: 16px; height: 16px; color: var(--text-soft); }

.pcard-foot { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding-top: .6rem; border-top: 1px solid var(--border); }
.pcard-agent { display: flex; align-items: center; gap: .45rem; min-width: 0; }
.pcard-agent .avatar { width: 26px; height: 26px; font-size: .7rem; }
.pcard-agent span { font-size: .8rem; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* البطاقة الأفقية (نتائج البحث بعرض القائمة) */
.pcard.horizontal { flex-direction: row; }
.pcard.horizontal .pcard-media { aspect-ratio: auto; width: 290px; flex: none; }
.pcard.horizontal .pcard-body { padding: 1.1rem 1.25rem; }
@media (max-width: 720px) {
    .pcard.horizontal { flex-direction: column; }
    .pcard.horizontal .pcard-media { width: 100%; aspect-ratio: 4 / 3; }
}

/* ---------- شريط الفلترة الهرمي (نمط تطبيق الهاتف) ---------- */

/* سطر لكل نوع فلتر، وكل سطر ينزلق أفقياً بالإصبع دون شريط تمرير مرئي */
.fbar {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-sm);
    padding: .5rem 0 .65rem;
    margin-bottom: 1.15rem;
}

.fbar-row {
    display: flex;
    gap: .45rem;
    padding: .3rem .85rem;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.fbar-row::-webkit-scrollbar { display: none; }
.fbar-row + .fbar-row { border-top: 1px solid var(--border); padding-top: .55rem; }

.fchip-btn {
    flex: none;
    display: inline-flex; align-items: center; gap: .35rem;
    padding: .5rem .85rem;
    border-radius: var(--r-full);
    background: var(--surface-2);
    border: 1px solid var(--border);
    font-size: .86rem; font-weight: 700; color: var(--text);
    white-space: nowrap;
    transition: background .16s var(--ease), border-color .16s var(--ease), color .16s var(--ease);
}
.fchip-btn:hover { border-color: var(--brand-300); color: var(--brand-700); }
.fchip-btn svg { width: 15px; height: 15px; flex: none; color: var(--text-soft); }
.fchip-btn .n { font-size: .74rem; font-weight: 600; color: var(--text-soft); }
.fchip-btn.on { background: var(--gold-grad); border-color: transparent; color: #fff; }
.fchip-btn.on svg, .fchip-btn.on .n { color: rgba(255, 255, 255, .78); }

/* سطر الغرض: ثلاث شرائح متساوية تشبه القاطع الواحد */
.fbar-row.seg-row { gap: .35rem; }
.fchip-seg {
    flex: 1 1 0; min-width: 84px;
    text-align: center; padding: .52rem .9rem;
    border-radius: var(--r-full);
    background: var(--surface-2);
    font-size: .88rem; font-weight: 700; color: var(--text-muted);
    white-space: nowrap;
}
.fchip-seg:hover { color: var(--text); }
.fchip-seg.on { background: var(--primary); color: var(--on-primary); box-shadow: 0 4px 12px var(--ring); }

/* مسار الموقع: كل المدن ← الرياض ← شمال الرياض */
.fbar-crumb {
    display: flex; align-items: center; flex-wrap: wrap; gap: .3rem;
    padding: .5rem .95rem .1rem;
    font-size: .8rem; color: var(--text-muted);
}
.fbar-crumb a { font-weight: 700; color: var(--primary); }
.fbar-crumb span { font-weight: 700; color: var(--text); }
.fbar-crumb svg { width: 12px; height: 12px; color: var(--text-soft); }

.fbar-foot { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; padding: .6rem .85rem 0; }
.fbar-go { flex: 1 1 130px; justify-content: center; }
.fbar-go .go-short { display: none; }

/* ---------- قائمة النتائج على شكل صفوف ---------- */

.plist.rows { grid-template-columns: 1fr; gap: .7rem; }
@media (min-width: 920px) { .plist.rows { grid-template-columns: 1fr 1fr; } }

/* بطاقة الصف: صورة مصغّرة بجانب النص، تبقى كذلك على كل المقاسات */
.pcard.compact { flex-direction: row; }
.pcard.compact:hover { transform: none; box-shadow: var(--shadow-sm); }
.pcard.compact .pcard-media { width: 124px; flex: none; aspect-ratio: auto; min-height: 120px; }
.pcard.compact .pcard-body { padding: .7rem .85rem; gap: .28rem; }
/* مسافة لزر المفضّلة حتى لا يغطّي نهاية العنوان */
.pcard.compact .pcard-title { font-size: .92rem; padding-inline-end: 1.9rem; }
.pcard.compact .pcard-amount { font-size: 1rem; font-weight: 800; color: var(--brand-700); }
.pcard.compact .pcard-amount .per { font-size: .76rem; font-weight: 600; color: var(--text-muted); }
.pcard.compact .pcard-loc { font-size: .8rem; }
.pcard.compact .pcard-specs { gap: .75rem; padding-top: .45rem; font-size: .8rem; flex-wrap: wrap; }
.pcard.compact .pcard-foot { display: none; }
.pcard.compact .pcard-tags { top: .45rem; inset-inline-start: .45rem; }
.pcard.compact .pcard-tags .badge:nth-child(n+2), .pcard.compact .pcard-count { display: none; }
.pcard.compact .pcard-fav { width: 30px; height: 30px; top: .4rem; inset-inline-end: .4rem; }
.pcard.compact .pcard-fav svg { width: 16px; height: 16px; }

.preview-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin: .3rem 0 .85rem; }
.preview-head h2 { font-size: 1.1rem; margin: 0; }
.preview-more { margin-top: .95rem; justify-content: center; }

/* الخريطة أعلى النتائج في نفس الصفحة */
.map-inline {
    /* مرجع تموضع لـ #map وأزرار الأدوات، وإلا امتدّت الخريطة خارج الصندوق */
    position: relative;
    /* شريط خريطة قصير يكفي لتحديد الموقع، والتوسيع بزر ملء الصفحة */
    height: clamp(150px, 24vh, 240px);
    margin-bottom: 1.1rem;
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    overflow: hidden;
}
.map-inline #map { width: 100%; height: 100%; }

/* الخريطة بملء الصفحة فوق باقي المحتوى */
.map-inline.full {
    position: fixed; inset: 0; z-index: 200;
    height: 100%; margin: 0; border: 0; border-radius: 0;
}
body.map-locked { overflow: hidden; }

.map-tools { position: absolute; top: .6rem; inset-inline-start: .6rem; z-index: 500; display: flex; gap: .4rem; }
.map-tool {
    width: 38px; height: 38px; display: grid; place-items: center; cursor: pointer;
    border: 1px solid var(--border); border-radius: var(--r-sm);
    background: var(--surface); color: var(--text);
    box-shadow: var(--shadow-sm);
}
.map-tool:hover { color: var(--primary); border-color: var(--brand-300); }
.map-tool .ic-close { display: none; }
.map-inline.full .map-tool .ic-open { display: none; }
.map-inline.full .map-tool .ic-close { display: block; }

/* زر "فلترة على الخريطة" بجانب زر الفلترة */
.fbar-map { flex: 0 1 auto; white-space: nowrap; }

/* أثناء جلب اللوحة الجديدة تُخفَّف الحالية بدل قفزة تحميل كاملة */
[data-filter-panel] { transition: opacity .16s var(--ease); }
[data-filter-panel].is-loading { opacity: .5; pointer-events: none; }

/* ---------- بطاقة المدينة ---------- */

.citycard { position: relative; border-radius: var(--r-lg); overflow: hidden; aspect-ratio: 3 / 4; display: block; }
.citycard img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s var(--ease); }
.citycard:hover img { transform: scale(1.08); }
.citycard::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, rgba(6,15,21,.82) 6%, rgba(6,15,21,.15) 55%, transparent); }
.citycard-body { position: absolute; inset-inline: 0; bottom: 0; padding: 1.1rem; color: #fff; z-index: 2; }
.citycard-body b { font-size: 1.2rem; font-weight: 800; display: block; }
.citycard-body span { font-size: .84rem; opacity: .85; }
.citycard.small { aspect-ratio: 4 / 3; }

/* ---------- صفحة البحث ---------- */

.fgroup { padding: 1.05rem 1.15rem; border-bottom: 1px solid var(--border); }
.fgroup:last-child { border-bottom: 0; }
.fgroup > h4 { font-size: .88rem; font-weight: 700; margin-bottom: .75rem; color: var(--text); }

.seg { display: grid; grid-auto-flow: column; gap: .25rem; padding: .25rem; background: var(--surface-2); border-radius: var(--r-full); }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span {
    display: block; text-align: center; padding: .42rem .5rem; border-radius: var(--r-full);
    font-size: .86rem; font-weight: 700; color: var(--text-muted); cursor: pointer;
    transition: all .18s var(--ease);
}
.seg input:checked + span { background: var(--surface); color: var(--primary); box-shadow: var(--shadow-xs); }

.checks { display: flex; flex-direction: column; gap: .1rem; max-height: 250px; overflow-y: auto; }
.check { display: flex; align-items: center; gap: .55rem; padding: .38rem .3rem; border-radius: var(--r-xs); cursor: pointer; font-size: .9rem; }
.check:hover { background: var(--surface-2); }
.check input { width: 17px; height: 17px; accent-color: var(--primary); flex: none; cursor: pointer; }
.check .c-count { margin-inline-start: auto; font-size: .76rem; color: var(--text-soft); }

.pair { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }

.pills { display: flex; flex-wrap: wrap; gap: .35rem; }
.pill { position: relative; }
.pill input { position: absolute; opacity: 0; pointer-events: none; }
.pill span {
    display: block; padding: .35rem .8rem; border-radius: var(--r-full);
    border: 1px solid var(--border); font-size: .85rem; font-weight: 600;
    cursor: pointer; transition: all .16s var(--ease);
}
.pill span:hover { border-color: var(--brand-300); }
.pill input:checked + span { background: var(--brand-50); border-color: var(--brand-400); color: var(--brand-700); }

.switch { display: flex; align-items: center; justify-content: space-between; gap: .75rem; cursor: pointer; font-size: .9rem; font-weight: 600; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .track { width: 42px; height: 24px; border-radius: var(--r-full); background: var(--border-strong); position: relative; transition: background .2s var(--ease); flex: none; }
.switch .track::after {
    content: ""; position: absolute; top: 3px; inset-inline-start: 3px;
    width: 18px; height: 18px; border-radius: 50%; background: #fff;
    transition: transform .22s var(--ease); box-shadow: var(--shadow-xs);
}
.switch input:checked + .track { background: var(--primary); }
.switch input:checked + .track::after { transform: translateX(-18px); }
html[dir="ltr"] .switch input:checked + .track::after { transform: translateX(18px); }

/* مفاتيح في بطاقات: العنوان والشرح في جهة ومفتاحه في الجهة الأخرى داخل الإطار نفسه */
.switch-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: .6rem; margin-top: 1.2rem; }
.switch-card {
    align-items: flex-start; padding: .85rem 1rem;
    border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface);
    transition: border-color .18s var(--ease), background .18s var(--ease);
}
.switch-card:hover { border-color: var(--brand-300); }
.switch-card:has(input:checked) { border-color: var(--brand-300); background: var(--brand-50); }
.switch-card:has(input:focus-visible) { box-shadow: 0 0 0 3px var(--ring); }
.switch-card .track { margin-top: .1rem; }
.switch-text { display: flex; flex-direction: column; gap: .2rem; min-width: 0; }
.switch-text b { font-size: .9rem; }
.switch-text em { font-style: normal; font-weight: 500; font-size: .78rem; line-height: 1.55; color: var(--text-muted); }

.input, .select, .textarea {
    width: 100%; padding: .58rem .8rem;
    border: 1px solid var(--border-strong); border-radius: var(--r-sm);
    background: var(--surface); color: var(--text);
    font-size: .92rem;
    transition: border-color .18s var(--ease), box-shadow .18s var(--ease);
}
.input:focus, .select:focus, .textarea:focus { outline: 0; border-color: var(--brand-400); box-shadow: 0 0 0 3px var(--ring); }
.textarea { min-height: 130px; resize: vertical; line-height: 1.7; }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%235d707e' stroke-width='2.2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: left .7rem center; padding-inline-start: 2rem; }

.field { display: block; margin-bottom: 1rem; }
.field > label, .label { display: block; font-size: .86rem; font-weight: 700; margin-bottom: .35rem; }
.hint { font-size: .78rem; color: var(--text-soft); margin-top: .3rem; }
.field-error, .validation-summary-errors ul li, .text-danger, .field-validation-error {
    color: var(--danger); font-size: .82rem; font-weight: 600;
}
.input.input-validation-error, .select.input-validation-error, .textarea.input-validation-error { border-color: var(--danger); }

.alert { display: flex; align-items: flex-start; gap: .65rem; padding: .85rem 1.05rem; border-radius: var(--r-md); font-weight: 600; font-size: .9rem; margin-bottom: 1.25rem; }
.alert svg { width: 19px; height: 19px; flex: none; margin-top: 2px; }
.alert-success { background: var(--success-soft); color: var(--success); }
.alert-danger { background: var(--danger-soft); color: var(--danger); }
.alert-info { background: var(--brand-50); color: var(--brand-700); }
.alert-warn { background: var(--warning-soft); color: var(--warning); }

/* شريط فرز قائمة الإعلانات في لوحة الإدارة */
.listing-filter {
    display: flex; flex-wrap: wrap; align-items: flex-end; gap: .75rem;
    padding: .9rem 1.25rem; border-bottom: 1px solid var(--border);
    background: var(--surface-2);
}
.listing-filter .field { flex: 1 1 190px; min-width: 0; }
.listing-filter .select { width: 100%; }
.validation-summary-errors { background: var(--danger-soft); border-radius: var(--r-md); padding: .85rem 1.1rem; margin-bottom: 1.25rem; }
.validation-summary-errors ul { display: flex; flex-direction: column; gap: .2rem; }
.validation-summary-valid { display: none; }

/* شريط أدوات النتائج */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.1rem; }
.toolbar h1 { font-size: 1.32rem; margin: 0; font-weight: 800; }
.toolbar .sub { color: var(--text-muted); font-size: .88rem; }

/* رأس صفحة النتائج: العنوان والعدد، والترتيب في الطرف المقابل */
.search-page { padding-top: 1rem; }
.results-head {
    display: grid; grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "title tools" "sub tools";
    align-items: center; gap: .1rem 1rem; margin: .2rem 0 .9rem;
}
.results-head h1 { grid-area: title; font-size: 1.32rem; margin: 0; font-weight: 800; line-height: 1.45; }
.results-head .sub { grid-area: sub; color: var(--text-muted); font-size: .86rem; }
.results-tools { grid-area: tools; display: flex; align-items: center; gap: .5rem; }

/* قائمة الترتيب على شكل شريحة، بنفس لغة شرائح الفلترة */
.sortbox {
    position: relative; display: inline-flex; align-items: center;
    height: 40px; padding-inline: .8rem .6rem;
    border: 1px solid var(--border); border-radius: var(--r-full);
    background: var(--surface); box-shadow: var(--shadow-xs);
}
.sortbox > svg { width: 15px; height: 15px; color: var(--text-soft); flex: none; }
.sortbox select {
    appearance: none; border: 0; background: transparent; cursor: pointer;
    font: inherit; font-size: .86rem; font-weight: 700; color: var(--text);
    padding-block: 0; padding-inline: .4rem 1.1rem; height: 100%;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%235d707e' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: left 0 center;
}
/* يأخذ عرض الخيار المختار فقط بدل أطول خيار (حيث يدعمه المتصفّح) */
.sortbox select { field-sizing: content; }
.sortbox select:focus { outline: none; }
.sortbox:focus-within { border-color: var(--brand-300); box-shadow: 0 0 0 3px var(--ring); }

.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

@media (max-width: 620px) {
    .search-page { padding-top: .85rem; }
    /* على الهاتف سطر واحد: العنوان وبجانبه العدد، والترتيب في الطرف المقابل */
    .results-head { display: flex; align-items: center; gap: .45rem; margin: 0 0 .7rem; }
    .results-head h1 {
        flex: 0 1 auto; min-width: 0; font-size: 1rem; line-height: 1.4;
        white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
        display: block; -webkit-line-clamp: unset;
    }
    .results-head .sub { flex: none; font-size: .78rem; white-space: nowrap; }
    .results-head .sub .text-soft { display: none; }
    .results-tools { margin-inline-start: auto; flex: none; }
    .sortbox { height: 34px; padding-inline: .6rem .45rem; }
}
}

.viewtoggle { display: flex; gap: .2rem; padding: .22rem; background: var(--surface-2); border-radius: var(--r-full); border: 1px solid var(--border); }
.viewtoggle a { padding: .35rem .85rem; border-radius: var(--r-full); font-size: .85rem; font-weight: 700; color: var(--text-muted); display: inline-flex; align-items: center; gap: .35rem; }
.viewtoggle a.active { background: var(--surface); color: var(--primary); box-shadow: var(--shadow-xs); }
.viewtoggle svg { width: 15px; height: 15px; }

.activefilters { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1rem; }
.fchip { display: inline-flex; align-items: center; gap: .4rem; padding: .3rem .5rem .3rem .8rem; border-radius: var(--r-full); background: var(--brand-50); color: var(--brand-700); font-size: .83rem; font-weight: 700; }
.fchip a { display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: rgba(0,0,0,.08); font-size: .7rem; }
.fchip a:hover { background: var(--danger); color: #fff; }

/* ترقيم الصفحات */
.pager { display: flex; justify-content: center; align-items: center; gap: .3rem; margin-top: 2.25rem; flex-wrap: wrap; }
.pager a, .pager span {
    min-width: 40px; height: 40px; padding-inline: .6rem;
    display: grid; place-items: center; border-radius: var(--r-sm);
    font-weight: 700; font-size: .9rem; border: 1px solid transparent;
}
.pager a:hover { background: var(--surface); border-color: var(--border); }
.pager .current { background: var(--gold-grad); color: #fff; }
.pager .disabled { color: var(--text-soft); opacity: .5; }

/* حالة فارغة */
.empty { text-align: center; padding: 4rem 1rem; }
.empty-ic { width: 84px; height: 84px; margin: 0 auto 1.25rem; border-radius: 26px; background: var(--brand-50); color: var(--brand-500); display: grid; place-items: center; }
.empty-ic svg { width: 38px; height: 38px; }

/* ---------- الخريطة ---------- */

.map-layout { display: grid; grid-template-columns: minmax(380px, 460px) 1fr; height: calc(100vh - var(--header-h)); }
.map-panel { overflow-y: auto; overflow-x: hidden; padding: 1.1rem; background: var(--bg); border-inline-end: 1px solid var(--border); min-width: 0; }
.map-panel .grid, .map-panel .grid > * { min-width: 0; }

/* بطاقة مدمجة داخل لوحة الخريطة: صورة ضيّقة ونص يأخذ بقية العرض */
.map-panel .pcard.horizontal { flex-direction: row; width: 100%; }
.map-panel .pcard.horizontal .pcard-media { width: 150px; aspect-ratio: auto; min-height: 150px; }
.map-panel .pcard.horizontal .pcard-body { min-width: 0; padding: .8rem .9rem; gap: .4rem; }
.map-panel .pcard-title { font-size: .92rem; }
.map-panel .pcard-price { font-size: .95rem; inset-inline-start: .55rem; bottom: .55rem; }
.map-panel .pcard-tags { top: .5rem; inset-inline-start: .5rem; }
.map-panel .pcard-tags .badge:nth-child(n+2), .map-panel .pcard-count { display: none; }
.map-panel .pcard-fav { width: 30px; height: 30px; top: .45rem; inset-inline-end: .45rem; }
.map-panel .pcard-specs { gap: .7rem; padding-top: .5rem; font-size: .8rem; flex-wrap: wrap; }
.map-panel .pcard-foot { padding-top: .45rem; }
.map-panel .platform-mark img { height: 22px; }
.map-canvas { position: relative; }
#map { position: absolute; inset: 0; }
@media (max-width: 980px) {
    .map-layout { grid-template-columns: 1fr; height: auto; }
    .map-canvas { height: 62vh; }
}

.leaflet-container { font-family: inherit; background: var(--surface-2); }
.pin {
    background: var(--brand-700); color: #fff;
    padding: .28rem .6rem; border-radius: var(--r-full);
    font-weight: 800; font-size: .78rem; white-space: nowrap;
    box-shadow: var(--shadow-md); border: 2px solid #fff;
    transition: transform .16s var(--ease), background .16s var(--ease);
}
.pin:hover, .pin.active { background: var(--brand-500); transform: scale(1.09); z-index: 500 !important; }
.leaflet-popup-content-wrapper { border-radius: var(--r-md); padding: 0; overflow: hidden; box-shadow: var(--shadow-lg); }
.leaflet-popup-content { margin: 0; width: 244px !important; }
.leaflet-popup-tip { display: none; }
.map-pop img { width: 100%; height: 130px; object-fit: cover; }
.map-pop .b { padding: .7rem .85rem; }
.map-pop .p { font-weight: 800; color: var(--brand-600); }
.map-pop .t { font-size: .85rem; font-weight: 700; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.map-pop .s { font-size: .78rem; color: var(--ink-500); }

/* ---------- تفاصيل العقار ---------- */

.gallery { display: grid; grid-template-columns: 2fr 1fr 1fr; grid-template-rows: 1fr 1fr; gap: .5rem; height: 460px; border-radius: var(--r-lg); overflow: hidden; }
.gallery > a { position: relative; overflow: hidden; background: var(--ink-100); }
.gallery > a:first-child { grid-row: span 2; }
.gallery img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s var(--ease), filter .3s var(--ease); }
.gallery > a:hover img { transform: scale(1.04); }
/* زر الرجوع العائم فوق صورة العقار */
.gallery-wrap { position: relative; }
.back-btn {
    position: absolute; top: .75rem; inset-inline-start: .75rem; z-index: 5;
    width: 42px; height: 42px; border-radius: var(--r-full);
    display: grid; place-items: center;
    background: rgba(255, 255, 255, .92); color: var(--text);
    box-shadow: var(--shadow-md, 0 4px 14px rgba(0,0,0,.15));
    backdrop-filter: blur(6px);
    transition: transform .16s var(--ease), color .16s var(--ease);
}
.back-btn:hover { color: var(--primary); }
.back-btn:active { transform: scale(.92); }
/* في رأس صفحة الخدمة الداكن */
.hero > .back-btn { top: 1rem; inset-inline-start: 1rem; }
.back-btn svg { width: 20px; height: 20px; }

.gallery-more { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(8, 18, 25, .6); color: #fff; font-weight: 800; font-size: 1.05rem; backdrop-filter: blur(2px); }
@media (max-width: 860px) {
    .gallery { grid-template-columns: 1fr 1fr; height: 330px; }
    .gallery > a:nth-child(n+4) { display: none; }
}

.detail-layout { display: grid; grid-template-columns: 1fr 370px; gap: 1.85rem; align-items: start; margin-top: 1.85rem; }
@media (max-width: 1040px) { .detail-layout { grid-template-columns: 1fr; } }

.detail-aside { position: sticky; top: calc(var(--header-h) + 1rem); display: flex; flex-direction: column; gap: 1rem; }

.price-tag { font-size: 2.1rem; font-weight: 800; color: var(--text); line-height: 1.2; }
.price-tag span { font-size: .95rem; font-weight: 600; color: var(--text-muted); }

.keyfacts { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: .75rem; }
.keyfact { padding: .9rem .75rem; border-radius: var(--r-md); background: var(--surface-2); text-align: center; border: 1px solid var(--border); }
.keyfact svg { width: 21px; height: 21px; color: var(--primary); margin: 0 auto .35rem; }
.keyfact b { display: block; font-size: 1.05rem; font-weight: 800; }
.keyfact span { font-size: .78rem; color: var(--text-muted); }

.spectable { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 0 1.5rem; }
.specrow { display: flex; justify-content: space-between; gap: 1rem; padding: .7rem 0; border-bottom: 1px dashed var(--border); font-size: .92rem; }
.specrow span:first-child { color: var(--text-muted); }
.specrow span:last-child { font-weight: 700; }

.amenities { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: .6rem; }
.amenity { display: flex; align-items: center; gap: .55rem; padding: .6rem .8rem; border-radius: var(--r-sm); background: var(--surface-2); font-size: .89rem; font-weight: 600; }
.amenity svg { width: 17px; height: 17px; color: var(--brand-500); flex: none; }

.desc { white-space: pre-line; line-height: 2; color: var(--ink-700); }

.pricebar { display: flex; align-items: center; gap: .75rem; }
.pricebar .track { flex: 1; height: 8px; border-radius: var(--r-full); background: var(--ink-100); position: relative; overflow: hidden; }
.pricebar .fill { position: absolute; inset-block: 0; inset-inline-start: 0; border-radius: var(--r-full); background: linear-gradient(90deg, var(--brand-400), var(--brand-600)); }

#detail-map { height: 300px; border-radius: var(--r-md); overflow: hidden; }

/* صندوق التواصل */
.contactbox .agentline { display: flex; align-items: center; gap: .75rem; padding-bottom: 1rem; border-bottom: 1px solid var(--border); margin-bottom: 1rem; }
.contactbox .agentline b { display: block; font-size: .98rem; }
.contactbox .agentline span { font-size: .8rem; color: var(--text-muted); }
.phone-reveal { font-family: monospace; font-size: 1.15rem; letter-spacing: .08em; font-weight: 700; direction: ltr; }

/* ---------- لوحة التحكم ---------- */

.dash-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 1.6rem; align-items: start; }
@media (max-width: 960px) { .dash-layout { grid-template-columns: minmax(0, 1fr); } }

.dash-nav { display: flex; flex-direction: column; gap: .2rem; padding: .6rem; position: sticky; top: calc(var(--header-h) + 1rem); }
.dash-nav a { display: flex; align-items: center; gap: .65rem; padding: .62rem .8rem; border-radius: var(--r-sm); font-weight: 600; font-size: .92rem; color: var(--text-muted); }
.dash-nav a:hover { background: var(--surface-2); color: var(--text); }
.dash-nav a.active { background: var(--brand-50); color: var(--brand-700); }
.dash-nav svg { width: 18px; height: 18px; }
.dash-nav .n { margin-inline-start: auto; background: var(--danger); color: #fff; border-radius: var(--r-full); font-size: .7rem; padding: 0 .4rem; font-weight: 700; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(175px, 1fr)); gap: 1rem; }
.stat { padding: 1.15rem 1.25rem; }
.stat .ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--brand-50); color: var(--brand-600); margin-bottom: .7rem; }
.stat .ic svg { width: 20px; height: 20px; }
.stat b { display: block; font-size: 1.85rem; font-weight: 800; line-height: 1.15; }
.stat span { font-size: .85rem; color: var(--text-muted); }

.sparkline { display: flex; align-items: flex-end; gap: 4px; height: 70px; }
.sparkline i { flex: 1; background: linear-gradient(to top, var(--brand-500), var(--brand-300)); border-radius: 3px 3px 0 0; min-height: 4px; transition: opacity .18s var(--ease); }
.sparkline i:hover { opacity: .7; }

.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.tbl th { text-align: start; padding: .75rem 1rem; font-size: .8rem; font-weight: 700; color: var(--text-muted); border-bottom: 1px solid var(--border); white-space: nowrap; }
table.tbl td { padding: .85rem 1rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.tbl tr:last-child td { border-bottom: 0; }
table.tbl tbody tr:hover { background: var(--surface-2); }
.tbl-thumb { width: 62px; height: 46px; border-radius: 10px; object-fit: cover; flex: none; }

/* شبكة نموذج الإعلان */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 0 1rem; }
.form-section { padding: 1.5rem; }
.form-section + .form-section { margin-top: 1.1rem; }
.form-section > h3 { display: flex; align-items: center; gap: .55rem; margin-bottom: 1.15rem; font-size: 1.02rem; }
.form-section > h3 i { width: 26px; height: 26px; border-radius: 8px; background: var(--brand-50); color: var(--brand-600); display: grid; place-items: center; font-style: normal; font-size: .82rem; font-weight: 800; flex: none; }

.dropzone {
    border: 2px dashed var(--border-strong); border-radius: var(--r-md);
    padding: 2rem 1rem; text-align: center; cursor: pointer;
    transition: border-color .18s var(--ease), background .18s var(--ease);
}
.dropzone:hover, .dropzone.drag { border-color: var(--brand-400); background: var(--brand-50); }
.dropzone svg { width: 34px; height: 34px; color: var(--text-soft); margin: 0 auto .6rem; }

.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: .6rem; margin-top: .9rem; }
.thumb { position: relative; aspect-ratio: 4/3; border-radius: var(--r-sm); overflow: hidden; background: var(--ink-100); }
.thumb img, .thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }

/* الفيديو في نموذج الإعلان */
.media-divider { display: flex; align-items: center; gap: .8rem; margin: 1.6rem 0 1rem; color: var(--text-muted); font-size: .85rem; font-weight: 700; }
.media-divider::before, .media-divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.thumbs-video { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.thumb-cap {
    position: absolute; inset-inline-start: .35rem; bottom: .35rem; padding: .1rem .45rem;
    border-radius: var(--r-full); background: rgba(0, 0, 0, .62); color: #fff; font-size: .72rem; font-weight: 700;
}
.upload-progress {
    margin-top: 1rem; padding: .75rem 1rem; border-radius: var(--r-md);
    background: var(--brand-50); color: var(--brand-700); font-size: .88rem; font-weight: 700;
}

/* الفيديو في صفحة العقار */
.gallery-video-badge {
    position: absolute; bottom: .75rem; inset-inline-end: .75rem; z-index: 5;
    display: inline-flex; align-items: center; gap: .4rem; padding: .5rem .9rem;
    border-radius: var(--r-full); background: rgba(20, 16, 10, .78); color: #fff;
    font-size: .84rem; font-weight: 700; backdrop-filter: blur(6px);
}
.gallery-video-badge:hover { background: var(--primary); }
.video-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: .8rem; }
.video-grid.single { grid-template-columns: 1fr; }
.listing-video {
    width: 100%; max-height: 480px; border-radius: var(--r-md); background: #000; display: block;
}
.thumb button {
    position: absolute; top: 4px; inset-inline-end: 4px;
    width: 24px; height: 24px; border-radius: 50%; border: 0; cursor: pointer;
    background: rgba(11,23,32,.7); color: #fff; display: grid; place-items: center; font-size: .8rem;
}
.thumb button:hover { background: var(--danger); }
.thumb.removed { opacity: .35; filter: grayscale(1); }

/* رفع الفيديو على أجزاء: شريط تقدّم أسفل المعاينة */
.thumb-bar { position: absolute; inset-inline: 0; bottom: 0; height: 4px; background: rgba(0, 0, 0, .35); }
.thumb-bar i { display: block; height: 100%; width: 0; background: var(--primary); transition: width .3s var(--ease); }
.thumb:not(.is-uploading) .thumb-bar { display: none; }
.thumb.is-uploading video { opacity: .6; }
.thumb.is-failed { outline: 2px solid var(--danger); }
.thumb.is-failed .thumb-cap { background: var(--danger); }
.thumb-uploaded { display: grid; place-items: center; background: var(--brand-50); color: var(--brand-600); }
.thumb-uploaded .thumb-ready { display: grid; place-items: center; }

/* خريطة تحديد موقع العقار في نموذج الإعلان */
.picker-tools { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: .6rem; }
.picker-tools .input { flex: 1 1 260px; min-width: 0; }
.picker-tools .btn { flex: none; }
.picker-map { height: 380px; border-radius: var(--r-md); overflow: hidden; border: 1px solid var(--border); }
.picker-status { display: flex; align-items: center; justify-content: space-between; gap: .5rem; min-height: 2rem; margin-top: .4rem; }
@media (max-width: 720px) {
    .picker-map { height: 320px; }
    .picker-tools .btn { flex: 1 1 auto; }
}

/* ---------- التذييل ---------- */

.site-footer { background: var(--ink-900); color: var(--ink-300); margin-top: 4rem; }
.site-footer a:hover { color: var(--brand-300); }
.site-footer .cols { display: grid; grid-template-columns: 1.6fr repeat(3, 1fr); gap: 2.5rem; padding: 3.5rem 0 2.5rem; }
@media (max-width: 860px) { .site-footer .cols { grid-template-columns: 1fr 1fr; gap: 2rem; } }
.site-footer h5 { color: #fff; font-size: .95rem; margin-bottom: 1rem; }
.site-footer a { color: var(--ink-300); font-size: .89rem; display: block; padding: .28rem 0; }
.site-footer a:hover { color: var(--brand-300); }
.site-footer .brand { color: #fff; margin-bottom: .85rem; }
.site-footer .brand small { color: var(--ink-400); }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.08); padding: 1.25rem 0; display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; font-size: .84rem; }

/* توقيع الجهة المطوّرة: كبسولة بإطار ذهبي متدرّج متحرّك واسم لامع */
.dev-credit { display: flex; justify-content: center; padding: 0 0 1.6rem; }
.dev-credit-pill {
    position: relative; display: inline-flex; align-items: center; flex-wrap: wrap; justify-content: center;
    gap: .45rem; padding: .6rem 1.25rem; border-radius: 999px;
    font-size: .86rem; color: var(--ink-300); text-align: center;
    background:
        linear-gradient(var(--ink-900), var(--ink-900)) padding-box,
        linear-gradient(120deg, var(--brand-700), var(--brand-300), #fff3d6, var(--brand-300), var(--brand-700)) border-box;
    background-size: 100% 100%, 300% 100%;
    border: 1px solid transparent;
    box-shadow: 0 0 0 4px rgba(223, 189, 117, .05), 0 8px 28px -12px rgba(223, 189, 117, .45);
    animation: dev-credit-border 6s linear infinite;
    transition: transform .25s ease, box-shadow .25s ease;
}
.dev-credit-pill:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 0 4px rgba(223, 189, 117, .09), 0 12px 34px -12px rgba(223, 189, 117, .6);
}
.dev-credit-ic {
    display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%;
    color: var(--ink-900); background: linear-gradient(135deg, var(--brand-200), var(--brand-500));
}
.dev-credit-name {
    font-size: 1.05rem; font-weight: 800; letter-spacing: .08em;
    background: linear-gradient(90deg, var(--brand-400), #fff7e2, var(--brand-300), var(--brand-500));
    background-size: 250% 100%;
    -webkit-background-clip: text; background-clip: text; color: transparent;
    animation: dev-credit-shine 4s ease-in-out infinite;
}
@keyframes dev-credit-border { to { background-position: 0 0, 300% 0; } }
@keyframes dev-credit-shine { 0%, 100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }
@media (prefers-reduced-motion: reduce) {
    .dev-credit-pill, .dev-credit-name { animation: none; }
}
.social { display: flex; gap: .5rem; }
.social a { width: 36px; height: 36px; border-radius: var(--r-full); background: rgba(255,255,255,.07); display: grid; place-items: center; padding: 0; }
.social a:hover { background: var(--brand-600); color: #fff; }
.social svg { width: 17px; height: 17px; }

/* ---------- عناصر متنوّعة ---------- */

.ribbon {
    display: inline-flex; align-items: center; gap: .5rem;
    padding: .4rem .95rem; border-radius: var(--r-full);
    background: var(--surface); border: 1px solid var(--border);
    font-size: .84rem; font-weight: 700; box-shadow: var(--shadow-xs);
}
.ribbon .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--brand-500); box-shadow: 0 0 0 4px var(--brand-50); }

.cta {
    position: relative; overflow: hidden;
    border-radius: var(--r-xl); padding: clamp(2.2rem, 5vw, 3.4rem);
    background: linear-gradient(135deg, var(--brand-700), var(--ink-900) 85%);
    color: #fff; text-align: center;
}
.cta::before {
    content: ""; position: absolute; inset: 0;
    background: radial-gradient(600px 300px at 82% 0%, rgba(223,189,117,.32), transparent 60%);
}
.cta > * { position: relative; }
.cta h2 { color: #fff; }
.cta p { color: rgba(255,255,255,.78); max-width: 56ch; margin-inline: auto; }
.cta-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: .75rem; margin-top: 1.5rem; }
.cta-actions .btn { white-space: nowrap; }

/* على الهاتف: زرّان بعرض كامل فوق بعضهما بدل أن يخرجا عن حدود البطاقة */
@media (max-width: 620px) {
    .cta { padding: 2rem 1.25rem; border-radius: var(--r-lg); }
    .cta h2 { font-size: 1.35rem; line-height: 1.5; }
    .cta p { font-size: .92rem; }
    .cta-actions { flex-direction: column; align-items: stretch; gap: .6rem; }
    .cta-actions .btn { width: 100%; padding-block: .8rem; }
}

.breadcrumb { display: flex; align-items: center; gap: .45rem; font-size: .84rem; color: var(--text-muted); flex-wrap: wrap; padding: 1rem 0; }
.breadcrumb svg { width: 13px; height: 13px; opacity: .5; transform: scaleX(-1); }

.skeleton { background: linear-gradient(90deg, var(--ink-100) 25%, var(--ink-50) 37%, var(--ink-100) 63%); background-size: 400% 100%; animation: shimmer 1.4s infinite; border-radius: var(--r-sm); }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }

.toast-host { position: fixed; bottom: 1.25rem; inset-inline-start: 1.25rem; z-index: 200; display: flex; flex-direction: column; gap: .5rem; }
.toast {
    display: flex; align-items: center; gap: .6rem;
    padding: .75rem 1.1rem; border-radius: var(--r-md);
    background: var(--ink-900); color: #fff; font-weight: 600; font-size: .9rem;
    box-shadow: var(--shadow-lg); animation: toast-in .3s var(--ease);
}
.toast svg { width: 18px; height: 18px; }
@keyframes toast-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.reveal { opacity: 0; transform: translateY(18px); transition: opacity .6s var(--ease), transform .6s var(--ease); }
.reveal.in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
    .reveal { opacity: 1; transform: none; }
}

/* ---------- الاستجابة ---------- */

@media (max-width: 1024px) {
    .search-fields { grid-template-columns: 1fr 1fr; }
    .search-submit { grid-column: span 2; }
    .search-submit .btn { width: 100%; height: 52px; }
}

@media (max-width: 860px) {
    :root { --header-h: 84px; }
    .site-header .brand-logo { height: 64px; }
    .site-footer .brand-logo { height: 72px; }
    .nav-toggle { display: inline-flex; }
    .nav {
        position: fixed; inset: var(--header-h) 0 auto 0;
        flex-direction: column; align-items: stretch; gap: .15rem;
        background: var(--surface); border-bottom: 1px solid var(--border);
        padding: .85rem 1rem 1.25rem; box-shadow: var(--shadow-lg);
        transform: translateY(-120%); transition: transform .28s var(--ease);
        z-index: 55;
    }
    .nav.open { transform: none; }
    .nav a { padding: .7rem .9rem; font-size: 1rem; }

    .nav-login {
        display: flex; align-items: center; gap: .55rem;
        margin-top: .4rem; padding: .8rem .9rem;
        border-top: 1px solid var(--border);
        color: var(--primary); font-weight: 700;
    }
    .nav-login svg { width: 18px; height: 18px; }
    .hide-sm { display: none !important; }
}

@media (max-width: 620px) {
    :root { --header-h: 74px; }
    .site-header .brand-logo { height: 54px; }
    .search-fields { grid-template-columns: 1fr; }
    .search-submit { grid-column: auto; }
    .gallery { grid-template-columns: 1fr; height: 260px; }
    .gallery > a:nth-child(n+2) { display: none; }
    .hero-stats { gap: 1.5rem; }
    .hero-stats b { font-size: 1.4rem; }
    .price-tag { font-size: 1.7rem; }
}

/* ==========================================================================
   مكوّنات لوحة الإدارة
   ========================================================================== */

/* بطاقة طلب وكالة */
.reqcard { display: grid; grid-template-columns: 1fr auto; gap: 1.25rem; padding: 1.35rem; }
@media (max-width: 760px) { .reqcard { grid-template-columns: 1fr; } }

.reqcard .who { display: flex; align-items: center; gap: .75rem; margin-bottom: .9rem; }
.reqcard .who b { display: block; font-size: 1.04rem; }
.reqcard .who span { font-size: .82rem; color: var(--text-muted); }

.reqgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: .5rem 1.25rem; }
.reqgrid div { display: flex; justify-content: space-between; gap: .75rem; padding: .4rem 0; border-bottom: 1px dashed var(--border); font-size: .87rem; }
.reqgrid dt, .reqgrid .k { color: var(--text-muted); }
.reqgrid .v { font-weight: 700; }

.reqactions { display: flex; flex-direction: column; gap: .5rem; min-width: 190px; }

/* ---------- جرس الإشعارات ---------- */
.notif-trigger { position: relative; }
.notif-count {
    position: absolute; top: 2px; inset-inline-end: 2px; min-width: 18px; height: 18px; padding: 0 5px;
    display: grid; place-items: center; border-radius: 999px; border: 2px solid var(--surface);
    background: var(--danger); color: #fff; font-size: .66rem; font-weight: 800; line-height: 1;
}
.notif-panel { width: min(360px, calc(100vw - 24px)); padding: 0; overflow: hidden; }
.notif-head {
    display: flex; align-items: center; justify-content: space-between; gap: .5rem;
    padding: .75rem .9rem; border-bottom: 1px solid var(--border);
}
.menu-panel .notif-readall {
    width: auto; padding: .2rem .45rem; font-size: .78rem; font-weight: 700; color: var(--primary);
}
.notif-list { max-height: 360px; overflow-y: auto; }
.notif-empty { margin: 0; padding: 1.5rem 1rem; text-align: center; color: var(--text-muted); font-size: .88rem; }
.notif-item {
    display: flex; align-items: flex-start; gap: .65rem; padding: .7rem .9rem;
    border-bottom: 1px solid var(--border); color: var(--text); position: relative;
}
.menu-panel .notif-item { border-radius: 0; font-weight: 400; }
.notif-item:hover { background: var(--ink-50); }
.notif-item.unread { background: var(--brand-50); }
.notif-item.unread::before {
    content: ""; position: absolute; inset-inline-start: 5px; top: 1.15rem;
    width: 6px; height: 6px; border-radius: 50%; background: var(--primary);
}
.notif-ic {
    flex: none; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%;
    background: var(--ink-50); color: var(--primary);
}
.menu-panel .notif-ic svg { color: inherit; }
.notif-ic.k-10, .notif-ic.k-12 { background: var(--success-soft); color: var(--success); }
.notif-ic.k-11, .notif-ic.k-13 { background: var(--danger-soft); color: var(--danger); }
.notif-text { display: flex; flex-direction: column; gap: .1rem; min-width: 0; }
.notif-text b { font-size: .88rem; }
.notif-body { font-size: .8rem; color: var(--text-muted); line-height: 1.55; }
.notif-time { font-size: .72rem; color: var(--text-soft); }
.menu-panel .notif-all { justify-content: center; border-radius: 0; font-size: .85rem; color: var(--primary); }
.notif-page { overflow: hidden; padding: 0; }
.notif-page .notif-item:last-child { border-bottom: 0; }

/* ---------- صندوق العقارات الواردة ---------- */
.pending-card { display: grid; grid-template-columns: 220px 1fr; overflow: hidden; scroll-margin-top: calc(var(--header-h, 72px) + 1rem); }
.pending-card:target { box-shadow: 0 0 0 3px var(--brand-300); }
@media (max-width: 760px) { .pending-card { grid-template-columns: 1fr; } }
.pending-cover { position: relative; display: block; min-height: 170px; background: var(--ink-50); }
.pending-cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.pending-cover .badge { position: absolute; bottom: .6rem; inset-inline-start: .6rem; background: rgba(0, 0, 0, .55); color: #fff; }
.pending-body { padding: 1.1rem 1.25rem; min-width: 0; }
.pending-owner {
    display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; margin-top: .9rem;
    padding-top: .9rem; border-top: 1px solid var(--border);
}
.pending-owner > span:nth-child(2) { margin-inline-end: auto; }
.pending-actions { display: flex; flex-wrap: wrap; align-items: flex-start; gap: .45rem; margin-top: 1rem; }
.pending-reject { position: relative; }
.pending-reject form {
    position: absolute; z-index: 30; top: calc(100% + 6px); inset-inline-start: 0; width: min(320px, 80vw);
    padding: .8rem; background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--r-md); box-shadow: var(--shadow-lg);
}

/* ---------- رسالة الترحيب بالوسيط المقبول ---------- */
.welcome-overlay {
    position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 16px;
    background: rgba(30, 24, 14, .55); backdrop-filter: blur(3px);
    animation: welcome-fade .25s ease;
}
.welcome-card {
    width: min(480px, 100%); padding: 2rem 1.6rem 1.5rem; text-align: center;
    background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-lg);
    border-top: 4px solid var(--brand-400);
    animation: welcome-pop .35s cubic-bezier(.2, .9, .3, 1.2);
}
.welcome-badge {
    display: grid; place-items: center; width: 64px; height: 64px; margin: 0 auto 1rem; border-radius: 50%;
    color: #fff; background: linear-gradient(135deg, var(--brand-300), var(--brand-600));
    box-shadow: 0 10px 26px -10px rgba(168, 130, 60, .7);
}
.welcome-card h2 { font-size: 1.35rem; margin: 0 0 .4rem; }
.welcome-sub { color: var(--text-muted); margin: 0 0 1.2rem; }
.welcome-steps { list-style: none; margin: 0 0 1.4rem; padding: 0; text-align: start; display: grid; gap: .55rem; }
.welcome-steps li {
    display: flex; align-items: flex-start; gap: .6rem; padding: .6rem .75rem;
    background: var(--brand-50); border-radius: var(--r-sm); font-size: .9rem;
}
.welcome-steps .num {
    flex: none; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%;
    background: var(--primary); color: #fff; font-size: .78rem; font-weight: 800;
}
.welcome-actions { display: flex; flex-direction: column; gap: .4rem; }
@keyframes welcome-fade { from { opacity: 0; } }
@keyframes welcome-pop { from { opacity: 0; transform: translateY(12px) scale(.96); } }
@media (prefers-reduced-motion: reduce) { .welcome-overlay, .welcome-card { animation: none; } }

/* شرائح تبديل حالة الطلبات */
.statustabs { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.statustabs a {
    display: inline-flex; align-items: center; gap: .4rem;
    padding: .45rem 1rem; border-radius: var(--r-full);
    border: 1px solid var(--border); background: var(--surface);
    font-weight: 700; font-size: .87rem;
}
.statustabs a.active { background: var(--gold-grad); border-color: transparent; color: #fff; }
.statustabs .n { font-size: .76rem; opacity: .75; }

/* شبكة اختيار الصلاحيات */
.permgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .6rem; }
.permbox { position: relative; }
.permbox input { position: absolute; opacity: 0; pointer-events: none; }
.permbox span.body {
    display: flex; gap: .6rem; align-items: flex-start;
    padding: .8rem .9rem; border-radius: var(--r-md);
    border: 1px solid var(--border); background: var(--surface);
    cursor: pointer; transition: all .16s var(--ease); height: 100%;
}
.permbox span.body:hover { border-color: var(--brand-300); }
.permbox input:checked + span.body { border-color: var(--brand-400); background: var(--brand-50); box-shadow: 0 0 0 1px var(--brand-300) inset; }
.permbox .ic { width: 30px; height: 30px; border-radius: 9px; background: var(--ink-100); color: var(--brand-600); display: grid; place-items: center; flex: none; }
.permbox input:checked + span.body .ic { background: var(--brand-600); color: #fff; }
.permbox b { display: block; font-size: .89rem; }
.permbox em { display: block; font-style: normal; font-size: .76rem; color: var(--text-muted); line-height: 1.55; }

/* رقائق صلاحيات مختصرة في الجدول */
.permchips { display: flex; flex-wrap: wrap; gap: .25rem; }
.permchip { font-size: .72rem; font-weight: 700; padding: .14rem .5rem; border-radius: var(--r-full); background: var(--ink-100); color: var(--ink-700); }

/* معاينة حيّة لاحتساب السعر */
.pricepreview {
    margin-top: .75rem; padding: 1rem 1.15rem;
    border-radius: var(--r-md); background: var(--brand-50);
    border: 1px solid var(--brand-200);
}
.pricepreview .line { display: flex; justify-content: space-between; gap: 1rem; padding: .3rem 0; font-size: .89rem; }
.pricepreview .total { border-top: 1px solid var(--brand-200); margin-top: .35rem; padding-top: .55rem; font-weight: 800; font-size: 1.05rem; color: var(--brand-800); }
.pricepreview .muted { color: var(--text-muted); }

/* شريط مسار النموذج العام */
.steps { display: flex; gap: .5rem; justify-content: center; flex-wrap: wrap; margin-bottom: 2rem; }
.step { display: flex; align-items: center; gap: .5rem; font-size: .86rem; font-weight: 700; color: var(--text-muted); }
.step i { width: 26px; height: 26px; border-radius: 50%; background: var(--ink-100); color: var(--text-muted); display: grid; place-items: center; font-style: normal; font-size: .78rem; }
.step.on { color: var(--brand-700); }
.step.on i { background: var(--gold-grad); color: #fff; }
.step + .step::before { content: ""; width: 26px; height: 1px; background: var(--border-strong); }

/* صندوق ملخّص جانبي */
.sidebox { padding: 1.25rem; border-radius: var(--r-lg); background: var(--surface-2); border: 1px solid var(--border); }
.sidebox h4 { font-size: .92rem; margin-bottom: .75rem; }
.sidebox li { display: flex; gap: .55rem; align-items: flex-start; padding: .32rem 0; font-size: .86rem; color: var(--text-muted); }
.sidebox li svg { color: var(--brand-500); flex: none; margin-top: 3px; }

/* شارة "إعلان المنصة" على البطاقات */
.platform-mark { display: inline-flex; align-items: center; gap: .4rem; font-size: .8rem; font-weight: 700; color: var(--brand-700); }
.platform-mark img { height: 30px; width: auto; }

/* ==========================================================================
   الخدمات
   ========================================================================== */

.svc-grid { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }

.svc-card {
    position: relative; display: flex; flex-direction: column;
    padding: 1.6rem 1.5rem; border-radius: var(--r-lg);
    background: var(--surface); border: 1px solid var(--border);
    box-shadow: var(--shadow-xs); overflow: hidden;
    transition: transform .22s var(--ease), box-shadow .22s var(--ease), border-color .22s var(--ease);
}
.svc-card::before {
    content: ""; position: absolute; inset-inline-start: 0; top: 0; bottom: 0; width: 4px;
    background: var(--gold-grad); opacity: 0; transition: opacity .22s var(--ease);
}
.svc-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: transparent; }
.svc-card:hover::before { opacity: 1; }

.svc-ic {
    width: 54px; height: 54px; border-radius: 16px; flex: none;
    display: grid; place-items: center; margin-bottom: 1rem;
    background: var(--brand-50); color: var(--brand-600);
    transition: background .22s var(--ease), color .22s var(--ease);
}
.svc-card:hover .svc-ic { background: var(--gold-grad); color: #fff; }
.svc-ic svg { width: 26px; height: 26px; }

.svc-card h3 { font-size: 1.14rem; margin-bottom: .3rem; }
.svc-card .tag { font-size: .88rem; color: var(--brand-700); font-weight: 700; margin-bottom: .6rem; }
.svc-card p { font-size: .89rem; color: var(--text-muted); margin: 0 0 1.1rem; line-height: 1.8; }
.svc-card .go {
    margin-top: auto; display: inline-flex; align-items: center; gap: .4rem;
    font-weight: 700; font-size: .89rem; color: var(--primary);
}
.svc-card .go svg { transition: transform .2s var(--ease); }
.svc-card:hover .go svg { transform: translateX(-4px); }

.svc-hero { display: grid; grid-template-columns: 1fr 340px; gap: 2rem; align-items: start; }
@media (max-width: 960px) { .svc-hero { grid-template-columns: 1fr; } }

.svc-steps { counter-reset: step; display: grid; gap: .85rem; }
.svc-step {
    display: flex; gap: .9rem; align-items: flex-start;
    padding: 1rem 1.15rem; border-radius: var(--r-md);
    background: var(--surface-2); border: 1px solid var(--border);
}
.svc-step i {
    counter-increment: step; flex: none;
    width: 30px; height: 30px; border-radius: 50%;
    background: var(--gold-grad); color: #fff;
    display: grid; place-items: center; font-style: normal; font-weight: 800; font-size: .84rem;
}
.svc-step i::before { content: counter(step); }
.svc-step b { display: block; font-size: .92rem; }

.svc-benefits { display: grid; gap: .55rem; }
.svc-benefits li { display: flex; gap: .6rem; align-items: flex-start; font-size: .92rem; }
.svc-benefits svg { color: var(--brand-500); flex: none; margin-top: 4px; }

/* ==========================================================================
   المساعد العقاري
   ========================================================================== */

.chat-root { position: fixed; inset-inline-start: 1.15rem; bottom: 1.15rem; z-index: 180; }

.chat-launcher {
    position: relative;
    width: 60px; height: 60px; border-radius: var(--r-full); border: 0; cursor: pointer;
    background: var(--gold-grad); color: #fff;
    display: grid; place-items: center;
    box-shadow: 0 12px 30px rgba(120, 88, 30, .38);
    transition: transform .2s var(--ease), box-shadow .2s var(--ease);
}
.chat-launcher:hover { transform: scale(1.06); box-shadow: 0 16px 38px rgba(120, 88, 30, .46); }
.chat-launcher svg { width: 27px; height: 27px; }
.chat-root.open .chat-launcher { transform: scale(.92); }

.chat-badge {
    position: absolute; top: -2px; inset-inline-end: -2px;
    min-width: 20px; height: 20px; padding: 0 5px; border-radius: var(--r-full);
    background: var(--danger); color: #fff;
    font-size: .68rem; font-weight: 800; display: grid; place-items: center;
    border: 2px solid var(--bg);
}

.chat-panel {
    position: absolute; bottom: calc(100% + .75rem); inset-inline-start: 0;
    width: min(380px, calc(100vw - 2.3rem)); height: min(560px, calc(100vh - 8rem));
    display: flex; flex-direction: column; overflow: hidden;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--r-lg); box-shadow: var(--shadow-xl);
    animation: chat-in .24s var(--ease);
}
@keyframes chat-in { from { opacity: 0; transform: translateY(14px) scale(.97); } to { opacity: 1; transform: none; } }

.chat-head {
    display: flex; align-items: center; gap: .7rem;
    padding: .85rem 1rem; color: #fff;
    background: linear-gradient(135deg, var(--brand-600), var(--ink-900));
}
.chat-head img { height: 38px; width: auto; flex: none; }
.chat-head b { display: block; font-size: .96rem; }
.chat-head .status { font-size: .75rem; opacity: .82; display: flex; align-items: center; gap: .3rem; }
.chat-head .status::before {
    content: ""; width: 7px; height: 7px; border-radius: 50%;
    background: #6ee7a8; box-shadow: 0 0 0 3px rgba(110, 231, 168, .25);
}
.chat-head button {
    margin-inline-start: auto; width: 32px; height: 32px; border: 0; border-radius: 50%;
    background: rgba(255, 255, 255, .16); color: #fff; cursor: pointer;
    display: grid; place-items: center;
}
.chat-head button:hover { background: rgba(255, 255, 255, .28); }

.chat-log { flex: 1; overflow-y: auto; padding: 1rem; background: var(--surface-2); }
.chat-log::-webkit-scrollbar { width: 6px; }
.chat-log::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }

.chat-msg { display: flex; margin-bottom: .6rem; }
.chat-msg.me { justify-content: flex-start; }
.chat-msg.bot { justify-content: flex-end; }

.chat-bubble {
    max-width: 85%; padding: .68rem .9rem; border-radius: 16px;
    font-size: .89rem; line-height: 1.75;
}
.chat-msg.bot .chat-bubble {
    background: var(--surface); border: 1px solid var(--border);
    border-end-end-radius: 5px; color: var(--text);
}
.chat-msg.me .chat-bubble {
    background: var(--gold-grad); color: #fff; border-end-start-radius: 5px;
}
.chat-bubble b { font-weight: 800; }

.chat-typing { display: flex; gap: 4px; align-items: center; padding: .8rem .9rem; }
.chat-typing i {
    width: 7px; height: 7px; border-radius: 50%; background: var(--text-soft);
    animation: chat-dot 1.1s infinite ease-in-out;
}
.chat-typing i:nth-child(2) { animation-delay: .16s; }
.chat-typing i:nth-child(3) { animation-delay: .32s; }
@keyframes chat-dot { 0%, 60%, 100% { opacity: .3; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-4px); } }

.chat-cards { display: grid; gap: .5rem; margin: .2rem 0 .7rem; }
.chat-card {
    display: flex; gap: .65rem; align-items: center; padding: .5rem;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--r-sm); transition: border-color .18s var(--ease), transform .18s var(--ease);
}
.chat-card:hover { border-color: var(--brand-300); transform: translateX(-3px); }
.chat-card img { width: 66px; height: 52px; object-fit: cover; border-radius: 9px; flex: none; }
.chat-card .b { min-width: 0; }
.chat-card .p { display: block; font-weight: 800; font-size: .86rem; color: var(--brand-700); }
.chat-card .t {
    display: block; font-size: .8rem; font-weight: 600; line-height: 1.45;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.chat-card .s { display: block; font-size: .73rem; color: var(--text-soft); }

.chat-links { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .7rem; justify-content: flex-end; }
.chat-sugs { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .5rem; justify-content: flex-end; }
.chat-sugs button {
    padding: .38rem .8rem; border-radius: var(--r-full); cursor: pointer;
    border: 1px solid var(--brand-200); background: var(--brand-50);
    color: var(--brand-700); font-size: .81rem; font-weight: 700;
    transition: background .16s var(--ease), color .16s var(--ease);
}
.chat-sugs button:hover { background: var(--brand-600); color: #fff; border-color: transparent; }

.chat-form { display: flex; gap: .5rem; padding: .7rem; border-top: 1px solid var(--border); background: var(--surface); }
.chat-form input {
    flex: 1; min-width: 0; padding: .6rem .9rem; font-size: .9rem;
    border: 1px solid var(--border-strong); border-radius: var(--r-full);
    background: var(--surface-2); color: var(--text);
}
.chat-form input:focus { outline: 0; border-color: var(--brand-400); box-shadow: 0 0 0 3px var(--ring); }
.chat-form button {
    height: 40px; padding: 0 1.1rem; flex: none; border: 0; border-radius: var(--r-full); cursor: pointer;
    background: var(--gold-grad); color: #fff; font: inherit; font-size: .9rem; font-weight: 700;
}

@media (max-width: 480px) {
    .chat-root { inset-inline-start: .8rem; bottom: .8rem; }
    .chat-panel { height: min(76vh, 540px); }
}

/* الهاتف: المحادثة بملء الشاشة كتطبيق مراسلة. الارتفاع يتبع الجزء المرئي فوق لوحة المفاتيح
   (--chat-vh من chat.js)، و100dvh احتياطٌ للمتصفحات دون visualViewport */
@media (max-width: 620px) {
    .chat-root.open .chat-panel {
        position: fixed; inset-inline: 0; bottom: auto;
        top: var(--chat-top, 0px);
        width: 100%; height: var(--chat-vh, 100dvh);
        border: 0; border-radius: 0; box-shadow: none;
        z-index: 250; animation: chat-sheet-in .22s var(--ease);
    }
    .chat-root.open .chat-launcher { display: none; }
    .chat-root.open .chat-head { padding-top: calc(.85rem + env(safe-area-inset-top)); }
    .chat-root.open .chat-head button { width: 38px; height: 38px; }
    .chat-root.open .chat-form { padding-bottom: calc(.7rem + env(safe-area-inset-bottom)); }
    .chat-root.open.kb-open .chat-form { padding-bottom: .6rem; }
    body.chat-locked { overflow: hidden; }
}
@keyframes chat-sheet-in { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }

/* ==========================================================================
   تثبيت التطبيق
   ========================================================================== */

.install-banner {
    position: fixed; inset-inline-end: 1.15rem; bottom: 1.15rem; z-index: 175;
    display: flex; align-items: center; gap: .85rem;
    max-width: min(420px, calc(100vw - 2.3rem));
    padding: .85rem 1rem; border-radius: var(--r-lg);
    background: var(--surface); border: 1px solid var(--border);
    box-shadow: var(--shadow-lg); animation: chat-in .3s var(--ease);
}
.install-banner img { height: 42px; width: auto; flex: none; }
.install-banner b { display: block; font-size: .92rem; }
.install-banner .sub { font-size: .78rem; color: var(--text-muted); }
.install-banner .x {
    width: 26px; height: 26px; border: 0; border-radius: 50%; cursor: pointer;
    background: var(--ink-100); color: var(--text-muted); display: grid; place-items: center;
}

.install-steps { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); }
.install-os { padding: 1.4rem; }
.install-os h3 { display: flex; align-items: center; gap: .55rem; font-size: 1.02rem; margin-bottom: .9rem; }
.install-os ol { counter-reset: s; display: grid; gap: .6rem; }
.install-os li {
    display: flex; gap: .65rem; align-items: flex-start;
    font-size: .88rem; color: var(--text-muted); line-height: 1.75;
}
.install-os li::before {
    counter-increment: s; content: counter(s);
    flex: none; width: 23px; height: 23px; border-radius: 50%;
    background: var(--brand-50); color: var(--brand-700);
    display: grid; place-items: center; font-size: .74rem; font-weight: 800; margin-top: 2px;
}
.install-os kbd {
    font-family: inherit; background: var(--ink-100); border-radius: 5px;
    padding: 1px 6px; font-size: .84rem; font-weight: 700; color: var(--text);
}

/* ==========================================================================
   صقل تجربة الهاتف
   ========================================================================== */

/* لمس فوري بلا وميض رمادي ولا تأخير التكبير بالنقر المزدوج */
a, button, label, summary, select { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }

/* منطقة لمس زر المفضلة 44px تقريباً دون تكبير شكله الظاهر */
.pcard-fav::after { content: ""; position: absolute; inset: -7px; border-radius: inherit; }

/* الأزرار العائمة فوق شريط الإيماءات في iPhone */
.chat-root { bottom: calc(1.15rem + env(safe-area-inset-bottom)); }
.install-banner { bottom: calc(1.15rem + env(safe-area-inset-bottom)); }

/* على الشاشات اللمسية لا تبقى حالة المرور "عالقة" على العنصر بعد لمسه */
@media (hover: none) {
    .pcard-fav:hover { transform: none; }
    .fchip-btn:not(.on):hover { border-color: var(--border); color: var(--text); }
    .fchip-seg:not(.on):hover { color: var(--text-muted); }
}

@media (max-width: 860px) {
    /* تلاشٍ عند حافة السطر المنزلق يوحي بوجود خيارات أخرى بالسحب */
    .fbar-row:not(.seg-row) {
        padding-inline-end: 1.75rem;
        -webkit-mask-image: linear-gradient(to left, #000 calc(100% - 28px), transparent);
        mask-image: linear-gradient(to left, #000 calc(100% - 28px), transparent);
    }
}

@media (max-width: 620px) {
    /* خط 16px يمنع Safari في iPhone من تكبير الصفحة تلقائياً عند التركيز على الحقل */
    input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
    select, textarea, .input, .select, .textarea, .chat-form input { font-size: 16px; }

    .sortbox select { font-size: 16px; max-width: 132px; }

    /* صندوق الفلترة بعرض الشاشة كاملاً (يتجاوز هامش الحاوية 1rem من الجانبين)
       فتظهر شرائح أكثر في كل سطر، ويبدو كشريط أدوات تطبيق */
    .fbar {
        margin-inline: -1rem;
        border-inline: 0; border-radius: 0;
        box-shadow: 0 1px 0 var(--border), var(--shadow-xs);
    }
    .fbar-row { padding-inline-start: 1rem; }

    /* ثلاثة أسطر بدل أربعة: الأنواع، الموقع، ثم (الغرض + زر الخريطة) في سطر واحد.
       الترتيب بـ order فقط، فالكود نفسه يخدم الكمبيوتر بترتيبه الأصلي */
    .fbar {
        display: grid; grid-template-columns: auto minmax(0, 1fr);
        padding: .35rem 0 .55rem;
    }
    .fbar > * { grid-column: 1 / -1; }
    .fbar-types { order: 1; }
    .fbar-crumb { order: 2; padding-top: .35rem; }
    .fbar-loc { order: 3; }
    .fbar-purpose { order: 4; grid-column: 1; }
    .fbar-foot { order: 5; grid-column: 2; }

    .fbar .fbar-row + .fbar-row { border-top: 0; padding-top: .3rem; }
    .fbar .fbar-row { padding-block: .25rem; }
    /* خط فاصل واحد فوق كل من: سطر الموقع (أو مساره)، وسطر الغرض والخريطة */
    .fbar .fbar-row.fbar-loc, .fbar .fbar-crumb { border-top: 1px solid var(--border); margin-top: .3rem; padding-top: .45rem; }
    .fbar .fbar-crumb ~ .fbar-row.fbar-loc { border-top: 0; margin-top: 0; padding-top: .3rem; }

    /* شرائح أصغر قليلاً */
    .fchip-btn { padding: .42rem .78rem; font-size: .84rem; }

    /* السطر الأخير: قاطع الغرض المدمج بجانب زر الخريطة، فوق خط فاصل */
    .fbar .fbar-row.fbar-purpose, .fbar .fbar-foot {
        align-self: stretch; display: flex; align-items: center;
        border-top: 1px solid var(--border); margin-top: .35rem; padding-top: .55rem;
    }
    .fbar .fbar-row.fbar-purpose { padding-inline: 1rem .5rem; gap: 0; -webkit-mask-image: none; mask-image: none; overflow: visible; }

    /* قاطع واحد: حاوية رمادية وبداخلها الخيار المختار بلون المنصة */
    .fbar-purpose .fchip-seg {
        flex: none; min-width: 0; padding: .32rem .7rem;
        font-size: .76rem; background: transparent; border-radius: var(--r-full);
    }
    .fbar-purpose .fchip-seg.on { background: var(--primary); color: var(--on-primary); box-shadow: 0 2px 8px var(--ring); }
    .fbar .fbar-purpose { position: relative; isolation: isolate; }
    .fbar .fbar-purpose::after {
        content: ""; position: absolute; z-index: -1;
        inset-block: .55rem 0; inset-inline: 1rem .5rem;
        background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-full);
    }

    /* زر الخريطة: يملأ باقي السطر بعنوان صغير "عرض الخريطة" والعدد */
    .fbar .fbar-foot { flex-wrap: nowrap; gap: .35rem; padding-inline: 0 1rem; }
    .fbar-go { flex: 1 1 auto; min-width: 0; height: 34px; padding: 0 .7rem; gap: .35rem; }
    .fbar-go svg { width: 15px; height: 15px; }
    .fbar-go .go-label { display: none; }
    .fbar-go .go-short { display: inline; font-size: .76rem; font-weight: 700; white-space: nowrap; }

    /* الرئيسية: شريط عنوان قصير بسطر واحد، فيظهر الفلتر وأول النتائج دون تمرير */
    .hero.hero-slim { padding: 1.05rem 0 1.15rem; }
    .hero-slim h1 { font-size: clamp(1.2rem, 6.2vw, 1.5rem); line-height: 1.4; margin: 0; white-space: nowrap; }
    .hero-slim .hero-sub { display: none; }
    .hero-slim::after { height: 28px; }
    .home-filter { padding-top: .75rem; }
    /* صفحة العقار: المسار مخفي وزر الرجوع يقوم مقامه */
    .gallery-wrap { margin-top: .85rem; }
    /* عنوان "أحدث العروض" وعدد النتائج مخفيّان على الهاتف — العدد ظاهر أصلاً على زر الخريطة */
    .preview-head { display: none; }

    /* فراغ أقل بين الأقسام على الهاتف */
    .section { padding: 1.75rem 0; }
    .section-head { margin-bottom: 1rem; }

    /* خدمات الرئيسية على الهاتف: صفّ واحد لكل خدمة (أيقونة، اسم، وصف قصير، سهم) */
    .home-svc { gap: .6rem; }
    .home-svc .svc-card {
        display: grid; grid-template-columns: auto 1fr auto; align-items: center;
        column-gap: .85rem; padding: .85rem 1rem;
    }
    .home-svc .svc-card:hover { transform: none; }
    .home-svc .svc-ic { grid-row: span 2; width: 44px; height: 44px; border-radius: 13px; margin: 0; }
    .home-svc .svc-ic svg { width: 22px; height: 22px; }
    .home-svc .svc-card h3 { font-size: .98rem; margin: 0; }
    .home-svc .svc-card .tag { grid-column: 2; font-size: .8rem; font-weight: 600; margin: 0; }
    .home-svc .svc-card p { display: none; }
    .home-svc .svc-card .go { grid-column: 3; grid-row: 1 / span 2; margin: 0; font-size: 0; gap: 0; }

    /* مزايا المنصة: شبكة 2×2 بأيقونة وعنوان فقط */
    .home-features { grid-template-columns: 1fr 1fr !important; gap: .6rem; }
    .home-features .card-pad { padding: .95rem .9rem; }
    .home-features .stat { padding: 0; }
    .home-features .stat .ic { margin-bottom: .55rem !important; width: 36px; height: 36px; }
    .home-features h3 { font-size: .9rem; margin: 0 !important; line-height: 1.5; }
    .home-features p { display: none; }
    .chat-root { bottom: calc(.8rem + env(safe-area-inset-bottom)); }
}

/* ==========================================================================
   جولة تعريفية بعناصر الفلترة (أول زيارة فقط)
   ========================================================================== */

/* الجذر يغطي الصفحة ويلتقط النقرات حتى لا يُضغط شيء خلف الجولة */
.tour { position: fixed; inset: 0; z-index: 400; animation: tour-in .2s var(--ease); }
.tour.closing { opacity: 0; transition: opacity .18s var(--ease); }
body.tour-open { overflow: hidden; }

/* البقعة المضيئة: ظلّها الضخم هو الخلفية المعتمة */
.tour-spot {
    position: fixed; pointer-events: none;
    border-radius: 18px;
    box-shadow: 0 0 0 9999px rgba(10, 16, 30, .62), 0 0 0 3px rgba(223, 189, 117, .9);
    transition: top .28s var(--ease), left .28s var(--ease), width .28s var(--ease), height .28s var(--ease);
}

.tour-card {
    position: fixed; inset-inline: 12px; margin-inline: auto;
    max-width: 360px;
    background: var(--surface); color: var(--text);
    border-radius: var(--r-lg); padding: 1rem 1.1rem .85rem;
    box-shadow: 0 18px 40px rgba(0, 0, 0, .28);
    transition: top .28s var(--ease);
}
.tour-arrow {
    position: absolute; top: -7px; width: 14px; height: 14px;
    background: var(--surface); transform: rotate(45deg); border-radius: 3px;
}
.tour-card.above .tour-arrow { top: auto; bottom: -7px; }

.tour-step { font-size: .74rem; font-weight: 700; color: var(--primary); margin-bottom: .2rem; }
.tour-card h3 { font-size: 1.02rem; margin: 0 0 .3rem; }
.tour-card p { font-size: .88rem; line-height: 1.75; color: var(--text-muted); margin: 0 0 .85rem; }

.tour-actions { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.tour-actions [data-next] { min-width: 96px; }
.tour-dots { display: flex; gap: .3rem; }
.tour-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--border-strong); transition: width .2s var(--ease), background .2s var(--ease); }
.tour-dots i.on { width: 18px; border-radius: 3px; background: var(--primary); }

@keyframes tour-in { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
    .tour, .tour-spot, .tour-card { animation: none; transition: none; }
}

/* ==========================================================================
   لوحة التحكم: إدارة حسابات التواصل الاجتماعي
   ========================================================================== */

.social-row {
    display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: .8rem;
    padding: .8rem .9rem; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface);
}
.social-row.is-hidden { background: var(--surface-2); }
.social-row.is-hidden .social-ic, .social-row.is-hidden .social-body b { opacity: .55; }
.social-ic {
    width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center;
    background: var(--brand-50); color: var(--brand-700);
}
.social-body { min-width: 0; display: grid; gap: .3rem; }
.social-body b { font-size: .92rem; }
.social-body .input { padding-block: .5rem; font-size: .9rem; }
.social-switch { min-width: 110px; }

@media (max-width: 720px) {
    .social-row { grid-template-columns: auto minmax(0, 1fr); }
    .social-row .social-switch, .social-row > .row { grid-column: 1 / -1; }
    .social-row > .row { justify-content: flex-end; }
}

/* صفحة المدن والأحياء: صف لكل حي (الاسم، النطاق، عدد الإعلانات، الأزرار) */
.loc-row {
    display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) auto auto; align-items: center; gap: .6rem;
    padding: .55rem .7rem; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface);
}
.loc-row .input { padding-block: .45rem; font-size: .9rem; }
.loc-count { white-space: nowrap; }

@media (max-width: 720px) {
    .loc-row { grid-template-columns: minmax(0, 1fr) auto; }
    .loc-row .loc-count { order: 3; }
}
