/* ===== الأساس ===== */
*, *::before, *::after { box-sizing: border-box }
html {
 font-family: var(--font);
 -webkit-text-size-adjust: 100%;
 scroll-behavior: smooth }
body {
 margin: 0;
 min-height: 100vh;
 min-height: 100dvh;
 font-family: var(--font);
 font-size: var(--fs-16);
 line-height: var(--lh);
 color: var(--text);
 background: var(--ivory);
 -webkit-font-smoothing: antialiased }
button, input, select, textarea { font-family: var(--font); font-size: inherit; color: inherit }
img, svg { display: block; max-width: 100% }
a { color: var(--purple-700); text-decoration: none }
a:hover { text-decoration: underline }
h1, h2, h3, h4, p { margin: 0 }
h1 { font-size: var(--fs-32); font-weight: 700; line-height: 1.3 }
h2 { font-size: var(--fs-24); font-weight: 700; line-height: 1.35 }
h3 { font-size: var(--fs-20); font-weight: 600; line-height: 1.4 }
h4 { font-size: var(--fs-16); font-weight: 600 }
:focus-visible { outline: 2px solid var(--gold-500); outline-offset: 2px }
::selection { color: var(--on-brand); background: var(--purple-700) }
.sr-only {
 position: absolute;
 margin: -1px;
 padding: 0;
 border: 0;
 width: 1px;
 height: 1px;
 overflow: hidden;
 clip: rect(0 0 0 0) }
.container { margin-inline: auto; padding-inline: var(--s4); max-width: 1280px }
.muted { color: var(--muted) }
.small { font-size: var(--fs-14) }
.xs { font-size: var(--fs-12) }
.bold { font-weight: 700 }
.num { font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate }
.ltr { direction: ltr; unicode-bidi: isolate }
.row { display: flex; align-items: center; gap: var(--s2) }
.row.wrap { flex-wrap: wrap }
.row.between { justify-content: space-between }
.row.end { justify-content: flex-end }
.stack { display: flex; flex-direction: column; gap: var(--s3) }
.stack.lg { gap: var(--s5) }
.grow { flex: 1; min-width: 0 }
.hide { display: none !important }
.truncate { overflow: hidden; white-space: nowrap; text-overflow: ellipsis }
.divider { margin: var(--s4) 0; border: 0; border-top: 1px solid var(--border) }

/* ===== الأيقونات والعملة ===== */
.icon {
 display: inline-block;
 flex: none;
 width: 20px;
 height: 20px;
 fill: none;
 stroke: currentColor;
 stroke-width: 1.7;
 stroke-linecap: round;
 stroke-linejoin: round;
 vertical-align: middle }
.icon.sm { width: 16px; height: 16px }
.icon.lg { width: 28px; height: 28px }
.icon.xl { width: 48px; height: 48px }
.money {
 display: inline-flex;
 align-items: center;
 gap: 0.22em;
 font-variant-numeric: tabular-nums;
 white-space: nowrap }
.money svg { width: auto; height: 0.86em; fill: currentColor }

/* ===== الأزرار ===== */
.btn {
 display: inline-flex;
 position: relative;
 padding: 0 var(--s5);
 border: 1px solid transparent;
 border-radius: var(--r-sm);
 min-height: 48px;
 font-weight: 600;
 color: var(--text);
 background: transparent;
 align-items: center;
 justify-content: center;
 gap: var(--s2);
 cursor: pointer;
 white-space: nowrap;
 user-select: none;
 transition: transform var(--t-fast) var(--ease-out), background-color var(--t-fast) var(--ease-out), border-color var(--t-fast) var(--ease-out), opacity var(--t-fast) }
.btn:hover { text-decoration: none }
.btn:active { transform: scale(0.96) }
.btn[disabled], .btn.disabled, .btn.is-loading { opacity: 0.6; pointer-events: none }
.btn-primary { color: var(--on-brand); background: var(--purple-900) }
.btn-primary:hover { background: var(--purple-800) }
.btn-gold { color: var(--purple-950); background: var(--gold-500) }
.btn-gold:hover { background: var(--gold-600) }
.btn-outline { border-color: var(--border-strong); color: var(--text); background: var(--surface) }
.btn-outline:hover { border-color: var(--purple-500); background: var(--purple-50) }
.btn-ghost { padding-inline: var(--s3); color: var(--purple-700) }
.btn-ghost:hover { background: var(--purple-50) }
.btn-danger { color: #FFFFFF; background: var(--danger) }
.btn-danger-ghost { color: var(--danger) }
.btn-danger-ghost:hover { background: var(--danger-bg) }
.btn-sm { padding: 0 var(--s3); min-height: 36px; font-size: var(--fs-14) }
.btn-block { width: 100% }
.btn-icon { padding: 0; width: 44px; min-height: 44px }
.btn .spinner { position: absolute; inset: 0; margin: auto }
.btn.is-loading > :not(.spinner) { visibility: hidden }
.btn.is-done { color: #FFFFFF; background: var(--success) }
.spinner {
 border: 2px solid currentColor;
 border-radius: 50%;
 width: 20px;
 height: 20px;
 border-inline-end-color: transparent;
 animation: spin 0.7s linear infinite }
@keyframes spin { to { transform: rotate(360deg) } }
.link-btn {
 padding: 0;
 border: 0;
 font-weight: 600;
 color: var(--purple-700);
 background: none;
 cursor: pointer }

/* ===== الحقول ===== */
.field { display: flex; position: relative; flex-direction: column; gap: var(--s1) }
.field-box { position: relative }
.field input, .field select, .field textarea {
 padding: 22px var(--s4) 6px;
 border: 1px solid var(--border-strong);
 border-radius: var(--r-sm);
 width: 100%;
 min-height: 56px;
 color: var(--text);
 background: var(--surface);
 transition: border-color var(--t-fast) var(--ease-out), box-shadow var(--t-fast) var(--ease-out);
 appearance: none }
.field textarea { padding-top: 26px; min-height: 120px; resize: vertical }
.field select { padding-inline-start: var(--s7); cursor: pointer }
.field label {
 position: absolute;
 top: 17px;
 right: var(--s4);
 font-size: var(--fs-16);
 color: var(--muted);
 transform-origin: right top;
 transition: transform var(--t-fast) var(--ease-out), color var(--t-fast);
 pointer-events: none }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--purple-700); box-shadow: 0 0 0 4px var(--purple-100); outline: none }
