/* واجهة الموبايل (PWA) - فوق app.css. بتشتغل بس لما MobileChrome يكون مفعّل (شاشة ≤768px). */

/* ===== عام للشاشات الصغيرة ===== */
@media (max-width: 768px) {
  html, body {
    height: 100%;
    margin: 0;
    overscroll-behavior: none;
    -webkit-tap-highlight-color: transparent;
    -webkit-text-size-adjust: 100%;
  }
  /* أهداف لمس مريحة + منع تكبير iOS التلقائي عند التركيز على حقل */
  input, select, textarea { font-size: 16px; }
  .btn { min-height: 40px; }
  button, .mobile-shell .nav-item, .msheet-item { -webkit-user-select: none; user-select: none; }
  /* شاشة الدخول: احترام الـ notch */
  .login-shell { padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); }
}

/* ===== الشريط العلوي ===== */
.mobile-shell { height: 100vh; height: 100dvh; }
.mtopbar {
  height: auto;
  min-height: 52px;
  flex-wrap: nowrap;
  gap: 10px;
  padding: calc(6px + env(safe-area-inset-top, 0px)) calc(12px + env(safe-area-inset-right, 0px)) 6px calc(12px + env(safe-area-inset-left, 0px));
}
.mtitle { flex: 1; min-width: 0; font-weight: 700; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mbtn {
  background: transparent; border: 1px solid var(--border); color: var(--text-primary);
  width: 40px; height: 40px; border-radius: 10px; font-size: 20px; line-height: 1; cursor: pointer;
}
.mlive { width: 10px; height: 10px; border-radius: 50%; background: var(--accent-danger); flex-shrink: 0; }
.mlive.on { background: var(--accent-live); }
.mlive.mid { background: var(--accent-amber); }

/* ===== الشريط السفلي ===== */
.mobile-shell .nav-rail {
  padding-bottom: calc(6px + env(safe-area-inset-bottom, 0px));
  overflow-x: hidden;
}
.mobile-shell .nav-item {
  flex: 1 1 0;
  min-width: 0;
  min-height: 54px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 11px;
  text-align: center;
  background: transparent;
  border: 0;
  font-family: inherit;
  color: var(--text-secondary);
  text-decoration: none;
}
.mobile-shell .nav-item.active { color: var(--accent-live); }
.mobile-shell .nav-item span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.mico { font-size: 22px; line-height: 1; }

/* ===== قائمة «المزيد» (Bottom Sheet) ===== */
.msheet-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, .55); z-index: 1000; }
.msheet {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 1001;
  max-height: 85dvh; overflow-y: auto;
  background: var(--surface); color: var(--text-primary);
  border-radius: 18px 18px 0 0; border-top: 1px solid var(--border);
  padding: 8px 16px calc(16px + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -8px 30px rgba(0, 0, 0, .35);
}
.msheet-grip { width: 44px; height: 4px; border-radius: 2px; background: var(--border); margin: 4px auto 10px; }
.msheet-user { display: flex; flex-direction: column; gap: 2px; margin-bottom: 12px; }
.msheet-user span { color: var(--text-secondary); font-size: 12px; }
.msheet-row { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.msheet-row select { min-height: 42px; }
.msheet-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.msheet-item {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  min-height: 78px; padding: 8px 4px; text-align: center; font-size: 12px;
  background: var(--surface-raised); border: 1px solid var(--border-soft); border-radius: 12px;
  color: var(--text-primary); text-decoration: none;
}
.msheet-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.msheet-actions .btn { min-height: 44px; }
.msheet-actions .btn.wide { grid-column: 1 / -1; }
.msheet-hint {
  margin: 0 0 12px; padding: 10px 12px; font-size: 12px; line-height: 1.6;
  background: var(--surface-raised); border: 1px solid var(--border-soft); border-radius: 12px; color: var(--text-secondary);
}
.msheet-ver { margin-top: 12px; text-align: center; font-size: 11px; color: var(--text-muted); direction: ltr; word-break: break-all; }
