/* ===== واجهة الجوال (المرحلة ٢) — تُفعّل فقط عند body.appui على شاشات الجوال =====
   مربوطة بدور المحلل ومفتاح «وضعية التطبيق». لا تؤثّر على سطح المكتب ولا على بقية الصلاحيات. */

/* شريط التبويب السفلي + الورقة + ترويسة الترحيب: مخفيّة افتراضيًا (سطح المكتب) */
.mtab, .msheet-ov { display: none; }
.mgreet-hi, .mgreet-nm { display: none; }

@media (max-width: 860px) {
  /* إخفاء شريط التنقّل الأفقي العلوي واستبداله بتبويب سفلي */
  body.appui .tabs { display: none !important; }

  /* رأس تطبيق مُدمج + ترويسة ترحيب شخصية */
  body.appui .topbar { position: sticky; top: 0; z-index: 50; }
  body.appui .topbar .brand .t1,
  body.appui .topbar .brand .t2 { display: none; }
  body.appui .topbar .brand .mgreet-hi { display: block; font-size: 12px; opacity: .85; line-height: 1.3; }
  body.appui .topbar .brand .mgreet-nm { display: block; font-size: 16px; font-weight: 800; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

  /* صف واحد للأيقونات العلوية + رأس مُصغّر (أقل ارتفاعًا) */
  body.appui .topbar .inner { flex-wrap: nowrap !important; gap: 8px; padding: 7px 12px; }
  body.appui .topbar .brand { flex: 1 1 auto; min-width: 0; gap: 9px; }
  body.appui .topbar .brand .titles { min-width: 0; }
  body.appui .topbar .spacer { display: none; }
  body.appui .topbar .brand .logo { width: 36px; height: 36px; }
  body.appui .topbar .brand .logo svg { width: 26px; height: 26px; }
  body.appui .topbar .icon-btn { flex: none; width: 34px; height: 34px; border-radius: 9px; }
  body.appui .topbar .icon-btn svg { width: 18px; height: 18px; }

  /* مساحة أسفل المحتوى لتبويب السفلي */
  body.appui .container { padding-bottom: 86px !important; }

  /* رفع زر واتساب العائم فوق التبويب السفلي */
  body.appui .wa-fab { bottom: 80px !important; }

  /* ===== التبويب السفلي ===== */
  body.appui .mtab {
    display: flex; position: fixed; inset-inline: 0; bottom: 0; height: 66px; z-index: 60;
    background: var(--card, #fff); border-top: 1px solid var(--line, #e3edee);
    box-shadow: 0 -4px 16px rgba(8,63,71,.07); padding-bottom: 3px;
  }
  body.appui .mtab > a, body.appui .mtab > button {
    flex: 1; border: none; background: none; cursor: pointer; text-decoration: none;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    color: var(--muted, #6c8085); font-family: inherit; font-size: 10.5px; font-weight: 700;
  }
  body.appui .mtab .mi {
    width: 32px; height: 32px; border-radius: 50%; background: #eef3f4;
    display: flex; align-items: center; justify-content: center; transition: .15s;
  }
  body.appui .mtab .mi svg { width: 18px; height: 18px; stroke: currentColor; fill: none; }
  body.appui .mtab .active { color: var(--brand-d, #0B7E8A); }
  body.appui .mtab .active .mi { background: var(--brand, #0FA3B1); color: #fff; }

  /* ===== ورقة «المزيد» السفلية ===== */
  body.appui .msheet-ov {
    display: flex; position: fixed; inset: 0; z-index: 300; background: rgba(8,20,22,.45);
    align-items: flex-end; opacity: 0; pointer-events: none; transition: opacity .18s;
  }
  body.appui .msheet-ov.on { opacity: 1; pointer-events: auto; }
  body.appui .msheet {
    width: 100%; max-height: 78vh; overflow-y: auto; background: var(--card, #fff);
    border-radius: 22px 22px 0 0; padding: 14px 14px 22px; transform: translateY(16px); transition: transform .18s;
  }
  body.appui .msheet-ov.on .msheet { transform: translateY(0); }
  body.appui .msheet .grip { width: 44px; height: 5px; border-radius: 10px; background: #dfe8e8; margin: 0 auto 12px; }
  body.appui .msheet .msh-t { font-weight: 800; color: var(--brand-d, #0B7E8A); font-size: 14px; margin-bottom: 8px; padding-inline-start: 4px; }
  body.appui .msheet a {
    display: flex; align-items: center; gap: 10px; padding: 12px 10px; border-radius: 12px;
    text-decoration: none; color: var(--ink, #12242a); font-size: 13.5px; font-weight: 600; border-bottom: 1px solid #f1f5f5;
  }
  body.appui .msheet a:last-child { border-bottom: none; }
  body.appui .msheet a:active { background: #f0f7f7; }
  body.appui .msheet .close { width: 100%; margin-top: 8px; border: 1px solid var(--line,#e3edee); background: #fff; color: var(--brand-d,#0B7E8A); font-family: inherit; font-weight: 700; border-radius: 12px; padding: 11px; cursor: pointer; }

  /* لمسات تحسّن شكل البطاقات على الجوال */
  body.appui .card { border-radius: 16px; }
}