.field input:focus + label, .field input:not(:placeholder-shown) + label, .field textarea:focus + label, .field textarea:not(:placeholder-shown) + label, .field select + label { color: var(--purple-700); transform: translateY(-11px) scale(0.78) }
.field .chev {
 position: absolute;
 top: 18px;
 left: var(--s4);
 color: var(--muted);
 pointer-events: none }
.field .addon {
 position: absolute;
 top: 0;
 bottom: 0;
 left: var(--s2);
 margin: auto;
 height: 40px }
.field.has-addon input { padding-inline-end: var(--s7) }
.field .hint { font-size: var(--fs-12); color: var(--muted) }
.field .error { font-size: var(--fs-12); color: var(--danger); animation: rise var(--t-mid) var(--ease-out) }
.field.invalid input, .field.invalid select, .field.invalid textarea { border-color: var(--danger) }
.check {
 display: flex;
 align-items: flex-start;
 gap: var(--s2);
 cursor: pointer }
.check input { margin: 3px 0 0; width: 18px; height: 18px; accent-color: var(--purple-900) }
.switch {
 display: inline-flex;
 position: relative;
 width: 44px;
 height: 26px;
 flex: none }
.switch input { position: absolute; opacity: 0; inset: 0; cursor: pointer }
.switch span {
 position: absolute;
 inset: 0;
 border-radius: var(--r-full);
 background: var(--border-strong);
 transition: background-color var(--t-fast);
 pointer-events: none }
.switch span::after {
 position: absolute;
 top: 3px;
 right: 3px;
 border-radius: 50%;
 width: 20px;
 height: 20px;
 background: #FFFFFF;
 box-shadow: var(--shadow-1);
 content: '';
 transition: transform var(--t-fast) var(--ease-out) }
.switch input:checked + span { background: var(--purple-900) }
.switch input:checked + span::after { transform: translateX(-18px) }
.segmented {
 display: inline-flex;
 padding: var(--s1);
 border-radius: var(--r-sm);
 background: var(--purple-50);
 gap: var(--s1) }
.segmented button {
 padding: var(--s2) var(--s4);
 border: 0;
 border-radius: 9px;
 min-height: 36px;
 font-weight: 600;
 color: var(--text-2);
 background: transparent;
 cursor: pointer }
.segmented button.on { color: var(--purple-900); background: var(--surface); box-shadow: var(--shadow-1) }
.qty {
 display: inline-flex;
 border: 1px solid var(--border-strong);
 border-radius: var(--r-sm);
 align-items: center;
 overflow: hidden }
.qty button { border: 0; width: 44px; height: 44px; background: var(--surface-2); cursor: pointer }
.qty input {
 border: 0;
 width: 80px;
 height: 44px;
 font-weight: 700;
 text-align: center;
 background: var(--surface) }
.choice {
 display: flex;
 padding: var(--s4);
 border: 1px solid var(--border-strong);
 border-radius: var(--r-md);
 background: var(--surface);
 align-items: center;
 gap: var(--s3);
 cursor: pointer;
 transition: border-color var(--t-fast), box-shadow var(--t-fast) }
.choice:has(input:checked) { border-color: var(--purple-700); box-shadow: 0 0 0 3px var(--purple-100) }
.choice input { accent-color: var(--purple-900) }
.form-grid { display: grid; gap: var(--s4) }

/* ===== البطاقات ===== */
.card {
 padding: var(--s5);
 border: 1px solid var(--border);
 border-radius: var(--r-md);
 background: var(--surface);
 box-shadow: var(--shadow-1) }
.card.flush { padding: 0; overflow: hidden }
.card-head {
 display: flex;
 margin-bottom: var(--s4);
 align-items: center;
 justify-content: space-between;
 gap: var(--s3) }
.card-head h3 { font-size: var(--fs-16) }
.section { padding: var(--s7) 0 }
.section-head {
 display: flex;
 margin-bottom: var(--s5);
 align-items: flex-end;
 justify-content: space-between;
 gap: var(--s3) }
.section-head p { margin-top: var(--s1); color: var(--muted) }
.grid { display: grid; gap: var(--s4) }
.grid-2 { grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)) }
.grid-3 { grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)) }
.grid-4 { grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)) }
.split { display: grid; gap: var(--s5) }
.kv { display: grid; grid-template-columns: auto 1fr; gap: var(--s2) var(--s4) }
.kv dt { color: var(--muted) }
.kv dd { margin: 0; font-weight: 500; text-align: left }
.rows > * { padding: var(--s3) 0; border-bottom: 1px solid var(--border) }
.rows > *:last-child { border-bottom: 0 }
.specs { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)) }
.specs > div { display: flex; padding: var(--s3) var(--s4); border-bottom: 1px solid var(--border); justify-content: space-between; gap: var(--s3) }

