/* (21/11، البند 82) هيكل الواجهة الموحدة /app. كل الأصناف بالبادئة u- حتى لا تتداخل مع app.css وportal.css.
   المتغيرات (الألوان والخطوط والداكن) من app.css نفسها. لا نمط مضمّن (CSP): العرض المتغير من JavaScript عبر element.style. */
:root { --u-info: #1d4ed8; --u-side: #1f2a28; --u-side-ink: #c9d6d2; --u-nav-h: 64px; --u-top-h: 56px; }
:root[data-theme="dark"] { --u-info: #60a5fa; --u-side: #0a1210; }
.u-app { min-height: 100vh; min-height: 100dvh; }
.u-body { min-width: 0; display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; }
.u-svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* شريط المعاينة كدور */
.u-preview { position: sticky; top: 0; z-index: 9; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 12px;
  background: #7c3aed; color: #fff; font-size: 12.5px; }
.u-preview select { width: auto; min-height: 30px; padding: 2px 8px; font-size: 12px; border-radius: 8px; border: 0; background: #ede9fe; color: #4c1d95; }
.u-preview button { min-height: 30px; font-size: 12px; background: #fff; color: #5b21b6; border: 0; padding: 0 10px; white-space: nowrap; flex: none; }
.u-preview .u-pv-long { display: none; }
@media (min-width: 700px) { .u-preview .u-pv-long { display: inline; } }

/* الشريط العلوي */
.u-top { position: sticky; top: 0; z-index: 8; height: var(--u-top-h); display: flex; align-items: center; gap: 10px; padding: 0 10px 0 6px;
  background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.u-has-preview .u-top { top: 42px; }
/* (2/12، v57) سهم رجوع واحد في الرأس بدل أزرار «→ …» داخل الشاشات */
.u-main .lv-back { display: none; }
/* (2/12، v60) الشرائح الداخلية للمجموعة (الخطط، التقييم، أقسام الإدارة)، وأقسام صفحة المعرض */
.u-chips2 { margin-top: -4px; }
.u-chips2 button { font-size: .86em; }
.u-rsec > summary { cursor: pointer; font-weight: 700; padding: 4px 0; }
.u-top .u-back { margin-inline-end: -4px; }
html[dir="ltr"] .u-top .u-back .u-svg { transform: scaleX(-1); }
.u-brand { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink); min-width: 0; }
.u-brand img { width: 40px; height: 21px; flex: none; }
.u-brand strong { font-size: 15.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.u-acts { margin-inline-start: auto; display: flex; align-items: center; gap: 2px; }
.u-acts .lv-bell { border: 0; background: transparent; min-height: 42px; padding: 0 10px; }
.u-acts .lv-bell svg { width: 22px; height: 22px; }
.u-ib { position: relative; width: 42px; height: 42px; min-height: 0; padding: 0; border: 0; border-radius: 12px; background: transparent; display: grid; place-items: center; color: var(--ink); }
.u-ib[aria-expanded="true"] { background: var(--accent-soft); color: var(--accent); }
.u-ib .av, .u-ib .avatar { pointer-events: none; }

.u-main { flex: 1; width: 100%; max-width: 640px; margin: 0 auto; padding: 12px 14px calc(var(--u-nav-h) + 84px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 12px; box-sizing: border-box; }
.u-no-nav .u-main { padding-bottom: 40px; }

/* التنقل: سفلي على الجوال */
.u-nav { position: fixed; bottom: 0; inset-inline: 0; z-index: 6; display: flex; background: var(--surface); border-top: 1px solid var(--line);
  padding: 4px 4px calc(6px + env(safe-area-inset-bottom)); }
:root[data-theme="dark"] .u-nav { background: #13201d; }
.u-nav a { flex: 1 1 0; position: relative; min-width: 0; min-height: 54px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  font-size: 11px; color: var(--muted); text-decoration: none; border-radius: 12px; }
.u-nav a[aria-current="page"] { color: var(--accent); font-weight: 700; }
.u-nav .u-bd { position: absolute; top: 5px; inset-inline-start: calc(50% + 5px); min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--danger); color: #fff; font-size: 10px; font-weight: 700; display: grid; place-items: center; line-height: 1; }
.u-nav .u-nbrand, .u-nav .u-sep, .u-nav .u-foot { display: none; }

/* الزر العائم (+): صغير وشبه شفاف، يغمق عند الضغط */
.u-fab { position: fixed; z-index: 7; inset-inline-end: 14px; bottom: calc(var(--u-nav-h) + 14px + env(safe-area-inset-bottom)); width: 46px; height: 46px; min-height: 0; padding: 0;
  border-radius: 50%; border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); background: color-mix(in srgb, var(--accent) 22%, transparent);
  color: var(--accent); backdrop-filter: blur(6px); display: grid; place-items: center; opacity: .72; transition: background .18s, opacity .18s, color .18s; }
.u-fab .u-svg { stroke-width: 2.4; transition: transform .2s; }
.u-fab[aria-expanded="true"] { opacity: 1; background: var(--accent); color: var(--accent-ink); border-color: var(--accent); box-shadow: 0 8px 20px rgba(15,118,110,.35); }
.u-fab[aria-expanded="true"] .u-svg { transform: rotate(45deg); }
.u-fab-menu { position: fixed; z-index: 7; inset-inline-end: 14px; bottom: calc(var(--u-nav-h) + 70px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.u-fab-menu button { display: flex; align-items: center; gap: 10px; min-height: 44px; border-radius: 999px; padding: 0 16px 0 8px; background: var(--surface); box-shadow: var(--shadow); font-weight: 600; font-size: 13.5px; }
.u-fab-menu .u-fi { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.u-fab-menu .u-fi .u-svg { width: 17px; height: 17px; }
.u-scrim { position: fixed; inset: 0; z-index: 6; background: rgba(15, 23, 21, .28); }
.u-scrim.u-clear { background: transparent; }

/* القوائم المنبثقة */
.u-pop { position: fixed; z-index: 10; top: calc(var(--u-top-h) + 6px); inset-inline-end: 8px; width: min(360px, calc(100vw - 16px)); max-height: 76vh; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 18px 40px rgba(31,42,40,.18); padding: 8px; }
:root[data-theme="dark"] .u-pop { background: #15231f; }
.u-has-preview .u-pop { top: calc(var(--u-top-h) + 48px); }
.u-pop h3 { font-size: 13px; color: var(--muted); font-weight: 600; padding: 6px 8px 4px; margin: 0; }
.u-item { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; border: 0; border-radius: 10px; padding: 6px 8px; background: transparent; text-align: start; color: var(--ink); text-decoration: none; font-weight: 400; }
.u-item:hover { background: color-mix(in srgb, var(--accent) 8%, transparent); }
.u-item .u-svg { width: 20px; height: 20px; color: var(--muted); }
.u-item .u-tx { display: flex; flex-direction: column; min-width: 0; }
.u-item .u-tx span { font-size: 11.5px; color: var(--muted); }
.u-item[aria-checked="true"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.u-sepl { height: 1px; background: var(--line); margin: 6px 4px; }
.u-who { display: flex; gap: 10px; align-items: center; padding: 6px 8px 8px; }
.u-tgrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; padding: 4px; }
.u-tool { display: flex; flex-direction: column; align-items: center; gap: 6px; min-height: 92px; padding: 10px 4px; border-radius: 14px; border: 0; background: transparent; text-align: center; font-size: 12px; color: var(--ink); text-decoration: none; }
.u-tool:hover { background: color-mix(in srgb, var(--accent) 7%, transparent); }
.u-ti { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.u-tool.u-add .u-ti { background: transparent; border: 1.5px dashed var(--line); color: var(--muted); }

/* داخل الصفحة */
.u-h1 { font-size: 19px; margin: 0; }
.u-chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; margin: 0 -14px; padding-inline: 14px; }
.u-chips::-webkit-scrollbar { display: none; }
.u-chips button { white-space: nowrap; border-radius: 999px; min-height: 34px; font-size: 12.5px; padding: 0 12px; flex: none; }
.u-chips button[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); font-weight: 600; }
.u-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.u-tile { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; min-height: 104px; padding: 12px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); text-align: start; color: var(--ink); text-decoration: none; font-weight: 400; }
.u-tile .u-ti { width: 36px; height: 36px; border-radius: 11px; }
.u-tile .u-ti .u-svg { width: 19px; height: 19px; }
.u-tile strong { font-size: 13.5px; }
.u-tile span { font-size: 11.5px; color: var(--muted); }
.u-tile.u-soon { border-style: dashed; background: transparent; }
.u-tile.u-soon .u-ti { background: transparent; color: var(--muted); border: 1px dashed var(--muted); }
.u-tag { display: inline-flex; align-items: center; font-size: 11px; padding: 1px 8px; border-radius: 999px; white-space: nowrap; background: var(--accent-soft); color: var(--accent); }
.u-tag.u-soonb { background: transparent; border: 1px dashed var(--muted); color: var(--muted); }
.u-tag.u-later { background: color-mix(in srgb, var(--u-info) 12%, transparent); color: var(--u-info); }
.u-note { font-size: 12.5px; padding: 9px 12px; border-radius: 12px; background: color-mix(in srgb, var(--u-info) 10%, transparent); color: var(--u-info); }
.u-soonbox { border: 1.5px dashed var(--line); border-radius: 18px; padding: 22px 16px; text-align: center; display: flex; flex-direction: column; gap: 6px; align-items: center; color: var(--muted); }
.u-soonbox strong { color: var(--ink); font-size: 15px; }
.u-open { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); }
.u-open .u-tx { display: flex; flex-direction: column; min-width: 0; }
.u-open .u-tx span { font-size: 12px; color: var(--muted); }
.u-open a { flex: none; }

@media (hover: hover) { .u-tile:hover:not(.u-soon) { background: color-mix(in srgb, var(--accent) 6%, var(--surface)); } .u-nav a:hover { background: color-mix(in srgb, var(--accent) 7%, transparent); } }
@media (max-width: 380px) { .u-nav a { font-size: 10px; } }

/* اللابتوب: تنقل جانبي داكن لكل الأدوار */
@media (min-width: 900px) {
  .u-app { display: grid; grid-template-columns: 232px minmax(0, 1fr); }
  .u-app.u-no-nav { grid-template-columns: minmax(0, 1fr); }
  .u-nav { position: sticky; top: 0; height: 100vh; height: 100dvh; flex-direction: column; gap: 3px; border-top: 0; padding: 16px 12px; background: var(--u-side); color: var(--u-side-ink); overflow-y: auto; }
  :root[data-theme="dark"] .u-nav { background: var(--u-side); border-inline-end: 1px solid var(--line); }
  .u-nav .u-nbrand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; color: #fff; font-size: 16px; text-decoration: none; flex: none; flex-direction: row; min-height: 0; justify-content: flex-start; }
  .u-nav .u-nbrand img { width: 44px; height: 23px; background: #fff; border-radius: 6px; padding: 2px 3px; box-sizing: content-box; }
  .u-nav a { flex: 0 0 auto; flex-direction: row; justify-content: flex-start; gap: 12px; min-height: 44px; padding: 0 14px; font-size: 14px; color: var(--u-side-ink); }
  .u-nav a:hover { background: rgba(255,255,255,.06); }
  .u-nav a[aria-current="page"] { background: #2dd4bf; color: #062320; }
  .u-nav .u-bd { position: static; margin-inline-start: auto; }
  .u-nav .u-sep { display: block; height: 1px; background: rgba(255,255,255,.1); margin: 8px 6px; flex: none; }
  .u-nav .u-foot { display: block; margin-top: auto; font-size: 11px; color: #7f918c; padding: 8px 10px 0; }
  .u-top { padding: 0 22px; height: 60px; }
  .u-top .u-brand img { display: none; }
  .u-no-nav .u-top .u-brand img { display: block; }
  .u-top .u-brand strong { font-size: 17px; }
  .u-main { max-width: 1180px; padding: 20px 28px 48px; gap: 14px; }
  .u-chips { margin: 0; padding-inline: 0; flex-wrap: wrap; }
  .u-tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .u-fab { bottom: 26px; inset-inline-end: 26px; width: 50px; height: 50px; }
  .u-fab-menu { bottom: 86px; inset-inline-end: 26px; }
  .u-pop { top: 66px; inset-inline-end: 18px; }
  .u-has-preview .u-pop { top: 108px; }
}
@media (prefers-reduced-motion: reduce) { .u-fab, .u-fab .u-svg { transition: none; } }

/* (22/11، v30، البند 83-2) الرئيسية وبانتظار قرارك */
.u-screen { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.u-cols { display: flex; flex-direction: column; gap: 12px; }
.u-dec { border-color: color-mix(in srgb, var(--warn) 50%, var(--line)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--warn) 9%, transparent); }
.u-dec-n { font-size: 26px; color: var(--warn); line-height: 1; }
.u-dec-row { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 6px 2px; border-bottom: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.u-dec-row:last-child { border-bottom: 0; }
.u-dec-row .u-tx { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.u-dec-row .u-tx span { font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.u-cnt { min-width: 28px; height: 24px; border-radius: 12px; display: grid; place-items: center; font-weight: 700; font-size: 12.5px; background: color-mix(in srgb, var(--warn) 15%, transparent); color: var(--warn); flex: none; }
.u-cnt.blue { background: color-mix(in srgb, var(--u-info) 12%, transparent); color: var(--u-info); }
.u-cnt.z { background: transparent; color: var(--muted); }
.u-chev { color: var(--muted); font-size: 18px; }
.u-chip-n { color: var(--danger); }
.u-chips button[aria-pressed="true"] .u-chip-n { color: inherit; }
.u-req { text-decoration: none; color: var(--ink); }
.u-dec-body > .pt-split { display: flex; flex-direction: column; gap: 12px; }
@media (hover: hover) { .u-dec-row:hover { background: color-mix(in srgb, var(--accent) 6%, transparent); } }
@media (min-width: 900px) { .u-cols { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 16px; align-items: start; } }

/* (22/11، v30، البند 83-3) الطلبات الموحدة */
.u-pick { display: flex; flex-wrap: wrap; gap: 6px; }
.u-pick button { border-radius: 999px; min-height: 34px; font-size: 12.5px; padding: 0 12px; }
.u-pick button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); font-weight: 600; }
.u-screen .lv-panel { min-width: 0; }

/* (22/11، v31) مضيف الصفحات، وملفات الإدارة، والإدارة المدموجة، ومفتاح الإطلاق */
.u-frame { display: block; width: 100%; height: 72vh; min-height: 420px; border: 1px solid var(--line); border-radius: 18px; background: #fff; }
.u-code { width: 100%; min-height: 320px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; line-height: 1.5; direction: ltr; text-align: left; }
.u-sthumb { width: 48px; height: 48px; object-fit: cover; border-radius: 10px; background: var(--line); flex: none; }
.u-chg { outline: 2px solid var(--accent); }
.u-list { margin: 6px 0; padding-inline-start: 20px; color: var(--muted); display: flex; flex-direction: column; gap: 4px; }
.u-launch { border: 1.5px solid var(--warn); }
.u-link { text-decoration: none; color: inherit; }
.u-link:hover strong { color: var(--accent); }
.u-sub { display: flex; flex-direction: column; gap: 14px; }
.u-matrix select { min-width: 110px; }
.u-offline { margin-top: 40px; text-align: center; }

/* (22/11، v32) البيانات وإعدادات الزيارة */
.u-checks { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.u-ask { margin-top: 8px; padding: 10px; border-radius: 12px; border: 1px dashed var(--line); }
.u-vitems { margin-top: 8px; gap: 8px; }
/* (v32) المصفوفة على الجوال: بطاقة لكل ميزة، والأدوار الثلاثة تحتها بأسمائها */
@media (max-width: 700px) {
  .u-matrix thead { display: none; }
  .u-matrix, .u-matrix tbody { display: block; width: 100%; }
  .ow-scroll .pt-table.u-matrix { min-width: 0; }
  .u-matrix tr { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px 8px; padding: 12px 0; border-bottom: 1px solid var(--line); }
  .u-matrix td { display: block; border: 0; padding: 0; min-width: 0; }
  .u-matrix td.u-mp { grid-column: 1 / -1; color: var(--muted); font-size: 12px; }
  .u-matrix td.u-mn { grid-column: 1 / -1; }
  .u-matrix td[data-r]::before { content: attr(data-r); display: block; color: var(--muted); font-size: 12px; margin-bottom: 2px; }
  .u-matrix select { min-width: 0; width: 100%; }
}
/* (22/11، v33) طلب التحويل */
.u-qty { width: 90px; flex: none; }
.u-trdoc { background: #fff; color: #111; border-radius: 12px; padding: 12px; overflow-x: auto; font-size: 13px; }
.u-trdoc p { margin: 4px 0; }
.u-trtable { border-collapse: collapse; min-width: 520px; }
.u-trtable th { background: #ffff99; color: #111; border: 1px solid #333; padding: 4px 8px; }
.u-trtable td { border: 1px solid #333; padding: 4px 8px; text-align: center; }
.u-trmailcard { gap: 8px; }
@media (max-width: 700px) {
  .u-trwh thead { display: none; }
  .ow-scroll .pt-table.u-trwh { min-width: 0; }
  .u-trwh, .u-trwh tbody { display: block; }
  .u-trwh tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 8px; padding: 10px 0; border-bottom: 1px solid var(--line); }
  .u-trwh td { border: 0; padding: 0; }
  .u-trwh td[data-r]::before { content: attr(data-r); display: block; color: var(--muted); font-size: 12px; }
}

/* (22/11، v35) المحادثة الداخلية: الأيقونة بعدّاد، والقائمة، والمحادثة (فقاعات ورد ومنشن وتفاعلات ومرفقات)، وقائمة الإجراءات السفلية */
.u-chatb { color: var(--ink); text-decoration: none; }
.u-cbd { position: absolute; top: 4px; inset-inline-end: 3px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--danger); color: #fff;
  font-size: 10px; font-weight: 700; display: grid; place-items: center; line-height: 1; box-sizing: border-box; }
.u-cbd.hidden { display: none; }
.u-clist { padding: 6px; gap: 0; }
.u-clist h2 { padding: 6px 8px 2px; }
.u-crow { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 60px; padding: 8px; border: 0; border-radius: 12px; background: transparent;
  color: var(--ink); text-decoration: none; text-align: start; font-weight: 400; }
.u-crow:hover { background: color-mix(in srgb, var(--accent) 7%, transparent); }
.u-crow .u-tx { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.u-crow .u-tx span { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.u-crow.u-unread .u-tx strong, .u-crow.u-unread .u-tx span { color: var(--ink); font-weight: 700; }
.u-cav { width: 40px; height: 40px; border-radius: 50%; flex: none; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.u-cav.u-k-announce { background: color-mix(in srgb, var(--warn, #b45309) 16%, transparent); color: var(--warn, #b45309); }
.u-cav.u-k-direct { background: color-mix(in srgb, var(--u-info) 14%, transparent); color: var(--u-info); }
.u-cmeta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; font-size: 11.5px; flex: none; }
.u-cn { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--accent); color: var(--accent-ink, #fff); font-size: 11px; display: grid; place-items: center; box-sizing: border-box; }

/* المحادثة المفتوحة: ارتفاع ثابت، والرسائل تتمرر، ومربع الكتابة أسفلها فوق شريط التنقل */
.u-main.u-main-chat { padding-bottom: calc(var(--u-nav-h) + 8px + env(safe-area-inset-bottom)); padding-top: 6px; }
.u-chat-screen { display: flex; flex-direction: column; }
.u-cview { display: flex; flex-direction: column; height: calc(100vh - var(--u-top-h) - var(--u-nav-h) - 22px); height: calc(100dvh - var(--u-top-h) - var(--u-nav-h) - 22px - env(safe-area-inset-bottom));
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.u-chead { display: flex; align-items: center; gap: 4px; padding: 4px 6px; border-bottom: 1px solid var(--line); flex: none; }
.u-back { font-size: 20px; }
.u-ctitle { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; flex: 1; border: 0; background: transparent; padding: 4px 6px; min-height: 0; text-align: start; color: var(--ink); }
.u-ctitle strong { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.u-ctitle span { font-size: 11.5px; }
.u-cmembers { display: flex; flex-wrap: wrap; gap: 4px; padding: 6px 10px; border-bottom: 1px solid var(--line); max-height: 120px; overflow-y: auto; flex: none; }
.u-cmembers.hidden { display: none; }
/* (23/11، v36) شريط إجراءات المحادثة (إخفاء، أرشفة، حذف نهائي) */
.u-cacts { padding: 6px 10px; border-bottom: 1px solid var(--line); flex: none; }
.u-cacts.hidden { display: none; }
.u-cmsgs { flex: 1; overflow-y: auto; padding: 10px 10px 6px; display: flex; flex-direction: column; gap: 6px; overscroll-behavior: contain;
  background: color-mix(in srgb, var(--accent) 3%, var(--bg, var(--surface))); }
.u-older { align-self: center; }
.u-older.hidden { display: none; }
.u-cday { align-self: center; font-size: 11.5px; color: var(--muted); margin: 6px 0 2px; }
.u-cday span { background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px; }
.u-cempty { margin: auto; color: var(--muted); }
.u-cbub { position: relative; max-width: 82%; align-self: flex-start; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; border-start-start-radius: 4px;
  padding: 6px 10px 4px; display: flex; flex-direction: column; gap: 3px; user-select: text; -webkit-user-select: text; touch-action: pan-y; transition: transform .12s, box-shadow .3s; }
.u-cbub.u-mine { align-self: flex-end; background: color-mix(in srgb, var(--accent) 13%, var(--surface)); border-color: color-mix(in srgb, var(--accent) 25%, var(--line));
  border-start-start-radius: 14px; border-start-end-radius: 4px; }
.u-cbub:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.u-cbub.u-flash { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 45%, transparent); }
.u-cby { font-size: 12px; color: var(--accent); }
.u-ctext { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14.5px; line-height: 1.55; }
.u-dtx { color: var(--muted); font-style: italic; }
.u-mention { color: var(--u-info); font-weight: 700; background: color-mix(in srgb, var(--u-info) 10%, transparent); border-radius: 4px; padding: 0 2px; }
.u-cquote { display: flex; flex-direction: column; align-items: flex-start; gap: 0; border: 0; border-inline-start: 3px solid var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent);
  border-radius: 6px; padding: 3px 8px; min-height: 0; text-align: start; font-size: 12px; color: var(--ink); max-width: 100%; }
.u-cquote strong { color: var(--accent); font-size: 11.5px; }
.u-cquote span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; color: var(--muted); }
.u-cfoot { display: flex; gap: 4px; align-items: center; justify-content: flex-end; font-size: 10.5px; color: var(--muted); }
.u-cimg { display: block; margin: 2px -4px 0; }
.u-cimg img { display: block; max-width: 100%; max-height: 260px; border-radius: 10px; object-fit: cover; }
.u-caudio { display: flex; align-items: center; gap: 6px; }
.u-caudio audio { height: 36px; max-width: 230px; }
.u-cfile, .u-clink { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 10px; background: color-mix(in srgb, var(--ink) 5%, transparent); color: var(--ink); text-decoration: none; min-width: 0; }
.u-cfile .u-tx { display: flex; flex-direction: column; min-width: 0; }
.u-cfile .u-tx strong { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.u-cfile .u-tx span { font-size: 11px; color: var(--muted); }
.u-clink { font-size: 12.5px; color: var(--u-info); }
.u-corig-t { align-self: flex-start; border: 0; background: transparent; padding: 0; min-height: 0; font-size: 11px; color: var(--warn, #b45309); text-decoration: underline; }
.u-corig { font-size: 12.5px; background: color-mix(in srgb, var(--warn, #b45309) 10%, transparent); border-radius: 6px; padding: 4px 6px; white-space: pre-wrap; }
.u-corig.hidden { display: none; }
.u-cbub.u-del { opacity: .85; }
.u-creacts { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.u-creact { display: inline-flex; align-items: center; gap: 3px; min-height: 26px; padding: 0 7px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-size: 12.5px; color: var(--ink); }
.u-creact.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 700; }

.u-ccomp { flex: none; border-top: 1px solid var(--line); padding: 6px; display: flex; flex-direction: column; gap: 6px; position: relative; background: var(--surface); }
.u-crow2 { display: flex; align-items: flex-end; gap: 4px; }
.u-ctools { display: flex; flex: none; }
.u-ctools .u-ib { width: 38px; height: 38px; }
.u-ctools .u-ib[aria-pressed="true"] { color: var(--danger); }
.u-cin { flex: 1; min-width: 0; resize: none; min-height: 40px; max-height: 140px; padding: 9px 12px; border-radius: 20px; border: 1px solid var(--line); background: var(--bg, var(--surface)); color: var(--ink); font: inherit; font-size: 14.5px; line-height: 1.4; }
.u-csend { width: 42px; height: 42px; min-height: 0; padding: 0; border-radius: 50%; display: grid; place-items: center; flex: none; }
.u-csend .u-svg { transform: scaleX(-1); }
.u-cbar { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 10px; background: color-mix(in srgb, var(--accent) 8%, transparent); border-inline-start: 3px solid var(--accent); font-size: 12.5px; }
.u-cbar.hidden { display: none; }
.u-cbar .u-tx { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.u-cbar .u-tx span { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.u-x { border: 0; background: transparent; min-height: 0; width: 26px; height: 26px; padding: 0; font-size: 16px; color: var(--muted); }
.u-rec { background: color-mix(in srgb, var(--danger) 9%, transparent); border-color: var(--danger); }
.u-rdot { width: 10px; height: 10px; border-radius: 50%; background: var(--danger); animation: u-blink 1s infinite; flex: none; }
.u-rclock { font-variant-numeric: tabular-nums; }
@keyframes u-blink { 50% { opacity: .25; } }
.u-cro { text-align: center; color: var(--muted); font-size: 13px; padding: 8px; }
.u-cment { position: absolute; bottom: calc(100% + 4px); inset-inline: 6px; max-height: 220px; overflow-y: auto; background: var(--surface); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: var(--shadow); padding: 4px; z-index: 3; }
.u-cment.hidden { display: none; }

/* قائمة الإجراءات السفلية (الضغط المطوّل): التفاعلات بمجموعاتها الثلاث، والرد والنسخ والتعديل والحذف */
.u-sheet { position: fixed; z-index: 11; inset-inline: 0; bottom: 0; max-height: 80vh; overflow-y: auto; background: var(--surface); border-radius: 18px 18px 0 0;
  box-shadow: 0 -10px 30px rgba(0,0,0,.2); padding: 12px 12px calc(12px + env(safe-area-inset-bottom)); }
:root[data-theme="dark"] .u-sheet { background: #15231f; }
.u-rgroups { display: flex; flex-direction: column; gap: 6px; }
.u-rg { display: flex; flex-direction: column; gap: 2px; }
.u-rg > span { font-size: 11.5px; }
.u-rrow { display: flex; flex-wrap: wrap; gap: 4px; }
.u-rbtn { width: 44px; height: 44px; min-height: 0; padding: 0; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); font-size: 22px; }
.u-acts-list { display: flex; flex-direction: column; }
.u-item.danger { color: var(--danger); }
.u-lres { display: flex; flex-direction: column; max-height: 50vh; overflow-y: auto; }
.u-lres h3 { font-size: 12px; color: var(--muted); margin: 8px 4px 2px; }
.u-upick { display: flex; flex-direction: column; gap: 2px; max-height: 220px; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; padding: 6px 8px; }
.u-radmin summary { cursor: pointer; display: flex; flex-wrap: wrap; gap: 4px; align-items: baseline; }
.u-radmin > .stack { margin-top: 10px; }
/* (v76) الفروع ومناطق موفكس */
.u-branch { padding: 10px 0; border-top: 1px solid var(--line, #e5e7eb); }
.u-mvxrow { flex-wrap: wrap; gap: 6px 14px; }
.u-mvx { display: inline-flex; align-items: center; gap: 2px; white-space: nowrap; }
.u-chips .pt-tag .u-x { width: 20px; height: 20px; font-size: 14px; }
@media (min-width: 900px) {
  .u-main.u-main-chat { padding: 14px 28px; }
  .u-cview { height: calc(100vh - 60px - 30px); height: calc(100dvh - 60px - 30px); max-width: 860px; width: 100%; margin: 0 auto; }
  .u-sheet { inset-inline: auto; left: 50%; right: auto; transform: translateX(-50%); width: 420px; bottom: 30px; border-radius: 18px; }   /* (v39) كانت تنزاح يميناً في RTL */
  .u-cbub { max-width: 68%; }
}
@media (prefers-reduced-motion: reduce) { .u-cbub, .u-rdot { transition: none; animation: none; } }

/* (23/11، v37، البند 96) الشاشات الميدانية */
.u-flist { display: flex; flex-direction: column; gap: 6px; }
.u-frow { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 10px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.u-frow .grow { display: flex; flex-direction: column; min-width: 140px; }
.u-frow label.stack { min-width: 96px; }
.u-fnum { width: 96px; }
.u-fbar { position: sticky; bottom: 76px; display: flex; gap: 10px; align-items: center; padding: 10px 0; background: var(--bg); }
.u-fbig { font-size: 22px; }
.u-fbarw { height: 8px; border-radius: 6px; background: var(--line); overflow: hidden; }
.u-fbarf { display: block; height: 100%; width: 0; background: var(--accent); }
.u-fhead { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; width: 100%; background: none; border: 0; padding: 0; text-align: start; color: inherit; cursor: pointer; }
.u-fhead .grow { display: flex; flex-direction: column; }
.u-ftemp { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; border-radius: 10px; border: 1px dashed var(--line); margin-top: 8px; }
.u-fthumb { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.u-fwrap { overflow-x: auto; }
.u-ftable { width: 100%; border-collapse: collapse; font-size: 13px; }
.u-ftable th, .u-ftable td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: start; white-space: nowrap; }
.u-ftable th { color: var(--muted); font-weight: 600; }
.u-fflag td { background: color-mix(in srgb, var(--danger) 12%, transparent); }
@media (min-width: 900px) { .u-fbar { bottom: 0; } }
/* (28/11، v39) أوامر الزر العائم صارت أكثر: تمرير لو ما وسعت الشاشة */
.u-fab-menu { max-height: calc(100dvh - var(--u-nav-h) - 110px); overflow-y: auto; padding: 4px; }
/* (28/11، v39، ملاحظات حسام 1 و2) قائمة الرسالة والمحادثة بشكل الواتساب */
.u-cbub, .u-crow { -webkit-touch-callout: none; }
.u-cbub { -webkit-user-select: none; user-select: none; touch-action: pan-y; }
.u-wa-scrim { position: fixed; inset: 0; z-index: 30; background: rgba(10, 16, 14, .45); -webkit-backdrop-filter: blur(1.5px); backdrop-filter: blur(1.5px); }
.u-wa-ghost { position: fixed; z-index: 31; margin: 0; pointer-events: none; box-shadow: 0 6px 24px rgba(0,0,0,.18); }
.u-wa-row { background: var(--surface); border-radius: 12px; }
.u-wa-pill { position: fixed; z-index: 32; display: flex; align-items: center; gap: 2px; padding: 5px 6px; border-radius: 999px; background: var(--surface); box-shadow: 0 6px 24px rgba(0,0,0,.22); }
.u-wa-r { width: 42px; height: 42px; border: 0; border-radius: 50%; background: transparent; font-size: 24px; line-height: 1; display: grid; place-items: center; padding: 0; cursor: pointer; transition: transform .12s; }
.u-wa-r:hover, .u-wa-r:focus-visible { transform: scale(1.18); background: color-mix(in srgb, var(--accent) 10%, transparent); }
.u-wa-r.on { background: color-mix(in srgb, var(--accent) 18%, transparent); }
.u-wa-more { background: color-mix(in srgb, var(--ink) 7%, transparent); }
.u-wa-more .u-svg { width: 20px; height: 20px; }
.u-wa-menu { position: fixed; z-index: 32; min-width: 210px; max-width: calc(100vw - 16px); padding: 6px 0; border-radius: 14px; background: var(--surface); box-shadow: 0 8px 30px rgba(0,0,0,.24); display: flex; flex-direction: column; }
.u-wa-i { display: flex; align-items: center; justify-content: space-between; gap: 18px; min-height: 46px; padding: 0 18px; border: 0; background: transparent; color: var(--ink); font: inherit; font-size: 15px; font-weight: 500; text-align: start; cursor: pointer; }
.u-wa-i:hover, .u-wa-i:focus-visible { background: color-mix(in srgb, var(--accent) 8%, transparent); outline: none; }
.u-wa-i .u-svg { width: 20px; height: 20px; flex: none; color: var(--muted); }
.u-wa-i.danger, .u-wa-i.danger .u-svg { color: #c0392b; }
.u-wa-sep { height: 1px; margin: 4px 0; background: var(--line); }
.u-wa-menu .msg { margin: 6px 12px 0; }
:root[data-theme="dark"] .u-wa-pill, :root[data-theme="dark"] .u-wa-menu, :root[data-theme="dark"] .u-wa-row { background: #15231f; }
.u-chint { font-size: 12px; margin-top: 6px; }
.u-info-row { min-height: 44px; }
.u-info-msg { display: flex; gap: 8px; flex-wrap: wrap; }
.u-offscreen { position: fixed; top: -1000px; opacity: 0; }
@media (prefers-reduced-motion: reduce) { .u-wa-r { transition: none; } }

/* (29/11، v45) الطلبات بالبنود وجرد العرض */
.u-rq-line { flex-wrap: wrap; gap: 6px; align-items: center; }
.u-ri { padding: 8px 0; border-bottom: 1px solid rgba(127, 127, 127, .18); flex-direction: column; align-items: stretch; }   /* البند عمود: الحالة ثم الصورة ثم الأفعال */
.u-ri > .pt-row { flex-wrap: wrap; align-items: center; }
.u-ri .pt-in.u-fnum { width: 7.5em; }
.u-ri:last-child { border-bottom: 0; }
.u-ri-more summary { cursor: pointer; font-size: .85em; opacity: .8; }
.u-ret { outline: 2px solid #d97706; outline-offset: 2px; border-radius: 8px; }

/* (29/11، v45) خانة البحث فوق القوائم الطويلة */
.u-sel-q { min-width: 7em; max-width: 100%; }
.u-pick + .u-sel-q, .u-sel-q + .u-pick { margin-top: 4px; }

/* (1/12، v48، البند 86) داشبورد المندوب (repdash.js): يعمل على الجوال (~380px) وRTL، والأرقام لا تُقص (تمرير أفقي للجداول) */
.rd-head { margin-bottom: 8px; }
.rd-body { display: grid; gap: 12px; min-width: 0; }
.rd-filters { display: grid; gap: 10px; padding: 12px; }
.rd-pre { margin: 0; padding-inline: 0; }
.rd-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 10px; }
.rd-f { display: grid; gap: 4px; min-width: 0; font-size: 12.5px; color: var(--muted); }
.rd-f select, .rd-f input { min-height: 40px; width: 100%; min-width: 0; font-size: 14px; color: var(--ink); }
.rd-wide { grid-column: 1 / -1; }
@media (min-width: 900px) { .rd-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); } .rd-wide { grid-column: span 2; } }
.rd-asof { margin: 0; font-size: 12px; }
.rd-crumbs { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.rd-crumb { border-radius: 999px; }
.rd-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.rd-kpi { padding: 12px 14px; display: grid; gap: 4px; min-width: 0; }
.rd-kl { font-size: 12.5px; }
.rd-kv { font-size: clamp(20px, 6vw, 26px); font-weight: 700; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; text-align: start; }
.rd-d { font-size: 12px; font-variant-numeric: tabular-nums; }
.rd-up { color: var(--ok); }
.rd-down { color: var(--danger); }
.rd-note { font-size: 11.5px; }
.rd-span { grid-column: 1 / -1; margin: 0; }
.rd-chart { padding: 10px 12px; min-width: 0; }
.rd-svg { width: 100%; min-height: 190px; overflow: hidden; }
.rd-svg svg { display: block; max-width: 100%; height: auto; }
.rd-legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.rd-lg::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-inline-end: 5px; vertical-align: -1px; }
.rd-lg-s::before { background: var(--accent); }
.rd-lg-ly::before { background: var(--line); }
.rd-lg-c::before { background: var(--u-info); border-radius: 50%; }
.rd-b-s { fill: var(--accent); }
.rd-b-ly { fill: var(--line); }
.rd-l-c { fill: none; stroke: var(--u-info); stroke-width: 2; }
.rd-p-c { fill: var(--u-info); }
.rd-grid-l { stroke: var(--line); stroke-width: 1; }
.rd-ax { fill: var(--muted); font-size: 10px; font-family: var(--font); }
.rd-tcard { padding: 10px 12px; min-width: 0; }
.rd-h { margin: 0 0 8px; font-size: 15px; }
.rd-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.rd-t { width: 100%; border-collapse: collapse; font-size: 13px; }
.rd-t th, .rd-t td { padding: 7px 8px; border-bottom: 1px solid var(--line); text-align: start; }
.rd-t th { font-size: 12px; color: var(--muted); font-weight: 600; white-space: nowrap; }
.rd-t .rd-n { text-align: end; white-space: nowrap; font-variant-numeric: tabular-nums; }
.rd-t td:first-child { min-width: 120px; }
.rd-click { cursor: pointer; }
.rd-click:hover, .rd-click:focus-visible { background: var(--accent-soft); outline: none; }
.rd-exp { margin-bottom: 8px; }

/* (2/12، v64) مراجعة جرد البائع: صورة الموديل مصغّرة */
.u-sl-img { display: block; max-width: 180px; max-height: 180px; border-radius: 10px; margin: 6px 0; object-fit: cover; }
