/* سلّم الخطوط: 12 · 14 · 16 · 20 · 26 بكسل فقط (.75 · .875 · 1 · 1.25 · 1.625rem) */
/* ============ الألوان ============ */
:root {
  color-scheme: light;
  --bg: #f7f8fa;
  --surface: #ffffff;
  --surface-2: #f3f5f8;
  --surface-3: #eceff3;
  --text: #101828;
  --text-2: #344054;
  --muted: #667085;
  --border: #e6e9ef;
  --border-2: #d5dae2;
  --primary: #2563eb;
  --primary-strong: #1d4ed8;
  --primary-soft: #eef4ff;
  --primary-ink: #ffffff;
  --accent: #b45309;
  --accent-soft: #fdf2e3;
  --star: #f59e0b;
  --danger: #c4320a;
  --danger-soft: #fef1ee;
  --ok: #067647;
  --ok-soft: #ecfbf2;
  --wa: #128c4b;
  --ring: rgba(37, 99, 235, .22);
  --glass: rgba(247, 248, 250, .82);
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .04);
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 6px 20px -10px rgba(16, 24, 40, .12);
  --shadow-lg: 0 12px 32px -12px rgba(16, 24, 40, .22);
  --r: 16px;
  --card-pad: 18px;
  --r-sm: 12px;
  --side-w: 264px;
  --top-h: 60px;
  --nav-h: 66px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1316;
    --surface: #151b1f;
    --surface-2: #1b2328;
    --surface-3: #222c32;
    --text: #eef2f4;
    --text-2: #cdd6db;
    --muted: #96a4ab;
    --border: #243036;
    --border-2: #314048;
    --primary: #6ea8ff;
    --primary-strong: #93bfff;
    --primary-soft: #14233d;
    --primary-ink: #071a3a;
    --accent: #f2a649;
    --accent-soft: #3a2a13;
    --star: #f5b544;
    --danger: #ff8f7a;
    --danger-soft: #3b1b16;
    --ok: #5fd39a;
    --ok-soft: #12301f;
    --wa: #46cf86;
    --ring: rgba(110, 168, 255, .32);
    --glass: rgba(14, 19, 22, .82);
    --shadow-sm: none;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow-lg: 0 12px 32px -12px rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}
/* نفس الوضع الداكن عند اختياره يدوياً */
:root[data-theme="dark"] {
    --bg: #0e1316;
    --surface: #151b1f;
    --surface-2: #1b2328;
    --surface-3: #222c32;
    --text: #eef2f4;
    --text-2: #cdd6db;
    --muted: #96a4ab;
    --border: #243036;
    --border-2: #314048;
    --primary: #6ea8ff;
    --primary-strong: #93bfff;
    --primary-soft: #14233d;
    --primary-ink: #071a3a;
    --accent: #f2a649;
    --accent-soft: #3a2a13;
    --star: #f5b544;
    --danger: #ff8f7a;
    --danger-soft: #3b1b16;
    --ok: #5fd39a;
    --ok-soft: #12301f;
    --wa: #46cf86;
    --ring: rgba(110, 168, 255, .32);
    --glass: rgba(14, 19, 22, .82);
    --shadow-sm: none;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow-lg: 0 12px 32px -12px rgba(0, 0, 0, .6);
    color-scheme: dark;
  }


/* ============ الأساس ============ */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--top-h) + 16px); }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh; overflow-x: clip;
  background: var(--bg); color: var(--text);
  font: 15.5px/1.6 "IBM Plex Sans Arabic", system-ui, -apple-system, "Segoe UI", Tahoma, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-wrap: anywhere;
}
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-strong); }
h1, h2, h3 { line-height: 1.3; margin: 0; letter-spacing: -.01em; }
h1 { font-size: 1.625rem; font-weight: 700; }
h2 { font-size: 1rem; font-weight: 600; }
h3 { font-size: 1rem; font-weight: 600; }
p { margin: 0; }
img { max-width: 100%; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.pre { white-space: pre-wrap; color: var(--text-2); }
.grow { flex: 1; min-width: 0; }
.danger-text { color: var(--danger) !important; }
:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; border-radius: 8px; }
.i { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.i.end { margin-inline-start: auto; color: var(--muted); width: 18px; height: 18px; }

/* ============ الهيكل ============ */
.side { display: none; }
.shell { min-width: 0; }
.top {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 10px;
  min-height: calc(var(--top-h) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 16px 0;
  background: var(--glass); border-bottom: 1px solid var(--border);
  -webkit-backdrop-filter: saturate(160%) blur(14px); backdrop-filter: saturate(160%) blur(14px);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 700; }
.brand:hover { color: var(--text); }
.brand img { width: auto; max-width: 120px; object-fit: contain; border-radius: 10px; }
.brand-top b { font-size: 1rem; }
.top-title { font-size: 1rem; font-weight: 600; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-back { margin-inline-start: -8px; }

.wrap { max-width: 760px; margin: 0 auto; padding: 16px 16px 24px; }
.is-wide .wrap { max-width: 1200px; }
.is-wide .wrap:has(.detail-grid) { max-width: 1080px; }
.is-app .wrap { padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 24px); }

/* الشريط السفلي (موبايل) */
.bottom {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 50;
  display: flex; align-items: stretch; justify-content: center;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom)); padding: 0 6px env(safe-area-inset-bottom);
  background: var(--glass); border-top: 1px solid var(--border);
  -webkit-backdrop-filter: saturate(160%) blur(14px); backdrop-filter: saturate(160%) blur(14px);
}
.bottom a {
  flex: 1; min-width: 0; max-width: 130px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--muted); font-size: .75rem; font-weight: 500; white-space: nowrap;
}
.bottom a span { display: grid; place-items: center; width: 52px; height: 30px; border-radius: 999px; transition: background .2s, color .2s; }
.bottom a .i { width: 22px; height: 22px; }
.bottom a.on { color: var(--primary); font-weight: 600; }
.bottom a.on span { background: var(--primary-soft); }
.bottom a.fab span { width: 46px; height: 46px; margin-top: -18px; border-radius: 16px; background: var(--primary); color: var(--primary-ink); box-shadow: 0 8px 20px -6px rgba(37, 99, 235, .55); }
.bottom a.fab.on span { background: var(--primary-strong); }

/* الكمبيوتر: قائمة جانبية */
@media (min-width: 768px) {
  .is-app .side {
    display: flex; flex-direction: column; gap: 4px;
    position: fixed; inset-block: 0; inset-inline-start: 0; z-index: 45; width: var(--side-cur, var(--side-w));
    padding: 18px 14px 14px; background: var(--surface); border-inline-end: 1px solid var(--border);
    overflow-y: auto; scrollbar-width: thin;
  }
  .is-app .shell { margin-inline-start: var(--side-cur, var(--side-w)); transition: margin .2s ease; }
  .is-app .bottom, .is-app .brand-top, .is-app .top-back { display: none; }
  .is-app .top { padding-inline: 32px; gap: 16px; }
  .is-app .top-page { display: block; flex: 1; font-weight: 700; font-size: 1rem; letter-spacing: -.01em; }
  .is-app .top-title { display: none; }
  .is-app .wrap { padding: 24px 32px 40px; }
  .side .brand { padding: 2px 8px 16px; margin-bottom: 4px; border-bottom: 1px solid var(--border); }
  .side .brand span { display: flex; flex-direction: column; line-height: 1.35; min-width: 0; }
  .side .brand b { font-size: 1rem; }
  .side .brand small { font-weight: 400; color: var(--muted); font-size: .75rem; }
  .side-cta { margin: 10px 0 12px; min-height: 46px; border-radius: 12px; }
  .side-cta.on { background: var(--primary-strong); }
  .side-nav { display: flex; flex-direction: column; gap: 2px; }
  .side-sec { padding: 12px 12px 6px; font-size: .75rem; font-weight: 700; color: var(--muted); letter-spacing: .04em; }
  .side-nav a {
    position: relative; display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 10px; border-radius: 12px;
    color: var(--text-2); font-weight: 500; font-size: .875rem; transition: background .15s, color .15s;
  }
  .side-ic { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; color: var(--muted); transition: background .15s, color .15s; }
  .side-ic .i { width: 19px; height: 19px; }
  .side-nav a:hover { background: var(--surface-2); color: var(--text); }
  .side-nav a:hover .side-ic { color: var(--text); }
  .side-nav a.on { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
  .side-nav a.on .side-ic { background: var(--primary); color: var(--primary-ink); box-shadow: 0 4px 10px -4px rgba(37, 99, 235, .6); }
  .side-nav a.on::before { content: ""; position: absolute; inset-inline-start: -14px; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; background: var(--primary); }
  .side-foot { margin-top: auto; display: flex; align-items: center; gap: 4px; padding: 8px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); }
  .side-user { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 2px; border-radius: 10px; color: var(--text); }
  .side-user:hover { color: var(--primary); }
  .side-user > span:last-child { display: flex; flex-direction: column; line-height: 1.35; min-width: 0; }
  .side-user b { font-size: .875rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .side-user small { color: var(--muted); font-size: .75rem; }
  .side-foot form { margin: 0; }
  .side-foot .icon-btn { width: 38px; height: 38px; color: var(--muted); }
  .side-foot .icon-btn:hover { color: var(--danger); background: var(--danger-soft); }
}

/* الشريط العلوي */
.top-page { display: none; }
.scrolled .top { box-shadow: 0 1px 0 var(--border), 0 8px 24px -16px rgba(16, 24, 40, .25); }

/* ============ عناصر عامة ============ */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r);
  padding: var(--card-pad); margin: 0 0 14px; box-shadow: var(--shadow);
}
.card-title { display: flex; align-items: center; gap: 8px; font-size: 1rem; font-weight: 600; margin-bottom: 12px; }
.card-title .i { color: var(--primary); }
.empty { text-align: center; color: var(--muted); padding: 36px 20px; display: grid; justify-items: center; gap: 12px; grid-column: 1 / -1; }
.empty .i, .empty-i { width: 40px; height: 40px; color: var(--border-2); stroke-width: 1.5; }
.page-head { margin: 4px 0 16px; }
.page-head h1 + p { margin-top: 2px; }
.page-head.row { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.hint { font-size: .75rem; color: var(--muted); margin-top: -4px; }
.link-more { display: inline-flex; align-items: center; gap: 4px; margin-top: 10px; font-size: .875rem; font-weight: 500; }
.link-more .i { width: 16px; height: 16px; }
.ok-note { display: flex; align-items: center; gap: 8px; color: var(--ok); font-weight: 500; }

.avatar {
  display: inline-grid; place-items: center; flex: none;
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--primary-soft); color: var(--primary); font-weight: 700; font-size: 1rem;
}
.avatar-lg { width: 60px; height: 60px; font-size: 1.625rem; }
a.avatar:hover { color: var(--primary); }
img.avatar { object-fit: cover; background: var(--surface-2); padding: 0; }
.avatar-xs { width: 18px; height: 18px; font-size: .75rem; }
.avatar-md { width: 44px; height: 44px; font-size: 1rem; }
.avatar-xl { width: 84px; height: 84px; font-size: 1.625rem; box-shadow: 0 0 0 4px var(--surface), 0 0 0 5px var(--border); }
.avatar-pick { position: relative; display: block; margin: 0; cursor: pointer; border-radius: 50%; flex: none; }
.avatar-pick input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.avatar-cam { position: absolute; bottom: 0; inset-inline-start: 0; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--primary); color: var(--primary-ink); box-shadow: 0 0 0 3px var(--surface); }
.avatar-cam .i { width: 16px; height: 16px; }
.avatar-pick:has(input:focus-visible) { outline: 3px solid var(--ring); outline-offset: 3px; }
.avatar-edit { margin: 0; }
.avatar-edit.is-busy { opacity: .5; pointer-events: none; }
.avatar-actions { margin-top: 10px; }
.avatar-actions form { margin: 0; }
.avatar-actions label.btn { margin: 0; }

.badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px;
  font-size: .75rem; font-weight: 500; line-height: 1.7; white-space: nowrap;
  background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border);
}
.badge .i { width: 13px; height: 13px; }
.badge-prod { background: var(--primary-soft); color: var(--primary); border-color: transparent; }
.badge-warn { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.badge-off { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.stars { color: var(--star); font-size: .875rem; font-weight: 600; }
.stars-lg { color: var(--star); letter-spacing: 2px; }

.flash { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: var(--r-sm); margin-bottom: 14px; font-weight: 500; font-size: .875rem; }
.flash .i { margin-top: 2px; }
.flash-ok { background: var(--ok-soft); color: var(--ok); }
.flash-err { background: var(--danger-soft); color: var(--danger); }

/* ============ الأزرار ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: var(--r-sm);
  border: 1px solid var(--border-2); background: var(--surface); color: var(--text);
  font: inherit; font-weight: 600; font-size: .875rem; cursor: pointer; text-align: center; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .1s, box-shadow .15s;
}
.btn:hover { background: var(--surface-2); color: var(--text); }
.btn:active { transform: scale(.98); }
.btn-primary {
  background: var(--primary); border-color: var(--primary); color: var(--primary-ink);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .18), 0 1px 2px rgba(37, 99, 235, .2), 0 4px 12px -4px rgba(37, 99, 235, .45);
}
.btn-primary:hover { background: var(--primary-strong); border-color: var(--primary-strong); color: var(--primary-ink); }
.btn-wa { background: var(--wa); border-color: var(--wa); color: #fff; }
.btn-wa:hover { background: var(--wa); color: #fff; filter: brightness(.95); }
.btn-ghost { background: transparent; border-color: var(--border); }
.btn-danger { background: var(--danger-soft); border-color: transparent; color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); color: var(--danger); filter: brightness(.97); }
.btn-block { display: flex; width: 100%; }
.btn-lg { min-height: 50px; font-size: 1rem; }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: .875rem; border-radius: 10px; }
.btn-sm .i { width: 16px; height: 16px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

.icon-btn {
  position: relative; display: inline-grid; place-items: center; flex: none;
  width: 44px; height: 44px; border: 0; border-radius: 12px;
  background: transparent; color: var(--text-2); cursor: pointer; transition: background .15s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn[aria-expanded="true"] { background: var(--primary-soft); color: var(--primary); }
.icon-btn.sm { width: 40px; height: 40px; border-radius: 50%; background: var(--surface); border: 1px solid var(--border); color: var(--primary); }
.icon-btn.sm.wa { color: var(--wa); }
.icon-btn .dot { position: absolute; top: 9px; inset-inline-end: 9px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); border: 2px solid var(--surface); }

/* ============ البحث ============ */
.hero { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 4px 0 14px; }
.hero h1 { font-size: 1.25rem; }
.search-sticky {
  position: sticky; top: calc(var(--top-h) + env(safe-area-inset-top)); z-index: 30;
  margin: 0 -16px; padding: 8px 16px 6px; background: var(--bg);
}
.searchbar {
  display: flex; align-items: center; gap: 2px;
  background: var(--surface); border: 1px solid var(--border-2); border-radius: 14px;
  padding: 0 4px 0 6px; box-shadow: var(--shadow); transition: border-color .15s, box-shadow .15s;
}
.searchbar:focus-within { border-color: var(--primary); box-shadow: 0 0 0 4px var(--ring); }
.searchbar > .i { width: 22px; height: 22px; margin-inline: 10px 2px; color: var(--muted); }
.searchbar input#q {
  flex: 1; min-width: 0; margin: 0; min-height: 52px; border: 0; border-radius: 0; box-shadow: none;
  background: transparent; color: var(--text); font: inherit; font-size: 1rem; padding: 0 6px; outline: none;
  -webkit-appearance: none; appearance: none;
}
.searchbar input#q::placeholder { color: var(--muted); }

.chips {
  display: flex; gap: 8px; overflow-x: auto; margin: 0 -16px; padding: 10px 16px 4px;
  scrollbar-width: none; scroll-snap-type: x proximity; overscroll-behavior-x: contain;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; scroll-snap-align: start; min-height: 38px; padding: 0 16px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2);
  font: inherit; font-size: .875rem; font-weight: 500; cursor: pointer; white-space: nowrap;
  transition: background .15s, color .15s, border-color .15s;
}
.chip:hover { border-color: var(--border-2); }
.chip.on { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.chip { display: inline-flex; align-items: center; gap: 6px; }
.chip .i { width: 17px; height: 17px; }
.chip small { font-size: .75rem; font-weight: 600; opacity: .7; font-variant-numeric: tabular-nums; }
.sub-chips { padding-top: 8px; }
.sub-chips .chip { min-height: 34px; padding: 0 13px; font-size: .875rem; background: var(--surface-2); border-color: transparent; }
.sub-chips .chip.on { background: var(--primary-soft); color: var(--primary); border-color: var(--primary); font-weight: 600; }

.filters {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 12px; align-items: end; margin-top: 10px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 14px; box-shadow: var(--shadow);
}
.filters label { margin: 0; font-size: .75rem; color: var(--muted); }
.filters select { margin-top: 4px; }
.filters .check { color: var(--text); font-size: .875rem; }
.meta-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; min-height: 36px; font-size: .875rem; color: var(--muted); padding: 6px 2px; }

/* ============ بطاقات النتائج ============ */
.list { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); }
.item {
  display: flex; flex-direction: column; min-width: 0;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r);
  box-shadow: var(--shadow); overflow: hidden; transition: border-color .15s, box-shadow .15s;
}
.item:hover { border-color: var(--border-2); box-shadow: var(--shadow-lg); }
.item.is-off { opacity: .65; }
.item-main { flex: 1; display: block; padding: 14px 16px 12px; color: inherit; }
.item-main:hover { color: inherit; }
.item-top { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.item-top .stars { margin-inline-start: auto; }
.item h3 { font-size: 1rem; }
.item-co { color: var(--muted); font-size: .875rem; margin-top: 1px; }
.item-meta { display: flex; align-items: center; gap: 5px; color: var(--muted); font-size: .875rem; margin-top: 6px; }
.item-meta .i { width: 15px; height: 15px; }
.item-price { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 8px; margin-top: 10px; }
.item-price b { font-size: 1.25rem; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.item-price b.none { font-size: 1rem; font-weight: 500; color: var(--muted); }
.item-price span { color: var(--muted); font-size: .875rem; }
.item-price .badge { margin-inline-start: auto; }
.item-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 8px 10px 8px 16px; border-top: 1px solid var(--border); background: var(--surface-2);
  min-height: 56px;
}
.item-by { display: flex; align-items: center; gap: 5px; font-size: .75rem; color: var(--muted); min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-by .i { width: 14px; height: 14px; }
.item-by .avatar-xs { flex: none; }
.item-by.mine { color: var(--primary); font-weight: 500; }
.item-actions { display: flex; gap: 6px; flex: none; }
.skeleton { min-height: 170px; background: linear-gradient(90deg, var(--surface) 0%, var(--surface-2) 50%, var(--surface) 100%); background-size: 200% 100%; animation: shimmer 1.2s infinite linear; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ============ التفاصيل ============ */
.detail-head { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.detail h1 { font-size: 1.625rem; }
.detail .muted { margin-top: 2px; }
.detail .item-meta { margin-top: 8px; font-size: .875rem; }
.price-box {
  margin: 16px 0; padding: 14px 16px; border-radius: var(--r-sm);
  background: var(--primary-soft); display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px;
}
.price-label { width: 100%; font-size: .75rem; color: var(--primary); font-weight: 600; }
.price-big { font-size: 1.625rem; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; line-height: 1.2; }
.price-big small { font-size: 1rem; font-weight: 400; color: var(--muted); }
.price-box .badge { margin-inline-start: auto; background: var(--surface); }
.actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; margin-bottom: 8px; }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; margin: 0; }
.facts > div { padding: 10px 0; border-bottom: 1px solid var(--border); min-width: 0; }
.facts dt { font-size: .75rem; color: var(--muted); }
.facts dd { margin: 2px 0 0; font-weight: 500; }
.facts dd[dir="ltr"] { text-align: right; }
.sub { font-size: .875rem; margin: 16px 0 4px; color: var(--muted); font-weight: 600; }
.by-row { display: flex; align-items: center; gap: 12px; }
.timeline { list-style: none; margin: 0; padding: 0 18px 0 0; border-inline-start: 2px solid var(--border); }
.timeline li { position: relative; padding: 0 0 14px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; }
.timeline li::before { content: ""; position: absolute; inset-inline-start: -25px; top: 7px; width: 10px; height: 10px; border-radius: 50%; background: var(--border-2); border: 2px solid var(--surface); }
.timeline li.now::before { background: var(--primary); }
.timeline li .small { width: 100%; }
.timeline li:last-child { padding-bottom: 0; }

/* ============ النماذج ============ */
label { display: block; margin-bottom: 14px; font-size: .875rem; font-weight: 500; color: var(--text-2); }
label em { color: var(--danger); font-style: normal; }
.field-label { font-size: .875rem; font-weight: 500; color: var(--text-2); margin-bottom: 6px; }
input:not([type=checkbox]):not([type=radio]), select, textarea {
  display: block; width: 100%; margin-top: 6px;
  min-height: 46px; padding: 10px 13px; border-radius: var(--r-sm);
  border: 1px solid var(--border-2); background: var(--surface); color: var(--text);
  font: inherit; font-weight: 400; font-size: 1rem; box-shadow: var(--shadow-sm);
  transition: border-color .15s, box-shadow .15s;
}
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .8; }
input:hover, select:hover, textarea:hover { border-color: var(--muted); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px var(--ring); }
[aria-invalid="true"] { border-color: var(--danger) !important; }
select {
  -webkit-appearance: none; appearance: none; padding-inline-end: 13px; padding-inline-start: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23667085' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-size: 18px; background-position: left 12px center;
}
textarea { resize: vertical; min-height: 90px; line-height: 1.6; }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; margin: 0; cursor: pointer; }
.check input { width: 20px; height: 20px; margin: 0; accent-color: var(--primary); }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 12px; }
select { min-width: 0; text-overflow: ellipsis; }
.field-err { display: block; color: var(--danger); font-size: .75rem; margin-top: 5px; font-weight: 500; }
fieldset { border: 0; margin: 0; min-width: 0; }
.form legend {
  float: right; width: 100%; display: flex; align-items: center; gap: 8px;
  font-weight: 600; font-size: 1rem; color: var(--text); padding: 0; margin-bottom: 14px;
}
.form legend + * { clear: both; }
.form legend .i { color: var(--primary); }

.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 4px; margin-bottom: 14px; }
.seg label { margin: 0; position: relative; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; border-radius: 9px; cursor: pointer; font-weight: 500; color: var(--text-2); transition: background .15s, box-shadow .15s; }
.seg span small { color: var(--muted); font-weight: 400; }
.seg input:checked + span { background: var(--surface); color: var(--primary); font-weight: 600; box-shadow: var(--shadow); }
.seg input:focus-visible + span { outline: 3px solid var(--ring); }

.switch { display: flex; align-items: flex-start; gap: 12px; margin: 0; padding: 12px 0; border-top: 1px solid var(--border); cursor: pointer; position: relative; }
.switch:first-of-type { border-top: 0; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch-ui { flex: none; position: relative; width: 44px; height: 26px; margin-top: 2px; border-radius: 999px; background: var(--border-2); transition: background .2s; }
.switch-ui::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: inset-inline-start .2s; }
.switch input:checked + .switch-ui { background: var(--primary); }
.switch input:checked + .switch-ui::after { inset-inline-start: 21px; }
.switch input:focus-visible + .switch-ui { outline: 3px solid var(--ring); outline-offset: 2px; }
.switch span:last-child { display: flex; flex-direction: column; }
.switch b { font-weight: 600; color: var(--text); }
.switch small { color: var(--muted); font-weight: 400; font-size: .75rem; }

.role-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 8px; }
.role-pick label { margin: 0; position: relative; }
.role-pick input { position: absolute; opacity: 0; pointer-events: none; }
.role-pick span { display: flex; flex-direction: column; gap: 2px; height: 100%; padding: 12px; border-radius: var(--r-sm); border: 1.5px solid var(--border); cursor: pointer; transition: border-color .15s, background .15s; }
.role-pick span .i { color: var(--muted); margin-bottom: 4px; }
.role-pick b { color: var(--text); }
.role-pick small { color: var(--muted); font-weight: 400; font-size: .75rem; line-height: 1.45; }
.role-pick input:checked + span { border-color: var(--primary); background: var(--primary-soft); }
.role-pick input:checked + span .i { color: var(--primary); }
.role-pick input:focus-visible + span { outline: 3px solid var(--ring); }

.save-bar {
  position: sticky; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 10px); z-index: 20;
  display: flex; gap: 8px; padding: 10px; margin: 4px 0 14px;
  background: var(--glass); border: 1px solid var(--border); border-radius: var(--r); box-shadow: var(--shadow-lg);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
}
.save-bar .btn-primary { flex: 1; }
.danger-zone { display: flex; align-items: center; justify-content: space-between; gap: 12px; border-color: var(--danger-soft); }