/* ===== بطاقات الأرقام ===== */
.bento { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--s4) }
.kpi {
 display: flex;
 position: relative;
 padding: var(--s5);
 border: 1px solid var(--border);
 border-radius: var(--r-md);
 min-height: 136px;
 background: var(--surface);
 box-shadow: var(--shadow-1);
 flex-direction: column;
 justify-content: space-between;
 overflow: hidden }
.kpi .kpi-icon {
 position: absolute;
 top: var(--s4);
 left: var(--s4);
 color: var(--gold-500);
 opacity: 0.28 }
.kpi .kpi-icon .icon { width: 44px; height: 44px }
.kpi .label { font-size: var(--fs-14); color: var(--text-2) }
.kpi .value { font-size: var(--fs-32); font-weight: 700; line-height: 1.2 }
.kpi .sub { font-size: var(--fs-12); color: var(--muted) }
.kpi.lead { border-color: transparent; color: #FFFFFF; background: var(--purple-900) }
.kpi.lead .label, .kpi.lead .sub { color: var(--purple-200) }
.kpi.lead .kpi-icon { opacity: 0.4 }
.trend { display: inline-flex; font-size: var(--fs-12); font-weight: 600; align-items: center; gap: 2px }
.trend.up { color: var(--success) }
.trend.down { color: var(--danger) }
.spark { width: 100%; height: 36px; stroke: var(--gold-500); fill: none; stroke-width: 2 }
.ring { width: 56px; height: 56px; transform: rotate(-90deg) }
.ring circle { fill: none; stroke-width: 6 }
.ring .track { stroke: var(--purple-100) }
.ring .bar { stroke: var(--gold-500); stroke-linecap: round }
.bar-track { border-radius: var(--r-full); height: 8px; background: var(--purple-100); overflow: hidden }
.bar-track span { display: block; border-radius: inherit; height: 100%; background: var(--purple-700); transition: width var(--t-slow) var(--ease-out) }
.bar-track.gold span { background: var(--gold-500) }

/* ===== الشرائح والحالات ===== */
.chip {
 display: inline-flex;
 padding: 2px var(--s3);
 border-radius: var(--r-full);
 font-size: var(--fs-12);
 font-weight: 600;
 color: var(--text-2);
 background: var(--surface-2);
 align-items: center;
 gap: var(--s1);
 white-space: nowrap }
.chip::before { border-radius: 50%; width: 6px; height: 6px; background: currentColor; content: '' }
.chip.plain::before { display: none }
.chip.success { color: var(--success); background: var(--success-bg) }
.chip.warning { color: var(--warning); background: var(--warning-bg) }
.chip.danger { color: var(--danger); background: var(--danger-bg) }
.chip.info { color: var(--info); background: var(--info-bg) }
.chip.brand { color: var(--purple-700); background: var(--purple-100) }
.chip.gold { color: var(--gold-700); background: var(--gold-100) }
.pill {
 display: inline-flex;
 padding: var(--s2) var(--s4);
 border: 1px solid var(--border-strong);
 border-radius: var(--r-full);
 min-height: 40px;
 font-size: var(--fs-14);
 font-weight: 500;
 color: var(--text-2);
 background: var(--surface);
 align-items: center;
 gap: var(--s2);
 cursor: pointer;
 white-space: nowrap;
 transition: background-color var(--t-fast), border-color var(--t-fast) }
.pill:hover { border-color: var(--purple-500); text-decoration: none }
.pill.on { border-color: var(--purple-900); color: #FFFFFF; background: var(--purple-900) }
.pill .x { opacity: 0.7 }
.scroller {
 display: flex;
 margin-inline: calc(var(--s4) * -1);
 padding: var(--s1) var(--s4);
 gap: var(--s2);
 overflow-x: auto;
 scrollbar-width: none }
.scroller::-webkit-scrollbar { display: none }
.verified { display: inline-flex; font-size: var(--fs-12); font-weight: 600; color: var(--success); align-items: center; gap: 2px }
.stars { display: inline-flex; color: var(--gold-500); align-items: center; gap: 2px }
.stars .icon { width: 14px; height: 14px; fill: currentColor }
.badge-count {
 position: absolute;
 top: 4px;
 left: 4px;
 padding: 0 5px;
 border-radius: var(--r-full);
 min-width: 18px;
 height: 18px;
 font-size: 11px;
 font-weight: 700;
 line-height: 18px;
 color: var(--purple-950);
 text-align: center;
 background: var(--gold-500) }

/* ===== الجداول ===== */
.table-wrap { overflow-x: auto }
.table { width: 100%; font-size: var(--fs-14); border-collapse: collapse }
.table th {
 position: sticky;
 top: 0;
 padding: var(--s3) var(--s4);
 border-bottom: 1px solid var(--border);
 font-size: var(--fs-12);
 font-weight: 600;
 color: var(--muted);
 text-align: right;
 background: var(--surface-2);
 white-space: nowrap }
.table td { padding: var(--s3) var(--s4); border-bottom: 1px solid var(--border); vertical-align: middle }
.table tr:last-child td { border-bottom: 0 }
.table tbody tr { transition: background-color var(--t-fast) }
.table tbody tr:hover { background: var(--purple-50) }
.table tr[data-href] { cursor: pointer }
.toolbar {
 display: flex;
 margin-bottom: var(--s4);
 align-items: center;
 gap: var(--s2);
 flex-wrap: wrap }
.toolbar .search { flex: 1; min-width: 200px }
.search-input {
 display: flex;
 padding: 0 var(--s3);
 border: 1px solid var(--border-strong);
 border-radius: var(--r-sm);
 min-height: 44px;
 color: var(--muted);
 background: var(--surface);
 align-items: center;
 gap: var(--s2) }
.search-input input { border: 0; width: 100%; height: 42px; background: transparent; outline: none }
.search-input:focus-within { border-color: var(--purple-700); box-shadow: 0 0 0 4px var(--purple-100) }
.pager { display: flex; margin-top: var(--s4); align-items: center; justify-content: center; gap: var(--s2) }

/* ===== الحالات ===== */
.skeleton {
 border-radius: var(--r-sm);
 min-height: 16px;
 background: linear-gradient(90deg, var(--surface-2) 25%, var(--purple-50) 50%, var(--surface-2) 75%);
 background-size: 200% 100%;
 animation: shimmer 1.4s ease-in-out infinite }
@keyframes shimmer { to { background-position: -200% 0 } }
.empty {
 display: flex;
 padding: var(--s7) var(--s4);
 color: var(--text-2);
 text-align: center;
 flex-direction: column;
 align-items: center;
 gap: var(--s3) }
.empty svg.art { width: 120px; height: 96px; color: var(--purple-200) }
.empty h3 { color: var(--text) }
.alert {
 display: flex;
 padding: var(--s3) var(--s4);
 border-radius: var(--r-sm);
 font-size: var(--fs-14);
 color: var(--info);
 background: var(--info-bg);
 align-items: flex-start;
 gap: var(--s2) }
.alert.success { color: var(--success); background: var(--success-bg) }
.alert.warning { color: var(--warning); background: var(--warning-bg) }
.alert.danger { color: var(--danger); background: var(--danger-bg) }
.alert.brand { color: var(--purple-800); background: var(--purple-50) }
.offline-bar {
 position: fixed;
 right: 0;
 bottom: var(--bottom-h);
 left: 0;
 padding: var(--s2);
 font-size: var(--fs-14);
 color: #FFFFFF;
 text-align: center;
 background: var(--text);
 z-index: 60;
 animation: rise var(--t-mid) var(--ease-out) }

/* ===== الحركة ===== */
@keyframes rise { from { opacity: 0; transform: translateY(8px) } }
@keyframes fade { from { opacity: 0 } }
.reveal { animation: rise var(--t-slow) var(--ease-out) both }
.reveal:nth-child(2) { animation-delay: 40ms }
.reveal:nth-child(3) { animation-delay: 80ms }
.reveal:nth-child(4) { animation-delay: 120ms }
.reveal:nth-child(5) { animation-delay: 160ms }
.reveal:nth-child(6) { animation-delay: 200ms }
.page-enter { animation: rise var(--t-slow) var(--ease-out) both }
@media (prefers-reduced-motion: reduce) {
 *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; scroll-behavior: auto !important } }

/* ===== الرأس والتنقل ===== */
.app-header {
 position: sticky;
 top: 0;
 color: #FFFFFF;
 background: var(--glass-dark);
 -webkit-backdrop-filter: blur(16px) saturate(140%);
 backdrop-filter: blur(16px) saturate(140%);
 z-index: 50 }
.app-header .bar { display: flex; height: var(--header-h); align-items: center; gap: var(--s4) }
.app-header .logo img { width: auto; height: 34px }
.app-header nav { display: none; gap: var(--s1) }
.app-header nav a {
 padding: var(--s2) var(--s3);
 border-radius: 10px;
 font-size: var(--fs-14);
 font-weight: 500;
 color: var(--purple-200);
 transition: background-color var(--t-fast), color var(--t-fast) }
.app-header nav a:hover { color: #FFFFFF; background: rgba(255, 255, 255, 0.08); text-decoration: none }
.app-header nav a.on { color: #FFFFFF; background: rgba(255, 255, 255, 0.12) }
.app-header .search-input { display: none; border-color: transparent; max-width: 420px; flex: 1 }
.app-header .actions { display: flex; margin-inline-start: auto; align-items: center; gap: var(--s1) }
.app-header .hbtn {
 display: inline-flex;
 position: relative;
 border: 0;
 border-radius: 12px;
 width: 44px;
 height: 44px;
 color: #FFFFFF;
 background: transparent;
 align-items: center;
 justify-content: center;
 cursor: pointer;
 transition: background-color var(--t-fast) }
.app-header .hbtn:hover { background: rgba(255, 255, 255, 0.1) }
.avatar {
 display: inline-flex;
 border-radius: 50%;
 width: 36px;
 height: 36px;
 font-size: var(--fs-14);
 font-weight: 700;
 color: var(--purple-900);
 background: var(--gold-200);
 align-items: center;
 justify-content: center;
 flex: none;
 overflow: hidden;
 object-fit: cover }
.avatar.lg { width: 96px; height: 96px; font-size: var(--fs-32) }
.avatar.md { width: 48px; height: 48px; font-size: var(--fs-16) }
.bottom-nav {
 display: grid;
 position: fixed;
 right: 0;
 bottom: 0;
 left: 0;
 padding-bottom: env(safe-area-inset-bottom);
 border-top: 1px solid var(--glass-border);
 height: calc(var(--bottom-h) + env(safe-area-inset-bottom));
 background: var(--glass);
 -webkit-backdrop-filter: blur(18px) saturate(160%);
 backdrop-filter: blur(18px) saturate(160%);
 grid-template-columns: repeat(5, 1fr);
 z-index: 50 }
.bottom-nav a {
 display: flex;
 position: relative;
 font-size: 11px;
 font-weight: 500;
 color: var(--muted);
 flex-direction: column;
 align-items: center;
 justify-content: center;
 gap: 2px }
.bottom-nav a:hover { text-decoration: none }
.bottom-nav a.on { color: var(--purple-900) }
.bottom-nav a.on .icon { transform: translateY(-2px); transition: transform var(--t-mid) var(--ease-out) }
.bottom-nav .badge-count { top: 6px; left: calc(50% - 22px) }
main#app { padding-bottom: calc(var(--bottom-h) + var(--s5)); min-height: 70vh }
.crumbs { display: flex; padding: var(--s4) 0 0; font-size: var(--fs-12); color: var(--muted); flex-wrap: wrap; gap: var(--s1) }
.crumbs a { color: var(--muted) }
.page-head {
 display: flex;
 padding: var(--s5) 0;
 align-items: flex-end;
 justify-content: space-between;
 gap: var(--s3);
 flex-wrap: wrap }
.page-head p { margin-top: var(--s1); color: var(--muted) }
.tabs {
 display: flex;
 margin-bottom: var(--s4);
 border-bottom: 1px solid var(--border);
 gap: var(--s1);
 overflow-x: auto;
 scrollbar-width: none }
.tabs a, .tabs button {
 position: relative;
 padding: var(--s3) var(--s4);
 border: 0;
 font-weight: 600;
 color: var(--muted);
 background: none;
 cursor: pointer;
 white-space: nowrap }
.tabs a:hover { text-decoration: none }
.tabs .on { color: var(--purple-900) }
.tabs .on::after {
 position: absolute;
 right: var(--s3);
 bottom: -1px;
 left: var(--s3);
 height: 2px;
 background: var(--purple-900);
 content: '' }
.tabs .count { margin-inline-start: var(--s1); font-size: var(--fs-12); color: var(--muted) }

/* ===== التذييل ===== */
.app-footer { margin-top: var(--s7); padding: var(--s7) 0 calc(var(--bottom-h) + var(--s5)); color: var(--purple-200); background: var(--purple-950) }
.app-footer a { color: var(--purple-200) }
.app-footer .cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: var(--s5) }
.app-footer h4 { margin-bottom: var(--s3); color: #FFFFFF }
.app-footer ul { display: grid; margin: 0; padding: 0; list-style: none; gap: var(--s2) }
.app-footer .pay { display: flex; margin-top: var(--s5); flex-wrap: wrap; gap: var(--s2) }
.app-footer .pay img { padding: 4px 8px; border-radius: 8px; height: 32px; background: #FFFFFF }

/* ===== لوحات التحكم ===== */
.dash { display: block }
.side { display: none }
.side .store-switch {
 display: flex;
 margin-bottom: var(--s4);
 padding: var(--s3);
 border: 1px solid var(--border);
 border-radius: var(--r-sm);
 background: var(--surface-2);
 align-items: center;
 gap: var(--s3) }
.side nav { display: flex; flex-direction: column; gap: 2px }
.side .group { margin: var(--s4) var(--s3) var(--s1); font-size: var(--fs-12); color: var(--muted) }
.side a {
 display: flex;
 padding: var(--s2) var(--s3);
 border-radius: 10px;
 min-height: 44px;
 font-size: var(--fs-14);
 font-weight: 500;
 color: var(--text-2);
 align-items: center;
 gap: var(--s3);
 transition: background-color var(--t-fast), color var(--t-fast) }
.side a:hover { background: var(--purple-50); text-decoration: none }
.side a.on { color: var(--purple-900); background: var(--purple-100) }
.side a .count { margin-inline-start: auto; font-size: var(--fs-12); color: var(--muted) }
.dash-tabs { margin-top: var(--s3) }
.dash-main { min-width: 0 }

/* ===== المنتجات ===== */
.p-card {
 display: flex;
 position: relative;
 border: 1px solid var(--border);
 border-radius: var(--r-md);
 color: var(--text);
 background: var(--surface);
 flex-direction: column;
 overflow: hidden;
 transition: transform var(--t-mid) var(--ease-out), box-shadow var(--t-mid) var(--ease-out) }
.p-card:hover { box-shadow: var(--shadow-2); transform: translateY(-2px); text-decoration: none }
.p-card .media { position: relative; background: var(--surface-2); aspect-ratio: 1 / 1 }
.p-card .media img { width: 100%; height: 100%; object-fit: cover }
.p-card .media .tag { position: absolute; top: var(--s2); right: var(--s2) }
.p-card .fav {
 position: absolute;
 top: var(--s2);
 left: var(--s2);
 border: 0;
 border-radius: 50%;
 width: 40px;
 height: 40px;
 color: var(--text-2);
 background: var(--glass);
 -webkit-backdrop-filter: blur(8px);
 backdrop-filter: blur(8px);
 cursor: pointer }
.p-card .fav .icon { margin: auto }
.p-card .fav.on { color: var(--danger) }
.p-card .fav.on .icon { fill: currentColor }
.p-card .body { display: flex; padding: var(--s3); flex: 1; flex-direction: column; gap: var(--s1) }
.p-card .name {
 font-weight: 600;
 line-height: 1.45;
 display: -webkit-box;
 -webkit-line-clamp: 2;
 -webkit-box-orient: vertical;
 overflow: hidden }
.p-card .store { font-size: var(--fs-12); color: var(--muted) }
.p-card .price { margin-top: auto; padding-top: var(--s2); font-size: var(--fs-20); font-weight: 700 }
.p-card .price .unit { font-size: var(--fs-12); font-weight: 400; color: var(--muted) }
.p-card .moq { font-size: var(--fs-12); color: var(--text-2) }
.thumb { border-radius: var(--r-sm); width: 56px; height: 56px; background: var(--surface-2); object-fit: cover; flex: none }
.thumb.sm { width: 40px; height: 40px; border-radius: 10px }
.ph {
 display: flex;
 width: 100%;
 height: 100%;
 color: var(--purple-200);
 background: var(--purple-50);
 align-items: center;
 justify-content: center }
.ph .icon { width: 40%; height: 40%; max-width: 72px; max-height: 72px }
.gallery { display: grid; gap: var(--s2) }
.gallery .main { border-radius: var(--r-md); background: var(--surface-2); aspect-ratio: 1 / 1; overflow: hidden }
.gallery .main img { width: 100%; height: 100%; object-fit: cover }
.gallery .thumbs { display: flex; gap: var(--s2); overflow-x: auto }
.gallery .thumbs button { padding: 0; border: 2px solid transparent; border-radius: var(--r-sm); width: 72px; height: 72px; background: none; cursor: pointer; overflow: hidden; flex: none }
.gallery .thumbs button.on { border-color: var(--purple-900) }
.gallery .thumbs img { width: 100%; height: 100%; object-fit: cover }
.tiers { display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); gap: var(--s2) }
.tiers > div { padding: var(--s3); border: 1px solid var(--border); border-radius: var(--r-sm); text-align: center }
.tiers > div.on { border-color: var(--purple-700); background: var(--purple-50) }
.buy-box { position: sticky; top: calc(var(--header-h) + var(--s4)) }
.mobile-buy {
 position: fixed;
 right: 0;
 bottom: calc(var(--bottom-h) + env(safe-area-inset-bottom));
 left: 0;
 padding: var(--s3) var(--s4);
 border-top: 1px solid var(--glass-border);
 background: var(--glass);
 -webkit-backdrop-filter: blur(18px);
 backdrop-filter: blur(18px);
 z-index: 40 }

/* ===== الصفحة الرئيسية ===== */
.hero {
 position: relative;
 padding: var(--s7) 0;
 color: #FFFFFF;
 background: radial-gradient(1200px 500px at 90% -10%, rgba(196, 150, 74, 0.22), transparent 60%), radial-gradient(900px 500px at 0% 110%, rgba(122, 91, 176, 0.45), transparent 60%), var(--purple-900);
 overflow: hidden }
.hero::before { position: absolute; inset: 0; background: url('/assets/pattern/pattern.png') center / 420px repeat; content: ''; opacity: 0.07; pointer-events: none }
.hero .container { position: relative }
.hero h1 { font-size: clamp(1.75rem, 5vw, 2.75rem); line-height: 1.25 }
.hero p.lead { margin-top: var(--s3); max-width: 560px; color: var(--purple-200) }
.hero .search-input { margin-top: var(--s5); border-color: transparent; max-width: 620px; min-height: 56px }
.hero .glass-card {
 padding: var(--s5);
 border: 1px solid rgba(255, 255, 255, 0.16);
 border-radius: var(--r-lg);
 color: #FFFFFF;
 background: rgba(255, 255, 255, 0.1);
 -webkit-backdrop-filter: blur(20px) saturate(140%);
 backdrop-filter: blur(20px) saturate(140%) }
.trust { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--s4) }
.trust > div { display: flex; align-items: flex-start; gap: var(--s3) }
.trust .icon { color: var(--gold-500) }
.cat-card {
 display: block;
 position: relative;
 border-radius: var(--r-md);
 color: #FFFFFF;
 background: var(--purple-800);
 aspect-ratio: 4 / 3;
 overflow: hidden }
.cat-card img { width: 100%; height: 100%; object-fit: cover; transition: transform var(--t-slow) var(--ease-out) }
.cat-card:hover img { transform: scale(1.04) }
.cat-card .cap { position: absolute; right: 0; bottom: 0; left: 0; padding: var(--s4); background: linear-gradient(transparent, rgba(29, 14, 56, 0.85)) }
.cat-card:hover { text-decoration: none }
.banner {
 display: grid;
 border-radius: var(--r-lg);
 color: #FFFFFF;
 background: var(--purple-900);
 overflow: hidden }
.banner img { width: 100%; height: 100%; object-fit: cover }
.banner .txt { display: flex; padding: var(--s6); flex-direction: column; justify-content: center; gap: var(--s3) }
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--s5); counter-reset: step }
.steps > div { counter-increment: step }
.steps > div::before { display: block; margin-bottom: var(--s2); font-size: var(--fs-32); font-weight: 700; color: var(--gold-500); content: counter(step) }
.store-cover { border-radius: var(--r-lg); height: 180px; background: var(--purple-900) center / cover; overflow: hidden }
.store-cover img { width: 100%; height: 100%; object-fit: cover }
.store-head { display: flex; margin-top: -40px; padding: 0 var(--s4); align-items: flex-end; gap: var(--s4) }
.store-logo { border: 4px solid var(--surface); border-radius: var(--r-md); width: 96px; height: 96px; background: var(--surface); object-fit: cover; flex: none; overflow: hidden }

/* ===== النوافذ والرسائل ===== */
.overlay {
 display: flex;
 position: fixed;
 inset: 0;
 padding: var(--s4);
 background: var(--overlay);
 -webkit-backdrop-filter: blur(6px);
 backdrop-filter: blur(6px);
 align-items: flex-end;
 justify-content: center;
 z-index: 100;
 animation: fade var(--t-mid) var(--ease-out) }
.modal {
 display: flex;
 padding: var(--s5);
 border: 1px solid var(--glass-border);
 border-radius: var(--r-lg);
 width: 100%;
 max-width: 560px;
 max-height: 90vh;
 background: var(--surface);
 box-shadow: var(--shadow-3);
 flex-direction: column;
 gap: var(--s4);
 overflow-y: auto;
 animation: rise var(--t-slow) var(--ease-out) }
.modal.wide { max-width: 860px }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s3) }
.modal-foot { display: flex; padding-top: var(--s2); justify-content: flex-end; gap: var(--s2); flex-wrap: wrap }
.sheet-handle { margin: -8px auto 0; border-radius: var(--r-full); width: 40px; height: 4px; background: var(--border-strong) }
.toasts {
 display: flex;
 position: fixed;
 right: var(--s4);
 bottom: calc(var(--bottom-h) + var(--s4));
 left: var(--s4);
 flex-direction: column;
 align-items: center;
 gap: var(--s2);
 z-index: 200;
 pointer-events: none }