/* ============ الإعدادات واللوحة ============ */
.tabs {
  display: flex; gap: 4px; overflow-x: auto; margin: 0 -16px 16px; padding: 0 16px;
  border-bottom: 1px solid var(--border); scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs a {
  display: flex; align-items: center; gap: 7px; flex: none; min-height: 46px; padding: 0 12px;
  color: var(--muted); font-weight: 500; font-size: .875rem; border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabs a .i { width: 18px; height: 18px; }
.tabs a:hover { color: var(--text); }
.tabs a.on { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 14px; }
.kpis-3 { grid-template-columns: repeat(3, 1fr); }
.kpi {
  display: flex; flex-direction: column; gap: 2px; padding: 16px; min-width: 0;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); box-shadow: var(--shadow);
}
.kpi b { font-size: 1.625rem; font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; color: var(--text); }
.kpi span:last-child { font-size: .75rem; color: var(--muted); }
.kpi-i { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: var(--primary-soft); color: var(--primary); margin-bottom: 8px; }
.kpi-i.ok { background: var(--ok-soft); color: var(--ok); }
.kpi-i.warn { background: var(--accent-soft); color: var(--accent); }
.kpis-3 .kpi { text-align: center; align-items: center; padding: 14px 8px; }
@media (max-width: 599px) {
  .kpis:not(.kpis-3) { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpis:not(.kpis-3) .kpi {
    display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 10px; align-items: center; padding: 12px;
  }
  .kpis:not(.kpis-3) .kpi-i { grid-row: 1 / 3; margin: 0; }
  .kpis:not(.kpis-3) .kpi b { font-size: 1.25rem; }
  .kpis:not(.kpis-3) .kpi span:last-child { font-size: .75rem; line-height: 1.35; }
  .kpis:not(.kpis-3) .kpi:last-child:nth-child(odd) { grid-column: 1 / -1; }
}

.dash-grid, .settings-grid { display: grid; gap: 0 14px; grid-template-columns: minmax(0, 1fr); }
.span2 { grid-column: 1 / -1; }

.bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.bars li { display: grid; grid-template-columns: minmax(80px, 30%) 1fr auto; align-items: center; gap: 10px; }
.bar-label { font-size: .875rem; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { height: 10px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.bar-fill { display: block; height: 100%; border-radius: 4px; background: var(--primary); }
.bar-val { font-size: .875rem; font-weight: 600; font-variant-numeric: tabular-nums; min-width: 2ch; text-align: left; }

.table-wrap { overflow-x: auto; margin: 10px calc(var(--card-pad) * -1) -6px; padding: 0 var(--card-pad); }
.table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.table th { text-align: right; font-weight: 600; font-size: .75rem; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table tr:last-child td { border-bottom: 0; }
.num-cell { font-variant-numeric: tabular-nums; }

.people, .feed, .rows { list-style: none; margin: 0; padding: 0; }
.people li { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.people li:last-child { border-bottom: 0; }
.people li.is-off { opacity: .55; }
.people li.is-sel { background: var(--primary-soft); margin: 0 calc(var(--card-pad) * -1); padding-inline: var(--card-pad); }
.people .badge { margin-top: 4px; }
.people .num { text-align: center; flex: none; }
.people .num b { display: block; font-size: 1.25rem; font-variant-numeric: tabular-nums; }
.people .num small { color: var(--muted); font-size: .75rem; }
.feed li { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: .875rem; align-items: flex-start; }
.feed li:last-child { border-bottom: 0; }
.feed time { flex: none; white-space: nowrap; }
.feed-dot { flex: none; width: 10px; height: 10px; border-radius: 50%; margin-top: 7px; background: var(--border-2); }
.feed-dot.source_add { background: var(--ok); }
.feed-dot.source_edit { background: var(--primary); }
.feed-dot.source_delete { background: var(--danger); }
.feed-dot.settings, .feed-dot.product, .feed-dot.user_add, .feed-dot.user_edit { background: var(--accent); }
.rows li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.rows li:last-child { border-bottom: 0; }
.rows li.is-off { opacity: .6; }
.rows.compact li { padding: 9px 0; flex-wrap: nowrap; }
.rows.compact a { color: var(--text); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-form { display: flex; gap: 8px; flex: 1 1 280px; align-items: center; }
.row-form input { margin: 0 !important; }
.row-form .sort { width: 70px !important; flex: none; text-align: center; }
.row-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.row-actions form { margin: 0; }
.inline-add { display: flex; gap: 10px; align-items: flex-end; }
.inline-add label { flex: 1; margin: 0; }
.filter-row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.filter-row label { flex: 1 1 160px; margin: 0; }
.pager { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 14px; }

.profile { display: flex; align-items: center; gap: 16px; }
.profile h1 { font-size: 1.25rem; }
.menu { padding: 4px 0; }
.menu-item {
  display: flex; align-items: center; gap: 14px; width: 100%; min-height: 56px; padding: 0 18px;
  border: 0; border-bottom: 1px solid var(--border); background: none; color: var(--text);
  font: inherit; font-weight: 500; text-align: start; cursor: pointer;
}
.menu-item:hover { background: var(--surface-2); color: var(--text); }
.menu-item:last-child { border-bottom: 0; }
.menu-item > .i:first-child { color: var(--primary); }
.menu-item.muted { font-weight: 400; font-size: .875rem; color: var(--muted); cursor: default; }
.menu-item.muted:hover { background: none; }
details.card > summary { display: flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 600; min-height: 28px; list-style: none; }
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary .i { color: var(--primary); }
details.card > summary::after { content: ""; margin-inline-start: auto; width: 8px; height: 8px; border-inline-start: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(135deg); transition: transform .2s; }
details[open].card > summary::after { transform: rotate(45deg); }
details[open].card > summary { margin-bottom: 16px; }

/* ============ المقاسات ============ */
@media (max-width: 380px) {
  .grid2, .role-pick { grid-template-columns: 1fr; }
  .wrap { padding-inline: 12px; }
  .search-sticky, .chips, .tabs { margin-inline: -12px; padding-inline: 12px; }
  :root { --card-pad: 16px; }
  .kpi b { font-size: 1.625rem; }
  .bottom a span { width: 44px; }
}
@media (max-width: 599px) {
  .hide-sm { display: none !important; }
  .danger-zone { flex-direction: column; align-items: stretch; }
}
@media (min-width: 600px) {
  .filters { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .filters .check { grid-column: span 2; }
  .filters #fReset { justify-self: start; grid-column: span 2; }
  .hero h1 { font-size: 1.625rem; }
}
@media (min-width: 900px) {
  .dash-grid, .settings-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .users-grid { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); align-items: start; }
  .settings-grid > .card:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .detail-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); gap: 0 16px; align-items: start; }
  .detail-grid > .detail { position: sticky; top: calc(var(--top-h) + env(safe-area-inset-top) + 16px); max-height: calc(100vh - var(--top-h) - 32px); overflow-y: auto; }
  .form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; align-items: start; }
}
@media (min-width: 768px) {
  .search-sticky { margin-inline: -32px; padding-inline: 32px; }
  .chips, .tabs { margin-inline: 0; padding-inline: 0; }
  .save-bar { bottom: 16px; }
  .wrap:has(.form-page) { max-width: 1100px; }
}
@media (hover: none) {
  .item:hover { box-shadow: var(--shadow); border-color: var(--border); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
/* ============ معالج الإضافة ============ */
.wizard { max-width: 640px; margin: 0 auto; }
.wiz-head { margin: 4px 0 16px; }
.wiz-head h1 { margin-bottom: 14px; }
.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; counter-reset: s; }
.steps li { position: relative; display: flex; align-items: center; gap: 8px; padding: 0 0 10px; font-size: .875rem; font-weight: 500; color: var(--muted); border-bottom: 3px solid var(--border); transition: color .2s, border-color .2s; }
.steps li span { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--surface-3); color: var(--muted); font-size: .75rem; font-weight: 700; transition: background .2s, color .2s; }
.steps li.on { color: var(--text); border-color: var(--primary); font-weight: 600; }
.steps li.on span { background: var(--primary); color: var(--primary-ink); }
.steps li.done { color: var(--primary); border-color: var(--primary); }
.steps li.done span { background: var(--primary-soft); color: var(--primary); }
.wizard[data-step="1"] .wiz-step[data-step="2"], .wizard[data-step="2"] .wiz-step[data-step="1"] { display: none; }
.wiz-step { animation: wizIn .25s ease; }
@keyframes wizIn { from { opacity: 0; transform: translateY(6px); } }
.wiz-actions {
  position: sticky; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 10px); z-index: 20;
  display: flex; gap: 8px; margin: 18px calc(var(--card-pad) * -.5) 0; padding: 8px;
  background: var(--glass); border: 1px solid var(--border); border-radius: var(--r); box-shadow: var(--shadow-lg);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
}
@media (min-width: 768px) { .wiz-actions { bottom: 16px; } }
.wiz-actions .btn-primary { flex: 1; }
.wiz-actions .btn-primary .i { transform: none; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.type-pick { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 14px; }
.type-pick label { margin: 0; position: relative; }
.type-pick input { position: absolute; opacity: 0; pointer-events: none; }
.type-pick span {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 64px;
  border: 1.5px solid var(--border); border-radius: var(--r-sm); background: var(--surface); color: var(--text-2);
  font-size: .875rem; font-weight: 500; cursor: pointer; transition: border-color .15s, background .15s, color .15s;
}
.type-pick span .i { color: var(--muted); }
.type-pick input:checked + span { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.type-pick input:checked + span .i { color: var(--primary); }
.type-pick input:focus-visible + span { outline: 3px solid var(--ring); }

.wiz-sec { padding: 4px 0 6px; }
.wiz-sec + .wiz-sec { border-top: 1px solid var(--border); padding-top: 16px; margin-top: 4px; }
.wiz-sec-h { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; font-size: .75rem; font-weight: 700; color: var(--primary); letter-spacing: .01em; }
.wiz-sec-h .i { width: 16px; height: 16px; }
.opt { font-weight: 400; color: var(--muted); font-size: .75rem; }
.pill-pick { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.pill-pick label { margin: 0; position: relative; }
.pill-pick input { position: absolute; opacity: 0; pointer-events: none; }
.pill-pick span {
  display: inline-flex; align-items: center; gap: 6px; min-height: 42px; padding: 0 15px; border-radius: 999px;
  border: 1px solid var(--border-2); background: var(--surface); color: var(--text-2);
  font-size: .875rem; font-weight: 500; cursor: pointer; transition: background .15s, border-color .15s, color .15s;
}
.pill-pick span .i { width: 17px; height: 17px; color: var(--muted); }
.pill-pick span:hover { border-color: var(--muted); }
.pill-pick input:checked + span { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); font-weight: 600; }
.pill-pick input:checked + span .i { color: var(--primary-ink); }
.pill-pick input:focus-visible + span { outline: 3px solid var(--ring); outline-offset: 2px; }
.city-other { display: none; }
.city-sec:has(input[value="__other"]:checked) .city-other { display: block; }
.switch-inline { border-top: 0; padding: 4px 0 14px; align-items: center; }
.switch-inline .switch-ui { margin-top: 0; }
.switch-inline b { font-weight: 500; color: var(--text-2); font-size: .875rem; }
.tel-input { font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.dup { margin-top: 4px; padding: 12px 14px; border-radius: var(--r-sm); background: var(--accent-soft); color: var(--text); font-size: .875rem; }
.dup b { color: var(--accent); }
.dup ul { margin: 6px 0; padding-inline-start: 18px; }

.psearch { display: flex; align-items: center; gap: 8px; padding: 0 12px; margin: 12px 0; border: 1px solid var(--border-2); border-radius: var(--r-sm); background: var(--surface); }
.psearch:focus-within { border-color: var(--primary); box-shadow: 0 0 0 4px var(--ring); }
.psearch .i { color: var(--muted); }
.psearch input { margin: 0 !important; border: 0 !important; box-shadow: none !important; background: transparent !important; padding-inline: 0 !important; }
.ptiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 150px), 1fr)); gap: 8px; }
.ptile { margin: 0; position: relative; }
.ptile input { position: absolute; opacity: 0; pointer-events: none; }
.ptile span {
  position: relative; display: flex; align-items: center; gap: 10px; min-height: 56px; padding: 10px 12px; padding-inline-end: 36px;
  border: 1.5px solid var(--border); border-radius: var(--r-sm); background: var(--surface); cursor: pointer;
  transition: border-color .15s, background .15s;
}
.ptile span > .i { color: var(--primary); flex: none; }
.ptile b { font-weight: 500; font-size: .875rem; line-height: 1.35; color: var(--text); }
.ptile .tick { position: absolute; top: 6px; inset-inline-end: 6px; display: none; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--primary); color: var(--primary-ink); font-style: normal; box-shadow: var(--shadow); }
.ptile .tick .i { width: 14px; height: 14px; stroke-width: 2.6; }
.ptile input:checked + span { border-color: var(--primary); background: var(--primary-soft); }
.ptile input:checked + span b { font-weight: 600; }
.ptile input:checked + span .tick { display: grid; }
.ptile input:focus-visible + span { outline: 3px solid var(--ring); }
.shake { animation: shake .35s; }
@keyframes shake { 25% { transform: translateX(6px); } 50% { transform: translateX(-6px); } 75% { transform: translateX(3px); } }

.complete {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; margin-bottom: 10px; border-radius: var(--r-sm);
  background: var(--accent-soft); color: var(--text); border: 1px dashed var(--accent);
}
.complete:hover { color: var(--text); filter: brightness(.98); }
.complete > .i:first-child { color: var(--accent); }
.complete span { display: flex; flex-direction: column; }
.complete small { color: var(--muted); font-size: .75rem; }

.pgroups { display: grid; gap: 8px; }
.pgroup { border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface); overflow: hidden; }
.pgroup > summary, .cat-card > summary {
  display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 8px 14px; cursor: pointer; list-style: none;
}
.pgroup > summary::-webkit-details-marker, .cat-card > summary::-webkit-details-marker { display: none; }
.pgroup > summary::after, .cat-card > summary::after { content: ""; flex: none; width: 8px; height: 8px; margin-inline-start: auto; border-inline-start: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(135deg); transition: transform .2s; }
.pgroup[open] > summary::after, .cat-card[open] > summary::after { transform: rotate(45deg); }
.pgroup[open] > summary { border-bottom: 1px solid var(--border); background: var(--surface-2); }
.pg-ic { display: grid; place-items: center; flex: none; width: 40px; height: 40px; border-radius: 12px; background: var(--primary-soft); color: var(--primary); }
.pg-name { display: flex; flex-direction: column; line-height: 1.35; min-width: 0; }
.pg-name b { font-weight: 600; color: var(--text); }
.pg-name small { color: var(--muted); font-size: .75rem; }
.pg-sel { display: grid; place-items: center; min-width: 24px; height: 24px; padding: 0 7px; border-radius: 999px; background: var(--primary); color: var(--primary-ink); font-size: .75rem; font-weight: 700; }
.pgroup .ptiles { padding: 4px 10px 10px; }
.pg-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 10px 6px; }
.pg-status { font-size: .75rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.pg-all {
  display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 12px 0 14px; border-radius: 999px;
  border: 1px solid var(--border-2); background: var(--surface); color: var(--text-2);
  font: inherit; font-size: .875rem; font-weight: 600; cursor: pointer; transition: background .15s, border-color .15s, color .15s;
}
.pg-all:hover { border-color: var(--primary); color: var(--primary); }
.pg-box { display: grid; place-items: center; width: 18px; height: 18px; border-radius: 5px; border: 1.5px solid var(--border-2); background: var(--surface); transition: background .15s, border-color .15s; }
.pg-box .i { width: 12px; height: 12px; stroke-width: 3; opacity: 0; color: var(--primary-ink); }
.pg-all.some .pg-box { border-color: var(--primary); background: var(--primary-soft); }
.pg-all.some .pg-box::after { content: ""; width: 8px; height: 2px; border-radius: 1px; background: var(--primary); }
.pg-all.some .pg-box .i { display: none; }
.pg-all[aria-pressed="true"] { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }
.pg-all[aria-pressed="true"] .pg-box { background: var(--primary); border-color: var(--primary); }
.pg-all[aria-pressed="true"] .pg-box .i { opacity: 1; }
.pgroup .ptile span { min-height: 50px; }

.prod-grid { align-items: start; }
@media (min-width: 900px) { .prod-grid { grid-template-columns: minmax(0, 4fr) minmax(0, 8fr); } .prod-grid > .card:first-child { position: sticky; top: calc(var(--top-h) + 16px); } }
.sub-details { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.sub-details > summary { display: flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 600; color: var(--primary); min-height: 36px; }
.sub-details[open] > summary { margin-bottom: 10px; }
.cat-list { display: grid; gap: 10px; min-width: 0; }
.cat-card { padding: 0; margin: 0; }
.cat-card.is-off .pg-ic { filter: grayscale(1); opacity: .6; }
.cat-card[open] > summary { border-bottom: 1px solid var(--border); }
.cat-card > :not(summary) { margin-inline: var(--card-pad); }
.cat-edit { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 14px; }
.cat-edit input[name=name] { flex: 1 1 180px; margin: 0 !important; }
.cat-edit select { flex: 0 1 150px; margin: 0 !important; }
.cat-edit .sort { width: 70px !important; flex: none; margin: 0 !important; text-align: center; }
.cat-actions { margin: 8px var(--card-pad) 0; }
.prod-rows { margin-bottom: 6px; }
.prod-rows li { flex-direction: column; align-items: stretch; gap: 8px; }
.prod-rows .row-form { flex: none; flex-wrap: wrap; }
.prod-rows .row-form input[name=name] { flex: 1 1 150px; }
.prod-rows .row-form .cat-sel { flex: 1 1 140px; margin: 0 !important; }
.prod-rows .row-actions { justify-content: flex-end; }
@media (min-width: 600px) { .prod-rows .row-form { flex-wrap: nowrap; } .prod-rows .row-form .cat-sel { flex: 0 1 170px; } }
.pgroup .ptiles { grid-template-columns: repeat(auto-fill, minmax(min(100%, 128px), 1fr)); }
.bars li { grid-template-columns: minmax(90px, 32%) 1fr auto; }
.bar-parts { grid-column: 1 / -1; margin-top: -6px; font-size: .75rem; color: var(--muted); }

/* ============ الشعار ============ */
.logo-pick { display: flex; gap: 14px; align-items: flex-start; padding-bottom: 14px; margin-bottom: 14px; border-bottom: 1px solid var(--border); }
.logo-preview { display: grid; place-items: center; flex: none; width: 84px; height: 84px; padding: 8px; border-radius: var(--r-sm); border: 1px dashed var(--border-2);
  background: repeating-conic-gradient(var(--surface-2) 0 25%, var(--surface) 0 50%) 50% / 14px 14px; }
.logo-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
.logo-pick .btn-row { margin-top: 8px; align-items: center; }
.file-btn { position: relative; overflow: hidden; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* ============ الصور ============ */
.media-card legend .media-count { font-weight: 400; margin-inline-start: 4px; }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 10px; }
.media-item, .media-add {
  position: relative; margin: 0; aspect-ratio: 1; border-radius: var(--r-sm); overflow: hidden;
}
.media-item { background: var(--surface-2); border: 1px solid var(--border); }
.media-item img { width: 100%; height: 100%; object-fit: cover; display: block; transition: opacity .15s, filter .15s; }
.media-item.is-del img { opacity: .35; filter: grayscale(1); }
.media-item.is-del { border-color: var(--danger); }
.media-del, .media-x {
  position: absolute; top: 6px; inset-inline-end: 6px; margin: 0; display: grid; place-items: center;
  width: 32px; height: 32px; border-radius: 50%; border: 0; cursor: pointer;
  background: rgba(16, 24, 40, .62); color: #fff; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.media-del input { position: absolute; opacity: 0; pointer-events: none; }
.media-del .i, .media-x .i { width: 16px; height: 16px; }
.media-item.is-del .media-del { background: var(--danger); }
.media-del:has(input:focus-visible) { outline: 3px solid var(--ring); }
.media-new { position: absolute; bottom: 6px; inset-inline-start: 6px; padding: 0 8px; border-radius: 999px; font-size: .75rem; font-weight: 600; background: var(--primary); color: var(--primary-ink); }
.media-add {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  border: 1.5px dashed var(--border-2); background: var(--surface-2); color: var(--primary);
  font-size: .875rem; font-weight: 600; cursor: pointer; transition: border-color .15s, background .15s;
}
.media-add:hover { border-color: var(--primary); background: var(--primary-soft); }
.media-add input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.media-add .i { width: 24px; height: 24px; }
.media-add:has(input:focus-visible) { outline: 3px solid var(--ring); }
.media-add.is-full { display: none; }
.media-add.is-busy { opacity: .6; pointer-events: none; }
@media (hover: hover) { .media-cam { display: none; } }

.item-thumb { float: left; position: relative; width: 76px; height: 76px; margin: 0 12px 6px 0; border-radius: 12px; overflow: hidden; background: var(--surface-2); border: 1px solid var(--border); }
.item-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.item-thumb small { position: absolute; bottom: 4px; left: 4px; min-width: 20px; padding: 0 5px; border-radius: 999px; background: rgba(16, 24, 40, .7); color: #fff; font-size: .75rem; font-weight: 600; text-align: center; line-height: 1.6; }
.item-main.has-img .item-top .stars { margin-inline-start: 0; }
.item-main.has-img::after { content: ""; display: block; clear: both; }

.detail.has-cover { padding-top: 0; overflow: hidden; }
.gallery { margin: 0 calc(var(--card-pad) * -1) 16px; }
.cover { position: relative; display: block; width: 100%; padding: 0; border: 0; cursor: zoom-in; background: var(--surface-2); aspect-ratio: 16 / 10; overflow: hidden; }
.cover img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .3s; }
.cover:hover img { transform: scale(1.02); }
.cover-count { position: absolute; bottom: 10px; left: 10px; display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; background: rgba(16, 24, 40, .65); color: #fff; font-size: .75rem; font-weight: 600; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.cover-count .i { width: 15px; height: 15px; }
.strip { display: flex; gap: 8px; overflow-x: auto; padding: 10px var(--card-pad) 0; scrollbar-width: none; }
.strip::-webkit-scrollbar { display: none; }
.strip button { flex: none; width: 64px; height: 64px; padding: 0; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; cursor: pointer; background: var(--surface-2); }
.strip img { width: 100%; height: 100%; object-fit: cover; display: block; }
.detail.has-cover .detail-head { margin-top: 0; }
.tools { margin-top: 4px; }
.tools .btn { flex: 1; }

.lb { width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: rgba(5, 8, 10, .94); color: #fff; }
.lb::backdrop { background: rgba(5, 8, 10, .94); }
.lb[open] { display: grid; place-items: center; }
.lb img { max-width: 100vw; max-height: 100dvh; object-fit: contain; user-select: none; -webkit-user-drag: none; }
.lb-btn { position: absolute; display: grid; place-items: center; width: 48px; height: 48px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .14); color: #fff; cursor: pointer; }
.lb-btn:hover { background: rgba(255, 255, 255, .24); }
.lb-btn .i { width: 24px; height: 24px; }
.lb-close { top: calc(env(safe-area-inset-top) + 14px); left: 14px; }
.lb-prev { right: 14px; top: 50%; transform: translateY(-50%); }
.lb-next { left: 14px; top: 50%; transform: translateY(-50%); }
.lb.single .lb-prev, .lb.single .lb-next { display: none; }
.lb-count { position: absolute; bottom: calc(env(safe-area-inset-bottom) + 18px); left: 50%; transform: translateX(-50%); font-size: .875rem; font-weight: 600; padding: 3px 12px; border-radius: 999px; background: rgba(255, 255, 255, .14); }
.lb-count:empty { display: none; }

/* ============ الطباعة (A4) ============ */
.print-head, .print-foot, .print-gallery { display: none; }
@media print {
  @page { size: A4; margin: 14mm 12mm; }
  /* الطباعة فاتحة دائماً حتى لو كان المظهر داكناً */
  :root, :root[data-theme], :root:not([data-theme="light"]) {
    --bg: #fff; --surface: #fff; --surface-2: #f4f6f8; --text: #101828; --text-2: #344054; --muted: #5d6676;
    --border: #dfe3e8; --border-2: #cfd5dc; --primary: #2563eb; --primary-soft: #eef4ff; --shadow: none; --shadow-lg: none;
    color-scheme: light;
  }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  body { background: #fff; font-size: 11pt; }
  .top, .bottom, .side, .search-sticky, .save-bar, .actions, .tools, .complete, .strip, .cover-count, .flash, .lb, .no-print { display: none !important; }
  .is-app .shell { margin: 0 !important; }
  .wrap, .is-wide .wrap { max-width: none !important; padding: 0 !important; }
  .card { box-shadow: none; break-inside: avoid; border-color: var(--border); }
  .detail-grid { display: grid !important; grid-template-columns: 1.15fr 1fr; gap: 0 12px; align-items: start; }
  .detail-grid > .detail { position: static !important; max-height: none !important; overflow: visible !important; }
  .gallery { margin-bottom: 12px; }
  .cover { aspect-ratio: 16 / 9; }
  .print-head {
    display: flex; align-items: center; gap: 10px; padding-bottom: 10px; margin-bottom: 14px; border-bottom: 2px solid var(--primary);
  }
  .print-head img { width: auto; max-width: 170px; object-fit: contain; border-radius: 8px; }
  .print-head div { display: flex; flex-direction: column; line-height: 1.35; }
  .print-head span { color: var(--muted); font-size: 9pt; }
  .print-head .print-meta { margin-inline-start: auto; text-align: left; }
  .print-head .print-meta b { color: var(--primary); }
  .print-gallery { display: block; break-before: auto; margin-top: 4px; }
  .print-gallery h2 { font-size: 12pt; margin: 0 0 8px; }
  .print-gallery div { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .print-gallery img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); break-inside: avoid; }
  .print-foot { display: block; margin-top: 14px; padding-top: 8px; border-top: 1px solid var(--border); font-size: 8.5pt; color: var(--muted); text-align: center; }
  a { color: inherit; }
}
.offline-box { margin-top: 20vh; }

/* ============ تحسينات الفحص الشامل ============ */
/* A: تبويبات الإعدادات على الموبايل — أربعة بعرض متساوٍ بدون قص */
@media (max-width: 599px) {
  .tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; overflow: visible; }
  .tabs a { flex-direction: column; justify-content: center; gap: 3px; min-height: 58px; padding: 0 2px; font-size: .75rem; text-align: center; }
  .tabs a .i { width: 20px; height: 20px; }
}
/* B: أشرطة اللوحة على الموبايل — الاسم والرقم فوق الشريط */
@media (max-width: 599px) {
  .bars li { grid-template-columns: 1fr auto; gap: 4px 10px; }
  .bar-label { white-space: normal; }
  .bar-track { grid-column: 1 / -1; grid-row: 2; }
  .bar-parts { grid-row: 3; margin-top: 0; }
}
/* C: ترحيب أصغر على الموبايل */
@media (max-width: 599px) {
  .hero { margin: 0 0 8px; }
  .hero h1 { font-size: 1.25rem; }
  .hero .muted { display: none; }
}
/* D: مسافة قبل أزرار الاتصال عندما لا يوجد صندوق سعر */
.detail .item-meta + .actions, .detail .muted + .actions { margin-top: 16px; }
/* E: صفحة الدخول بدون الشريط العلوي (الشعار ظاهر في الوسط) */
.is-guest .top { display: none; }
/* F: التاريخ في الشريط العلوي (الكمبيوتر) بدل تكرار العنوان، وإخفاء العنوان المكرر على الموبايل */
.is-app .top-page { display: none; align-items: center; gap: 8px; color: var(--muted); font-weight: 500 !important; font-size: .875rem !important; }
.top-page .i { width: 17px; height: 17px; }
@media (min-width: 768px) { .is-app .top-page { display: flex; } }
@media (max-width: 767px) { .has-back .page-head h1, .has-back .wiz-head h1 { display: none; } .has-back .wiz-head { margin-top: 0; } }
/* G: صورة الغلاف بارتفاع معقول على التابلت والكمبيوتر */
.cover { max-height: 380px; }
/* H: بطاقات الأرقام في صف واحد على التابلت */
.kpis:not(.kpis-3) { grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); }

/* ============ ألوان الأقسام (نص 700 على خلفية 50: تباين ≥ 4.5) ============ */
.cc-blue   { --c: #1d4ed8; --cs: #eff6ff; --ci: #fff; }
.cc-orange { --c: #c2410c; --cs: #fff7ed; --ci: #fff; }
.cc-amber  { --c: #b45309; --cs: #fffbeb; --ci: #fff; }
.cc-teal   { --c: #0f766e; --cs: #f0fdfa; --ci: #fff; }
.cc-violet { --c: #6d28d9; --cs: #f5f3ff; --ci: #fff; }
.cc-rose   { --c: #be123c; --cs: #fff1f2; --ci: #fff; }
.cc-slate  { --c: #334155; --cs: #f1f5f9; --ci: #fff; }
.cc-stone  { --c: #57534e; --cs: #f5f5f4; --ci: #fff; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .cc-blue { --c: #93c5fd; --cs: rgba(59, 130, 246, .16); --ci: #0b1530; }
  :root:not([data-theme="light"]) .cc-orange { --c: #fdba74; --cs: rgba(249, 115, 22, .16); --ci: #2a1405; }
  :root:not([data-theme="light"]) .cc-amber { --c: #fcd34d; --cs: rgba(245, 158, 11, .16); --ci: #281a03; }
  :root:not([data-theme="light"]) .cc-teal { --c: #5eead4; --cs: rgba(20, 184, 166, .16); --ci: #04201d; }
  :root:not([data-theme="light"]) .cc-violet { --c: #c4b5fd; --cs: rgba(139, 92, 246, .18); --ci: #1b0d3a; }
  :root:not([data-theme="light"]) .cc-rose { --c: #fda4af; --cs: rgba(244, 63, 94, .16); --ci: #2c0610; }
  :root:not([data-theme="light"]) .cc-slate { --c: #cbd5e1; --cs: rgba(148, 163, 184, .16); --ci: #0f172a; }
  :root:not([data-theme="light"]) .cc-stone { --c: #d6d3d1; --cs: rgba(168, 162, 158, .16); --ci: #1c1917; }
}
/* نفس الوضع الداكن عند اختياره يدوياً */
:root[data-theme="dark"] .cc-blue { --c: #93c5fd; --cs: rgba(59, 130, 246, .16); --ci: #0b1530; }
:root[data-theme="dark"] .cc-orange { --c: #fdba74; --cs: rgba(249, 115, 22, .16); --ci: #2a1405; }
:root[data-theme="dark"] .cc-amber { --c: #fcd34d; --cs: rgba(245, 158, 11, .16); --ci: #281a03; }
:root[data-theme="dark"] .cc-teal { --c: #5eead4; --cs: rgba(20, 184, 166, .16); --ci: #04201d; }
:root[data-theme="dark"] .cc-violet { --c: #c4b5fd; --cs: rgba(139, 92, 246, .18); --ci: #1b0d3a; }
:root[data-theme="dark"] .cc-rose { --c: #fda4af; --cs: rgba(244, 63, 94, .16); --ci: #2c0610; }
:root[data-theme="dark"] .cc-slate { --c: #cbd5e1; --cs: rgba(148, 163, 184, .16); --ci: #0f172a; }
:root[data-theme="dark"] .cc-stone { --c: #d6d3d1; --cs: rgba(168, 162, 158, .16); --ci: #1c1917; }

.badge-cat { background: var(--cs); color: var(--c); border-color: transparent; font-weight: 600; }
.chip[class*="cc-"] .i { color: var(--c); }
.chip[class*="cc-"].on { background: var(--c); border-color: var(--c); color: var(--ci); }
.chip[class*="cc-"].on .i { color: var(--ci); }
.pgroup[class*="cc-"] .pg-ic, .cat-card[class*="cc-"] .pg-ic { background: var(--cs); color: var(--c); }
.pgroup[class*="cc-"] .ptile input:checked + span { border-color: var(--c); background: var(--cs); }
.pgroup[class*="cc-"] .ptile .tick, .pgroup[class*="cc-"] .pg-sel { background: var(--c); color: var(--ci); }

/* ============ تحديث السعر السريع ============ */
.price-box { position: relative; }
.price-box.is-empty { background: var(--surface-2); border: 1px dashed var(--border-2); }
.price-none { font-size: 1rem; font-weight: 500; color: var(--muted); }
.qp { width: 100%; }
.qp > summary { list-style: none; width: max-content; margin-top: 4px; }
.qp > summary::-webkit-details-marker { display: none; }
.qp[open] > summary { display: none; }
.qp-form { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 10px; margin-top: 10px; padding-top: 12px; border-top: 1px solid var(--border); }
.qp-form label { margin: 0; }
.qp-form .qp-cur { grid-column: 1 / -1; margin: 0; }
.qp-form .btn { grid-column: 1 / -1; }
.qp-price input { font-size: 1.25rem !important; font-weight: 600; }
.pgroup[class*="cc-"] .pg-all:hover { border-color: var(--c); color: var(--c); }
.pgroup[class*="cc-"] .pg-all[aria-pressed="true"] { background: var(--cs); border-color: var(--c); color: var(--c); }
.pgroup[class*="cc-"] .pg-all[aria-pressed="true"] .pg-box { background: var(--c); border-color: var(--c); }
.pgroup[class*="cc-"] .pg-all[aria-pressed="true"] .pg-box .i { color: var(--ci); }
.pgroup[class*="cc-"] .pg-all.some .pg-box { border-color: var(--c); background: var(--cs); }
.pgroup[class*="cc-"] .pg-all.some .pg-box::after { background: var(--c); }

/* ============ القائمة الجانبية: كاملة / شريط أيقونات ============ */
@media (min-width: 768px) { .is-app { --side-cur: 76px; } }
@media (min-width: 1280px) { .is-app:not(.side-mini) { --side-cur: var(--side-w); } }
@media (min-width: 768px) and (max-width: 1279.98px) {
  .is-app .side { padding: 14px 10px; align-items: center; overflow: visible; }
  .is-app .side .side-label, .is-app .side .side-sec, .is-app .side .side-count { display: none !important; }
  .is-app .side-head { flex-direction: column; gap: 6px; width: 100%; }
  .is-app .side .brand { justify-content: center; padding: 2px 0 10px; width: 100%; }
  .is-app .side-cta { width: 48px; min-height: 48px; padding: 0; margin: 6px 0 10px; border-radius: 14px; }
  .is-app .side-cta .i { width: 22px; height: 22px; }
  .is-app .side-nav { align-items: center; width: 100%; gap: 6px; }
  .is-app .side-nav a { width: 52px; height: 48px; justify-content: center; padding: 0; }
  .is-app .side-nav a.on::before { inset-inline-start: -10px; }
  .is-app .side-ic { width: 40px; height: 40px; border-radius: 12px; }
  .is-app .side-dot { display: block; }
  .is-app .side-foot { flex-direction: column; padding: 6px; gap: 6px; }
  .is-app .side-user { justify-content: center; padding: 0; }
  .is-app [data-tip] { position: relative; }
  .is-app [data-tip]:hover::after, .is-app [data-tip]:focus-visible::after {
    content: attr(data-tip); position: absolute; inset-inline-start: calc(100% + 12px); top: 50%; transform: translateY(-50%);
    padding: 6px 11px; border-radius: 9px; background: var(--text); color: var(--bg); font-size: .75rem; font-weight: 500;
    white-space: nowrap; box-shadow: var(--shadow-lg); z-index: 70; pointer-events: none;
  }
  .side-toggle { display: none; }
}
@media (min-width: 1280px) {
  .is-app.side-mini .side { padding: 14px 10px; align-items: center; overflow: visible; }
  .is-app.side-mini .side .side-label, .is-app.side-mini .side .side-sec, .is-app.side-mini .side .side-count { display: none !important; }
  .is-app.side-mini .side-head { flex-direction: column; gap: 6px; width: 100%; }
  .is-app.side-mini .side .brand { justify-content: center; padding: 2px 0 10px; width: 100%; }
  .is-app.side-mini .side-cta { width: 48px; min-height: 48px; padding: 0; margin: 6px 0 10px; border-radius: 14px; }
  .is-app.side-mini .side-cta .i { width: 22px; height: 22px; }
  .is-app.side-mini .side-nav { align-items: center; width: 100%; gap: 6px; }
  .is-app.side-mini .side-nav a { width: 52px; height: 48px; justify-content: center; padding: 0; }
  .is-app.side-mini .side-nav a.on::before { inset-inline-start: -10px; }
  .is-app.side-mini .side-ic { width: 40px; height: 40px; border-radius: 12px; }
  .is-app.side-mini .side-dot { display: block; }
  .is-app.side-mini .side-foot { flex-direction: column; padding: 6px; gap: 6px; }
  .is-app.side-mini .side-user { justify-content: center; padding: 0; }
  .is-app.side-mini [data-tip] { position: relative; }
  .is-app.side-mini [data-tip]:hover::after, .is-app.side-mini [data-tip]:focus-visible::after {
    content: attr(data-tip); position: absolute; inset-inline-start: calc(100% + 12px); top: 50%; transform: translateY(-50%);
    padding: 6px 11px; border-radius: 9px; background: var(--text); color: var(--bg); font-size: .75rem; font-weight: 500;
    white-space: nowrap; box-shadow: var(--shadow-lg); z-index: 70; pointer-events: none;
  }
  .side-mini .side-toggle .i { transform: scaleX(-1); }
}
.side-head { display: flex; align-items: center; gap: 4px; }
.side-head .brand { flex: 1; min-width: 0; }
.side-toggle { width: 36px; height: 36px; color: var(--muted); flex: none; }
.side-toggle:hover { color: var(--primary); background: var(--primary-soft); }
.side-head .brand { border-bottom: 0 !important; }
.side-cta { position: relative; }
.side-count { margin-inline-start: auto; min-width: 24px; padding: 0 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); font-size: .75rem; font-weight: 600; line-height: 1.75; text-align: center; font-variant-numeric: tabular-nums; }
.side-count.warn { background: var(--accent-soft); color: var(--accent); }
.side-nav a.on .side-count:not(.warn) { background: var(--surface); color: var(--primary); }
.side-ic { position: relative; }
.side-dot { display: none; position: absolute; top: 4px; inset-inline-end: 4px; width: 9px; height: 9px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px var(--surface); }

/* ============ انتقال سلس بين الصفحات (View Transitions) ============ */
@view-transition { navigation: auto; }
.side { view-transition-name: side; }
.top { view-transition-name: topbar; }
.bottom { view-transition-name: bottomnav; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .16s; }
@media (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
}

/* ============ زر الحساب وقائمته (الشريط العلوي) ============ */
.user-btn {
  margin-inline-start: auto; display: inline-flex; align-items: center; gap: 10px;
  min-height: 46px; padding: 4px 10px 4px 6px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font: inherit; cursor: pointer; box-shadow: var(--shadow-sm); transition: border-color .15s, box-shadow .15s, background .15s;
}
.user-btn:hover { border-color: var(--border-2); box-shadow: var(--shadow); }
.user-btn:has(+ .user-menu:popover-open) { border-color: var(--primary); box-shadow: 0 0 0 4px var(--ring); }
.user-btn .avatar { width: 34px; height: 34px; font-size: .875rem; }
.user-btn-text { display: flex; flex-direction: column; line-height: 1.25; text-align: start; min-width: 0; }
.user-btn-text b { font-size: .875rem; font-weight: 600; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-btn-text small { font-size: .75rem; color: var(--muted); }
.user-btn-chev { width: 16px; height: 16px; color: var(--muted); transition: transform .2s; }
.user-btn:has(+ .user-menu:popover-open) .user-btn-chev { transform: rotate(180deg); }
@media (max-width: 479px) { .user-btn-text { display: none; } .user-btn { padding: 3px 6px 3px 3px; gap: 4px; min-height: 42px; } }

.user-menu {
  position: fixed; inset: auto; top: calc(var(--top-h) + env(safe-area-inset-top) + 6px); left: 12px; margin: 0;
  width: min(290px, calc(100vw - 24px)); padding: 6px; border-radius: var(--r);
  border: 1px solid var(--border); background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg);
  opacity: 0; transform: translateY(-6px) scale(.98); transform-origin: top left;
  transition: opacity .15s, transform .15s, overlay .15s allow-discrete, display .15s allow-discrete;
}
.user-menu:popover-open { opacity: 1; transform: none; }
@starting-style { .user-menu:popover-open { opacity: 0; transform: translateY(-6px) scale(.98); } }
@media (min-width: 768px) { .user-menu { left: 28px; } }
.user-menu::backdrop { background: transparent; }
.um-head { display: flex; align-items: center; gap: 12px; padding: 10px 10px 12px; margin-bottom: 4px; border-bottom: 1px solid var(--border); }
.um-head div { display: flex; flex-direction: column; min-width: 0; line-height: 1.4; }
.um-head b { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.um-head small { color: var(--muted); font-size: .75rem; }
.user-menu a, .um-logout {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 44px; padding: 0 12px; border-radius: 10px;
  border: 0; background: none; color: var(--text-2); font: inherit; font-weight: 500; font-size: .875rem; text-align: start; cursor: pointer;
}
.user-menu a .i, .um-logout .i { width: 19px; height: 19px; color: var(--muted); }
.user-menu a:hover, .user-menu a:focus-visible { background: var(--surface-2); color: var(--text); }
.user-menu a:hover .i { color: var(--primary); }
.user-menu form { margin: 0; }
.um-logout { color: var(--danger); }
.um-logout .i { color: var(--danger); }
.um-logout:hover { background: var(--danger-soft); }
.um-sep { display: block; height: 1px; margin: 4px 8px; background: var(--border); }

/* ============ زر طي القائمة في أسفل القائمة الجانبية ============ */
.side-foot { padding: 6px !important; background: transparent !important; border: 0 !important; border-top: 1px solid var(--border) !important; border-radius: 0 !important; }
.side-toggle {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 44px; padding: 0 10px; border: 0; border-radius: 12px;
  background: none; color: var(--muted); font: inherit; font-weight: 500; font-size: .875rem; cursor: pointer;
}
.side-toggle:hover { background: var(--surface-2); color: var(--primary); }
.side-toggle .side-ic .i { transition: transform .25s ease; }
.side-mini .side-toggle .side-ic { background: var(--primary-soft); color: var(--primary); }
.side-mini .side-toggle .side-ic .i { transform: scaleX(-1); }
@media (min-width: 768px) and (max-width: 1279.98px) { .side-foot { display: none !important; } }
@media (min-width: 1280px) { .side-mini .side-toggle { width: 52px; justify-content: center; padding: 0; } }

/* ============ سرعة العرض ============ */
.list .item { content-visibility: auto; contain-intrinsic-size: auto 230px; }
.item-thumb img, .strip img, .media-item img { background: var(--surface-2); }

/* ============ دليل الموردين: بطاقات وأقسام ============ */
.item-secs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.item h3 { font-size: 1rem; }
.list .item { contain-intrinsic-size: auto 190px; }
.sec-group + .sec-group { margin-top: 12px; }
.sec-cat { display: block; font-size: .75rem; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.sec-list { display: flex; flex-wrap: wrap; gap: 6px; }
.no-phone { display: flex; align-items: center; gap: 6px; margin: 14px 0 6px; }
.no-phone .i { width: 16px; height: 16px; }
.detail .tools { margin-top: 10px; }
.detail .tools .btn { flex: 1 1 auto; }

/* ============ المعالج: 3 خطوات، المراجعة، المسودة ============ */
.steps-3 { grid-template-columns: repeat(3, 1fr); }
.steps li { cursor: pointer; }
.review { margin: 0; display: grid; gap: 0; }
.review > div { display: grid; grid-template-columns: minmax(84px, 30%) 1fr auto; gap: 4px 12px; align-items: start; padding: 12px 0; border-bottom: 1px solid var(--border); }
.review > div:last-child { border-bottom: 0; }
.review dt { color: var(--muted); font-size: .875rem; }
.review dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.link-btn { border: 0; background: none; padding: 0 4px; color: var(--primary); font: inherit; font-size: .875rem; font-weight: 600; cursor: pointer; }
.link-btn:hover { text-decoration: underline; }
.wiz-actions-3 { flex-wrap: wrap; }
.wiz-actions-3 .btn-primary { flex: 1 1 180px; }
@media (max-width: 479px) { .wiz-actions-3 .btn { flex: 1 1 40%; } .wiz-actions-3 .btn-primary { flex-basis: 100%; order: -1; } }
.wizard[data-step="1"] .wiz-step[data-step="3"], .wizard[data-step="2"] .wiz-step[data-step="3"],
.wizard[data-step="3"] .wiz-step[data-step="1"], .wizard[data-step="3"] .wiz-step[data-step="2"] { display: none; }
.draft-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin-bottom: 12px; padding: 10px 14px; border-radius: var(--r-sm); background: var(--primary-soft); color: var(--text); font-size: .875rem; }
.draft-bar > .i { color: var(--primary); }
.draft-bar span { flex: 1 1 200px; }
.wizard-danger { max-width: 640px; margin: 14px auto 0; }

/* ============ الإعدادات الشخصية (ملفي / كلمة المرور) ============ */
.tabs-sep { flex: none; width: 1px; margin: 12px 6px; background: var(--border); }
@media (max-width: 599px) {
  .tabs-sep { display: none; }
  .tabs-n2 { grid-template-columns: repeat(2, 1fr); }
  .tabs-n6 { grid-template-columns: repeat(3, 1fr); }
}
.photo-set { display: flex; align-items: center; gap: 18px; }
.photo-set-body { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.photo-set-body p { margin: 0; }
.photo-set-body .btn-row { margin: 0; }
@media (max-width: 420px) { .photo-set { flex-direction: column; text-align: center; } .photo-set-body .btn-row { justify-content: center; } }
.avatar-link { border-radius: 50%; flex: none; }
.avatar-link:focus-visible { outline: 3px solid var(--ring); outline-offset: 3px; }
.form input:disabled { background: var(--surface-2); color: var(--muted); cursor: not-allowed; }
.pw-field { position: relative; display: block; margin-top: 6px; }
.pw-field input { margin-top: 0 !important; padding-left: 46px; }
.pw-eye {
  position: absolute; top: 0; bottom: 0; left: 0; width: 44px; display: grid; place-items: center;
  border: 0; background: none; color: var(--muted); cursor: pointer; border-radius: 10px;
}
.pw-eye:hover { color: var(--text); }
.pw-eye:focus-visible { outline: 2px solid var(--ring); outline-offset: -2px; }
.pw-eye .i { width: 19px; height: 19px; }
.pw-eye .eye-off, .pw-eye[aria-pressed="true"] .eye-on { display: none; }
.pw-eye[aria-pressed="true"] .eye-off { display: block; }
.sec-tips { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.sec-tips li { display: flex; align-items: flex-start; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); line-height: 1.6; }
.sec-tips li:last-child { border-bottom: 0; }
.sec-tips .i { flex: none; width: 20px; height: 20px; margin-top: 2px; color: var(--primary); }

/* ============ تبويب «التطبيق»: معاينة الأيقونة والمشاركة ============ */
.mini-label { display: block; font-size: .875rem; font-weight: 600; color: var(--text-2); margin: 4px 0 8px; }
.icon-preview {
  --ib: #ffffff; --sc: 68%; --sc-a: 53%;
  display: grid; grid-template-columns: auto auto minmax(0, 1fr); align-items: start; gap: 18px;
  padding: 20px 18px 14px; margin-bottom: 16px; border-radius: var(--r-sm);
  background: linear-gradient(135deg, #dbe7ff, #f3e8ff 55%, #ffe9d6);
}
.icon-preview.ip-s { --sc: 56%; --sc-a: 44%; }
.icon-preview.ip-l { --sc: 80%; --sc-a: 62%; }
.icon-preview figure { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; }
.icon-preview figcaption { max-width: 84px; font-size: .75rem; font-weight: 500; color: #101828; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-preview small { font-size: .75rem; color: #475467; }
.ip-tile {
  display: grid; place-items: center; width: 66px; height: 66px; background: var(--ib);
  box-shadow: 0 6px 16px -6px rgba(16, 24, 40, .35), inset 0 0 0 1px rgba(16, 24, 40, .06); transition: background .2s;
}
.ip-tile img { width: var(--sc); height: var(--sc); object-fit: contain; transition: width .2s, height .2s; }
.ip-ios { border-radius: 22.5%; }
.ip-android { border-radius: 50%; }
.ip-android img { width: var(--sc-a); height: var(--sc-a); }
.ip-tab {
  display: flex; align-items: center; gap: 8px; width: 100%; max-width: 220px; min-height: 40px; margin-top: 13px; padding: 0 12px;
  background: #fff; border-radius: 10px 10px 0 0; box-shadow: 0 -1px 0 rgba(16, 24, 40, .06), 0 6px 14px -8px rgba(16, 24, 40, .3);
}
.ip-tab b { font-size: .75rem; font-weight: 500; color: #101828; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ip-fav { display: grid; place-items: center; flex: none; width: 18px; height: 18px; border-radius: 5px; background: var(--ib); box-shadow: inset 0 0 0 1px rgba(16, 24, 40, .08); }
.ip-fav img { width: 86%; height: 86%; object-fit: contain; }
@media (max-width: 420px) { .icon-preview { grid-template-columns: 1fr 1fr; } .icon-preview figure:last-child { grid-column: 1 / -1; } .ip-tab { margin-top: 0; } }

.swatches { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 16px; }
.form .swatches legend { float: none; margin-bottom: 8px; font-size: .875rem; color: var(--text-2); }
.swatch { position: relative; margin: 0; cursor: pointer; }
.swatch input[type=radio] { position: absolute; opacity: 0; pointer-events: none; }
.swatch span, .swatch input[type=color] {
  display: block; width: 34px; height: 34px; border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(16, 24, 40, .14); transition: transform .15s, box-shadow .15s;
}
.swatch:hover span { transform: scale(1.08); }
.swatch input:checked + span { box-shadow: inset 0 0 0 1px rgba(16, 24, 40, .14), 0 0 0 3px var(--surface), 0 0 0 5px var(--primary); }
.swatch input:focus-visible + span { outline: 3px solid var(--ring); outline-offset: 4px; }
.swatch input[type=color] { padding: 0; border: 0; min-height: 0; cursor: pointer; background: conic-gradient(red, yellow, lime, aqua, blue, magenta, red); }
.swatch input[type=color]::-webkit-color-swatch-wrapper { padding: 0; }
.swatch input[type=color]::-webkit-color-swatch { border: 0; border-radius: 50%; opacity: 0; }
.swatch input[type=color]::-moz-color-swatch { border: 0; border-radius: 50%; opacity: 0; }

.og-card { overflow: hidden; margin-bottom: 16px; border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface-2); }
.og-card img { display: block; width: 100%; height: auto; aspect-ratio: 1200 / 630; object-fit: cover; background: var(--surface-3); }
.og-body { display: flex; flex-direction: column; gap: 3px; padding: 10px 14px 12px; border-inline-start: 4px solid var(--wa); }
.og-host { font-size: .75rem; color: var(--muted); text-align: end; }
.og-body b { font-size: 1rem; }
.og-body p { margin: 0; font-size: .875rem; color: var(--text-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.dl-row { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 12px; }
.dl-row .link-more .i { width: 16px; height: 16px; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-preview { background: linear-gradient(135deg, #1e293b, #312e81 55%, #3b1d0f); }
  :root:not([data-theme="light"]) .icon-preview figcaption { color: #f1f5f9; }
  :root:not([data-theme="light"]) .icon-preview small { color: #cbd5e1; }
}
/* نفس الوضع الداكن عند اختياره يدوياً */
:root[data-theme="dark"] .icon-preview { background: linear-gradient(135deg, #1e293b, #312e81 55%, #3b1d0f); }
:root[data-theme="dark"] .icon-preview figcaption { color: #f1f5f9; }
:root[data-theme="dark"] .icon-preview small { color: #cbd5e1; }

@media (max-width: 599px) { .swatches { gap: 8px; } .swatch span, .swatch input[type=color] { width: 40px; height: 40px; } }

/* شعار عريض أو داكن: لا يُقص في القائمة المطوية، ويبقى واضحاً في الوضع الداكن */
.brand img { max-width: 132px; object-fit: contain; }
@media (min-width: 768px) and (max-width: 1279px) { .is-app .side .brand img { max-width: 46px; height: auto; max-height: 40px; } }
@media (min-width: 1280px) { .is-app.side-mini .side .brand img { max-width: 46px; height: auto; max-height: 40px; } }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .brand img, :root:not([data-theme="light"]) .auth-brand img, :root:not([data-theme="light"]) .logo-preview img { background: #fff; padding: 4px; border-radius: 10px; }
  :root:not([data-theme="light"]) .logo-preview { background: #fff; }
}
/* نفس الوضع الداكن عند اختياره يدوياً */
:root[data-theme="dark"] .brand img, :root[data-theme="dark"] .auth-brand img, :root[data-theme="dark"] .logo-preview img { background: #fff; padding: 4px; border-radius: 10px; }
:root[data-theme="dark"] .logo-preview { background: #fff; }


/* =====================================================================
   v18 — تحسينات الموبايل + المظهر الداكن اليدوي + مزايا جديدة
   ===================================================================== */

/* صورة الحساب في الشريط العلوي: الحرف الأول بلون ثابت لكل مستخدم */
.avatar-ini { --h1: #dbeafe; --h2: #1d4ed8; background: var(--h1); color: var(--h2); font-weight: 700; }
.avatar-ini.hue-1 { --h1: #dcfce7; --h2: #15803d; }
.avatar-ini.hue-2 { --h1: #fef3c7; --h2: #b45309; }
.avatar-ini.hue-3 { --h1: #fce7f3; --h2: #be185d; }
.avatar-ini.hue-4 { --h1: #ede9fe; --h2: #6d28d9; }
.avatar-ini.hue-5 { --h1: #ccfbf1; --h2: #0f766e; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .avatar-ini { --h1: #1e3a8a; --h2: #dbeafe; } :root:not([data-theme="light"]) .avatar-ini.hue-1 { --h1: #14532d; --h2: #dcfce7; } :root:not([data-theme="light"]) .avatar-ini.hue-2 { --h1: #78350f; --h2: #fef3c7; } :root:not([data-theme="light"]) .avatar-ini.hue-3 { --h1: #831843; --h2: #fce7f3; } :root:not([data-theme="light"]) .avatar-ini.hue-4 { --h1: #4c1d95; --h2: #ede9fe; } :root:not([data-theme="light"]) .avatar-ini.hue-5 { --h1: #134e4a; --h2: #ccfbf1; } }
:root[data-theme="dark"] .avatar-ini { --h1: #1e3a8a; --h2: #dbeafe; }
:root[data-theme="dark"] .avatar-ini.hue-1 { --h1: #14532d; --h2: #dcfce7; }
:root[data-theme="dark"] .avatar-ini.hue-2 { --h1: #78350f; --h2: #fef3c7; }
:root[data-theme="dark"] .avatar-ini.hue-3 { --h1: #831843; --h2: #fce7f3; }
:root[data-theme="dark"] .avatar-ini.hue-4 { --h1: #4c1d95; --h2: #ede9fe; }
:root[data-theme="dark"] .avatar-ini.hue-5 { --h1: #134e4a; --h2: #ccfbf1; }

/* قائمة الحساب: الرأس نفسه رابط «حسابي» + مبدّل المظهر */
.user-menu a.um-head { display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 10px; margin-bottom: 4px; border-bottom: 1px solid var(--border); border-radius: 12px 12px 0 0; color: var(--text); font-weight: 400; }
.user-menu a.um-head small { font-size: .75rem; color: var(--muted); }
.user-menu a.um-head .um-go { margin-inline-start: auto; width: 18px; height: 18px; color: var(--muted); }
.um-theme { padding: 8px 10px 10px; }
.um-theme-label { display: flex; align-items: center; gap: 8px; font-size: .875rem; font-weight: 600; color: var(--text-2); margin-bottom: 8px; }
.um-theme-label .i { width: 17px; height: 17px; color: var(--primary); }
.theme-seg { position: relative; display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); }
.theme-seg button {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 52px; padding: 4px;
  border: 0; border-radius: 9px; background: none; color: var(--muted); font: inherit; font-size: .75rem; font-weight: 500; cursor: pointer;
  transition: background .2s, color .2s, box-shadow .2s;
}
.theme-seg button .i { width: 19px; height: 19px; transition: transform .45s cubic-bezier(.34, 1.56, .64, 1); }
.theme-seg button:hover { color: var(--text); }
.theme-seg button[aria-checked="true"] { background: var(--surface); color: var(--primary); box-shadow: 0 1px 3px rgba(16, 24, 40, .12); font-weight: 600; }
.theme-seg button[aria-checked="true"] .i { transform: rotate(-20deg) scale(1.12); }
.theme-seg button[data-theme-set="dark"][aria-checked="true"] .i { transform: rotate(-35deg) scale(1.12); }
.theme-seg button:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }

/* حركة تبديل المظهر: دائرة تنتشر من الزر */
html.theme-anim .side, html.theme-anim .top, html.theme-anim .bottom { view-transition-name: none; }
html.theme-anim::view-transition-old(root) { animation: none; mix-blend-mode: normal; }
html.theme-anim::view-transition-new(root) { animation: theme-reveal .55s cubic-bezier(.4, 0, .2, 1); mix-blend-mode: normal; }
@keyframes theme-reveal { from { clip-path: circle(0 at var(--tx, 50%) var(--ty, 0)); } to { clip-path: circle(var(--tr, 150vmax) at var(--tx, 50%) var(--ty, 0)); } }
html:not(.theme-anim) body { transition: background-color .25s; }

/* أشرطة التمرير الأفقي: تدرّج على الحافة يوضح أن فيها المزيد */
.chips.fade-e, .tabs.fade-e { -webkit-mask-image: linear-gradient(to right, transparent 0, #000 44px); mask-image: linear-gradient(to right, transparent 0, #000 44px); }
.chips.fade-s, .tabs.fade-s { -webkit-mask-image: linear-gradient(to left, transparent 0, #000 44px); mask-image: linear-gradient(to left, transparent 0, #000 44px); }
.chips.fade-s.fade-e, .tabs.fade-s.fade-e { -webkit-mask-image: linear-gradient(to right, transparent 0, #000 44px, #000 calc(100% - 44px), transparent 100%); mask-image: linear-gradient(to right, transparent 0, #000 44px, #000 calc(100% - 44px), transparent 100%); }

/* تبويبات الإعدادات على الموبايل: شريط أفقي واحد قابل للتمرير (بدل سطرين) */
@media (max-width: 599px) {
  .tabs, .tabs-n2, .tabs-n6 { display: flex; grid-template-columns: none; gap: 2px; overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x proximity; }
  .tabs a { flex: none; flex-direction: row; gap: 6px; min-height: 48px; padding: 0 12px; font-size: .875rem; white-space: nowrap; scroll-snap-align: start; }
  .tabs a .i { width: 18px; height: 18px; }
  .tabs-sep { display: block; margin: 14px 4px; }
}

/* بطاقة المورد: أخف وأقصر على الموبايل (3 موردين في الشاشة) */
@media (max-width: 599px) {
  .list { gap: 10px; }
  .item-main { padding: 11px 14px 9px; }
  .item h3 { font-size: 1rem; }
  .item-co { font-size: .875rem; }
  .item-meta { margin-top: 3px; font-size: .875rem; }
  .item-secs { margin-top: 7px; gap: 5px; }
  .item-secs .badge { font-size: .75rem; padding: 2px 8px; min-height: 22px; }
  .item-foot { min-height: 0; padding: 4px 6px 4px 12px; }
}
.icon-btn.sm { width: 44px; height: 44px; }
.no-num { display: inline-flex; align-items: center; min-height: 32px; padding: 0 10px; border-radius: 999px; background: var(--surface); border: 1px dashed var(--border-2); color: var(--muted); font-size: .75rem; }

/* السحب على البطاقة: يميناً = اتصال، يساراً = واتساب */
.item[data-tel] { position: relative; touch-action: pan-y; }
.item[data-tel] > .item-main, .item[data-tel] > .item-foot { position: relative; z-index: 1; background: var(--surface); transform: translateX(var(--dx, 0)); transition: transform .26s cubic-bezier(.2, .8, .2, 1); }
.item[data-tel] > .item-foot { background: var(--surface-2); }
.item.is-swiping > .item-main, .item.is-swiping > .item-foot { transition: none; }
.swipe-bg { position: absolute; inset: 0; display: flex; align-items: center; justify-content: space-between; padding: 0 22px; font-weight: 700; font-size: .875rem; color: #fff; opacity: 0; transition: opacity .15s; }
.item[data-dir] .swipe-bg { opacity: 1; }
.item[data-dir="call"] .swipe-bg { background: linear-gradient(to left, var(--primary), #1d4ed8); }
.item[data-dir="wa"] .swipe-bg { background: linear-gradient(to right, #16a34a, #128c4b); }
.swipe-bg span { display: flex; align-items: center; gap: 8px; transition: transform .2s; }
.swipe-bg .i { width: 22px; height: 22px; }
.item[data-dir="call"] .sw-wa, .item[data-dir="wa"] .sw-call { visibility: hidden; }
.sw-call { order: 2; } /* الاتصال يظهر يساراً (البطاقة تتحرك يميناً) */
.item[data-armed] .swipe-bg span { transform: scale(1.12); }
.swipe-hint { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 12px; margin-bottom: 10px; border-radius: 12px; background: var(--primary-soft); color: var(--primary); font-size: .875rem; font-weight: 500; }
.swipe-hint span { display: flex; align-items: center; gap: 6px; }
.swipe-hint .i { width: 16px; height: 16px; flex: none; }
.swipe-hint .link-btn { min-height: 44px; padding: 0 6px; font-weight: 700; }

/* هياكل التحميل بشكل البطاقة */
.item.skel { min-height: 0; }
.skel-main { display: flex; flex-direction: column; gap: 9px; padding: 14px 16px 12px; }
.skel-foot { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px 8px 16px; border-top: 1px solid var(--border); background: var(--surface-2); }
.sk { display: block; height: 12px; border-radius: 6px; background: linear-gradient(90deg, var(--surface-2) 0%, var(--surface-3) 50%, var(--surface-2) 100%); background-size: 200% 100%; animation: shimmer 1.2s infinite linear; }
.sk-t { width: 55%; height: 16px; } .sk-s { width: 35%; } .sk-m { width: 70%; }
.sk-row { display: flex; gap: 6px; }
.sk-b { width: 64px; height: 22px; border-radius: 999px; }
.sk-c { width: 40px; height: 40px; border-radius: 50%; }
@media (prefers-reduced-motion: reduce) { .sk { animation: none; } }

/* رسالة أسفل الشاشة + صندوق الإرسال بدون إنترنت */
.toast {
  position: fixed; z-index: 90; left: 50%; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 14px); max-width: min(92vw, 460px);
  padding: 12px 16px; border-radius: 14px; background: #101828; color: #fff; font-size: .875rem; font-weight: 500; box-shadow: var(--shadow-lg);
  opacity: 0; transform: translate(-50%, 12px); pointer-events: none; transition: opacity .2s, transform .25s cubic-bezier(.2, .8, .2, 1);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast[data-kind="ok"] { background: #067647; }
.toast[data-kind="err"] { background: #b42318; }
@media (min-width: 768px) { .toast { bottom: 24px; } }
.outbox-pill {
  position: fixed; z-index: 80; right: 50%; transform: translateX(50%); top: calc(var(--top-h) + env(safe-area-inset-top) + 8px);
  padding: 7px 14px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); border: 1px solid currentColor;
  font-size: .75rem; font-weight: 600; white-space: nowrap; box-shadow: var(--shadow);
}


/* صلاحية المستخدم */
.perm-pick { display: grid; gap: 8px; margin: 4px 0 16px; }
.perm-pick legend { float: none; margin-bottom: 6px; }
.check-card { position: relative; display: block; margin: 0; cursor: pointer; }
.check-card input { position: absolute; opacity: 0; pointer-events: none; }
.check-card span { display: flex; flex-direction: column; gap: 2px; min-height: 56px; padding: 10px 14px; padding-inline-start: 40px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); transition: border-color .15s, background .15s; }
.check-card span::before { content: ""; position: absolute; inset-inline-start: 14px; top: 50%; width: 16px; height: 16px; margin-top: -8px; border-radius: 50%; border: 2px solid var(--border-2); background: var(--surface); }
.check-card input:checked + span { border-color: var(--primary); background: var(--primary-soft); }
.check-card input:checked + span::before { border-color: var(--primary); box-shadow: inset 0 0 0 3px var(--surface); background: var(--primary); }
.check-card input:focus-visible + span { outline: 3px solid var(--ring); }
.check-card small { color: var(--muted); font-size: .75rem; }
#userForm:has(input[name=role][value=admin]:checked) .perm-pick { display: none; }

/* لوحة المدير: نمو الموردين */
.growth { margin-bottom: 14px; }
.growth-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.growth-head .card-title { margin-bottom: 2px; }
.growth-stat { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.3; }
.growth-stat b { font-size: 1.625rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.growth-stat span { font-size: .75rem; color: var(--muted); }
.growth-stat strong { color: var(--ok); }
.gchart { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; margin-top: 8px; }
.gc-axis { grid-column: 2; display: flex; flex-direction: column; justify-content: space-between; height: 170px; font-size: .75rem; color: var(--muted); font-variant-numeric: tabular-nums; transform: translateY(-.5em); }
.gc-plot {
  grid-column: 1; grid-row: 1; position: relative; display: flex; flex-direction: row; align-items: flex-end; gap: 4px; height: 170px;
  border-bottom: 1px solid var(--border-2);
  background: repeating-linear-gradient(to top, transparent 0, transparent calc(25% - 1px), var(--border) calc(25% - 1px), var(--border) 25%);
}
.gc-col { position: relative; flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; min-width: 0; cursor: default; }
.gc-col:focus { outline: none; }
.gc-col:focus-visible .gc-bar { outline: 2px solid var(--primary); outline-offset: 2px; }
.gc-bar { position: relative; display: block; width: min(30px, 72%); height: 0; min-height: 0; border-radius: 4px 4px 0 0; background: var(--primary); opacity: .5; transition: opacity .15s, height .5s cubic-bezier(.2, .8, .2, 1); }
.gc-col.now .gc-bar, .gc-col:hover .gc-bar, .gc-col.tt-on .gc-bar { opacity: 1; }
.gc-bar b { position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); padding-bottom: 3px; font-size: .75rem; color: var(--text); }
.gc-col small { position: absolute; top: calc(100% + 6px); white-space: nowrap; font-size: .75rem; color: var(--muted); }
.gchart { padding-bottom: 22px; }
.chart-tt { position: fixed; z-index: 95; padding: 6px 10px; border-radius: 8px; background: #101828; color: #fff; font-size: .75rem; pointer-events: none; white-space: nowrap; transform: translate(-50%, -100%); }
.head-actions { margin: 0; flex-wrap: nowrap; }

/* قائمة الموردين PDF */
.report-bar { align-items: flex-end; }
.report { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 18px; }
.report-head { display: flex; align-items: center; gap: 12px; padding-bottom: 12px; margin-bottom: 14px; border-bottom: 2px solid var(--primary); }
.report-head img { width: auto; max-width: 140px; object-fit: contain; }
.report-head div { display: flex; flex-direction: column; line-height: 1.4; }
.report-head span { color: var(--muted); font-size: .875rem; }
.report-meta { margin-inline-start: auto; text-align: end; }
.report-sec { margin-bottom: 18px; break-inside: auto; }
.report-sec h2 { font-size: 1rem; margin: 0 0 8px; padding: 6px 10px; border-radius: 8px; background: var(--primary-soft); color: var(--primary); }
.report-sec h2 small { font-weight: 500; color: var(--muted); }
.report-table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.report-table th { text-align: start; font-size: .75rem; color: var(--muted); font-weight: 600; padding: 6px 8px; border-bottom: 1px solid var(--border-2); }
.report-table td { padding: 7px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
.report-table td small { display: block; color: var(--muted); font-size: .75rem; }
.report-table td.n { color: var(--muted); width: 28px; font-variant-numeric: tabular-nums; }
.report-table td.tel { white-space: nowrap; text-align: left; font-variant-numeric: tabular-nums; }
.report-table tr { break-inside: avoid; }
.report-foot { margin-top: 12px; font-size: .75rem; color: var(--muted); text-align: center; }
@media (max-width: 599px) {
  .report { padding: 12px; overflow-x: auto; }
  .report-table { min-width: 560px; }
}
@media print {
  .report { border: 0; padding: 0; }
  .report-table { font-size: 9.5pt; min-width: 0; }
  .report-sec h2 { break-after: avoid; }
}

/* أهداف لمس مريحة (44px) على أجهزة اللمس */
@media (pointer: coarse) {
  .chip { min-height: 44px; }
  .sub-chips .chip { min-height: 40px; }
  .link-btn, .link-more { min-height: 44px; display: inline-flex; align-items: center; }
  .btn-sm { min-height: 44px; }
}

/* بطاقة المورد في الموبايل: الأزرار في عمود جانبي بدل شريط سفلي → بطاقة أقصر (3–4 موردين في الشاشة) */
@media (max-width: 599px) {
  .item:not(.skel) { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "main act" "by act"; }
  .item:not(.skel) > .item-main { grid-area: main; padding: 12px 14px 4px; }
  .item:not(.skel) > .item-foot { display: contents; }
  .item:not(.skel) .item-by { grid-area: by; padding: 2px 14px 11px; font-size: .75rem; }
  .item:not(.skel) .item-actions {
    grid-area: act; flex-direction: column; justify-content: center; gap: 8px; padding: 10px 10px 10px 12px;
    border-inline-start: 1px solid var(--border); background: var(--surface-2);
  }
  .item:not(.skel) .no-num { writing-mode: horizontal-tb; max-width: 64px; text-align: center; line-height: 1.3; padding: 6px 8px; border-radius: 10px; }
  .item[data-tel] .item-by, .item[data-tel] .item-actions { position: relative; z-index: 1; transform: translateX(var(--dx, 0)); transition: transform .26s cubic-bezier(.2, .8, .2, 1); }
  .item[data-tel] .item-by { background: var(--surface); }
  .item.is-swiping .item-by, .item.is-swiping .item-actions { transition: none; }
  .item-secs .badge:nth-child(n+4):not(:last-child) { display: none; } /* 3 أقسام + «+N» في الموبايل */
}
/* أهداف لمس 44px على شاشات الموبايل (حتى بدون كشف اللمس) */
@media (max-width: 767px) {
  .chip { min-height: 44px; }
  .sub-chips .chip { min-height: 44px; }
  .btn-sm { min-height: 44px; }
  .link-more, .link-btn { min-height: 44px; display: inline-flex; align-items: center; }
  .user-btn { min-height: 44px; min-width: 44px; }
  .brand-top { min-height: 44px; }
}

/* =====================================================================
   v19 — الشريط السفلي: حركات مرنة + مؤشر ينزلق بين الصفحات
   ===================================================================== */
.bottom a { position: relative; -webkit-tap-highlight-color: transparent; touch-action: manipulation; user-select: none; }
.bottom a > span { position: relative; isolation: isolate; transition: transform .35s cubic-bezier(.34, 1.56, .64, 1); }
.bottom a.on:not(.fab) > span { background: none; }
.bn-pill {
  position: absolute; inset: 0; z-index: -1; border-radius: 999px; background: var(--primary-soft);
  view-transition-name: bn-pill;
  animation: bn-pill-in .42s cubic-bezier(.34, 1.56, .64, 1);
}
@keyframes bn-pill-in { from { transform: scaleX(.4); opacity: 0; } to { transform: none; opacity: 1; } }
.bottom a .i { transition: transform .4s cubic-bezier(.34, 1.56, .64, 1), stroke-width .2s; }
.bottom a.on:not(.fab) .i { stroke-width: 2.3; animation: bn-icon-pop .5s cubic-bezier(.34, 1.56, .64, 1); }
@keyframes bn-icon-pop { 0% { transform: translateY(2px) scale(.82); } 55% { transform: translateY(-3px) scale(1.12); } 100% { transform: none; } }
.bn-lb { font-weight: inherit; transition: transform .3s cubic-bezier(.34, 1.56, .64, 1), color .2s; }
.bottom a.on .bn-lb { transform: translateY(-1px); }
/* لحظة الضغط وارتداد الإفلات */
.bottom a.bn-down > span { transform: scale(.84); transition-duration: .12s; }
.bottom a.bn-up > span { animation: bn-bounce .42s cubic-bezier(.34, 1.56, .64, 1); }
@keyframes bn-bounce { 0% { transform: scale(.84); } 60% { transform: scale(1.08); } 100% { transform: scale(1); } }
/* زر الإضافة: نبض خفيف وظل يتنفس */
.bottom a.fab > span { transition: transform .35s cubic-bezier(.34, 1.56, .64, 1), box-shadow .3s, background .2s; }
.bottom a.fab.bn-down > span { transform: scale(.88) rotate(-8deg); box-shadow: 0 3px 10px -4px rgba(37, 99, 235, .6); }
.bottom a.fab.bn-up > span { animation: bn-fab .5s cubic-bezier(.34, 1.56, .64, 1); }
@keyframes bn-fab { 0% { transform: scale(.88) rotate(-8deg); } 55% { transform: scale(1.1) rotate(6deg); } 100% { transform: none; } }
.bottom a.fab .i { transition: transform .45s cubic-bezier(.34, 1.56, .64, 1); }
.bottom a.fab.bn-up .i, .bottom a.fab.on .i { transform: rotate(90deg); }
/* موجة عند اللمس */
.bottom a::after {
  content: ""; position: absolute; top: 50%; left: 50%; width: 56px; height: 56px; margin: -34px 0 0 -28px; border-radius: 50%;
  background: var(--primary); opacity: 0; transform: scale(.2); pointer-events: none;
}
.bottom a.bn-up:not(.fab)::after { animation: bn-ripple .5s ease-out; }
@keyframes bn-ripple { from { opacity: .16; transform: scale(.3); } to { opacity: 0; transform: scale(1.35); } }
/* المؤشر ينزلق بين الصفحات (انتقال الصفحات في المتصفحات الحديثة) */
::view-transition-group(bn-pill) { animation-duration: .38s; animation-timing-function: cubic-bezier(.34, 1.4, .64, 1); }
::view-transition-old(bn-pill), ::view-transition-new(bn-pill) { animation: none; mix-blend-mode: normal; height: 100%; }
html.theme-anim .bn-pill { view-transition-name: none; }
/* مفتاح «أصوات اللمس» في قائمة الحساب */
.um-sound { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 48px; margin: 0; padding: 0 12px; border-radius: 10px; cursor: pointer; font-size: .875rem; }
.um-sound:hover { background: var(--surface-2); }
.um-sound > span:first-child { display: flex; align-items: center; gap: 12px; }
.um-sound .i { width: 19px; height: 19px; color: var(--muted); }
.um-sound input { position: absolute; opacity: 0; pointer-events: none; }
.um-sound input:checked + .switch-ui { background: var(--primary); }
.um-sound input:checked + .switch-ui::after { inset-inline-start: 21px; }
.um-sound input:focus-visible + .switch-ui { outline: 3px solid var(--ring); outline-offset: 2px; }
.um-sound .switch-ui { margin: 0; }
@media (prefers-reduced-motion: reduce) {
  .bn-pill, .bottom a.on:not(.fab) .i, .bottom a.bn-up > span, .bottom a.fab.bn-up > span, .bottom a.bn-up::after { animation: none !important; }
  ::view-transition-group(bn-pill) { animation-duration: 0s; }
}
.start-hint { display: flex; gap: 12px; align-items: flex-start; padding: 14px; margin-bottom: 14px; border-radius: 12px; background: var(--primary-soft); color: var(--primary); }
.start-hint .i { width: 22px; height: 22px; flex: none; margin-top: 2px; }
.start-hint div { display: flex; flex-direction: column; gap: 2px; }
.start-hint span { color: var(--text-2); font-size: .875rem; }

/* تعديل القسم الرئيسي */
.cat-edit-box { margin-top: 12px; }
.cat-edit-box > summary { list-style: none; display: inline-flex; width: auto; }
.cat-edit-box > summary::-webkit-details-marker { display: none; }
.cat-edit-box[open] > summary { background: var(--primary-soft); color: var(--primary); border-color: transparent; }
.cat-edit-form { margin-top: 12px; padding: 14px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface-2); }
.cat-edit-form legend { float: none; font-size: .875rem; margin-bottom: 8px; }
.icon-pick, .color-pick { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.icon-pick label, .color-pick label { position: relative; margin: 0; cursor: pointer; }
.icon-pick input, .color-pick input { position: absolute; opacity: 0; pointer-events: none; }
.icon-pick span { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; width: 72px; min-height: 62px; padding: 6px 4px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--text-2); transition: border-color .15s, background .15s, color .15s; }
.icon-pick .i { width: 22px; height: 22px; }
.icon-pick small { font-size: .75rem; color: var(--muted); text-align: center; line-height: 1.2; }
.icon-pick input:checked + span { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.icon-pick input:focus-visible + span { outline: 3px solid var(--ring); }
.color-pick label { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 58px; }
.color-pick span { display: block; width: 36px; height: 36px; border-radius: 50%; background: var(--cs); box-shadow: inset 0 0 0 9px var(--c), inset 0 0 0 10px rgba(0, 0, 0, .06); transition: transform .15s, box-shadow .15s; }
.color-pick small { font-size: .75rem; color: var(--muted); }
.color-pick input:checked + span { box-shadow: inset 0 0 0 9px var(--c), 0 0 0 3px var(--surface-2), 0 0 0 5px var(--c); transform: scale(1.06); }
.color-pick input:checked ~ small { color: var(--text); font-weight: 600; }
.color-pick input:focus-visible + span { outline: 3px solid var(--ring); outline-offset: 4px; }
.sort-field small { font-weight: 400; color: var(--muted); font-size: .75rem; }
.sort-field input { max-width: 140px; }
.quick-add { display: flex; gap: 8px; align-items: center; margin-top: 4px; margin-bottom: var(--card-pad); }
.quick-add input { flex: 1; min-width: 0; margin: 0 !important; }
.quick-add .btn { flex: none; min-height: 44px; }
.cat-edit-box:not([open]) { display: inline-block; vertical-align: top; margin-inline-end: 0; }
.cat-edit-box:not([open]) + .cat-actions { display: inline-flex; vertical-align: top; margin-top: 12px; margin-inline-start: 4px; }

/* =====================================================================
   v22 — صفحة المنتجات للموبايل: أقل ازدحاماً، فتح بحركة ناعمة، إدخال متتالٍ سريع
   ===================================================================== */
:root { interpolate-size: allow-keywords; }
.cat-card::details-content, .prod-item details::details-content, .cat-edit-box::details-content, .new-cat::details-content {
  block-size: 0; overflow: clip; transition: block-size .32s cubic-bezier(.2, .8, .2, 1), content-visibility .32s allow-discrete;
}
.cat-card[open]::details-content, .prod-item details[open]::details-content, .cat-edit-box[open]::details-content, .new-cat[open]::details-content { block-size: auto; }
@media (prefers-reduced-motion: reduce) {
  .cat-card::details-content, .prod-item details::details-content, .cat-edit-box::details-content, .new-cat::details-content { transition: none; }
}

.prod-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.prod-stats { font-size: .875rem; color: var(--muted); }
.prod-stats b { color: var(--text); font-variant-numeric: tabular-nums; }
.prod-filter { position: relative; flex: 1 1 220px; max-width: 360px; margin: 0; }
.prod-filter .i { position: absolute; inset-inline-start: 12px; top: 50%; width: 18px; height: 18px; margin-top: -9px; color: var(--muted); pointer-events: none; }
.prod-filter input { margin: 0 !important; padding-inline-start: 38px; min-height: 44px; border-radius: 999px; }

/* بطاقة «قسم رئيسي جديد» */
.new-cat { padding: 0; margin-bottom: 12px; }
.new-cat > summary, .cat-card > summary { display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 10px var(--card-pad); cursor: pointer; list-style: none; -webkit-tap-highlight-color: transparent; }
.new-cat > summary::-webkit-details-marker { display: none; }
.new-cat > summary .pg-ic { background: var(--primary); color: var(--primary-ink); transition: transform .3s cubic-bezier(.34, 1.56, .64, 1); }
.new-cat[open] > summary .pg-ic { transform: rotate(45deg); }
.new-cat > summary::after { content: none; }
.new-cat-form { padding: 4px var(--card-pad) var(--card-pad); }
.pg-name { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.35; }
.pg-name small { color: var(--muted); font-size: .75rem; }
.cat-card > summary:active, .new-cat > summary:active { background: var(--surface-2); }

/* القسم الرئيسي */
.cat-list { display: grid; gap: 10px; }
.cat-card > summary .pg-ic { transition: transform .35s cubic-bezier(.34, 1.56, .64, 1); }
.cat-card[open] > summary .pg-ic { transform: scale(1.06); }
.cat-note { margin: 12px var(--card-pad) 0; }
.quick-add { display: flex; gap: 8px; margin: 12px var(--card-pad) 6px !important; }
.quick-add input { flex: 1; min-width: 0; margin: 0 !important; min-height: 48px; border-radius: 14px; }
.quick-add .btn { flex: none; width: 48px; min-height: 48px; padding: 0; border-radius: 14px; }
.quick-add .btn .i { width: 22px; height: 22px; }

/* المنتجات: سطر واحد نظيف، والتعديل عند الضغط */
.prod-list { list-style: none; margin: 6px 0 0 !important; padding: 0; margin-inline: 0 !important; }
.prod-item { border-top: 1px solid var(--border); }
.prod-item > details > summary {
  display: flex; align-items: center; gap: 8px; min-height: 52px; padding: 6px var(--card-pad); cursor: pointer; list-style: none;
  -webkit-tap-highlight-color: transparent; transition: background .15s;
}
.prod-item > details > summary::-webkit-details-marker { display: none; }
.prod-item > details > summary:hover, .prod-item > details > summary:active { background: var(--surface-2); }
.prod-item > details[open] > summary { background: var(--primary-soft); }
.pi-name { flex: 1; min-width: 0; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pi-count { flex: none; font-size: .75rem; color: var(--muted); padding: 2px 8px; border-radius: 999px; background: var(--surface-2); font-variant-numeric: tabular-nums; }
.pi-more { flex: none; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; color: var(--muted); transition: background .15s, color .15s, transform .25s; }
.pi-more .i { width: 17px; height: 17px; }
.prod-item > details[open] .pi-more { color: var(--primary); background: var(--surface); transform: rotate(-12deg); }
.prod-item.is-off .pi-name { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--border-2); }
.pi-panel { padding: 4px var(--card-pad) 14px; background: var(--primary-soft); }
.pi-form label { margin-bottom: 10px; }
.pi-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.prod-empty { padding: 14px var(--card-pad); border-top: 1px solid var(--border); }
/* المنتج المضاف للتو: ومضة خفيفة */
.prod-item.is-new > details > summary { animation: pi-new 1.6s ease-out; }
@keyframes pi-new { 0%, 25% { background: color-mix(in srgb, var(--ok) 22%, transparent); } 100% { background: transparent; } }
.prod-item.is-new .pi-name::after { content: " ✓"; color: var(--ok); font-weight: 700; }

/* أسفل القسم: تعديل/إيقاف/حذف */
.cat-foot { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 6px; margin: 0 !important; padding: 10px var(--card-pad) 12px; border-top: 1px solid var(--border); background: var(--surface-2); }
.cat-foot .cat-edit-box { margin: 0; flex: 0 1 auto; }
.cat-foot .cat-edit-box[open] { flex-basis: 100%; order: 3; }
.cat-foot .cat-edit-box[open] > summary { margin-bottom: 0; }
.cat-foot form { margin: 0; }
.cat-foot .cat-edit-form { background: var(--surface); }
.prod-nohit { text-align: center; padding: 20px; }
.prod-hide { display: none !important; }
.new-cat > summary .pg-ic .i { color: var(--primary-ink); }
.prod-filter input { padding-inline-start: 40px !important; }
.cat-foot .cat-edit-box[open] { order: 0; }
@media (min-width: 900px) { .cat-list { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; } }

/* =====================================================================
   شاشة البداية: افتتاحية oli (من حزمة oli-intro) — قطرة تسقط، يتكوّن الحرف o حولها، ثم l و i والنقطة، ولمعة ذهبية
   مدمجة في النظام: CSS هنا (بدون <style> داخل الصفحة بسبب CSP)، مرة لكل جلسة، 2.6 ثانية
   ===================================================================== */
.splash-screen { display: none; }
html.splash .splash-screen {
  --sp-ink: #11151c; --sp-quiet: #7c7972; --sp-gold: #b98421;
  position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; overflow: hidden;
  background: #fff; color: var(--sp-ink); -webkit-tap-highlight-color: transparent;
}
html.splash body { overflow: hidden; }
.sp-skip {
  position: absolute; top: calc(env(safe-area-inset-top) + clamp(18px, 4vw, 40px)); left: clamp(18px, 5vw, 64px);
  display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 6px; border: 0; background: none;
  color: var(--sp-quiet); font: inherit; font-size: .75rem; cursor: pointer; transition: color .2s; opacity: 0; animation: sp-fade .5s .6s both;
}
.sp-skip:hover { color: var(--sp-ink); }
.sp-skip:focus-visible { outline: 2px solid var(--sp-gold); outline-offset: 4px; border-radius: 8px; }
.sp-skip svg { width: 16px; height: 16px; }
.sp-center { display: flex; flex-direction: column; align-items: center; padding: 0 24px; }
.sp-logo-wrap { position: relative; width: clamp(200px, 29vw, 320px); max-width: 74vw; aspect-ratio: 700 / 520; direction: ltr; }
.sp-brand { position: relative; z-index: 2; display: block; width: 100%; height: 100%; overflow: visible; }
.sp-piece { transform-box: fill-box; transform-origin: center; }
.sp-trace { fill: none; stroke: var(--sp-gold); stroke-width: 1.5; stroke-linecap: round; opacity: 0; stroke-dasharray: 1; stroke-dashoffset: 1; }
.sp-shine { opacity: 0; }
.sp-ripple { position: absolute; z-index: 0; left: 28%; top: 64%; width: 84px; height: 24px; border: 1px solid var(--sp-gold); border-radius: 50%; opacity: 0; transform: translate(-50%, -50%); }
.sp-welcome { margin: 30px 0 0; font-size: 1rem; line-height: 1.8; color: var(--sp-ink); }
.sp-welcome b { font-family: Arial, sans-serif; font-weight: 600; direction: ltr; display: inline-block; }
.sp-rule { margin-top: 20px; width: 32px; height: 1px; background: var(--sp-gold); opacity: .65; transform-origin: center; }
/* التسلسل الزمني (مطابق للحزمة) */
html.splash .sp-drop { animation: sp-drop-in .9s cubic-bezier(.2, .8, .15, 1) .04s both; }
html.splash .sp-o { animation: sp-form-ring .85s cubic-bezier(.2, .8, .15, 1) .43s both; }
html.splash .sp-l { animation: sp-letter-in .75s cubic-bezier(.16, 1, .3, 1) .77s both; }
html.splash .sp-i { animation: sp-letter-in .75s cubic-bezier(.16, 1, .3, 1) .92s both; }
html.splash .sp-dot { animation: sp-dot-in .7s cubic-bezier(.2, .8, .15, 1) 1.03s both; }
html.splash .sp-trace { animation: sp-trace-ring 1.4s ease .21s both; }
html.splash .sp-ripple { animation: sp-ripple 1s cubic-bezier(.2, .6, .2, 1) .48s both; }
html.splash .sp-shine { animation: sp-gold-sweep 1.1s cubic-bezier(.2, .5, .3, 1) 1.34s both; }
html.splash .sp-welcome { animation: sp-welcome-in .65s ease 1.65s both; }
html.splash .sp-rule { animation: sp-rule-in .7s cubic-bezier(.16, 1, .3, 1) 1.73s both; }
@keyframes sp-drop-in { 0% { opacity: 0; transform: translateY(-114px) scale(.38, .75); } 25% { opacity: 1; } 58% { transform: translateY(4px) scale(1.025, .975); } 82% { transform: translateY(-1px) scale(.997, 1.003); } 100% { opacity: 1; transform: none; } }
@keyframes sp-form-ring { 0% { opacity: 0; transform: scale(.86) rotate(-9deg); } 100% { opacity: 1; transform: none; } }
@keyframes sp-letter-in { 0% { opacity: 0; transform: translateY(24px); } 100% { opacity: 1; transform: none; } }
@keyframes sp-dot-in { 0% { opacity: 0; transform: translateY(-48px) scale(.6); } 70% { opacity: 1; transform: translateY(2px) scale(1.035, .965); } 100% { opacity: 1; transform: none; } }
@keyframes sp-trace-ring { 0% { opacity: 0; stroke-dashoffset: 1; } 15% { opacity: .55; } 70% { opacity: .4; stroke-dashoffset: 0; } 100% { opacity: 0; stroke-dashoffset: 0; } }
@keyframes sp-ripple { 0% { opacity: 0; transform: translate(-50%, -50%) scale(.4); } 18% { opacity: .23; } 100% { opacity: 0; transform: translate(-50%, -50%) scale(3.2); } }
@keyframes sp-gold-sweep { 0% { opacity: 0; transform: translateX(-520px); } 20% { opacity: .32; } 75% { opacity: .2; } 100% { opacity: 0; transform: translateX(850px); } }
@keyframes sp-welcome-in { 0% { opacity: 0; transform: translateY(9px); } 100% { opacity: 1; transform: none; } }
@keyframes sp-rule-in { 0% { opacity: 0; transform: scaleX(0); } 100% { opacity: .65; transform: scaleX(1); } }
@keyframes sp-fade { from { opacity: 0; } to { opacity: 1; } }
/* الخروج: تلاشٍ هادئ والصفحة تدخل من الأسفل */
html.splash-out .splash-screen { opacity: 0; visibility: hidden; transition: opacity .4s ease, visibility 0s .4s; pointer-events: none; }
html.splash-out .sp-center { transform: scale(1.04); opacity: 0; transition: transform .45s cubic-bezier(.4, 0, .2, 1), opacity .35s; }
html.splash .wrap { opacity: 0; transform: translateY(14px); }
html.splash .bottom { transform: translateY(105%); }
html.splash .side { transform: translateX(105%); }
html.splash.splash-out .wrap { opacity: 1; transform: none; transition: opacity .45s .1s, transform .55s .1s cubic-bezier(.2, .8, .2, 1); }
html.splash.splash-out .bottom, html.splash.splash-out .side { transform: none; transition: transform .55s .15s cubic-bezier(.2, .8, .2, 1); }
@media (max-width: 600px) { .sp-logo-wrap { width: 232px; } .sp-welcome { margin-top: 28px; } }
@media (max-height: 520px) { .sp-logo-wrap { width: 180px; } .sp-welcome { margin-top: 14px; } }
@media (prefers-reduced-motion: reduce) {
  html.splash .splash-screen *, html.splash .splash-screen { animation: none !important; }
  .sp-piece, .sp-welcome, .sp-skip { opacity: 1 !important; transform: none !important; }
  .sp-trace, .sp-ripple, .sp-shine { opacity: 0 !important; }
  html.splash .wrap, html.splash .bottom, html.splash .side { transform: none; }
}
@media print { .splash-screen { display: none !important; } }

/* =====================================================================
   v25 — مراجعة التصميم (أولويات الفهم والسرعة)
   ===================================================================== */
/* صفحات النماذج (إضافة/تعديل مورد) في الموبايل: بلا شريط سفلي وزر + — زر «التالي» وحده ثابتاً */
@media (max-width: 767px) {
  .is-form .bottom { display: none; }
  .is-form.is-app .wrap { padding-bottom: calc(env(safe-area-inset-bottom) + 16px); }
  .is-form .wiz-actions { bottom: calc(env(safe-area-inset-bottom) + 10px); }
}
.wiz-actions .btn-primary .i { width: 20px; height: 20px; }

/* لوحة الفلاتر: عنوان + إغلاق + «تم» */
.filters-head { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; margin-bottom: 2px; }
.filters-head b { display: flex; align-items: center; gap: 8px; font-size: 1rem; }
.filters-head b .i { width: 18px; height: 18px; color: var(--primary); }
.filters-foot { grid-column: 1 / -1; display: flex; gap: 8px; justify-content: flex-end; margin-top: 4px; }
.filters-foot .btn-primary { min-width: 110px; }

/* الكمبيوتر: الموردون يملؤون العرض (3–5 أعمدة) */
.is-wide .wrap:has(#list) { max-width: 1680px; }
@media (min-width: 1024px) { .list { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); } }
.hero-date { white-space: nowrap; }
@media (max-width: 599px) { .hero-date { display: none; } }

/* أزرار الفلاتر السريعة 44px في كل الأحجام */
.chip, .sub-chips .chip { min-height: 44px; }
/* صفحة المورد: «⋯» للخيارات الثانوية */
.tools .more-btn { width: 48px; padding: 0; flex: none; }
.tools .more-btn .i { width: 22px; height: 22px; }
.more-menu {
  position: fixed; inset: auto; margin: 0; padding: 6px; width: min(280px, calc(100vw - 24px));
  border: 1px solid var(--border); border-radius: var(--r); background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg);
  opacity: 0; transform: translateY(6px) scale(.98); transition: opacity .15s, transform .15s, overlay .15s allow-discrete, display .15s allow-discrete;
}
.more-menu:popover-open { opacity: 1; transform: none; }
@starting-style { .more-menu:popover-open { opacity: 0; transform: translateY(6px) scale(.98); } }
.more-menu::backdrop { background: rgba(16, 24, 40, .12); }
.more-menu a, .more-menu button {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 52px; padding: 8px 12px; border: 0; border-radius: 10px;
  background: none; color: var(--text); font: inherit; text-align: start; cursor: pointer;
}
.more-menu a:hover, .more-menu button:hover { background: var(--surface-2); color: var(--text); }
.more-menu .i { width: 20px; height: 20px; color: var(--primary); flex: none; }
.more-menu span { display: flex; flex-direction: column; line-height: 1.35; }
.more-menu small { color: var(--muted); font-size: .75rem; }
.facts .fact-wide { grid-column: 1 / -1; }
@media print { .more-menu { display: none !important; } }
/* شارة نوع النشاط بلون لكل نوع */
.item-co { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; }
.et-badge { display: inline-flex; align-items: center; min-height: 22px; padding: 1px 9px; border-radius: 999px; background: var(--cs); color: var(--c); font-size: .75rem; font-weight: 600; }
.badge-more { font-weight: 600; }


.btn-row.tools { display: flex; flex-wrap: nowrap; }
.btn-row.tools > .btn:first-child { flex: 1; }
.btn-row.tools .more-btn { flex: 0 0 52px; width: 52px; }

/* =====================================================================
   v26 — الشريط العلوي + قائمة «+» السريعة + السحب للتحديث
   ===================================================================== */
/* الشريط العلوي: زجاج شفاف، يصغر ويتضح عند التمرير */
.top {
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  border-bottom-color: transparent;
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  transition: min-height .25s cubic-bezier(.2, .8, .2, 1), box-shadow .25s, border-color .25s, background-color .25s;
}
.scrolled .top { background: color-mix(in srgb, var(--surface) 82%, transparent); border-bottom-color: var(--border); box-shadow: 0 10px 30px -22px rgba(16, 24, 40, .45); }
@media (max-width: 767px) {
  .scrolled .top { min-height: calc(var(--top-h) - 6px + env(safe-area-inset-top)); }
  .brand-top img { transition: height .25s, width .25s; }
  .scrolled .brand-top img { height: 28px; }
}
.brand-top { gap: 9px; }
.brand-top b { font-size: 1rem; letter-spacing: -.01em; }
.top-back { width: 42px; height: 42px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); color: var(--text); box-shadow: var(--shadow-sm); }
.top-back:active { transform: scale(.94); }
.top-title { font-size: 1rem; font-weight: 700; letter-spacing: -.01em; }
/* الكمبيوتر: عنوان الصفحة مع أيقونته */
.is-app .top-page { gap: 10px; color: var(--text); font-weight: 700 !important; font-size: 1rem !important; }
.top-page-ic { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 11px; background: var(--primary-soft); color: var(--primary); }
.top-page-ic .i { width: 18px; height: 18px; }
.top-page b { font-weight: 700; }
/* زر الحساب */
.user-btn { transition: border-color .2s, box-shadow .2s, transform .15s, background-color .2s; }
.user-btn:active { transform: scale(.96); }
.user-btn .avatar { box-shadow: 0 0 0 2px var(--surface), 0 0 0 3.5px color-mix(in srgb, var(--primary) 35%, transparent); }
/* بدون إنترنت */
.net-chip { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 12px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: .75rem; font-weight: 700; animation: net-in .35s cubic-bezier(.34, 1.56, .64, 1); }
.net-chip .i { width: 16px; height: 16px; }
.net-chip:not([hidden]) ~ .user-btn { margin-inline-start: 0; }
@keyframes net-in { from { opacity: 0; transform: translateY(-6px) scale(.9); } to { opacity: 1; transform: none; } }
@media (max-width: 767px) { .net-chip { margin-inline-start: auto; } }

/* زر «+» ↔ «×» */
.bottom a.fab .i { transition: transform .4s cubic-bezier(.34, 1.56, .64, 1); }
.bottom a.fab.fab-open > span { background: var(--text); color: var(--surface); box-shadow: 0 10px 24px -8px rgba(16, 24, 40, .55); }
.bottom a.fab.fab-open .i { transform: rotate(135deg) !important; }
.bottom a.fab.fab-open { color: var(--text); }
.fab-on .bottom { z-index: 70; }
/* القائمة السريعة: خلفية ضبابية وبطاقات ترتفع من الزر بالتتابع */
.fab-sheet { position: fixed; inset: 0; z-index: 65; }
.fab-backdrop { position: absolute; inset: 0; background: rgba(8, 14, 30, .38); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); opacity: 0; transition: opacity .25s; }
.fab-sheet.open .fab-backdrop { opacity: 1; }
.fab-actions {
  position: absolute; left: 50%; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 18px); width: min(360px, calc(100vw - 32px));
  transform: translateX(-50%); display: flex; flex-direction: column; gap: 10px;
}
.fab-act {
  display: flex; align-items: center; gap: 14px; min-height: 64px; padding: 10px 14px; border-radius: 18px;
  background: var(--surface); color: var(--text); border: 1px solid var(--border); box-shadow: 0 14px 34px -16px rgba(8, 14, 30, .5);
  opacity: 0; transform: translateY(24px) scale(.94); transition: opacity .22s, transform .32s cubic-bezier(.34, 1.4, .64, 1);
  -webkit-tap-highlight-color: transparent;
}
.fab-act:hover, .fab-act:focus-visible { color: var(--text); border-color: var(--primary); }
.fab-act:active { transform: scale(.97) !important; }
.fab-sheet.open .fab-act { opacity: 1; transform: none; }
/* تتابع من الأقرب للزر (الأسفل) للأبعد */
.fab-act:nth-last-child(1) { transition-delay: 0s; }
.fab-act:nth-last-child(2) { transition-delay: .04s; }
.fab-act:nth-last-child(3) { transition-delay: .08s; }
.fab-act:nth-last-child(4) { transition-delay: .12s; }
.fab-sheet.closing .fab-act { transition-delay: 0s; transition-duration: .16s; }
.fab-act > span:last-child { display: flex; flex-direction: column; min-width: 0; line-height: 1.35; }
.fab-act b { font-size: 1rem; font-weight: 700; }
.fab-act small { font-size: .75rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fa-ic { display: grid; place-items: center; flex: none; width: 44px; height: 44px; border-radius: 14px; background: var(--primary-soft); color: var(--primary); }
.fa-ic .i { width: 22px; height: 22px; }
.fab-main { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.fab-main:hover, .fab-main:focus-visible { color: var(--primary-ink); }
.fab-main .fa-ic { background: rgba(255, 255, 255, .18); color: #fff; }
.fab-main small { color: rgba(255, 255, 255, .8); }
.fa-wa { background: color-mix(in srgb, var(--wa) 14%, transparent); color: var(--wa); }
.fa-copy { background: var(--accent-soft); color: var(--accent); }
.fa-prod { background: var(--surface-2); color: var(--text-2); }
@media (min-width: 768px) { .fab-sheet { display: none; } }

/* السحب للتحديث */
.ptr {
  --ptr: 0px; --rot: 0deg;
  position: fixed; z-index: 45; left: 50%; top: calc(var(--top-h) + env(safe-area-inset-top) - 46px);
  width: 46px; height: 46px; margin-left: -23px; display: grid; place-items: center; border-radius: 50%;
  background: var(--surface); color: var(--primary); border: 1px solid var(--border); box-shadow: 0 10px 26px -10px rgba(16, 24, 40, .45);
  transform: translateY(var(--ptr)) scale(calc(.6 + min(var(--ptr), 76px) / 190px)); opacity: 0; pointer-events: none;
  transition: transform .3s cubic-bezier(.34, 1.4, .64, 1), opacity .2s, background-color .2s, color .2s;
}
.ptr.on { opacity: 1; }
.ptr.on:not(.busy) { transition: opacity .15s, background-color .2s, color .2s; }
.ptr-ic { display: grid; place-items: center; transform: rotate(var(--rot)); }
.ptr-ic .i { width: 22px; height: 22px; }
.ptr.armed { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); }
.ptr.busy .ptr-ic { animation: ptr-spin .7s linear infinite; }
.ptr.done { background: var(--ok); border-color: var(--ok); color: #fff; }
.ptr.done .ptr-ic { animation: none; transform: scale(1.1); }
@keyframes ptr-spin { to { transform: rotate(360deg); } }
@media (pointer: coarse) { html { overscroll-behavior-y: contain; } }
@media (min-width: 768px) { .ptr { display: none; } }
@media (prefers-reduced-motion: reduce) { .fab-act, .fab-backdrop, .ptr { transition: none; } .ptr.busy .ptr-ic { animation-duration: 1.4s; } }
.swipe-hint .link-btn { flex: none; white-space: nowrap; }
.swipe-hint span { flex: 1; min-width: 0; }

/* الفلاتر السريعة: كل الأقسام ظاهرة — في الموبايل تلتف على عدة أسطر بدل التمرير الجانبي */
.chip-empty:not(.on) { opacity: .62; }
.chip-empty:not(.on) small { opacity: .8; }
@media (max-width: 767px) {
  #chips { flex-wrap: wrap; overflow: visible; row-gap: 8px; scroll-snap-type: none; -webkit-mask-image: none !important; mask-image: none !important; }
  #chips .chip { scroll-snap-align: none; }
}
/* الصفحة الرئيسية بلا حقل بحث: زر الفلاتر بجانب عدد الموردين */
.meta-row { flex-wrap: wrap; }
.filters-btn { position: relative; margin-inline-start: auto; gap: 6px; }
.filters-btn .i { width: 17px; height: 17px; }
.filters-btn[aria-expanded="true"] { background: var(--primary-soft); color: var(--primary); border-color: transparent; }
.filters-btn .dot { position: absolute; top: 7px; inset-inline-end: 7px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); border: 2px solid var(--surface); }
#filters { margin: 0 0 12px; }
.search-sticky .chips:first-child { padding-top: 4px; }

/* =====================================================================
   v34 — صفحة المورد: بطاقة رئيسية واحدة واضحة + الأقسام
   ===================================================================== */
.sup { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 900px) {
  .sup { grid-template-columns: minmax(340px, 420px) minmax(0, 1fr); }
  .sup-hero { position: sticky; top: calc(var(--top-h) + 16px); }
}
.is-wide .wrap:has(.sup) { max-width: 1100px; }
.sup .card { margin: 0; }
.sup-head { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.sup-mark { display: grid; place-items: center; flex: none; width: 56px; height: 56px; border-radius: 18px; background: var(--cs); color: var(--c); }
.sup-mark .i { width: 26px; height: 26px; }
.sup-title { min-width: 0; }
.sup-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 4px; }
.sup-title h1 { font-size: 1.625rem; line-height: 1.3; margin: 0; overflow-wrap: anywhere; }
.sup-co { margin: 2px 0 0; color: var(--muted); }
/* الموقع والأرقام */
.sup-facts { list-style: none; margin: 0 0 14px; padding: 0; border: 1px solid var(--border); border-radius: 14px; overflow: hidden; }
.sup-facts li { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 8px 12px; border-top: 1px solid var(--border); }
.sup-facts li:first-child { border-top: 0; }
.sf-ic { display: grid; place-items: center; flex: none; width: 36px; height: 36px; border-radius: 11px; background: var(--surface-2); color: var(--muted); }
.sf-ic .i { width: 18px; height: 18px; }
.sf-ic.sf-wa { color: var(--wa); background: color-mix(in srgb, var(--wa) 12%, transparent); }
.sf-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.4; }
.sf-txt small { font-size: .75rem; color: var(--muted); }
.sf-num { font-size: 1rem; font-weight: 600; color: var(--text); text-align: right; font-variant-numeric: tabular-nums; letter-spacing: .02em; }
a.sf-num:hover { color: var(--primary); }
.sf-copy { flex: none; width: 44px; height: 44px; color: var(--muted); transition: color .2s, background .2s, transform .2s; }
.sf-copy:active { transform: scale(.92); }
.sf-copy.copied { color: var(--ok); background: var(--ok-soft); }
.sf-none .sf-txt { color: var(--muted); }
/* الأزرار */
.sup-hero .actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 8px; margin: 0 0 8px; }
.sup-hero .actions .btn { min-height: 50px; font-size: 1rem; }
.sup-hero .tools { margin: 0; }
/* من أضافه: سطر صغير أسفل البطاقة */
.sup-meta { display: flex; align-items: center; gap: 8px; margin: 14px calc(var(--card-pad) * -1) calc(var(--card-pad) * -1); padding: 12px var(--card-pad); border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--r) var(--r); font-size: .75rem; color: var(--muted); line-height: 1.5; }
.sup-meta b { color: var(--text-2); font-weight: 600; }
.sup-meta .avatar { flex: none; }
/* الأقسام */
.sup-secs .card-title { align-items: center; }
.sec-count { display: inline-grid; place-items: center; min-width: 26px; height: 22px; padding: 0 7px; margin-inline-start: 4px; border-radius: 999px; background: var(--surface-2); color: var(--text-2); font-size: .75rem; font-weight: 700; }
.sup-secs .sec-group + .sec-group { margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--border); }
.sup-secs .link-more { gap: 6px; margin-top: 16px; }
.sup-secs .link-more .i { width: 16px; height: 16px; }
/* واتساب في الوضع الداكن: نص داكن على الأخضر الفاتح (تباين واضح) */
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn-wa { color: #052e16; } }
:root[data-theme="dark"] .btn-wa { color: #052e16; }
@media print {
  .sup { display: block; }
  .sup-hero { position: static; }
  .sf-copy, .sup-meta .avatar { display: none !important; }
  .sup .card { break-inside: avoid; margin-bottom: 10px; }
}

/* =====================================================================
   v35 — صفحة إضافة/تعديل مورد
   ===================================================================== */
.wiz-head h1 { margin-bottom: 2px; }
.wiz-sub { margin: 0 0 14px; font-size: .875rem; color: var(--muted); }
/* المؤشر: شرائح متصلة تمتلئ بالتقدم */
.steps li { border-bottom: 0; padding-bottom: 12px; }
.steps li::after { content: ""; position: absolute; inset-inline: 0; bottom: 0; height: 4px; border-radius: 99px; background: var(--border); }
.steps li::before { content: ""; position: absolute; z-index: 1; inset-inline-start: 0; bottom: 0; height: 4px; width: 0; border-radius: 99px; background: var(--primary); transition: width .45s cubic-bezier(.2, .8, .2, 1); }
.steps li.on::before { width: 50%; }
.steps li.done::before { width: 100%; }
.steps li.done span { background: var(--primary); color: var(--primary-ink); }
@media (max-width: 479px) { .steps li { font-size: .75rem; gap: 6px; } .steps li span { width: 24px; height: 24px; } }
/* الخطوة 1: ثلاث بطاقات واضحة بدل بطاقة طويلة */
.wiz-step[data-step="1"] { background: none; border: 0; box-shadow: none; padding: 0; }
.wiz-step[data-step="1"] > .wiz-sec {
  padding: var(--card-pad); margin: 0 0 12px; border: 1px solid var(--border); border-radius: var(--r);
  background: var(--surface); box-shadow: var(--shadow);
}
.wiz-step[data-step="1"] > .wiz-sec + .wiz-sec { border-top: 1px solid var(--border); margin-top: 0; }
.wiz-step[data-step="1"] .wiz-actions { margin-inline: 0; }
.wiz-sec-h { font-size: 1rem; color: var(--text); gap: 10px; margin-bottom: 14px; }
.wiz-sec-h .i { width: 32px; height: 32px; padding: 7px; border-radius: 10px; background: var(--primary-soft); color: var(--primary); box-sizing: border-box; }
.wiz-sec label:last-child, .wiz-sec .switch:last-child { margin-bottom: 0; }
/* المسودة */
.draft-bar { flex-wrap: nowrap; gap: 10px; padding: 8px 8px 8px 12px; }
.db-ic { display: grid; place-items: center; flex: none; width: 34px; height: 34px; border-radius: 10px; background: var(--surface); color: var(--primary); }
.db-ic .i { width: 18px; height: 18px; }
.db-txt { flex: 1 1 auto !important; min-width: 0; display: flex; flex-direction: column; line-height: 1.35; }
.db-txt small { color: var(--muted); font-size: .75rem; }
.draft-bar .btn { flex: none; }
#draftDiscard { width: 44px; padding: 0; }
/* الخطوة 2: شريط «المختار» */
.psel { position: sticky; top: calc(var(--top-h) + env(safe-area-inset-top) + 6px); z-index: 5; display: flex; align-items: center; gap: 10px; margin: 0 0 12px; padding: 8px 10px; border: 1px solid color-mix(in srgb, var(--primary) 30%, var(--border)); border-radius: 14px; background: color-mix(in srgb, var(--primary-soft) 85%, var(--surface)); box-shadow: var(--shadow); }
.psel-h { flex: none; font-size: .75rem; color: var(--primary); font-weight: 600; display: flex; align-items: center; gap: 6px; }
.psel-h b { display: inline-grid; place-items: center; min-width: 24px; height: 24px; padding: 0 6px; border-radius: 99px; background: var(--primary); color: var(--primary-ink); font-size: .75rem; }
.psel-list { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; min-width: 0; }
.psel-list::-webkit-scrollbar { display: none; }
.psel-chip { flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 0 6px 0 12px; border: 1px solid var(--border); border-radius: 99px; background: var(--surface); color: var(--text); font: inherit; font-size: .75rem; font-weight: 500; cursor: pointer; animation: psel-in .25s cubic-bezier(.34, 1.56, .64, 1); }
.psel-chip span { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--surface-2); color: var(--muted); font-size: 1rem; line-height: 1; }
.psel-chip:hover span { background: var(--danger-soft); color: var(--danger); }
@keyframes psel-in { from { opacity: 0; transform: scale(.8); } to { opacity: 1; transform: none; } }
.ptile span b { line-height: 1.35; }
/* الخطوة 3: معاينة بطاقة المورد */
.rv { display: block; }
.rv-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.rv-title { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.rv-title b { font-size: 1.25rem; line-height: 1.35; overflow-wrap: anywhere; }
.rv-title span { color: var(--muted); font-size: .875rem; }
.rv-none { color: var(--muted); font-weight: 400; font-size: .875rem; }
.rv-edit { display: grid; place-items: center; flex: none; width: 44px; height: 44px; border: 0; border-radius: 12px; background: none; color: var(--primary); cursor: pointer; }
.rv-edit:hover { background: var(--primary-soft); }
.rv-edit .i { width: 18px; height: 18px; }
.rv-facts li { padding-inline-end: 4px; }
.rv-secs { padding: 12px; border: 1px solid var(--border); border-radius: 14px; }
.rv-secs-h { display: flex; align-items: center; justify-content: space-between; margin: -4px 0 6px; }
.rv-secs-h b { display: flex; align-items: center; gap: 6px; }
.rv-secs .sec-group + .sec-group { margin-top: 10px; }
/* إصلاح: قواعد قديمة كانت تطبَّق على العناصر الجديدة */
.draft-bar > span { flex: none; }
.draft-bar > .db-txt { flex: 1 1 auto; }
.draft-bar > .db-ic { width: 34px; }
.review.rv > div { display: block; padding: 0; border-bottom: 0; grid-template-columns: none; }
.review.rv > .rv-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.review.rv > .rv-secs { padding: 12px; border: 1px solid var(--border); border-radius: 14px; }
.rv-secs-h { margin: 0 0 8px; }
.rv-secs .sec-group { display: block; }

/* =====================================================================
   v36 — الصفحة الرئيسية
   ===================================================================== */
.hero { align-items: flex-end; margin: 4px 0 12px; }
.hero-text { min-width: 0; }
.hero-greet { margin: 0 0 2px; font-size: .875rem; font-weight: 600; color: var(--primary); }
.hero h1 { font-size: 1.25rem; line-height: 1.35; margin: 0; }
.hero .hero-date { display: block !important; margin: 4px 0 0; font-size: .75rem; }
@media (min-width: 768px) { .hero h1 { font-size: 1.625rem; } }
/* لمحة سريعة */
.home-stats { list-style: none; margin: 0 0 14px; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.home-stats li { display: flex; flex-direction: column; justify-content: center; gap: 2px; min-height: 64px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow-sm); min-width: 0; }
.home-stats b { font-size: 1.25rem; font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; color: var(--text); }
.home-stats span { font-size: .75rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.home-stats .hs-new b { color: var(--ok); }
@media (max-width: 479px) { .home-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); } .home-stats .hide-xs { display: none; } .home-stats li { padding: 8px 10px; min-height: 58px; } }
@media (min-width: 1024px) { .home-stats { max-width: 720px; } }
/* سطر العدد */
#count b { color: var(--text); font-weight: 600; }
#count .cnt { display: inline-grid; place-items: center; min-width: 26px; height: 22px; padding: 0 7px; margin-inline-start: 2px; border-radius: 99px; background: var(--primary-soft); color: var(--primary); font-size: .75rem; font-weight: 700; }
#count .sort-hint { color: var(--muted); font-size: .75rem; }
/* بطاقة بلا رقم: أيقونة بدل نص مكسور */
.no-num { display: grid !important; place-items: center; width: 44px; height: 44px; min-height: 0 !important; padding: 0 !important; border-radius: 50% !important; color: var(--muted); }
.no-num .i { width: 20px; height: 20px; }
@media (max-width: 599px) { .item:not(.skel) .no-num { max-width: none; } }
/* لمسة على البطاقة */
.item { transition: transform .15s, box-shadow .2s, border-color .2s; }
.item:active { transform: scale(.985); }
.chip .i { flex: none; }
@media (max-width: 599px) {
  .hero { margin-bottom: 10px; }
  .hero .hero-date { display: none !important; }
  .hero h1 { font-size: 1.25rem; }
  .home-stats { gap: 6px; margin-bottom: 10px; }
  .home-stats li { min-height: 0; padding: 7px 10px; gap: 0; border-radius: 12px; }
  .home-stats b { font-size: 1rem; }
}

/* =====================================================================
   v37 — القائمة الجانبية (أقسام سريعة) + الشريط السفلي العائم
   ===================================================================== */
@media (min-width: 768px) {
  .side-nav { overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; flex: 1; min-height: 0; }
  .side-nav a.side-cat { min-height: 40px; font-size: .875rem; font-weight: 500; }
  .side-cat .side-ic { width: 30px; height: 30px; border-radius: 9px; background: var(--cs); color: var(--c); }
  .side-cat .side-ic .i { width: 17px; height: 17px; }
  .side-cat.is-empty { opacity: .62; }
  .side-cat .side-count { font-weight: 600; }
  .side-nav a.side-cat.on { background: color-mix(in srgb, var(--cs) 70%, var(--surface)); color: var(--text); }
  .side-nav a.side-cat.on .side-ic { background: var(--c); color: #fff; box-shadow: none; }
  .side-nav a.side-cat.on::before { background: var(--c); }
}
/* الشريط السفلي العائم (موبايل/التطبيق) */
@media (max-width: 767px) {
  .bottom {
    left: 10px; right: 10px; bottom: max(10px, env(safe-area-inset-bottom));
    height: var(--nav-h); padding: 0 4px; border: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
    border-radius: 24px; background: color-mix(in srgb, var(--surface) 82%, transparent);
    box-shadow: 0 12px 34px -14px rgba(16, 24, 40, .35), 0 1px 0 rgba(255, 255, 255, .5) inset;
    -webkit-backdrop-filter: saturate(180%) blur(18px); backdrop-filter: saturate(180%) blur(18px);
  }
  .is-app .wrap { padding-bottom: calc(var(--nav-h) + max(10px, env(safe-area-inset-bottom)) + 28px); }
  .bottom a.fab span { margin-top: -22px; box-shadow: 0 10px 22px -6px rgba(37, 99, 235, .6), 0 0 0 5px color-mix(in srgb, var(--bg) 92%, transparent); }
  .toast { bottom: calc(var(--nav-h) + max(10px, env(safe-area-inset-bottom)) + 16px); }
  .fab-actions { bottom: calc(var(--nav-h) + max(10px, env(safe-area-inset-bottom)) + 22px); }
  html.splash .bottom { transform: translateY(140%); }
}
@media (max-width: 767px) and (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .bottom { box-shadow: 0 12px 34px -14px rgba(0, 0, 0, .7); } }
@media (max-width: 767px) { :root[data-theme="dark"] .bottom { box-shadow: 0 12px 34px -14px rgba(0, 0, 0, .7); } }

/* =====================================================================
   v38 — الموبايل: بلا مربعات إحصائيات، وشريط علوي أحدث
   ===================================================================== */
@media (max-width: 767px) { .home-stats { display: none; } }
.hero h1 { font-size: 1.25rem; }
@media (min-width: 768px) { .hero h1 { font-size: 1.625rem; } }
/* صورة الحساب مع نقطة الاتصال */
.user-av { position: relative; display: inline-grid; flex: none; }
.net-dot { position: absolute; bottom: 0; inset-inline-start: 0; width: 11px; height: 11px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 2px var(--surface); transition: background .3s; }
.is-offline .net-dot { background: #98a2b3; }
@media (max-width: 767px) {
  .top { gap: 12px; padding-inline: 14px; min-height: calc(56px + env(safe-area-inset-top)); }
  .scrolled .top { min-height: calc(52px + env(safe-area-inset-top)); }
  /* الشعار والاسم */
  .brand-top { gap: 10px; min-height: 44px; }
  .brand-top img { height: 34px; width: auto; max-width: 96px; border-radius: 11px; box-shadow: 0 4px 12px -6px rgba(16, 24, 40, .35); }
  .scrolled .brand-top img { height: 30px; }
  .brand-top b { font-size: 1rem; font-weight: 700; letter-spacing: -.01em; }
  /* زر الحساب: صورة دائرية فقط بإطار ناعم (بلا اسم وسهم) */
  .user-btn { order: 3; margin-inline-start: auto; padding: 2px; min-width: 44px; min-height: 44px; border: 0; background: none; box-shadow: none; border-radius: 50%; }
  .user-btn-text, .user-btn-chev { display: none !important; }
  .user-btn .avatar { width: 38px; height: 38px; box-shadow: 0 0 0 2px var(--surface), 0 0 0 3.5px color-mix(in srgb, var(--primary) 40%, transparent); }
  .user-btn:has(+ .user-menu:popover-open) { box-shadow: none; }
  .user-btn:has(+ .user-menu:popover-open) .avatar { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--primary); }
  .net-chip { order: 2; margin-inline-start: auto; }
  .net-chip:not([hidden]) + .user-btn { margin-inline-start: 0; }
  /* الصفحات الداخلية: زر رجوع دائري وعنوان واضح */
  .top-back { width: 40px; height: 40px; border-radius: 50%; }
  .top-title { font-size: 1rem; }
}

/* =====================================================================
   v39 — زر لصق الرقم + رسالة «تم الحفظ»
   ===================================================================== */
.tel-field { position: relative; display: block; margin-top: 6px; }
.tel-field input { margin-top: 0 !important; padding-left: 92px; }
.tel-paste {
  position: absolute; top: 50%; left: 6px; transform: translateY(-50%);
  display: inline-flex; align-items: center; gap: 5px; min-height: 36px; padding: 0 12px; border: 0; border-radius: 10px;
  background: var(--primary-soft); color: var(--primary); font: inherit; font-size: .75rem; font-weight: 700; cursor: pointer;
  transition: background .2s, color .2s, transform .15s;
}
.tel-paste .i { width: 16px; height: 16px; }
.tel-paste:hover { background: color-mix(in srgb, var(--primary) 16%, var(--surface)); }
.tel-paste:active { transform: translateY(-50%) scale(.94); }
.tel-paste.pasted { background: var(--ok-soft); color: var(--ok); }
.tel-paste:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
/* رسالة «تم الحفظ»: تظهر بحركة ثم تختفي وحدها */
.flash-saved { animation: saved-in .5s cubic-bezier(.34, 1.56, .64, 1); transition: opacity .35s, transform .35s; }
.flash-saved > .i { animation: saved-tick .6s .15s cubic-bezier(.34, 1.56, .64, 1) both; }
.flash-saved.fade-out { opacity: 0; transform: translateY(-8px); }
@keyframes saved-in { from { opacity: 0; transform: translateY(-10px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes saved-tick { 0% { transform: scale(0) rotate(-45deg); } 100% { transform: none; } }
@media (prefers-reduced-motion: reduce) { .flash-saved, .flash-saved > .i { animation: none; } }
/* الرقم يُكتب من اليسار، فالزر على اليمين حتى لا يغطيه */
.tel-field input { padding-left: 14px !important; padding-right: 92px !important; }
.tel-paste { left: auto; right: 6px; }

/* =====================================================================
   v40 — الدخول بالبصمة أو الوجه (Passkeys)
   ===================================================================== */
.pk-login { margin-bottom: 6px; }
.pk-btn { gap: 10px; min-height: 54px; border: 1px solid color-mix(in srgb, var(--primary) 30%, var(--border)); background: var(--primary-soft); color: var(--primary); font-weight: 700; }
.pk-btn:hover { background: color-mix(in srgb, var(--primary) 14%, var(--surface)); color: var(--primary); }
.pk-ic { display: grid; place-items: center; width: 30px; height: 30px; }
.pk-ic .i { width: 26px; height: 26px; }
.pk-btn.busy .pk-ic .i, #pkAdd.busy .i, [data-pk-yes].busy { animation: pk-pulse 1s ease-in-out infinite; }
@keyframes pk-pulse { 50% { opacity: .45; transform: scale(.92); } }
.pk-or { display: flex; align-items: center; gap: 10px; margin: 16px 0 6px; color: var(--muted); font-size: .75rem; }
.pk-or::before, .pk-or::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.pk-msg { margin: 8px 0 0; font-size: .875rem; text-align: center; color: var(--muted); }
.pk-msg[data-kind="err"] { color: var(--danger); }
.pk-msg[data-kind="ok"] { color: var(--ok); font-weight: 600; }
.pk-card .muted b { color: var(--text); }
.pk-list { list-style: none; margin: 12px 0 14px; padding: 0; border: 1px solid var(--border); border-radius: 14px; overflow: hidden; }
.pk-list li { display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 8px 8px 8px 12px; border-top: 1px solid var(--border); }
.pk-list li:first-child { border-top: 0; }
.pk-dev { display: grid; place-items: center; flex: none; width: 38px; height: 38px; border-radius: 12px; background: var(--ok-soft); color: var(--ok); }
.pk-dev .i { width: 20px; height: 20px; }
.pk-info { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.4; }
.pk-info small { color: var(--muted); font-size: .75rem; }
.pk-card label { margin-top: 4px; }
/* اقتراح التفعيل بعد الدخول */
.pk-offer { display: flex; align-items: center; gap: 12px; margin: 0 0 12px; padding: 10px 8px 10px 12px; border-radius: 16px; background: linear-gradient(135deg, var(--primary-soft), color-mix(in srgb, var(--primary-soft) 40%, var(--surface))); border: 1px solid color-mix(in srgb, var(--primary) 25%, var(--border)); animation: saved-in .45s cubic-bezier(.34, 1.56, .64, 1); }
.pko-ic { display: grid; place-items: center; flex: none; width: 42px; height: 42px; border-radius: 13px; background: var(--primary); color: var(--primary-ink); }
.pko-ic .i { width: 24px; height: 24px; }
.pko-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.4; }
.pko-txt small { color: var(--muted); font-size: .75rem; }
.pk-offer.done { background: var(--ok-soft); border-color: transparent; }
.pk-offer.done .pko-ic { background: var(--ok); }
.pk-offer.done .btn, .pk-offer.done [data-pk-later] { display: none; }

/* ============ v41: صفحة الدخول ============ */
.is-guest { background: radial-gradient(120% 60% at 50% -10%, color-mix(in srgb, var(--primary) 13%, transparent), transparent 70%), var(--bg); background-attachment: fixed; }
.is-guest .wrap { max-width: 960px; padding-top: max(16px, env(safe-area-inset-top)); }
.auth { display: grid; min-height: calc(100dvh - 40px); align-content: center; justify-items: center; padding-block: 20px; }
.auth-main { width: 100%; max-width: 400px; }
.auth-side { display: none; }

.auth-brand { display: grid; justify-items: center; gap: 12px; margin-bottom: 22px; text-align: center; animation: au-up .5s cubic-bezier(.2, .8, .2, 1) both; }
.ab-logo { position: relative; display: grid; place-items: center; }
.ab-logo::before { content: ""; position: absolute; inset: -14px; border-radius: 32px; background: radial-gradient(closest-side, color-mix(in srgb, var(--primary) 26%, transparent), transparent); filter: blur(6px); }
.auth .ab-logo img { position: relative; width: 76px; height: 76px; object-fit: contain; border-radius: 22px; padding: 8px !important; background: #fff !important; border: 1px solid rgba(16, 24, 40, .06); box-shadow: 0 10px 28px -10px color-mix(in srgb, var(--primary) 70%, transparent); }
.auth-brand h1 { margin: 0; font-size: 1.625rem; font-weight: 700; letter-spacing: -.01em; }

.auth-card {
  padding: 24px 20px 22px; border-radius: 22px; background: var(--surface);
  border: 1px solid var(--border); box-shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 24px 48px -24px rgba(16, 24, 40, .25);
  animation: au-up .5s .08s cubic-bezier(.2, .8, .2, 1) both;
}
.auth-card.has-err { animation: au-up .5s .08s cubic-bezier(.2, .8, .2, 1) both, shake .4s .55s; }
.ac-head { margin-bottom: 18px; }
.ac-head h2 { margin: 0 0 2px; font-size: 1.25rem; font-weight: 700; }
.ac-head p { margin: 0; color: var(--muted); font-size: .875rem; }
.auth-card .flash { margin: 0 0 14px; }
.auth-card label { margin-bottom: 14px; }

/* حقول بأيقونة */
.in-ic { position: relative; display: block; margin-top: 6px; }
.in-ic > .i { position: absolute; top: 50%; right: 14px; width: 19px; height: 19px; margin-top: -9.5px; color: var(--muted); pointer-events: none; transition: color .15s; z-index: 1; }
.in-ic input { margin-top: 0 !important; min-height: 50px !important; padding-right: 44px !important; border-radius: 14px !important; background: var(--surface-2) !important; box-shadow: none !important; border-color: transparent !important; }
.in-ic input:hover { border-color: var(--border-2) !important; }
.in-ic input:focus { background: var(--surface) !important; border-color: var(--primary) !important; box-shadow: 0 0 0 4px var(--ring) !important; }
.in-ic:focus-within > .i { color: var(--primary); }
.in-ic input[aria-invalid="true"] { border-color: var(--danger) !important; background: var(--danger-soft) !important; }
.in-ic input[aria-invalid="true"] ~ .i, .in-ic:has(input[aria-invalid="true"]) > .i { color: var(--danger); }
.in-ic.pw-field input { padding-left: 46px; }

.caps-warn { display: flex; align-items: center; gap: 6px; margin: -6px 0 12px; font-size: .75rem; color: var(--accent); }
.caps-warn .i { width: 15px; height: 15px; }
.field-err { margin: -8px 0 12px; font-size: .875rem; color: var(--danger); }

/* زر الدخول مع مؤشر انتظار */
.auth-go { position: relative; margin-top: 6px; min-height: 52px; border-radius: 14px; font-size: 1rem; }
.go-spin { display: none; width: 20px; height: 20px; border-radius: 50%; border: 2.5px solid currentColor; border-inline-end-color: transparent; animation: ptr-spin .7s linear infinite; }
.is-busy .auth-go { pointer-events: none; opacity: .9; }
.is-busy .go-txt { display: none; }
.is-busy .go-spin { display: block; }

.auth-card .pk-btn { min-height: 52px; border-radius: 14px; }
.auth-card .pk-or { margin: 18px 0 12px; }

.auth-foot { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 6px; margin: 18px 0 0; text-align: center; color: var(--muted); font-size: .75rem; animation: au-fade .6s .3s both; }
.auth-foot .i { width: 14px; height: 14px; color: var(--ok); }

@keyframes au-up { from { opacity: 0; transform: translateY(14px); } }
@keyframes au-fade { from { opacity: 0; } }

/* الكمبيوتر: بطاقة واحدة مقسومة — لوحة تعريف ملوّنة + نموذج، بنفس الارتفاع */
@media (min-width: 900px) {
  .auth {
    grid-template-columns: 400px 420px; justify-content: center; justify-items: stretch; align-content: center; gap: 0;
    min-height: calc(100dvh - 40px); padding: 0; margin: 0 auto;
  }
  .auth-side, .auth-main { align-self: stretch; }
  .auth-side {
    position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: center; gap: 14px;
    min-height: 540px; padding: 48px 40px; border-radius: 0 28px 28px 0; color: #fff;
    background: linear-gradient(155deg, #2563eb 0%, #1d4ed8 55%, #172554 100%);
    animation: au-fade .5s both;
  }
  .as-glow { position: absolute; inset: auto -30% -40% auto; width: 420px; height: 420px; border-radius: 50%; background: radial-gradient(closest-side, rgba(255, 255, 255, .2), transparent); }
  .auth-side::after { content: ""; position: absolute; inset: 0; background-image: radial-gradient(rgba(255, 255, 255, .12) 1px, transparent 1px); background-size: 18px 18px; mask-image: linear-gradient(to bottom, #000, transparent 75%); pointer-events: none; }
  .auth-side img { position: relative; width: 84px; height: 84px; border-radius: 24px; object-fit: contain; background: #fff; padding: 10px; box-shadow: 0 14px 30px -12px rgba(0, 0, 0, .45); }
  .auth-side h2 { position: relative; margin: 8px 0 2px; font-size: 1.625rem; font-weight: 700; color: #fff; }
  .auth-side ul { position: relative; list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 14px; }
  .auth-side li { display: flex; align-items: center; gap: 12px; font-size: 1rem; color: rgba(255, 255, 255, .92); }
  .auth-side li .i { flex: none; width: 38px; height: 38px; padding: 9px; border-radius: 12px; background: rgba(255, 255, 255, .14); }

  /* الجزء الأيسر: نفس البطاقة، النموذج في الوسط والملاحظة في أسفلها */
  .auth-main {
    display: flex; flex-direction: column; justify-content: center; max-width: none; padding: 40px 44px 24px;
    background: var(--surface); border: 1px solid var(--border); border-right: 0; border-radius: 28px 0 0 28px;
    animation: au-fade .5s both;
  }
  .auth { filter: drop-shadow(0 30px 40px rgba(16, 24, 40, .14)); }
  .auth-main .auth-brand { display: none; }
  .auth-card { padding: 0; border: 0; border-radius: 0; box-shadow: none; background: none; animation: au-up .5s .1s cubic-bezier(.2, .8, .2, 1) both; }
  .auth-card.has-err { animation: shake .4s .3s; }
  .ac-head h2 { font-size: 1.625rem; }
  .auth-foot { margin-top: auto; padding-top: 22px; }
}
@media (prefers-reduced-motion: reduce) {
  .auth-brand, .auth-card, .auth-side, .auth-foot { animation: none !important; }
}

/* ============ v43: صفحة الإضافة — منع التكرار ============ */
.dup { margin: -4px 0 14px; padding: 0; background: none; display: grid; gap: 8px; animation: au-up .25s ease-out; }
.dup-row { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border-radius: 14px; font-size: .875rem; line-height: 1.6; }
.dup-row > div { min-width: 0; flex: 1; display: grid; gap: 4px; }
.dup-row b { color: var(--text); font-weight: 600; }
.dup-row a:not(.btn) { color: var(--primary); font-weight: 700; }
.dup-row small { color: var(--muted); font-size: .75rem; }
.dup-same { background: color-mix(in srgb, var(--danger-soft) 70%, var(--surface)); border: 1px solid color-mix(in srgb, var(--danger) 22%, transparent); }
.dup-sim { background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 20%, transparent); }
.dup-ic { flex: none; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; font-weight: 800; font-size: .875rem; color: #fff; background: var(--danger); }
.dup-sim .dup-ic { background: var(--accent); }
.dup-prods { display: flex; flex-wrap: wrap; gap: 4px; }
.dup-prods span { padding: 1px 8px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); font-size: .75rem; color: var(--text-2); }
.dup-line { display: block; }
.dup-acts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.dup-acts .btn { min-height: 36px; background: var(--surface); border: 1px solid var(--border); }
.dup-have { margin: 0 0 12px; padding: 10px 12px; border-radius: 14px; font-size: .875rem; line-height: 1.7; background: var(--primary-soft); border: 1px solid color-mix(in srgb, var(--primary) 22%, transparent); }
.dup-have b { color: var(--primary); }
/* قسم مسجّل لهذا المورد من قبل: مقفل */
.ptile.is-have { cursor: not-allowed; }
.ptile.is-have > span { opacity: .55; background: var(--surface-2); border-style: dashed; }
.ptile.is-have::after { content: "مسجّل"; position: absolute; top: -7px; inset-inline-end: 8px; padding: 0 7px; border-radius: 999px; font-size: .6875rem; line-height: 18px; font-weight: 700; white-space: nowrap; color: var(--ok); background: var(--ok-soft); border: 1px solid color-mix(in srgb, var(--ok) 25%, transparent); }
.ptile.is-have .tick { display: none; }
/* أثناء الحفظ */
.wizard.is-saving #saveBtn { pointer-events: none; opacity: .85; }
.wizard.is-saving #saveBtn .i { animation: pk-pulse .9s ease-in-out infinite; }

/* ============ v44: الفحوصات ============ */
.fa-test { background: var(--ok-soft); color: var(--ok); }

/* --- رأس القائمة --- */
.tl-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 4px 0 12px; }
.tl-head h1 { margin: 0; font-size: 1.625rem; font-weight: 700; }
.tl-head p { margin: 2px 0 0; }
.tl-add { flex: none; }
.tl-filter { position: sticky; top: calc(var(--top-h) + env(safe-area-inset-top)); z-index: 15; margin: 0 -16px 8px; padding: 6px 16px 2px; background: var(--glass); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); }
.tl-filter .psearch { margin: 0; min-height: 46px; border-radius: 14px; }
.tl-filter .psearch input { border: 0 !important; box-shadow: none !important; background: none !important; margin: 0; min-height: 44px; padding: 0; }
.tl-chips { margin: 0 -16px; padding: 8px 16px 8px; }
.tl-chips label { margin: 0; }
.tl-chips input { position: absolute; opacity: 0; pointer-events: none; }
.tl-chips .chip { padding: 0; border: 0; background: none; min-height: 0; }
.tl-chips .chip > span { display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); transition: background .15s, color .15s, border-color .15s; }
.tl-chips .chip bdi { font-size: .75rem; opacity: .7; font-variant-numeric: tabular-nums; }
.tl-chips input:checked + span { background: var(--text); border-color: var(--text); color: var(--surface); }
.tl-chips .chip-pass input:checked + span { background: var(--ok); border-color: var(--ok); color: #fff; }
.tl-chips .chip-fail input:checked + span { background: var(--danger); border-color: var(--danger); color: #fff; }
.tl-chips .chip-tog input:checked + span { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.tl-chips input:focus-visible + span { outline: 3px solid var(--ring); }

/* --- القائمة والبطاقة --- */
.t-list { display: grid; gap: 10px; transition: opacity .15s; }
.t-list.is-loading { opacity: .55; }
.t-day { margin: 10px 2px 0; font-size: .75rem; font-weight: 700; color: var(--muted); letter-spacing: .02em; }
.t-day:first-child { margin-top: 2px; }
.t-card {
  display: grid; grid-template-columns: 96px 1fr; gap: 12px; align-items: start; padding: 10px; border-radius: 18px;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm); color: inherit; text-decoration: none;
  transition: transform .15s, box-shadow .15s, border-color .15s; animation: au-up .3s ease-out both;
}
.t-card:hover { border-color: var(--border-2); box-shadow: var(--shadow); }
.t-card:active { transform: scale(.985); }
.t-card.is-latest { border-color: color-mix(in srgb, var(--ok) 30%, var(--border)); }
.t-thumbs { display: grid; gap: 2px; width: 96px; height: 96px; border-radius: 12px; overflow: hidden; background: var(--surface-2); }
.t-n2 { grid-template-columns: 1fr 1fr; }
.t-n3 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.t-n3 .t-th:first-child { grid-row: span 2; }
.t-n4 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.t-th { position: relative; display: block; min-height: 0; overflow: hidden; }
.t-th img { width: 100%; height: 100%; object-fit: cover; display: block; }
.t-more { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(16, 24, 40, .55); color: #fff; font-size: .875rem; }
.t-body { min-width: 0; display: grid; gap: 4px; }
.t-top { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.t-new, .t-old, .t-res { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 999px; font-size: .75rem; font-weight: 700; line-height: 20px; }
.t-new { background: var(--ok-soft); color: var(--ok); }
.t-old { background: var(--surface-2); color: var(--muted); font-weight: 600; }
.t-res .i { width: 13px; height: 13px; stroke-width: 2.6; }
.t-pass { background: var(--ok); color: #fff; }
.t-fail { background: var(--danger); color: #fff; }
.t-sup { font-size: 1rem; font-weight: 700; line-height: 1.4; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.t-prod { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.t-ver { display: inline-flex; align-items: center; gap: 3px; color: var(--muted); font-size: .75rem; }
.t-ver .i { width: 13px; height: 13px; }
.t-note { margin: 0; font-size: .875rem; color: var(--text-2); line-height: 1.5; }
.t-meta { font-size: .75rem; color: var(--muted); }
.t-moreb { margin-top: 4px; }
.t-empty-q { display: grid; justify-items: center; gap: 6px; padding: 36px 16px; color: var(--muted); text-align: center; }
.t-empty-q .i { width: 28px; height: 28px; }
.t-empty { display: grid; justify-items: center; gap: 8px; padding: 36px 20px; text-align: center; }
.t-empty h2 { margin: 6px 0 0; font-size: 1.25rem; }
.t-empty p { max-width: 380px; margin: 0 0 10px; }
.t-empty-art { display: grid; place-items: center; width: 76px; height: 76px; border-radius: 24px; background: var(--primary-soft); color: var(--primary); }
.t-empty-art .i { width: 36px; height: 36px; }
@media (min-width: 768px) {
  .t-list:not(.t-list-sm) { grid-template-columns: 1fr 1fr; }
  .t-list:not(.t-list-sm) .t-day, .t-list:not(.t-list-sm) .t-moreb, .t-list .t-empty-q { grid-column: 1 / -1; }
}

/* --- صفحة المورد --- */
.sup-tests .card-title { display: flex; align-items: center; gap: 8px; }
.sup-tests .st-add { margin-inline-start: auto; }
.st-none { margin: 4px 0 0; }

/* --- فحص جديد --- */
.tf-head h1 { margin: 2px 0 4px; font-size: 1.625rem; font-weight: 700; }
.tf-head p { margin: 0 0 14px; font-size: .875rem; }
.tf-sec { margin-bottom: 12px; transition: box-shadow .2s; }
.tf-h { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; font-size: 1rem; }
.tf-h small { margin-inline-start: auto; font-size: .75rem; }
.tf-n { display: grid; place-items: center; flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); font-size: .75rem; font-weight: 800; }
.tf-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.tf-grid:not(.has-shots) { grid-template-columns: 1fr 1fr; }
.tf-pick { position: relative; display: grid; place-items: center; align-content: center; gap: 4px; margin: 0; min-height: 96px; aspect-ratio: 1; border-radius: 16px; border: 1.5px dashed color-mix(in srgb, var(--primary) 40%, var(--border)); background: var(--primary-soft); color: var(--primary); cursor: pointer; text-align: center; transition: transform .15s, background .15s; }
.tf-grid:not(.has-shots) .tf-pick { aspect-ratio: auto; min-height: 140px; }
.tf-pick:active { transform: scale(.97); }
.tf-pick input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.tf-pick:focus-within { outline: 3px solid var(--ring); }
.tf-pick b { font-size: .875rem; }
.tf-pick small { font-size: .75rem; opacity: .75; }
.tf-pick-ic { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 14px; background: var(--surface); box-shadow: var(--shadow-sm); }
.tf-pick-ic .i { width: 24px; height: 24px; }
.tf-cam { background: var(--primary); color: var(--primary-ink); border-style: solid; border-color: var(--primary); }
.tf-cam .tf-pick-ic { background: rgba(255, 255, 255, .18); box-shadow: none; }
.tf-grid.has-shots .tf-pick small, .tf-grid.has-shots .tf-pick-ic { display: none; }
.tf-grid.has-shots .tf-pick::before { content: "+"; font-size: 1.625rem; font-weight: 300; line-height: 1; }
.tf-grid.is-full .tf-pick { display: none; }
.tf-grid.is-busy .tf-pick { opacity: .6; pointer-events: none; }
.tf-shot { position: relative; margin: 0; aspect-ratio: 1; border-radius: 16px; overflow: hidden; background: var(--surface-2); animation: psel-in .25s cubic-bezier(.34, 1.56, .64, 1); }
.tf-shot img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tf-i { position: absolute; bottom: 6px; inset-inline-start: 6px; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; background: rgba(16, 24, 40, .6); color: #fff; font-size: .75rem; font-weight: 700; display: grid; place-items: center; }
.tf-x { position: absolute; top: 4px; inset-inline-end: 4px; width: 32px; height: 32px; border: 0; border-radius: 50%; background: rgba(16, 24, 40, .6); color: #fff; font-size: 1.25rem; line-height: 1; cursor: pointer; display: grid; place-items: center; }
.tf-drop-hint { display: none; margin: 10px 0 0; }
@media (hover: hover) and (pointer: fine) { .tf-drop-hint { display: block; } .tf-cam { display: none !important; } .tf-grid:not(.has-shots) { grid-template-columns: 1fr; } }
.tf-photos.is-drag { box-shadow: 0 0 0 3px var(--primary); }
.tf-sec .field-err { margin: 10px 0 0; }

.tf-sup { display: flex; align-items: center; gap: 12px; padding: 10px 10px 10px 12px; border-radius: 14px; background: var(--surface-2); margin-bottom: 12px; }
.tf-sup-ic { display: grid; place-items: center; flex: none; width: 40px; height: 40px; border-radius: 12px; background: var(--surface); color: var(--primary); }
.tf-sup-t { flex: 1; min-width: 0; display: grid; }
.tf-sup-t small { color: var(--muted); font-size: .75rem; direction: rtl; }
.tf-find .psearch { margin: 0; min-height: 48px; border-radius: 14px; }
.tf-find .psearch input { border: 0 !important; box-shadow: none !important; background: none !important; margin: 0; min-height: 46px; padding: 0; }
.tf-res { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; }
.tf-res button { width: 100%; display: grid; gap: 1px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); color: inherit; font: inherit; text-align: start; cursor: pointer; animation: au-up .2s ease-out both; }
.tf-res button:hover, .tf-res button:focus-visible { border-color: var(--primary); background: var(--primary-soft); }
.tf-res small, .tf-res-p { font-size: .75rem; color: var(--muted); }
.tf-res-none { padding: 12px; text-align: center; color: var(--muted); font-size: .875rem; }
.tf-prods { display: flex; flex-wrap: wrap; gap: 8px; }
.tf-prod { min-height: 44px; padding: 0 16px; border-radius: 999px; border: 1.5px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-size: .875rem; font-weight: 600; cursor: pointer; transition: background .15s, border-color .15s, transform .15s; }
.tf-prod:active { transform: scale(.96); }
.tf-prod[aria-checked="true"] { background: var(--cs, var(--primary-soft)); border-color: var(--c, var(--primary)); color: var(--c, var(--primary)); }
.tf-prod[aria-checked="true"]::before { content: "✓ "; }
.seg-pass input:checked + span { color: var(--ok); }
.seg-fail input:checked + span { color: var(--danger); }
.seg .i { width: 16px; height: 16px; }
.tf-row { margin-top: 4px; }
.tf-row label { margin-bottom: 0; }
.tf-note { resize: none; min-height: 46px; overflow: hidden; }
.tf-bar { position: sticky; bottom: calc(env(safe-area-inset-bottom) + 10px); z-index: 20; display: grid; gap: 8px; padding: 10px; margin: 4px 0 14px; background: var(--glass); border: 1px solid var(--border); border-radius: var(--r); box-shadow: var(--shadow-lg); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); }
.tf-prog { position: relative; height: 26px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.tf-prog i { position: absolute; inset: 0 0 0 auto; width: 0; background: linear-gradient(90deg, var(--primary), color-mix(in srgb, var(--primary) 70%, #fff)); transition: width .2s; }
.tf-prog span { position: relative; display: grid; place-items: center; height: 100%; font-size: .75rem; font-weight: 600; color: var(--text); }
.tform.is-sending #tfSave .i { animation: pk-pulse .9s ease-in-out infinite; }

/* --- صفحة الفحص --- */
.tdet { display: grid; gap: 12px; }
.tdet-gal { position: relative; padding: 0; overflow: hidden; }
.tg-track { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; overscroll-behavior-x: contain; background: var(--surface-2); }
.tg-track::-webkit-scrollbar { display: none; }
.tg-track:focus-visible { outline: 3px solid var(--ring); outline-offset: -3px; }
.tg-slide { flex: 0 0 100%; margin: 0; scroll-snap-align: center; display: grid; place-items: center; }
.tg-open { display: block; width: 100%; padding: 0; border: 0; background: none; cursor: zoom-in; }
.tg-open img { display: block; width: 100%; height: auto; max-height: 70vh; object-fit: contain; }
.tg-dots { position: absolute; bottom: 10px; inset-inline: 0; display: flex; justify-content: center; gap: 6px; pointer-events: none; }
.tg-dots button { pointer-events: auto; width: 8px; height: 8px; padding: 0; border: 0; border-radius: 999px; background: rgba(16, 24, 40, .35); cursor: pointer; transition: width .2s, background .2s; }
.tg-dots button[aria-current] { width: 22px; background: var(--primary); }
.tg-count { position: absolute; top: 10px; inset-inline-start: 10px; padding: 2px 10px; border-radius: 999px; background: rgba(16, 24, 40, .6); color: #fff; font-size: .75rem; font-weight: 700; direction: ltr; }
.tdet-sup { margin: 8px 0 6px; font-size: 1.25rem; font-weight: 700; }
.tdet-sup a { color: inherit; }
.tdet-prod { margin-bottom: 8px; }
.tdet-info .btn-row { margin-top: 12px; }
.tdet-del { margin-top: 10px; border-top: 1px solid var(--border); padding-top: 10px; }
.t-tl { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; position: relative; }
.t-tl a { display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: 14px; color: inherit; border: 1px solid transparent; }
.t-tl a:hover { background: var(--surface-2); }
.t-tl .is-cur a { border-color: var(--primary); background: var(--primary-soft); }
.t-tl img { width: 48px; height: 48px; border-radius: 10px; object-fit: cover; flex: none; }
.t-tl a > span:not(.t-new) { flex: 1; display: grid; }
.t-tl small { color: var(--muted); font-size: .75rem; }
@media (min-width: 900px) {
  .tdet { grid-template-columns: 1.4fr 1fr; align-items: start; }
  .tdet-gal { grid-row: span 2; }
}

/* --- العرض بالحجم الكامل --- */
.lb { width: 100vw; max-width: none; height: 100dvh; max-height: none; margin: 0; padding: 0; border: 0; background: #000; color: #fff; }
.lb::backdrop { background: #000; }
.lb[open] { display: flex; flex-direction: column; animation: au-fade .2s; }
.lb-bar { display: flex; align-items: center; gap: 8px; padding: max(10px, env(safe-area-inset-top)) 12px 10px; }
.lb-bar .icon-btn { color: #fff; background: rgba(255, 255, 255, .12); }
.lb-bar .lb-count { position: static; transform: none; margin-left: auto; font-weight: 700; direction: ltr; }
.lb-stage { flex: 1; display: grid; place-items: center; overflow: hidden; touch-action: none; }
.lb-stage img { max-width: 100%; max-height: 100%; object-fit: contain; transform-origin: center; transition: transform .08s; user-select: none; -webkit-user-drag: none; }

/* ============ v45: الفحوصات حسب المنتج ============ */
.t-cat { padding: 1px 8px; border-radius: 999px; font-size: .75rem; font-weight: 600; line-height: 20px; background: var(--cs, var(--surface-2)); color: var(--c, var(--muted)); }
.t-card { border-inline-start: 3px solid var(--c, var(--border)); }
.t-card.is-latest { border-color: color-mix(in srgb, var(--ok) 30%, var(--border)); border-inline-start-color: var(--c, var(--ok)); }
.tdet-sup { display: flex; align-items: center; gap: 10px; }
.tdet-ic { display: grid; place-items: center; flex: none; width: 40px; height: 40px; border-radius: 12px; background: var(--cs, var(--primary-soft)); color: var(--c, var(--primary)); }
.tdet-ic .i { width: 22px; height: 22px; }

/* اختيار المنتج: لمسة واحدة */
.tp-picked { margin-inline-start: auto; color: var(--ok); font-weight: 700; font-size: .875rem; max-width: 55%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tp-recent { margin-bottom: 12px; padding-bottom: 12px; border-bottom: 1px dashed var(--border); }
.tp-lbl { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; font-size: .75rem; font-weight: 600; color: var(--muted); }
.tp-lbl .i { width: 14px; height: 14px; }
.tp-search { margin: 0 0 12px; min-height: 46px; border-radius: 14px; }
.tp-search input { border: 0 !important; box-shadow: none !important; background: none !important; margin: 0; min-height: 44px; padding: 0; }
.tp-groups { display: grid; gap: 14px; }
.tp-cat { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: .875rem; font-weight: 700; color: var(--text-2); }
.tp-cat-ic { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; background: var(--cs, var(--surface-2)); color: var(--c, var(--muted)); }
.tp-cat-ic .i { width: 15px; height: 15px; }
.tp-row { display: flex; flex-wrap: wrap; gap: 8px; }
.tp-chip { position: relative; margin: 0; }
.tp-chip input { position: absolute; opacity: 0; pointer-events: none; }
.tp-chip span { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 16px; border-radius: 999px; border: 1.5px solid var(--border); background: var(--surface); color: var(--text); font-size: .875rem; font-weight: 600; cursor: pointer; transition: background .15s, border-color .15s, color .15s, transform .15s; -webkit-tap-highlight-color: transparent; }
.tp-chip span:active { transform: scale(.96); }
.tp-chip:hover span { border-color: var(--c, var(--border-2)); }
.tp-chip.on span, .tp-chip input:checked + span { background: var(--c, var(--primary)); border-color: var(--c, var(--primary)); color: var(--ci, #fff); box-shadow: 0 6px 16px -8px var(--c, var(--primary)); }
.tp-chip.on span::before, .tp-chip input:checked + span::before { content: "✓"; font-weight: 800; }
.tp-chip input:focus-visible + span { outline: 3px solid var(--ring); outline-offset: 2px; }
.tf-note-l { margin: 0; }
.chip-cat input:checked + span { background: var(--c) !important; border-color: var(--c) !important; color: var(--ci, #fff) !important; }

/* ============ v46: فحص جديد — تسهيلات كاملة ============ */
.vh { position: fixed !important; top: 0; left: 0; width: 1px; height: 1px; opacity: 0; overflow: hidden; clip-path: inset(50%); pointer-events: none; }
.tf-note-bar { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; padding: 8px 8px 8px 12px; border-radius: 14px; background: var(--primary-soft); border: 1px solid color-mix(in srgb, var(--primary) 20%, transparent); font-size: .875rem; animation: saved-in .4s cubic-bezier(.34, 1.56, .64, 1); }
.tfn-ic { display: grid; place-items: center; color: var(--primary); }
.tfn-ic .i { width: 18px; height: 18px; }
.tfn-t { flex: 1; }

/* الصور: حالة فارغة = زران كبيران */
.tf-count { margin-inline-start: auto; color: var(--muted); font-size: .75rem; font-weight: 600; }
.tf-empty { display: grid; gap: 10px; }
.tf-big { display: flex; align-items: center; gap: 14px; margin: 0; min-height: 76px; padding: 12px 16px; border-radius: 18px; border: 1.5px dashed color-mix(in srgb, var(--primary) 40%, var(--border)); background: var(--primary-soft); color: var(--primary); cursor: pointer; transition: transform .15s, box-shadow .15s; -webkit-tap-highlight-color: transparent; }
.tf-big:active { transform: scale(.98); }
.tf-big > span:last-child { display: grid; }
.tf-big b { font-size: 1rem; }
.tf-big small { font-size: .75rem; opacity: .8; font-weight: 500; }
.tfb-ic { display: grid; place-items: center; flex: none; width: 48px; height: 48px; border-radius: 14px; background: var(--surface); box-shadow: var(--shadow-sm); }
.tfb-ic .i { width: 26px; height: 26px; }
.tf-big-cam { border-style: solid; border-color: var(--primary); background: var(--primary); color: var(--primary-ink); box-shadow: 0 10px 24px -12px var(--primary); }
.tf-big-cam .tfb-ic { background: rgba(255, 255, 255, .18); box-shadow: none; }
@media (hover: hover) and (pointer: fine) { .tf-big-cam, .tf-add-cam { display: none !important; } }

/* الصور: الشريط */
.tf-strip .tf-grid, .tf-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.tf-shot { position: relative; margin: 0; aspect-ratio: 3 / 4; border-radius: 14px; overflow: hidden; background: var(--surface-2); box-shadow: var(--shadow-sm); animation: psel-in .25s cubic-bezier(.34, 1.56, .64, 1); }
.tf-open { display: block; width: 100%; height: 100%; padding: 0; border: 0; background: none; cursor: zoom-in; }
.tf-open img { width: 100%; height: 100%; object-fit: cover; display: block; transition: filter .2s; }
.is-enh .tf-open img, .tf-lb img.is-enh { filter: grayscale(1) contrast(1.45) brightness(1.08); }
.tf-add { display: grid; place-items: center; align-content: center; gap: 4px; margin: 0; aspect-ratio: 3 / 4; border-radius: 14px; border: 1.5px dashed color-mix(in srgb, var(--primary) 40%, var(--border)); background: var(--primary-soft); color: var(--primary); cursor: pointer; font-size: .75rem; font-weight: 600; text-align: center; }
.tf-add .i { width: 24px; height: 24px; }
.tf-add:active { transform: scale(.96); }
.tf-grid.is-full .tf-add { display: none; }
.is-busy .tf-add, .is-busy .tf-big { opacity: .6; pointer-events: none; }
.tf-tools { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.tf-enh { display: flex; align-items: center; gap: 8px; margin: 0; font-size: .875rem; font-weight: 600; color: var(--text-2); cursor: pointer; position: relative; }
.tf-enh input { position: absolute; opacity: 0; pointer-events: none; }
.tf-sw { position: relative; flex: none; width: 40px; height: 24px; border-radius: 999px; background: var(--border-2); transition: background .2s; }
.tf-sw::after { content: ""; position: absolute; top: 3px; right: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform .2s; }
.tf-enh input:checked + .tf-sw { background: var(--primary); }
.tf-enh input:checked + .tf-sw::after { transform: translateX(-16px); }
.tf-enh input:focus-visible + .tf-sw { outline: 3px solid var(--ring); }
.tf-size { font-size: .75rem; }
.tf-tip { margin: 8px 0 0; font-size: .75rem; }
.field-err.is-soft { color: var(--accent); }

/* المنتج المختار: سطر واحد */
.tp-chosen { display: flex; align-items: center; gap: 10px; }
.tp-chosen-v { display: inline-flex; align-items: center; gap: 8px; min-height: 46px; padding: 0 16px; border-radius: 999px; background: var(--c, var(--primary)); color: var(--ci, #fff); font-size: 1rem; box-shadow: 0 6px 16px -8px var(--c, var(--primary)); animation: psel-in .25s cubic-bezier(.34, 1.56, .64, 1); }
.tp-chosen-v .i { width: 18px; height: 18px; stroke-width: 2.6; }
.tp-chosen .btn { margin-inline-start: auto; }
.tp-picker { animation: au-up .2s ease-out; }
.tf-sec-note .tf-h-in { margin-bottom: 10px; }
.tf-sec-note label { margin: 0; font-size: 1rem; font-weight: 400; color: inherit; }
.tf-sec-note .tf-h-in b { font-weight: 700; }

/* شريط الحفظ: ملخص جاهزية */
.tf-sum { display: flex; justify-content: center; gap: 6px; flex-wrap: wrap; font-size: .75rem; }
.tf-sum span { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 999px; background: var(--surface-2); color: var(--muted); font-weight: 600; }
.tf-sum span::before { content: "○"; }
.tf-sum span.ok { background: var(--ok-soft); color: var(--ok); }
.tf-sum span.ok::before { content: "✓"; }
.tform:not(.is-ready) #tfSave { opacity: .72; }
.tform.is-waiting .tf-prog i { width: 100% !important; background: repeating-linear-gradient(-45deg, var(--accent-soft) 0 10px, transparent 10px 20px); animation: none; }

/* معاينة الصورة قبل الرفع */
.tf-lb .lb-stage { padding: 0 12px; }
.tf-lb-acts { display: flex; justify-content: center; gap: 8px; padding: 12px 12px max(14px, env(safe-area-inset-bottom)); }
.tf-lb-acts button { display: grid; justify-items: center; gap: 4px; min-width: 84px; min-height: 60px; padding: 8px 10px; border: 0; border-radius: 14px; background: rgba(255, 255, 255, .1); color: #fff; font: inherit; font-size: .75rem; font-weight: 600; cursor: pointer; }
.tf-lb-acts button:disabled { opacity: .35; cursor: default; background: rgba(255, 255, 255, .1) !important; color: #fff !important; }
.tf-lb-acts .i { width: 22px; height: 22px; }
.tf-lb-acts .danger-text { color: #fca5a5; }
.lb[open] > .lb-bar, .lb[open] > .tf-lb-acts { width: 100%; align-self: stretch; box-sizing: border-box; }
.lb[open] > .lb-stage { width: 100%; align-self: stretch; min-height: 0; }

/* ============ v47: الشريط السفلي (موبايل) ============ */
@media (max-width: 767px) {
  /* زر + دائماً في المنتصف بالضبط، والأزرار موزعة بالتساوي حوله */
  nav.bottom { display: grid; grid-auto-flow: column; grid-template-columns: repeat(5, minmax(0, 1fr)); padding: 0 6px; }
  nav.bottom:not(:has(> a.fab)) { grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); }
  nav.bottom > a { max-width: none; min-width: 0; height: 100%; padding: 0; gap: 4px; }
  nav.bottom > a.fab { grid-column: 3; }
  nav.bottom > a.fab:nth-last-child(2) + a { grid-column: 4 / span 2; }  /* زر واحد بعد + (مستخدم عادي): يأخذ النصف كاملاً */
  nav.bottom .bn-lb { font-size: .75rem; line-height: 1; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
  nav.bottom > a:not(.fab) > span { width: 56px; height: 32px; }
  nav.bottom > a.on:not(.fab) .bn-lb { font-weight: 700; }

  /* يختفي عند النزول للقراءة، ويعود عند الصعود */
  nav.bottom { transition: transform .32s cubic-bezier(.2, .8, .2, 1), opacity .25s; will-change: transform; }
  html.bn-hide nav.bottom, html.kb-open nav.bottom { transform: translateY(calc(100% + 24px + env(safe-area-inset-bottom))); opacity: 0; pointer-events: none; }
  html.bn-hide body.fab-on nav.bottom { transform: none; opacity: 1; pointer-events: auto; }
  /* زر «للأعلى» العائم وغيره يتبعون الشريط */
  html.bn-hide .toast { transform: translateY(calc(var(--nav-h) + 10px)); }
}
/* نقطة «جديد» على الفحوصات */
.bn-dot { position: absolute; top: 2px; inset-inline-end: 12px; width: 9px; height: 9px; border-radius: 50%; background: var(--danger); box-shadow: 0 0 0 2px var(--surface); animation: bn-dot-in .5s cubic-bezier(.34, 1.56, .64, 1), bn-dot-pulse 2.4s 1s ease-in-out 3; }
@keyframes bn-dot-in { from { transform: scale(0); } }
@keyframes bn-dot-pulse { 50% { box-shadow: 0 0 0 2px var(--surface), 0 0 0 6px color-mix(in srgb, var(--danger) 25%, transparent); } }
.side-nav a.has-new .side-label::after { content: ""; display: inline-block; width: 7px; height: 7px; margin-inline-start: 6px; border-radius: 50%; background: var(--danger); vertical-align: middle; }
@media (prefers-reduced-motion: reduce) {
  nav.bottom { transition: none; }
  .bn-dot { animation: none; }
}

/* ============ v48: الفحوصات — مشاركة واتساب + تصحيحات ============ */
.t-card { position: relative; border-inline-start-width: 1px; border-inline-start-color: var(--border); padding-inline-end: 60px; }
.t-card.is-latest { border-color: color-mix(in srgb, var(--ok) 28%, var(--border)); }
.t-card:has(.t-hit:active) { transform: scale(.985); }
.t-card:has(.t-hit:focus-visible) { outline: 3px solid var(--ring); outline-offset: 2px; }
.t-hit { position: absolute; inset: 0; z-index: 1; border-radius: inherit; }
.t-hit:focus-visible { outline: none; }
.t-cat::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-inline-end: 5px; border-radius: 50%; background: var(--c, var(--muted)); vertical-align: 1px; }
.t-cat { background: var(--surface-2); color: var(--text-2); }
.t-wa {
  position: absolute; z-index: 2; inset-inline-end: 10px; top: 50%; margin-top: -22px;
  display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 14px;
  background: color-mix(in srgb, var(--wa) 12%, var(--surface)); color: var(--wa); cursor: pointer;
  transition: transform .15s, background .15s; -webkit-tap-highlight-color: transparent;
}
.t-wa .i { width: 22px; height: 22px; }
.t-wa:hover { background: var(--wa); color: #fff; }
.t-wa:active { transform: scale(.9); }
.t-wa:focus-visible { outline: 3px solid var(--ring); }
[data-share].is-busy .i, #tdDl.is-busy .i { animation: pk-pulse .8s ease-in-out infinite; }
[data-share].is-busy { pointer-events: none; }
/* صفحة الفحص */
.tdet-acts { display: grid; gap: 10px; margin-top: 14px; }
.tdet-acts .btn-row { margin: 0; }
.tdet-wa { width: 100%; min-height: 52px; border-radius: 14px; font-size: 1rem; }
.tdet-wa .i { width: 22px; height: 22px; }
.tg-count { top: auto; bottom: 8px; inset-inline-start: auto; inset-inline-end: 10px; }
.lb-bar .lb-wa { background: var(--wa) !important; }

/* ============ v48: الشريط السفلي — كبسولة زجاجية + زر عائم منفصل (موبايل) ============ */
@media (max-width: 767px) {
  :root { --bn-h: 62px; --bn-fab: 58px; --bn-gap: 10px; }
  nav.bottom {
    display: flex; align-items: stretch; gap: 2px;
    right: 14px; left: calc(14px + var(--bn-fab) + var(--bn-gap)); bottom: max(12px, env(safe-area-inset-bottom));
    height: var(--bn-h); padding: 5px;
    border-radius: 999px; border: 1px solid rgba(255, 255, 255, .55);
    background: color-mix(in srgb, var(--surface) 70%, transparent);
    -webkit-backdrop-filter: blur(22px) saturate(190%); backdrop-filter: blur(22px) saturate(190%);
    box-shadow: 0 1px 0 rgba(255, 255, 255, .7) inset, 0 -1px 0 rgba(16, 24, 40, .04) inset, 0 14px 34px -14px rgba(16, 24, 40, .35), 0 2px 6px -2px rgba(16, 24, 40, .08);
    transition: height .32s cubic-bezier(.2, .8, .2, 1), transform .32s cubic-bezier(.2, .8, .2, 1), opacity .25s, left .32s cubic-bezier(.2, .8, .2, 1);
  }
  nav.bottom > a:not(.fab) { flex: 1; grid-column: auto !important; position: relative; border-radius: 999px; gap: 3px; z-index: 0; }
  nav.bottom > a:not(.fab) > span { width: auto; height: auto; background: none !important; position: relative; }
  nav.bottom > a:not(.fab) .i { width: 23px; height: 23px; }
  nav.bottom .bn-lb { font-size: .6875rem; font-weight: 600; letter-spacing: .01em; transition: opacity .2s, transform .3s cubic-bezier(.2, .8, .2, 1), max-height .3s; max-height: 14px; }
  nav.bottom > a.on:not(.fab) { color: var(--primary); }
  /* العدسة: تغطي الزر كله وتنزلق بين الصفحات */
  nav.bottom .bn-pill {
    inset: 0; border-radius: 999px; z-index: -1;
    background: color-mix(in srgb, var(--primary) 13%, var(--surface));
    box-shadow: 0 1px 0 rgba(255, 255, 255, .8) inset, 0 0 0 1px color-mix(in srgb, var(--primary) 14%, transparent), 0 4px 12px -6px color-mix(in srgb, var(--primary) 45%, transparent);
  }
  nav.bottom > a:not(.fab)::after { width: 64px; height: 64px; margin: -32px 0 0 -32px; }

  /* زر + دائرة عائمة منفصلة بجانب الكبسولة */
  nav.bottom > a.fab {
    position: absolute; left: calc(-1 * (var(--bn-fab) + var(--bn-gap))); top: 50%; width: var(--bn-fab); height: var(--bn-fab); margin-top: calc(var(--bn-fab) / -2);
    grid-column: auto !important; flex: none; padding: 0; gap: 0; border-radius: 50%; color: var(--primary-ink);
    transition: width .32s cubic-bezier(.2, .8, .2, 1), height .32s cubic-bezier(.2, .8, .2, 1), margin .32s cubic-bezier(.2, .8, .2, 1), left .32s cubic-bezier(.2, .8, .2, 1);
  }
  nav.bottom > a.fab > span {
    width: 100% !important; height: 100% !important; margin: 0 !important; border-radius: 50% !important;
    background: radial-gradient(120% 120% at 30% 20%, color-mix(in srgb, var(--primary) 70%, #fff), var(--primary) 55%, var(--primary-strong)) !important;
    box-shadow: 0 1px 0 rgba(255, 255, 255, .45) inset, 0 12px 26px -10px color-mix(in srgb, var(--primary) 85%, transparent), 0 0 0 1px rgba(255, 255, 255, .25) !important;
  }
  nav.bottom > a.fab .i { width: 26px; height: 26px; stroke-width: 2.4; }
  nav.bottom > a.fab .bn-lb { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  nav.bottom > a.fab.fab-open > span { background: var(--text) !important; }

  /* النزول للقراءة: الكبسولة تصغر (أيقونات فقط) بدل أن تختفي — التنقل يبقى بلمسة */
  html.bn-hide nav.bottom { transform: none; opacity: 1; pointer-events: auto; height: 50px; padding: 4px; }
  html.bn-hide nav.bottom .bn-lb { opacity: 0; max-height: 0; transform: translateY(4px); }
  html.bn-hide nav.bottom > a:not(.fab) { gap: 0; }
  html.bn-hide nav.bottom > a.fab { --bn-fab: 48px; }
  html.bn-hide nav.bottom { --bn-fab: 48px; }
  /* لوحة المفاتيح: يختفي كاملاً */
  html.kb-open nav.bottom { transform: translateY(calc(100% + 30px + env(safe-area-inset-bottom))); opacity: 0; pointer-events: none; }
  html.bn-hide .toast { transform: translate(-50%, 0); }

  .is-app .wrap { padding-bottom: calc(var(--bn-h) + max(12px, env(safe-area-inset-bottom)) + 28px); }
  .fab-actions { bottom: calc(var(--bn-h) + max(12px, env(safe-area-inset-bottom)) + 16px); }
  .toast { bottom: calc(var(--bn-h) + max(12px, env(safe-area-inset-bottom)) + 14px); }
}
@media (max-width: 767px) and (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) nav.bottom { border-color: rgba(255, 255, 255, .09); background: color-mix(in srgb, var(--surface) 72%, transparent); box-shadow: 0 1px 0 rgba(255, 255, 255, .06) inset, 0 16px 36px -14px rgba(0, 0, 0, .8); }
  :root:not([data-theme="light"]) nav.bottom .bn-pill { background: color-mix(in srgb, var(--primary) 22%, var(--surface)); box-shadow: 0 1px 0 rgba(255, 255, 255, .08) inset, 0 0 0 1px color-mix(in srgb, var(--primary) 25%, transparent); }
}
@media (max-width: 767px) {
  :root[data-theme="dark"] nav.bottom { border-color: rgba(255, 255, 255, .09); background: color-mix(in srgb, var(--surface) 72%, transparent); box-shadow: 0 1px 0 rgba(255, 255, 255, .06) inset, 0 16px 36px -14px rgba(0, 0, 0, .8); }
  :root[data-theme="dark"] nav.bottom .bn-pill { background: color-mix(in srgb, var(--primary) 22%, var(--surface)); box-shadow: 0 1px 0 rgba(255, 255, 255, .08) inset, 0 0 0 1px color-mix(in srgb, var(--primary) 25%, transparent); }
}
@media (max-width: 767px) and (prefers-reduced-motion: reduce) { nav.bottom, nav.bottom > a.fab, nav.bottom .bn-lb { transition: none; } }
@media (max-width: 767px) { nav.bottom .bn-dot { top: -3px; inset-inline-end: -7px; } }
/* صورة صغيرة فورية تحت الصورة الواضحة حتى تكتمل */
.tg-open { position: relative; display: grid; }
.tg-open > img { grid-area: 1 / 1; }
.tg-lq { filter: blur(6px); transform: scale(1.02); }
.tg-open > img:not(.tg-lq) { position: relative; z-index: 1; }

/* ============ v49: إشعارات الفحوصات ============ */
.tl-head-acts { display: flex; align-items: center; gap: 8px; flex: none; }
.tl-bell { width: 44px; height: 44px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface); color: var(--muted); position: relative; }
.tl-bell.on { color: var(--primary); background: var(--primary-soft); border-color: color-mix(in srgb, var(--primary) 30%, transparent); }
.tl-bell.on::after { content: ""; position: absolute; top: 9px; inset-inline-end: 10px; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 2px var(--surface); }
.push-offer { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; padding: 10px 8px 10px 12px; border-radius: 16px; background: linear-gradient(135deg, var(--primary-soft), color-mix(in srgb, var(--primary-soft) 40%, var(--surface))); border: 1px solid color-mix(in srgb, var(--primary) 22%, var(--border)); animation: saved-in .45s cubic-bezier(.34, 1.56, .64, 1); }
.po-ic { display: grid; place-items: center; flex: none; width: 40px; height: 40px; border-radius: 12px; background: var(--primary); color: var(--primary-ink); }
.po-ic .i { width: 20px; height: 20px; animation: po-ring 2.4s ease-in-out 1s 2; transform-origin: 50% 10%; }
@keyframes po-ring { 0%, 60%, 100% { transform: none; } 10%, 30% { transform: rotate(14deg); } 20%, 40% { transform: rotate(-14deg); } }
.po-t { flex: 1; min-width: 0; display: grid; line-height: 1.45; }
.po-t b { font-size: .875rem; }
.po-t small { font-size: .75rem; color: var(--muted); }
#tdPdf.is-busy .i { animation: pk-pulse .8s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) { .po-ic .i { animation: none; } }
#pushBtn.is-busy .i, #pushYes.is-busy { animation: pk-pulse .8s ease-in-out infinite; } #pushYes.is-busy { pointer-events: none; }

/* ============ v50: الشريط العلوي (موبايل) — عناصر زجاجية عائمة + حافة ضبابية + عنوان يظهر عند التمرير ============ */
@media (max-width: 767px) {
  .top {
    position: sticky; top: 0; z-index: 40; gap: 8px;
    min-height: calc(60px + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 12px 0;
    background: transparent !important; border-bottom: 0 !important; box-shadow: none !important;
    -webkit-backdrop-filter: none !important; backdrop-filter: none !important;
  }
  .scrolled .top { min-height: calc(56px + env(safe-area-inset-top)); }
  /* حافة ضبابية متدرجة خلف الشريط (تظهر عند التمرير فقط) */
  .top::before {
    content: ""; position: absolute; inset: 0 0 -22px; z-index: -1; pointer-events: none;
    background: linear-gradient(to bottom, color-mix(in srgb, var(--bg) 92%, transparent) 0%, color-mix(in srgb, var(--bg) 70%, transparent) 62%, transparent 100%);
    -webkit-backdrop-filter: blur(14px) saturate(170%); backdrop-filter: blur(14px) saturate(170%);
    -webkit-mask-image: linear-gradient(to bottom, #000 58%, transparent); mask-image: linear-gradient(to bottom, #000 58%, transparent);
    opacity: 0; transition: opacity .28s ease;
  }
  .scrolled .top::before { opacity: 1; }

  /* زجاج للعناصر نفسها */
  .top .brand-top, .top .top-back, .top .user-btn, .top .t-glass {
    background: color-mix(in srgb, var(--surface) 72%, transparent);
    border: 1px solid rgba(255, 255, 255, .6);
    -webkit-backdrop-filter: blur(18px) saturate(180%); backdrop-filter: blur(18px) saturate(180%);
    box-shadow: 0 1px 0 rgba(255, 255, 255, .7) inset, 0 8px 22px -12px rgba(16, 24, 40, .35), 0 1px 3px -1px rgba(16, 24, 40, .08);
    transition: transform .2s cubic-bezier(.34, 1.56, .64, 1), box-shadow .2s, background .2s;
  }
  .top .brand-top:active, .top .top-back:active, .top .user-btn:active { transform: scale(.94); }

  /* الشعار + الاسم: كبسولة */
  .top .brand-top { gap: 9px; min-height: 44px; padding: 4px 6px 4px 14px; border-radius: 999px; }
  .top .brand-top img { height: 34px !important; width: 34px; max-width: none; border-radius: 50%; object-fit: cover; box-shadow: none; }
  .top .brand-top b { font-size: .9375rem; font-weight: 700; transition: opacity .2s, max-width .3s; white-space: nowrap; overflow: hidden; max-width: 160px; }

  /* زر الرجوع: دائرة */
  .top .top-back { flex: none; width: 44px; height: 44px; margin: 0; border-radius: 50%; color: var(--text); display: grid; place-items: center; }
  .top .top-back .i { width: 21px; height: 21px; stroke-width: 2.2; }

  /* صورة الحساب: دائرة زجاجية */
  .top .user-btn { width: 46px; height: 46px; min-width: 46px; min-height: 46px; padding: 3px; border-radius: 50%; display: grid; place-items: center; }
  .top .user-btn .avatar { width: 38px; height: 38px; box-shadow: none; }
  .top .user-btn:has(+ .user-menu:popover-open) { box-shadow: 0 0 0 3px var(--ring), 0 8px 22px -12px rgba(16, 24, 40, .35); }
  .top .user-btn:has(+ .user-menu:popover-open) .avatar { box-shadow: none; }

  /* العنوان الصغير: مخفي ما دام عنوان الصفحة الكبير ظاهراً، ويظهر بانزلاق عند تجاوزه */
  .top .top-title, .is-app .top .top-page {
    display: flex !important; align-items: center; gap: 8px; min-width: 0; flex: 0 1 auto; max-width: calc(100vw - 150px);
    min-height: 40px; padding: 0 14px; border-radius: 999px; font-size: .9375rem !important; font-weight: 700 !important; color: var(--text);
    opacity: 0; transform: translateY(6px) scale(.96); pointer-events: none;
    transition: opacity .22s ease, transform .3s cubic-bezier(.2, .8, .2, 1);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .top .top-page b, .top .top-title { overflow: hidden; text-overflow: ellipsis; }
  .top .top-page .top-page-ic { width: 26px; height: 26px; border-radius: 8px; flex: none; }
  .top .top-page .top-page-ic .i { width: 15px; height: 15px; }
  html.h1-gone .top .top-title, html.h1-gone.no-back .top .top-page { opacity: 1; transform: none; }
  html.no-h1 .top .top-title { opacity: 1; transform: none; }
  /* صفحات التبويب: عند ظهور العنوان الصغير يبقى الشعار وحده (بلا الاسم) */
  html.h1-gone .top .brand-top b { opacity: 0; max-width: 0; }
  html.h1-gone .top .brand-top { padding-inline: 4px; }
  /* صفحات بزر رجوع: العنوان بجانبه، والصفحات بلا زر رجوع لا تُظهر .top-title */
  html:not(.no-back) .top .top-page { display: none !important; }

  .top .net-chip { order: 2; margin-inline-start: auto; }
  .top .user-btn { order: 3; margin-inline-start: auto; }
  .top .net-chip:not([hidden]) + .user-btn { margin-inline-start: 0; }
}
@media (max-width: 767px) and (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .top .brand-top, :root:not([data-theme="light"]) .top .top-back, :root:not([data-theme="light"]) .top .user-btn, :root:not([data-theme="light"]) .top .t-glass {
    border-color: rgba(255, 255, 255, .09); background: color-mix(in srgb, var(--surface) 74%, transparent);
    box-shadow: 0 1px 0 rgba(255, 255, 255, .06) inset, 0 10px 24px -12px rgba(0, 0, 0, .75);
  }
}
@media (max-width: 767px) {
  :root[data-theme="dark"] .top .brand-top, :root[data-theme="dark"] .top .top-back, :root[data-theme="dark"] .top .user-btn, :root[data-theme="dark"] .top .t-glass {
    border-color: rgba(255, 255, 255, .09); background: color-mix(in srgb, var(--surface) 74%, transparent);
    box-shadow: 0 1px 0 rgba(255, 255, 255, .06) inset, 0 10px 24px -12px rgba(0, 0, 0, .75);
  }
}
@media (max-width: 767px) and (prefers-reduced-motion: reduce) { .top::before, .top .top-title, .top .top-page, .top .brand-top b { transition: none; } }

/* ============ v50: سرعة اللمس — استجابة فورية لكل زر ============ */
a, button, label, summary, select, [role="button"], [role="menuitem"], [role="radio"], .chip, .t-card, .item { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
@media (hover: none) {
  /* ضغطة فورية (بلا انتظار) ورجوع ناعم */
  .btn, .icon-btn, .chip, .tp-chip span, .fab-act, .user-menu a, .um-logout, .tabs a, .side-nav a, .t-wa, .tf-add, .tf-big, .link-more {
    transition: transform .16s cubic-bezier(.34, 1.56, .64, 1), background-color .15s, color .15s, border-color .15s, box-shadow .15s, opacity .15s;
  }
  .btn:active, .icon-btn:active, .chip:active, .fab-act:active, .user-menu a:active, .um-logout:active, .tabs a:active, .link-more:active { transform: scale(.95); transition-duration: 0s; }
  .t-card:has(.t-hit:active), .item:active { transform: scale(.985); transition: transform 0s; }
  .t-card, .item { transition: transform .18s cubic-bezier(.34, 1.56, .64, 1); }
  .btn:active { filter: brightness(.96); }
  /* حالة «جارٍ الفتح» للرابط الملموس */
  a.is-going { opacity: .7; }
}
@media (max-width: 767px) { :root .top .brand-top img { padding: 0 !important; background: none !important; } }

/* ============ v51: إدارة الفحوصات — تراجع، تحديد متعدد، تعديل ============ */
.undo-bar { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; padding: 10px 10px 10px 14px; border-radius: 16px; background: var(--text); color: var(--surface); animation: saved-in .4s cubic-bezier(.34, 1.56, .64, 1); }
.ub-ic { display: grid; place-items: center; opacity: .7; }
.ub-ic .i { width: 18px; height: 18px; }
.ub-t { flex: 1; min-width: 0; display: grid; font-size: .875rem; font-weight: 600; line-height: 1.4; }
.ub-t small { font-weight: 400; opacity: .7; font-size: .75rem; }
.undo-bar .btn { background: var(--surface); color: var(--text); border-color: transparent; font-weight: 700; }

.tl-sel { width: 44px; height: 44px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface); color: var(--muted); }
.tl-sel[aria-pressed="true"] { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); }
.t-check { position: absolute; z-index: 3; top: 10px; inset-inline-start: 10px; display: none; place-items: center; width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--border-2); background: var(--surface); color: transparent; pointer-events: none; transition: background .15s, border-color .15s, transform .2s cubic-bezier(.34, 1.56, .64, 1); }
.t-check .i { width: 15px; height: 15px; stroke-width: 3; }
.sel-mode .t-check { display: grid; }
.sel-mode .t-wa { display: none; }
.sel-mode .t-card { padding-inline-end: 12px; user-select: none; -webkit-user-select: none; }
.sel-mode .t-card .t-thumbs { margin-inline-start: 26px; }
.t-card.is-sel { border-color: var(--primary) !important; background: color-mix(in srgb, var(--primary) 6%, var(--surface)); box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 30%, transparent); }
.t-card.is-sel .t-check { background: var(--primary); border-color: var(--primary); color: #fff; transform: scale(1.08); }
.t-card { -webkit-touch-callout: none; }
.sel-bar {
  position: fixed; z-index: 75; left: 12px; right: 12px; bottom: max(12px, env(safe-area-inset-bottom));
  display: flex; align-items: center; gap: 8px; padding: 8px; border-radius: 22px;
  background: color-mix(in srgb, var(--surface) 86%, transparent); border: 1px solid var(--border);
  -webkit-backdrop-filter: blur(20px) saturate(180%); backdrop-filter: blur(20px) saturate(180%);
  box-shadow: 0 18px 40px -16px rgba(16, 24, 40, .45); animation: saved-in .35s cubic-bezier(.34, 1.56, .64, 1);
}
.sel-bar .sel-n { flex: 1; font-size: .875rem; }
.sel-bar form { margin: 0; }
.sel-bar .btn { min-height: 42px; }
.sel-bar .btn:disabled { opacity: .45; }
.sel-mode nav.bottom { transform: translateY(calc(100% + 40px)); opacity: 0; pointer-events: none; }
@media (min-width: 768px) { .sel-bar { left: auto; right: auto; inset-inline-start: calc(var(--side-w) + 24px); inset-inline-end: 24px; max-width: 720px; margin-inline: auto; } }

.tdet-manage { display: flex; gap: 6px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); }
.tdet-manage .tdet-del { margin: 0; padding: 0; border: 0; }

.te-shot { cursor: pointer; margin: 0; }
.te-shot img { width: 100%; height: 100%; object-fit: cover; display: block; transition: filter .2s, opacity .2s; }
.te-shot .te-rm { position: absolute; opacity: 0; pointer-events: none; }
.te-x { position: absolute; top: 6px; inset-inline-end: 6px; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: rgba(16, 24, 40, .6); color: #fff; }
.te-x .i { width: 16px; height: 16px; }
.te-gone { position: absolute; inset: auto 0 0; display: none; padding: 6px; text-align: center; font-size: .75rem; font-weight: 700; color: #fff; background: var(--danger); }
.te-shot:has(.te-rm:checked) img { filter: grayscale(1); opacity: .45; }
.te-shot:has(.te-rm:checked) .te-gone { display: block; }
.te-shot:has(.te-rm:checked) .te-x { background: var(--danger); }
.te-shot:has(.te-rm:focus-visible) { outline: 3px solid var(--ring); }
.te-badge { position: absolute; bottom: 6px; inset-inline-start: 6px; padding: 1px 8px; border-radius: 999px; background: var(--ok); color: #fff; font-size: .75rem; font-weight: 700; }
.te-tip { margin: 10px 0 0; }

/* ============ v51: البحث الشامل + زره في الشريط العلوي ============ */
.top-search { flex: none; width: 44px; height: 44px; border-radius: 50%; color: var(--text); }
.top-search .i { width: 21px; height: 21px; stroke-width: 2.2; }
@media (min-width: 768px) { .top-search { margin-inline-start: auto; border: 1px solid var(--border); background: var(--surface); } .top-search + .net-chip + .user-btn, .top-search ~ .user-btn { margin-inline-start: 0 !important; } }
@media (max-width: 767px) {
  .top .top-search { order: 3; margin-inline-start: auto;
    background: color-mix(in srgb, var(--surface) 72%, transparent); border: 1px solid rgba(255, 255, 255, .6);
    -webkit-backdrop-filter: blur(18px) saturate(180%); backdrop-filter: blur(18px) saturate(180%);
    box-shadow: 0 1px 0 rgba(255, 255, 255, .7) inset, 0 8px 22px -12px rgba(16, 24, 40, .35), 0 1px 3px -1px rgba(16, 24, 40, .08);
    transition: transform .2s cubic-bezier(.34, 1.56, .64, 1); }
  .top .top-search:active { transform: scale(.92); }
  .top .top-search ~ .user-btn { order: 4; margin-inline-start: 0; }
  .top .net-chip { order: 2; }
  :root[data-theme="dark"] .top .top-search { border-color: rgba(255, 255, 255, .09); background: color-mix(in srgb, var(--surface) 74%, transparent); box-shadow: 0 1px 0 rgba(255, 255, 255, .06) inset, 0 10px 24px -12px rgba(0, 0, 0, .75); }
}
@media (max-width: 767px) and (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .top .top-search { border-color: rgba(255, 255, 255, .09); background: color-mix(in srgb, var(--surface) 74%, transparent); box-shadow: 0 1px 0 rgba(255, 255, 255, .06) inset, 0 10px 24px -12px rgba(0, 0, 0, .75); } }

.gs { width: 100%; max-width: 640px; max-height: none; margin: 0 auto; padding: 0; border: 0; background: transparent; color: var(--text); overflow: visible; }
.gs::backdrop { background: rgba(8, 14, 30, .42); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); animation: au-fade .2s; }
.gs[open] { display: block; }
.gs-box { margin: max(10px, env(safe-area-inset-top)) 10px 0; border-radius: 24px; background: var(--surface); border: 1px solid var(--border); box-shadow: 0 30px 60px -20px rgba(16, 24, 40, .5); overflow: hidden; animation: gs-in .28s cubic-bezier(.2, .8, .2, 1); display: flex; flex-direction: column; max-height: calc(100dvh - 24px - env(safe-area-inset-top)); }
.gs.closing .gs-box { animation: gs-out .16s ease-in forwards; }
.gs.closing::backdrop { opacity: 0; transition: opacity .16s; }
@keyframes gs-in { from { opacity: 0; transform: translateY(-14px) scale(.98); } }
@keyframes gs-out { to { opacity: 0; transform: translateY(-10px) scale(.98); } }
@media (min-width: 768px) { .gs-box { margin-top: 10vh; } }
.gs-head { display: flex; align-items: center; gap: 8px; padding: 10px; border-bottom: 1px solid var(--border); }
.gs-field { flex: 1; display: flex; align-items: center; gap: 8px; min-height: 48px; padding: 0 14px; border-radius: 16px; background: var(--surface-2); }
.gs-field .i { width: 20px; height: 20px; color: var(--muted); flex: none; }
.gs-field input { flex: 1; margin: 0 !important; min-height: 46px !important; padding: 0 !important; border: 0 !important; background: none !important; box-shadow: none !important; font-size: 1rem; }
.gs-close { flex: none; min-height: 44px; padding: 0 10px; border: 0; background: none; color: var(--primary); font: inherit; font-weight: 600; cursor: pointer; }
.gs-body { overflow-y: auto; overscroll-behavior: contain; padding: 6px 8px 12px; transition: opacity .15s; -webkit-overflow-scrolling: touch; }
.gs-body.is-loading { opacity: .6; }
.gs-g h3 { margin: 12px 8px 6px; font-size: .75rem; font-weight: 700; color: var(--muted); }
.gs-it { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 8px; border-radius: 14px; color: var(--text); text-decoration: none; animation: au-up .2s ease-out both; }
.gs-it:hover, .gs-it:focus-visible { background: var(--surface-2); outline: none; }
.gs-it:active { transform: scale(.985); }
.gs-it > span:last-child { min-width: 0; display: grid; line-height: 1.4; }
.gs-it b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gs-it small { font-size: .75rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gs-it mark { background: color-mix(in srgb, var(--primary) 18%, transparent); color: inherit; border-radius: 4px; padding: 0 1px; }
.gs-ic { display: grid; place-items: center; flex: none; width: 40px; height: 40px; border-radius: 12px; background: var(--cs, var(--primary-soft)); color: var(--c, var(--primary)); }
.gs-ic .i { width: 20px; height: 20px; }
.gs-th { flex: none; width: 40px; height: 40px; border-radius: 10px; object-fit: cover; background: var(--surface-2); }
.gs-recent { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 6px; }
.gs-recent button { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); font: inherit; font-size: .875rem; cursor: pointer; }
.gs-recent .i { width: 14px; height: 14px; color: var(--muted); }
.gs-none { display: grid; justify-items: center; gap: 10px; padding: 28px 12px; color: var(--muted); text-align: center; }
.gs-none p { margin: 0; }
@media (prefers-reduced-motion: reduce) { .gs-box, .gs-it, .gs::backdrop { animation: none; } }
/* إصلاح: مدخلات الشرائح المخفية داخل الشريحة نفسها (كانت تدفع الصفحة جانبياً عند كثرة الأقسام) */
.tl-chips .chip { position: relative; }
.tl-chips input { inset: 0; width: 100%; height: 100%; margin: 0; }
.tl-head > div:first-child { min-width: 0; }
@media (max-width: 380px) { .tl-add { padding-inline: 12px; } .tl-add .tl-add-t { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); } .tl-head h1 { font-size: 1.25rem; } }
@media (max-width: 380px) { .tl-filter { margin-inline: -12px; padding-inline: 12px; } .tl-chips { margin-inline: -12px; padding-inline: 12px; } }
.tl-head h1 { white-space: nowrap; }
.tl-head > div:first-child { flex: 1 1 auto; }
.tl-head p { font-size: .8125rem; }
.te-grid { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)) !important; }
.te-grid .tf-add { aspect-ratio: 3 / 4; }

/* ============ v52: رقم من خارج العراق — تنبيه + اختيار الدولة ============ */
.ph-cc { margin: -4px 0 14px; padding: 12px; border-radius: 16px; background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent); animation: au-up .25s ease-out; }
.ph-cc[data-mode="info"] { background: var(--primary-soft); border-color: color-mix(in srgb, var(--primary) 22%, transparent); padding: 8px 8px 8px 12px; }
.ph-cc-h { display: flex; align-items: center; gap: 10px; }
.ph-cc-h > span:not(.ph-cc-ic):not(.ph-flag) { flex: 1; display: grid; line-height: 1.45; }
.ph-cc-h b { font-size: .875rem; }
.ph-cc-h small { font-size: .75rem; color: var(--muted); }
.ph-cc-ic { display: grid; place-items: center; flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: #fff; font-weight: 800; }
.ph-flag { font-size: 1.125rem; line-height: 1; }
.ph-flag-lg { font-size: 1.625rem; }
.ph-cc-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 6px; margin-top: 10px; }
.ph-cc-list button { display: flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 10px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--text); font: inherit; font-size: .875rem; cursor: pointer; transition: transform .15s, border-color .15s; animation: au-up .25s ease-out both; }
.ph-cc-list button bdi { margin-inline-start: auto; color: var(--muted); font-size: .75rem; font-variant-numeric: tabular-nums; }
.ph-cc-list button:hover, .ph-cc-list button:focus-visible { border-color: var(--accent); }
.ph-cc-list button:active { transform: scale(.96); }
.ph-cc-other { width: 100%; margin-top: 8px; min-height: 40px; border: 1px dashed var(--border-2); border-radius: 12px; background: none; color: var(--text-2); font: inherit; font-size: .8125rem; cursor: pointer; }

/* ============ v52: زر البحث المتمدد في الصفحة الرئيسية ============ */
.qrow { position: relative; display: flex; align-items: center; gap: 0; }
.qrow > .chips { flex: 1; min-width: 0; transition: opacity .2s, transform .25s cubic-bezier(.2, .8, .2, 1); }
.qbox {
  position: relative; z-index: 2; flex: none; display: flex; align-items: center;
  width: 44px; height: 44px; margin-inline-end: 6px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm);
  transition: width .34s cubic-bezier(.2, .8, .2, 1), box-shadow .2s, border-color .2s;
  overflow: hidden;
}
.qbox-btn { flex: none; display: grid; place-items: center; width: 42px; height: 42px; padding: 0; border: 0; background: none; color: var(--text); cursor: pointer; border-radius: 50%; }
.qbox-btn .i { width: 20px; height: 20px; stroke-width: 2.2; transition: color .2s, transform .3s cubic-bezier(.34, 1.56, .64, 1); }
.qbox-btn:active .i { transform: scale(.85); }
.qbox input { flex: 1; min-width: 0; width: 0; margin: 0 !important; min-height: 42px !important; padding: 0 !important; border: 0 !important; background: none !important; box-shadow: none !important; font-size: 1rem; opacity: 0; transition: opacity .2s .1s; }
.qbox-x { flex: none; display: grid; place-items: center; width: 36px; height: 36px; margin-inline-end: 3px; padding: 0; border: 0; border-radius: 50%; background: var(--surface-2); color: var(--muted); cursor: pointer; opacity: 0; transform: scale(.6); transition: opacity .2s, transform .25s cubic-bezier(.34, 1.56, .64, 1); pointer-events: none; }
.qbox-x .i { width: 16px; height: 16px; }
/* مفتوح: يغطي صف الأقسام بالكامل */
.qrow.q-open .qbox { position: absolute; inset-inline: 0; width: auto; margin: 0; border-color: var(--primary); box-shadow: 0 0 0 4px var(--ring), var(--shadow); }
.qrow.q-open > .chips { opacity: 0; transform: translateX(-12px); pointer-events: none; }
.qbox.is-open input { opacity: 1; }
.qbox.is-open .qbox-x { opacity: 1; transform: none; pointer-events: auto; }
.qbox.is-open .qbox-btn { pointer-events: none; color: var(--primary); }
.qbox.has-q .qbox-btn .i { color: var(--primary); }
@media (prefers-reduced-motion: reduce) { .qbox, .qbox input, .qbox-x, .qrow > .chips { transition: none; } }
.qrow > .chips { margin: 0; margin-inline-end: -16px; padding: 6px 0; padding-inline-end: 16px; }
@media (max-width: 380px) { .qrow > .chips { margin-inline-end: -12px; padding-inline-end: 12px; } }
.meta-row.qrow { position: relative; min-height: 50px; align-items: center; }
.meta-row.qrow .qbox { margin-inline-start: auto; margin-inline-end: 0; }
.meta-row.qrow #count { transition: opacity .2s; }
.meta-row.qrow.q-open #count, .meta-row.qrow.q-open #offline { opacity: 0; }
.meta-row.qrow.q-open .qbox { top: 3px; }
.qbox input::-webkit-search-cancel-button, .qbox input::-webkit-search-decoration { -webkit-appearance: none; appearance: none; display: none; }

/* ============ v52: تقييم الموردين ============ */
.st { display: inline-block; width: 16px; height: 16px; background: var(--border-2); flex: none;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2.5l2.9 6 6.6.9-4.8 4.6 1.2 6.5L12 17.4l-5.9 3.1 1.2-6.5L2.5 9.4l6.6-.9z'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2.5l2.9 6 6.6.9-4.8 4.6 1.2 6.5L12 17.4l-5.9 3.1 1.2-6.5L2.5 9.4l6.6-.9z'/%3E%3C/svg%3E") center / contain no-repeat; }
.st.on { background: #f59e0b; }
.st.half { background: linear-gradient(to left, #f59e0b 50%, var(--border-2) 50%); }
.stars { display: inline-flex; gap: 2px; vertical-align: middle; }
.stars-sm .st { width: 13px; height: 13px; }
.item-rt { display: inline-flex; align-items: center; gap: 3px; margin-inline-start: 8px; padding: 1px 7px; border-radius: 999px; background: #fef6e7; color: #92400e; font-size: .75rem; font-weight: 700; vertical-align: 2px; }
.item-rt .st { width: 12px; height: 12px; }
.item-rt small { font-weight: 500; opacity: .7; }
:root[data-theme="dark"] .item-rt { background: rgba(245, 158, 11, .16); color: #fcd34d; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .item-rt { background: rgba(245, 158, 11, .16); color: #fcd34d; } }

.sup-rate .card-title .i { color: #f59e0b; }
.rt-best { display: inline-flex; align-items: center; gap: 6px; margin: 0 0 10px; padding: 4px 12px 4px 10px; border-radius: 999px; background: linear-gradient(135deg, #fef3c7, #fde68a); color: #92400e; font-size: .8125rem; font-weight: 700; box-shadow: 0 4px 12px -6px rgba(245, 158, 11, .7); }
.rt-best .i { width: 16px; height: 16px; }
.rt-sum { display: grid; grid-template-columns: auto 1fr; gap: 18px; align-items: center; padding: 12px; border-radius: 16px; background: var(--surface-2); margin-bottom: 14px; }
.rt-big { display: grid; justify-items: center; gap: 2px; min-width: 90px; }
.rt-big b { font-size: 2.25rem; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.rt-big small { color: var(--muted); font-size: .75rem; }
.rt-axes { display: grid; gap: 10px; }
.rt-axes > div { display: grid; grid-template-columns: 64px 1fr 28px; align-items: center; gap: 8px; font-size: .8125rem; }
.rt-axes b { font-variant-numeric: tabular-nums; }
.rt-bar { height: 8px; border-radius: 999px; background: var(--border); overflow: hidden; }
.rt-bar i { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, #fbbf24, #f59e0b); transition: width .6s cubic-bezier(.2, .8, .2, 1); }
.rt-form { display: grid; gap: 10px; padding: 12px; border-radius: 16px; border: 1px dashed var(--border-2); }
.rt-form-h { font-size: .9375rem; }
.rt-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: .875rem; }
.rt-pick { position: relative; display: flex; gap: 4px; touch-action: none; }
.rt-pick button { width: 38px; height: 38px; padding: 0; border: 0; background: none; cursor: pointer; display: grid; place-items: center; }
.rt-pick button::before { content: ""; width: 30px; height: 30px; background: var(--border-2); transition: background .15s, transform .2s cubic-bezier(.34, 1.56, .64, 1);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2.5l2.9 6 6.6.9-4.8 4.6 1.2 6.5L12 17.4l-5.9 3.1 1.2-6.5L2.5 9.4l6.6-.9z'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2.5l2.9 6 6.6.9-4.8 4.6 1.2 6.5L12 17.4l-5.9 3.1 1.2-6.5L2.5 9.4l6.6-.9z'/%3E%3C/svg%3E") center / contain no-repeat; }
.rt-pick button.on::before { background: #f59e0b; }
.rt-pick button.pop::before { animation: rt-pop .35s cubic-bezier(.34, 1.56, .64, 1); }
.rt-pick button:focus-visible { outline: 3px solid var(--ring); border-radius: 10px; }
.rt-pick[data-label]:not([data-label=""])::after { content: attr(data-label); position: absolute; top: -18px; inset-inline-end: 0; font-size: .6875rem; font-weight: 700; color: #b45309; }
@keyframes rt-pop { 50% { transform: scale(1.3); } }
.rt-form textarea { min-height: 44px; resize: vertical; }
.rt-acts { display: flex; align-items: center; gap: 8px; }
.rt-list { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 12px; }
.rt-list li { display: flex; gap: 10px; align-items: flex-start; }
.rt-list li > div { min-width: 0; flex: 1; display: grid; gap: 2px; }
.rt-list b small { color: var(--muted); font-weight: 500; }
.rt-mini { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.rt-mini small { color: var(--muted); font-size: .75rem; }
.rt-list p { margin: 2px 0 0; padding: 8px 10px; border-radius: 12px; background: var(--surface-2); font-size: .875rem; line-height: 1.6; }

.top-chips { margin-bottom: 12px; }
.top-chips .chip { text-decoration: none; }
.rank { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; counter-reset: r; }
.rank-it a { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 18px; background: var(--surface); border: 1px solid var(--border); color: inherit; text-decoration: none; box-shadow: var(--shadow-sm); animation: au-up .3s ease-out both; transition: transform .15s; }
.rank-it a:active { transform: scale(.985); }
.rank-n { position: relative; display: grid; place-items: center; flex: none; width: 44px; height: 44px; border-radius: 14px; background: var(--surface-2); color: var(--muted); font-weight: 800; }
.rank-n .i { position: absolute; width: 44px; height: 44px; opacity: .25; }
.rank-it.top1 .rank-n { background: linear-gradient(135deg, #fde68a, #f59e0b); color: #78350f; }
.rank-it.top2 .rank-n { background: linear-gradient(135deg, #f1f5f9, #94a3b8); color: #1e293b; }
.rank-it.top3 .rank-n { background: linear-gradient(135deg, #fed7aa, #c2410c); color: #fff; }
.rank-it.top1 a { border-color: color-mix(in srgb, #f59e0b 45%, var(--border)); box-shadow: 0 10px 24px -14px rgba(245, 158, 11, .7); }
.rank-main { flex: 1; min-width: 0; display: grid; gap: 2px; }
.rank-name { font-size: 1rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-main small { color: var(--muted); font-size: .75rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-axes { display: flex; gap: 10px; font-size: .75rem; color: var(--text-2); }
.rank-score { display: grid; justify-items: center; gap: 2px; flex: none; }
.rank-score > b { font-size: 1.375rem; font-weight: 800; line-height: 1; }
.rank-score small { font-size: .6875rem; color: var(--muted); }
.rank-note { display: flex; gap: 6px; align-items: flex-start; margin-top: 14px; }
.rank-note .i { width: 15px; height: 15px; flex: none; margin-top: 3px; }

.hero { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.hero-acts { display: flex; gap: 8px; flex: none; }
.hero-act { display: grid; justify-items: center; gap: 4px; min-width: 56px; font-size: .75rem; font-weight: 600; color: var(--text-2); text-decoration: none; }
.ha-ic { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 16px; box-shadow: var(--shadow-sm); transition: transform .16s cubic-bezier(.34, 1.56, .64, 1); }
.hero-act:active .ha-ic { transform: scale(.9); }
.ha-ic .i { width: 22px; height: 22px; }
.ha-map { background: linear-gradient(135deg, #dbeafe, #bfdbfe); color: #1d4ed8; }
.ha-top { background: linear-gradient(135deg, #fef3c7, #fde68a); color: #b45309; }
:root[data-theme="dark"] .ha-map { background: rgba(59, 130, 246, .18); color: #93c5fd; } :root[data-theme="dark"] .ha-top { background: rgba(245, 158, 11, .18); color: #fcd34d; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .ha-map { background: rgba(59, 130, 246, .18); color: #93c5fd; } :root:not([data-theme="light"]) .ha-top { background: rgba(245, 158, 11, .18); color: #fcd34d; } }

/* ============ v52: قيم ورقة الفحص (الذكاء الاصطناعي) + المقارنة ============ */
.tdet-ai .card-title .i { color: #8b5cf6; }
.ai-tbl { width: 100%; border-collapse: collapse; font-size: .9375rem; }
.ai-tbl th, .ai-tbl td { padding: 10px 4px; border-bottom: 1px solid var(--border); text-align: start; vertical-align: top; }
.ai-tbl tr:last-child th, .ai-tbl tr:last-child td { border-bottom: 0; }
.ai-tbl th { font-weight: 600; color: var(--text-2); width: 50%; }
.ai-tbl th small { display: block; font-weight: 400; color: var(--muted); font-size: .6875rem; direction: ltr; text-align: start; }
.ai-tbl td { font-weight: 700; font-variant-numeric: tabular-nums; }
.ai-tbl td small { font-weight: 500; color: var(--muted); }
.ai-wait { display: flex; align-items: center; gap: 10px; padding: 14px; border-radius: 14px; color: #6d28d9; background: linear-gradient(90deg, rgba(139, 92, 246, .08), rgba(139, 92, 246, .16), rgba(139, 92, 246, .08)); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; font-weight: 600; font-size: .875rem; }
.ai-spin { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid currentColor; border-inline-end-color: transparent; animation: ptr-spin .7s linear infinite; }
.ai-note { display: flex; gap: 6px; align-items: flex-start; margin: 10px 0 0; padding: 8px 10px; border-radius: 12px; background: var(--surface-2); font-size: .8125rem; color: var(--text-2); }
.ai-note .i { width: 15px; height: 15px; flex: none; margin-top: 3px; }
.ai-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border); }
.ai-foot small { display: inline-flex; align-items: center; gap: 5px; font-size: .75rem; }
.ai-foot small .i { width: 14px; height: 14px; color: #8b5cf6; }
#aiRead.is-busy .i { animation: ptr-spin .8s linear infinite; }
.cmp-h { display: flex; align-items: center; gap: 8px; margin: 18px 0 8px; font-size: 1rem; }
.cmp-h .i { width: 18px; height: 18px; color: var(--primary); }
.cmp-wrap { overflow-x: auto; margin: 0 -4px; }
.cmp { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .8125rem; }
.cmp th, .cmp td { padding: 8px 10px; border-bottom: 1px solid var(--border); text-align: start; white-space: nowrap; }
.cmp thead th { color: var(--muted); font-weight: 600; font-size: .75rem; }
.cmp tbody th { font-weight: 600; color: var(--text-2); position: sticky; inset-inline-start: 0; background: var(--surface); }
.cmp td { font-weight: 700; font-variant-numeric: tabular-nums; }
.cmp .is-cur { background: var(--primary-soft); }
.cmp thead .is-cur { color: var(--primary); }
.cmp-d { display: inline-block; width: 0; height: 0; margin-inline-start: 5px; border: 5px solid transparent; vertical-align: 1px; }
.cmp-d.up { border-bottom-color: #dc6803; border-top: 0; }
.cmp-d.dn { border-top-color: #0e9384; border-bottom: 0; }
.tdet > * { min-width: 0; }
.cmp-wrap { max-width: 100%; }

/* =====================================================================
   v55 — موبايل: بحث واحد (زر الشريط العلوي) يعمل في كل الصفحات + أقسام بشكل مربعات
   ===================================================================== */
.ct-ic, .ct-n { display: contents; }
.gs-g h3 span { margin-inline-start: 4px; font-weight: 600; opacity: .7; font-variant-numeric: tabular-nums; }
.gs-scope { display: flex; gap: 6px; overflow-x: auto; padding: 8px 10px; border-bottom: 1px solid var(--border); scrollbar-width: none; }
.gs-scope::-webkit-scrollbar { display: none; }
.gs-scope button { flex: none; min-height: 34px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); font: inherit; font-size: .8125rem; font-weight: 600; cursor: pointer; transition: background .15s, color .15s, border-color .15s, transform .15s; }
.gs-scope button:active { transform: scale(.95); }
.gs-scope button.on { background: var(--text); border-color: var(--text); color: var(--surface); }
.gs-scope button[hidden] { display: none; }
.gs-ctx { width: 100%; margin: 6px 0 2px; border: 1px dashed color-mix(in srgb, var(--primary) 45%, transparent); background: var(--primary-soft); font: inherit; text-align: start; cursor: pointer; }
.gs-ctx b { color: var(--primary); }
.gs-none small { font-size: .8125rem; }
.gs-none-ic { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; background: var(--surface-2); }
.gs-none-ic .i { width: 26px; height: 26px; }

@media (max-width: 767px) {
  /* حقول البحث المكررة تختفي: يبقى زر البحث بجانب صورة المستخدم (تظهر فقط إن كان فيها نص فعّال) */
  #qbox:not(.has-q) { display: none; }
  .tl-filter .psearch.gs-dup { display: none; }

  /* نافذة البحث: شاشة كاملة تنزل من الأعلى بنعومة */
  .gs { max-width: none; height: 100%; }
  .gs-box { margin: 0; height: 100dvh; max-height: none; border: 0; border-radius: 0; padding-top: env(safe-area-inset-top); animation: gs-in-m .3s cubic-bezier(.2, .8, .2, 1); }
  .gs.closing .gs-box { animation: gs-out-m .18s ease-in forwards; }
  .gs-head { padding: 10px 12px; border-bottom: 0; }
  .gs-field { min-height: 50px; border-radius: 999px; transition: box-shadow .2s, background .2s; }
  .gs-field:focus-within { background: var(--surface); box-shadow: 0 0 0 2px var(--primary), 0 0 0 6px var(--ring); }
  .gs-scope { padding: 2px 12px 10px; }
  .gs-body { flex: 1; padding: 4px 10px calc(16px + env(safe-area-inset-bottom)); }
  .gs-it { min-height: 60px; }
  .gs-g + .gs-g { border-top: 1px solid var(--border); margin-top: 6px; }
  @keyframes gs-in-m { from { opacity: 0; transform: translateY(-24px); } }
  @keyframes gs-out-m { to { opacity: 0; transform: translateY(-16px); } }

  /* الأقسام: شبكة مربعات (3 في الصف) — أيقونة ملونة + الاسم + العدد */
  .search-sticky { position: relative; top: auto; padding-top: 4px; }
  #chips { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 0; padding: 4px 0 2px; }
  #chips .chip { position: relative; display: grid; justify-items: center; align-content: center; gap: 6px; min-height: 92px; padding: 12px 6px 10px; border-radius: 18px; border: 1px solid var(--border); background: var(--surface); color: var(--text); white-space: normal; text-align: center; box-shadow: 0 1px 2px rgba(16, 24, 40, .04); transition: transform .18s cubic-bezier(.34, 1.56, .64, 1), background .2s, border-color .2s, box-shadow .2s; -webkit-tap-highlight-color: transparent; }
  #chips .chip:active { transform: scale(.95); }
  #chips .ct-ic { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 13px; background: var(--cs, var(--primary-soft)); color: var(--c, var(--primary)); transition: background .2s, color .2s, transform .25s cubic-bezier(.34, 1.56, .64, 1); }
  #chips .ct-ic .i { width: 21px; height: 21px; }
  #chips .ct-n { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; font-size: .8125rem; font-weight: 600; line-height: 1.3; }
  #chips .chip small { position: absolute; top: 7px; inset-inline-end: 8px; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--surface-2); color: var(--muted); font-size: .6875rem; font-weight: 700; line-height: 20px; opacity: 1; }
  #chips .chip.on { background: var(--c, var(--primary)); border-color: var(--c, var(--primary)); color: var(--ci, #fff); box-shadow: 0 10px 22px -12px var(--c, var(--primary)); }
  #chips .chip[data-c=""].on { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); box-shadow: 0 10px 22px -12px var(--primary); }
  #chips .chip.on .ct-ic { background: rgba(255, 255, 255, .2); color: inherit; transform: scale(1.06); }
  #chips .chip.on small { background: rgba(255, 255, 255, .24); color: inherit; }
  #chips .chip-empty:not(.on) { opacity: 1; }
  #chips .chip-empty:not(.on) .ct-ic { filter: grayscale(.7); opacity: .6; }
  #chips .chip-empty:not(.on) .ct-n { color: var(--muted); }

  /* منتجات القسم: صف يمرّ جانبياً تحت المربعات */
  #subChips { margin: 0 -16px; padding: 10px 16px 2px; }
  #subChips:not([hidden]) { animation: au-up .22s ease-out both; }
  #subChips .chip { min-height: 38px; padding: 0 14px; border-radius: 999px; }
  #subChips .chip.on { background: var(--text); border-color: var(--text); color: var(--surface); }
  .meta-row.qrow { min-height: 44px; }
  .meta-row.qrow #qbox.has-q { margin-inline-start: 0; flex: 1 1 100%; order: -1; }
}
@media (max-width: 767px) and (prefers-color-scheme: dark) { :root:not([data-theme="light"]) #chips .chip { box-shadow: none; } }
@media (max-width: 380px) { #chips .chip { min-height: 86px; } #subChips { margin: 0 -12px; padding-inline: 12px; } }
@media (prefers-reduced-motion: reduce) { #chips .chip, #chips .ct-ic, #subChips:not([hidden]), .gs-box { animation: none; transition: none; } }

/* v57 — صفحة الموردين بلا زر بحث (البحث من الشريط العلوي فقط)؛ التصفية الفعّالة = شارة تُلغى بلمسة */
.qpill { display: inline-flex; align-items: center; gap: 6px; max-width: 60%; min-height: 36px; margin-inline-start: auto; padding: 0 12px; border-radius: 999px; border: 1px solid color-mix(in srgb, var(--primary) 40%, transparent); background: var(--primary-soft); color: var(--primary); font: inherit; font-size: .875rem; font-weight: 600; cursor: pointer; animation: au-up .2s ease-out both; }
.qpill[hidden] { display: none; }
.qpill span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qpill .i { flex: none; width: 15px; height: 15px; }
.qpill:active { transform: scale(.96); }


/* =====================================================================
   v60 — الأسعار اليومية: بطاقات هادئة (الأحدث أولاً) + «بلا سعر» مطويّة + نافذة «سعر جديد»
   ===================================================================== */
.pr-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin: 4px 0 14px; }
.pr-head h1 { margin: 0 0 6px; font-size: 1.25rem; }
.pr-head-acts { display: flex; align-items: center; gap: 8px; flex: none; }
.pr-share { border: 1px solid var(--border); background: var(--surface); color: var(--wa); }
.pr-days { display: flex; align-items: center; gap: 4px; }
.pr-dbtn { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; color: var(--muted); }
.pr-dbtn:active { background: var(--surface-2); }
.pr-dbtn[rel="prev"] .i { transform: scaleX(-1); }
.pr-dbtn .i { width: 18px; height: 18px; }
.pr-day { position: relative; display: inline-flex; align-items: baseline; gap: 6px; min-height: 32px; padding: 4px 10px; border-radius: 999px; background: var(--surface-2); cursor: pointer; font-size: .875rem; }
.pr-day .muted { font-size: .75rem; }
.pr-day input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0 !important; padding: 0 !important; opacity: 0; cursor: pointer; border: 0 !important; min-height: 0 !important; }

.pr-prog { display: flex; align-items: center; gap: 12px; margin: 0 0 12px; font-size: .75rem; color: var(--muted); }
.pr-prog b { color: var(--text); font-size: .875rem; font-variant-numeric: tabular-nums; }
.pr-bar { flex: 1; height: 4px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.pr-bar i { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--primary); transition: width .5s cubic-bezier(.2, .8, .2, 1); }
.pr-prog.is-full .pr-bar i { background: var(--ok); }

.pr-list { display: grid; gap: 8px; }
.pc { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "ic m p" "ic m k"; column-gap: 12px; align-items: center; width: 100%; padding: 12px 14px; border-radius: 18px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; text-align: start; cursor: pointer; box-shadow: var(--shadow-sm); animation: au-up .25s ease-out both; transition: transform .15s, border-color .2s; -webkit-tap-highlight-color: transparent; }
.pc:active { transform: scale(.985); }
.pc:disabled { cursor: default; opacity: 1; }
.pc-ic { grid-area: ic; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 13px; background: var(--cs, var(--primary-soft)); color: var(--c, var(--primary)); }
.pc-ic .i { width: 20px; height: 20px; }
.pc-main { grid-area: m; min-width: 0; display: grid; gap: 1px; line-height: 1.35; }
.pc-n { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pc-meta { color: var(--muted); font-size: .75rem; }
.pc-note { color: var(--text-2); font-size: .75rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pc-price { grid-area: p; display: grid; justify-items: end; gap: 2px; }
.pc-v { display: inline-flex; align-items: baseline; gap: 3px; font-size: 1.25rem; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.pc-v small { font-size: .75rem; font-weight: 600; color: var(--muted); }
.pc-ch { padding: 1px 8px; border-radius: 999px; font-size: .75rem; font-weight: 700; background: var(--surface-2); color: var(--muted); }
.pc-ch.up { background: var(--danger-soft); color: var(--danger); }
.pc-ch.dn { background: var(--ok-soft); color: var(--ok); }
.pc-ch.up::before { content: "▲ "; font-size: .625rem; }
.pc-ch.dn::before { content: "▼ "; font-size: .625rem; }
.pc-ch.new { background: var(--primary-soft); color: var(--primary); }
.pc .pr-spark { grid-area: k; justify-self: end; width: 56px; height: 16px; margin-top: 4px; overflow: visible; }
.pr-spark polyline { fill: none; stroke: var(--muted); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.pr-spark.up polyline { stroke: var(--danger); }
.pr-spark.dn polyline { stroke: var(--ok); }

.pr-empty { display: grid; justify-items: center; gap: 8px; padding: 36px 16px; border-radius: 20px; border: 1px dashed var(--border-2); background: var(--surface); text-align: center; }
.pr-empty p { margin: 0 0 6px; max-width: 30ch; font-size: .875rem; }
.pr-empty-ic { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 18px; background: var(--accent-soft); color: var(--accent); }
.pr-empty-ic .i { width: 26px; height: 26px; }

.pr-miss { margin-top: 14px; border-radius: 18px; border: 1px solid var(--border); background: var(--surface); }
.pr-miss summary { display: flex; align-items: center; gap: 8px; min-height: 52px; padding: 0 14px; cursor: pointer; list-style: none; font-size: .875rem; font-weight: 600; color: var(--text-2); }
.pr-miss summary::-webkit-details-marker { display: none; }
.pr-miss summary > span { display: inline-flex; align-items: center; gap: 8px; flex: 1; }
.pr-miss summary .i { width: 17px; height: 17px; color: var(--muted); }
.pr-miss summary b { min-width: 24px; padding: 0 8px; border-radius: 999px; background: var(--surface-2); text-align: center; font-size: .75rem; line-height: 22px; }
.pr-miss summary > .i:last-child { transition: transform .25s; }
.pr-miss[open] summary > .i:last-child { transform: rotate(180deg); }
.pr-miss-in { padding: 0 14px 14px; }
.pr-miss-row { display: flex; flex-wrap: wrap; gap: 6px; }
.pm { min-height: 36px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); font: inherit; font-size: .8125rem; cursor: pointer; transition: border-color .15s, transform .15s; }
.pm:hover { border-color: var(--c, var(--border-2)); }
.pm:active { transform: scale(.96); }
.pm:disabled { cursor: default; }
.pr-fill { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; margin-bottom: 10px; padding: 0 12px; border-radius: 999px; border: 1px dashed color-mix(in srgb, var(--primary) 50%, transparent); background: var(--primary-soft); color: var(--primary); font: inherit; font-size: .8125rem; font-weight: 700; cursor: pointer; }
.pr-fill .i { width: 15px; height: 15px; }

/* ---------- نافذة «سعر جديد»: ورقة من الأسفل في الموبايل، ونافذة في الوسط على الكمبيوتر ---------- */
.pd { width: 100%; max-width: 560px; max-height: none; margin: auto auto 0; padding: 0; border: 0; background: transparent; color: var(--text); overflow: visible; }
.pd::backdrop { background: rgba(8, 14, 30, .45); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); animation: au-fade .2s; }
.pd[open] { display: block; }
.pd-box { display: flex; flex-direction: column; max-height: calc(100dvh - 24px - env(safe-area-inset-top)); border-radius: 26px 26px 0 0; background: var(--surface); box-shadow: 0 -20px 50px -20px rgba(16, 24, 40, .45); animation: pd-in .32s cubic-bezier(.2, .9, .2, 1); transition: transform .2s; }
.pd.closing .pd-box { animation: pd-out .18s ease-in forwards; }
.pd.closing::backdrop { opacity: 0; transition: opacity .18s; }
@keyframes pd-in { from { transform: translateY(100%); } }
@keyframes pd-out { to { transform: translateY(100%); } }
.pd-grab { width: 40px; height: 5px; margin: 8px auto 0; border-radius: 999px; background: var(--border-2); }
.pd-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 12px 4px 16px; }
.pd-head h2 { margin: 0; font-size: 1.125rem; }
.pd-head h2 small { font-size: .875rem; font-weight: 500; color: var(--muted); }
.pd-body { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 6px 16px 8px; -webkit-overflow-scrolling: touch; }
.pd-sec { display: block; margin-bottom: 16px; }
.pd-lbl { display: block; margin-bottom: 8px; font-size: .75rem; font-weight: 700; color: var(--muted); }
.pd-mini { display: flex; align-items: center; gap: 6px; margin: 0 0 6px; font-size: .75rem; font-weight: 600; color: var(--muted); }
.pd-mini .i { width: 14px; height: 14px; }
.pd-search { display: flex; align-items: center; gap: 8px; min-height: 46px; margin-bottom: 12px; padding: 0 14px; border-radius: 999px; background: var(--surface-2); }
.pd-search:focus-within { background: var(--surface); box-shadow: 0 0 0 2px var(--primary), 0 0 0 6px var(--ring); }
.pd-search .i { width: 18px; height: 18px; color: var(--muted); flex: none; }
.pd-search input { flex: 1; min-width: 0; margin: 0 !important; min-height: 44px !important; padding: 0 !important; border: 0 !important; background: none !important; box-shadow: none !important; font-size: 1rem; }
.pd-recent { margin-bottom: 12px; padding-bottom: 12px; border-bottom: 1px dashed var(--border); }
.pd-groups { display: grid; gap: 12px; max-height: 38vh; overflow-y: auto; overscroll-behavior: contain; }
.pd-group[hidden], .pd-chip[hidden], .pd-recent[hidden] { display: none; }
.pd-cat-ic { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 7px; background: var(--cs, var(--surface-2)); color: var(--c, var(--muted)); }
.pd-cat-ic .i { width: 13px; height: 13px; }
.pd-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.pd-chip { min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1.5px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-size: .875rem; font-weight: 600; cursor: pointer; transition: border-color .15s, transform .15s, background .15s; -webkit-tap-highlight-color: transparent; }
.pd-chip:hover { border-color: var(--c, var(--border-2)); }
.pd-chip:active { transform: scale(.95); background: var(--cs, var(--surface-2)); }
.pd-chosen { display: flex; align-items: center; gap: 12px; padding: 10px 10px 10px 12px; border-radius: 16px; background: var(--surface-2); animation: au-up .2s ease-out both; }
.pd-chosen[hidden], .pd-pick[hidden] { display: none; }
.pd-chosen-ic { display: grid; place-items: center; flex: none; width: 40px; height: 40px; border-radius: 13px; background: var(--cs, var(--primary-soft)); color: var(--c, var(--primary)); }
.pd-chosen-ic .i { width: 20px; height: 20px; }
.pd-chosen-t { flex: 1; min-width: 0; display: grid; line-height: 1.35; }
.pd-chosen-t b { font-size: 1rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pd-chosen-t small { font-size: .75rem; color: var(--muted); }

.pd-cur { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; margin-bottom: 10px; border-radius: 14px; background: var(--surface-2); }
.pd-cur label { position: relative; margin: 0; }
.pd-cur input { position: absolute; opacity: 0; pointer-events: none; }
.pd-cur span { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; border-radius: 11px; font-size: .875rem; font-weight: 700; color: var(--muted); cursor: pointer; transition: background .2s, color .2s, box-shadow .2s; }
.pd-cur span small { font-weight: 600; opacity: .8; }
.pd-cur input:checked + span { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(16, 24, 40, .12); }
.pd-cur input:focus-visible + span { box-shadow: 0 0 0 3px var(--ring); }
.pd-amt { position: relative; display: block; margin: 0; }
.pd-amt input { width: 100%; min-height: 68px !important; margin: 0 !important; padding: 0 64px 0 16px !important; border-radius: 18px; border: 2px solid var(--border) !important; background: var(--surface) !important; direction: ltr; text-align: left; font-size: 2rem; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.02em; transition: border-color .2s, box-shadow .2s; }
.pd-amt input:focus { border-color: var(--primary) !important; box-shadow: 0 0 0 5px var(--ring) !important; outline: none; }
.pd-amt input::placeholder { color: var(--border-2); }
.pd-sym { position: absolute; top: 50%; right: 18px; transform: translateY(-50%); font-size: 1rem; font-weight: 700; color: var(--muted); pointer-events: none; }
.pd-hint { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; font-size: .8125rem; color: var(--muted); }
.pd-hint[hidden] { display: none; }
.pd-same { min-height: 32px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--primary); font: inherit; font-size: .75rem; font-weight: 700; cursor: pointer; }
.pd-same:active { transform: scale(.95); }
.pd-today { margin: -6px 0 16px; padding: 10px 12px; border-radius: 14px; background: var(--surface-2); }
.pd-today[hidden] { display: none; }
.pd-t { display: flex; align-items: center; gap: 8px; min-height: 36px; }
.pd-t + .pd-t { border-top: 1px solid var(--border); }
.pd-t b { flex: none; font-variant-numeric: tabular-nums; }
.pd-t small { flex: 1; min-width: 0; color: var(--muted); font-size: .75rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pd-del { flex: none; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; border: 0; background: none; color: var(--danger); font-size: 1.25rem; line-height: 1; cursor: pointer; }
.pd-del:active { background: var(--danger-soft); }
.pd-note-l textarea { width: 100%; min-height: 46px; margin: 0; resize: none; border-radius: 14px; font: inherit; font-size: 1rem; line-height: 1.5; }
.pd-foot { display: flex; gap: 8px; padding: 10px 16px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--border); background: var(--surface); }
.pd-foot .btn { min-height: 50px; }
.pd-foot .btn-primary { flex: 1; font-size: 1rem; }
.pd-foot .btn-ghost { flex: none; }
html.pd-on { overflow: hidden; }

/* الرئيسية: بطاقة «أسعار اليوم»، وقائمة «+» */
.hero-price { display: inline-flex; align-items: center; gap: 10px; flex: none; min-height: 48px; padding: 6px 14px 6px 10px; border-radius: 16px; background: var(--surface); border: 1px solid var(--border); color: var(--text); text-decoration: none; box-shadow: var(--shadow-sm); }
.hero-price > span:last-child { display: grid; line-height: 1.3; }
.hero-price b { font-size: .875rem; }
.hero-price small { font-size: .75rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.hp-ic { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 11px; background: var(--accent-soft); color: var(--accent); }
.hp-ic .i { width: 18px; height: 18px; }
.hero-price.is-full .hp-ic { background: var(--ok-soft); color: var(--ok); }
.hero-price:active { transform: scale(.97); }
.fa-price { background: var(--accent-soft); color: var(--accent); }

@media (max-width: 380px) {
  .pr-new span { display: none; }
  .pc { column-gap: 10px; padding: 12px; }
  .pc-v { font-size: 1.125rem; }
}
@media (min-width: 768px) {
  .pr-head, .pr-prog, #prBody { max-width: 760px; margin-inline: auto; }
  .pr-prog { margin-bottom: 14px; }
  .pd { margin: auto; }
  .pd-box { border-radius: 24px; max-height: min(86vh, 760px); box-shadow: 0 30px 60px -20px rgba(16, 24, 40, .5); animation: gs-in .28s cubic-bezier(.2, .8, .2, 1); }
  .pd.closing .pd-box { animation: gs-out .16s ease-in forwards; }
  .pd-grab { display: none; }
  .pd-head { padding-top: 14px; }
}
@media (prefers-reduced-motion: reduce) { .pc, .pd-box, .pd-chosen, .pr-bar i { animation: none; transition: none; } }
.pr-day { white-space: nowrap; }
.pr-head-t { min-width: 0; }
@media (max-width: 599px) { .pr-day .muted { display: none; } }
.pr-spark polyline, .pr-spark.up polyline, .pr-spark.dn polyline { stroke: color-mix(in srgb, var(--primary) 55%, transparent); }