.toast {
 display: flex;
 padding: var(--s3) var(--s4);
 border-radius: var(--r-sm);
 max-width: 480px;
 font-size: var(--fs-14);
 color: #FFFFFF;
 background: var(--purple-950);
 box-shadow: var(--shadow-3);
 align-items: center;
 gap: var(--s3);
 pointer-events: auto;
 animation: rise var(--t-mid) var(--ease-out) }
.toast.success .icon { color: #6EE7B7 }
.toast.error .icon { color: #FCA5A5 }
.toast button { padding: 0; border: 0; font-weight: 700; color: var(--gold-500); background: none; cursor: pointer }
.menu {
 position: absolute;
 top: calc(100% + 6px);
 left: 0;
 padding: var(--s2);
 border: 1px solid var(--glass-border);
 border-radius: var(--r-md);
 min-width: 240px;
 color: var(--text);
 background: var(--glass);
 -webkit-backdrop-filter: blur(20px) saturate(160%);
 backdrop-filter: blur(20px) saturate(160%);
 box-shadow: var(--shadow-3);
 z-index: 60;
 animation: rise var(--t-fast) var(--ease-out) }
.menu a, .menu button {
 display: flex;
 padding: var(--s2) var(--s3);
 border: 0;
 border-radius: 10px;
 width: 100%;
 min-height: 44px;
 font-size: var(--fs-14);
 color: var(--text);
 text-align: right;
 background: none;
 align-items: center;
 gap: var(--s2);
 cursor: pointer }
.menu a:hover, .menu button:hover { background: var(--purple-50); text-decoration: none }

/* ===== المحادثات ===== */
.chat {
 display: grid;
 border: 1px solid var(--border);
 border-radius: var(--r-md);
 height: calc(100vh - var(--header-h) - var(--bottom-h) - 120px);
 min-height: 480px;
 background: var(--surface);
 overflow: hidden }
.chat-list { border-left: 1px solid var(--border); overflow-y: auto }
.chat-list a { display: flex; padding: var(--s3) var(--s4); border-bottom: 1px solid var(--border); color: var(--text); gap: var(--s3) }
.chat-list a:hover { background: var(--purple-50); text-decoration: none }
.chat-list a.on { background: var(--purple-100) }
.chat-thread { display: flex; min-width: 0; flex-direction: column }
.chat-top { display: flex; padding: var(--s3) var(--s4); border-bottom: 1px solid var(--border); align-items: center; gap: var(--s3) }
.chat-msgs { display: flex; padding: var(--s4); background: var(--surface-2); flex: 1; flex-direction: column; gap: var(--s2); overflow-y: auto }
.msg { padding: var(--s2) var(--s3); border-radius: 14px; max-width: 78%; background: var(--surface); box-shadow: var(--shadow-1); align-self: flex-end; animation: rise var(--t-mid) var(--ease-out) }
.msg.mine { color: #FFFFFF; background: var(--purple-900); align-self: flex-start }
.msg.system { font-size: var(--fs-12); color: var(--text-2); text-align: center; background: var(--gold-100); box-shadow: none; align-self: center }
.msg .meta { margin-top: 2px; font-size: 11px; opacity: 0.7 }
.msg img { margin-top: var(--s1); border-radius: 10px; max-width: 240px }
.chat-input { display: flex; padding: var(--s3); border-top: 1px solid var(--border); align-items: flex-end; gap: var(--s2) }
.chat-input textarea {
 padding: var(--s3);
 border: 1px solid var(--border-strong);
 border-radius: var(--r-sm);
 min-height: 44px;
 max-height: 140px;
 background: var(--surface);
 flex: 1;
 resize: none }
.offer-card { padding: var(--s4); border: 1px solid var(--gold-200); border-radius: var(--r-md); max-width: 360px; background: var(--surface); align-self: center }

/* ===== الدخول ===== */
.auth-wrap {
 display: grid;
 position: relative;
 padding: var(--s5) var(--s4);
 min-height: calc(100vh - var(--header-h));
 background: radial-gradient(800px 400px at 100% 0%, rgba(196, 150, 74, 0.16), transparent 60%), radial-gradient(700px 500px at 0% 100%, rgba(122, 91, 176, 0.18), transparent 60%), var(--ivory);
 place-items: center }
.auth-card { padding: var(--s6) var(--s5); width: 100%; max-width: 460px }
.auth-card h1 { font-size: var(--fs-24) }
.otp { display: flex; direction: ltr; justify-content: center; gap: var(--s2) }
.otp input {
 border: 1px solid var(--border-strong);
 border-radius: var(--r-sm);
 width: 48px;
 height: 56px;
 font-size: var(--fs-24);
 font-weight: 700;
 text-align: center;
 background: var(--surface) }
.otp input:focus { border-color: var(--purple-700); box-shadow: 0 0 0 4px var(--purple-100); outline: none }
.stepper { display: flex; margin-bottom: var(--s5); gap: var(--s2) }
.stepper span { border-radius: var(--r-full); height: 4px; background: var(--border); flex: 1; transition: background-color var(--t-mid) }
.stepper span.on { background: var(--purple-900) }
.strength { display: flex; margin-top: var(--s1); gap: 4px }
.strength i { border-radius: 2px; height: 4px; background: var(--border); flex: 1 }
.strength.s1 i:nth-child(-n+1) { background: var(--danger) }
.strength.s2 i:nth-child(-n+2) { background: var(--warning) }
.strength.s3 i:nth-child(-n+3) { background: var(--gold-500) }
.strength.s4 i { background: var(--success) }
.timeline { display: flex; flex-direction: column; gap: 0 }
.timeline > div { position: relative; padding: 0 var(--s5) var(--s4) 0 }
.timeline > div::before { position: absolute; top: 6px; right: 0; border-radius: 50%; width: 10px; height: 10px; background: var(--border-strong); content: '' }
.timeline > div::after { position: absolute; top: 18px; right: 4px; bottom: 0; width: 2px; background: var(--border); content: '' }
.timeline > div:last-child::after { display: none }
.timeline > div.done::before { background: var(--success) }
.timeline > div.now::before { background: var(--gold-500); box-shadow: 0 0 0 4px var(--gold-100) }
.progress-steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--s2) }
.progress-steps > div { padding-top: var(--s2); border-top: 3px solid var(--border); font-size: var(--fs-12); color: var(--muted) }
.progress-steps > div.done { border-color: var(--success); color: var(--success) }
.progress-steps > div.now { border-color: var(--gold-500); color: var(--gold-700) }
.dropzone {
 display: flex;
 padding: var(--s5);
 border: 2px dashed var(--border-strong);
 border-radius: var(--r-md);
 color: var(--muted);
 text-align: center;
 background: var(--surface-2);
 flex-direction: column;
 align-items: center;
 gap: var(--s2);
 cursor: pointer;
 transition: border-color var(--t-fast), background-color var(--t-fast) }
.dropzone:hover, .dropzone.drag { border-color: var(--purple-500); background: var(--purple-50) }
.uploads { display: flex; flex-wrap: wrap; gap: var(--s2) }
.uploads .u { position: relative; border-radius: var(--r-sm); width: 88px; height: 88px; background: var(--surface-2); overflow: hidden }
.uploads .u img { width: 100%; height: 100%; object-fit: cover }
.uploads .u button {
 position: absolute;
 top: 4px;
 left: 4px;
 padding: 0;
 border: 0;
 border-radius: 50%;
 width: 28px;
 height: 28px;
 color: #FFFFFF;
 background: rgba(0, 0, 0, 0.55);
 cursor: pointer }
.chart { width: 100%; height: 220px }
.chart .grid-line { stroke: var(--border) }
.chart .line { fill: none; stroke: var(--purple-700); stroke-width: 2.5; stroke-linejoin: round }
.chart .area { fill: var(--purple-100); opacity: 0.6 }
.chart text { font-family: var(--font); font-size: 11px; fill: var(--muted) }
.chart .bar { fill: var(--purple-700) }
.chart .bar.alt { fill: var(--gold-500) }
.splash {
 display: grid;
 position: fixed;
 inset: 0;
 background: var(--ivory);
 place-items: center;
 z-index: 300;
 transition: opacity var(--t-slow) var(--ease-in) }
.splash img { width: 120px; height: auto; animation: splash-in 900ms var(--ease-out) both }
.splash.out { opacity: 0; pointer-events: none }
@keyframes splash-in { from { opacity: 0; transform: scale(0.88) } }

/* ===== الشاشات الكبيرة ===== */
@media (min-width: 640px) {
 .form-grid.two { grid-template-columns: 1fr 1fr }
 .form-grid .full { grid-column: 1 / -1 }
 .overlay { align-items: center }
 .bento { grid-template-columns: repeat(3, 1fr) }
 .toasts { right: auto; left: var(--s5) } }

@media (min-width: 1024px) {
 :root { --bottom-h: 0px }
 .bottom-nav, .mobile-buy, .sheet-handle { display: none }
 .app-header nav { display: flex }
 .app-header .search-input { display: flex }
 .container { padding-inline: var(--s5) }
 .split { grid-template-columns: minmax(0, 1fr) 360px; align-items: start }
 .split.half { grid-template-columns: 1fr 1fr }
 .split.wide-side { grid-template-columns: minmax(0, 1fr) 420px }
 .dash { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: var(--s5); align-items: start }
 .side {
  display: block;
  position: sticky;
  top: calc(var(--header-h) + var(--s4));
  padding: var(--s4) var(--s2);
  max-height: calc(100vh - var(--header-h) - var(--s5));
  overflow-y: auto }
 .dash-tabs { display: none }
 .bento { grid-template-columns: repeat(4, 1fr) }
 .bento .wide { grid-column: span 2 }
 .bento .tall { grid-row: span 2 }
 .chat { grid-template-columns: 340px 1fr }
 .gallery { grid-template-columns: 1fr }
 .banner { grid-template-columns: 1fr 1fr }
 .hero { padding: var(--s8) 0 }
 .hero-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: var(--s6); align-items: center }
 .offline-bar { bottom: 0 } }

@media (max-width: 1023px) {
 .chat-list.has-active { display: none }
 .chat:not(.has-active) .chat-thread { display: none }
 .chat { grid-template-columns: 1fr }
 .hero .glass-card { margin-top: var(--s5) } }

@media print {
 .app-header, .bottom-nav, .app-footer, .side, .toolbar, .btn { display: none !important }
 body { background: #FFFFFF } }
