/* apps-launcher r1 (2026-11-17, owner: «حسن عرض ايقونات التطبيقات عند الضغط على زر التطبيقات بالاعلى بالهيدر»).
   Header «التطبيقات» sheet only (dialog that holds the apps search box). CSS only; no markup, data or behaviour change.
   - a centred panel, 960 px wide, height follows the content (≤ 86dvh) instead of a full-width 90dvh sheet with a cut row
   - title, close and search aligned with the grid; a denser, even grid (auto-fill 108 px) with smaller gaps
   - tiles: 52 px icons, two-line labels, clear hover/focus, badge kept on the icon corner; dark mode follows the tokens */
[role="dialog"]:has(input[placeholder*="التطبيقات"]) {
  inset-inline: 0 !important;
  margin-inline: auto !important;
  width: min(960px, calc(100vw - 24px)) !important;
  height: auto !important;
  max-height: 86dvh !important;
  top: 12px !important;
  padding: 20px 24px 16px !important;
  border: 1px solid hsl(var(--border) / .8) !important;
  border-radius: 20px !important;
  box-shadow: 0 24px 60px -12px rgb(0 0 0 / .28), 0 2px 6px rgb(0 0 0 / .06) !important;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}
[role="dialog"]:has(input[placeholder*="التطبيقات"]) > div:first-of-type {
  padding: 0 0 12px !important;
  padding-inline-end: 40px !important;
  text-align: start !important;
}
[role="dialog"]:has(input[placeholder*="التطبيقات"]) > div:first-of-type h2 {
  font-size: 1.125rem !important;
  line-height: 1.5 !important;
}
[role="dialog"]:has(input[placeholder*="التطبيقات"]) > button:first-child {
  top: 18px !important;
  inset-inline-end: 18px !important;
  inset-inline-start: auto !important;
  width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 10px !important;
}
[role="dialog"]:has(input[placeholder*="التطبيقات"]) > button:first-child:hover { background: hsl(var(--muted)) !important; }
[role="dialog"]:has(input[placeholder*="التطبيقات"]) .max-w-5xl { max-width: none !important; }
[role="dialog"]:has(input[placeholder*="التطبيقات"]) .max-w-5xl > .relative.mb-6 {
  margin-bottom: 16px !important;
  position: sticky; top: -20px; z-index: 2;
  padding-block: 4px;
  background: inherit;
}
[role="dialog"]:has(input[placeholder*="التطبيقات"]) input[placeholder*="التطبيقات"] {
  height: 44px !important;
  border-radius: 12px !important;
  font-size: .9375rem !important;
}
[role="dialog"]:has(input[placeholder*="التطبيقات"]) .max-w-5xl > .grid {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(108px, 1fr)) !important;
  gap: 4px 6px !important;
}
[role="dialog"]:has(input[placeholder*="التطبيقات"]) .max-w-5xl > .grid > button {
  gap: 8px !important;
  padding: 12px 6px 10px !important;
  border-radius: 14px !important;
  min-width: 0;
  outline-offset: -2px;
  transition: background-color .15s ease, transform .15s ease !important;
}
[role="dialog"]:has(input[placeholder*="التطبيقات"]) .max-w-5xl > .grid > button:hover {
  background: hsl(var(--muted) / .8) !important;
  transform: translateY(-1px);
}
[role="dialog"]:has(input[placeholder*="التطبيقات"]) .max-w-5xl > .grid > button > span:first-child > span:first-child {
  width: 52px !important;
  height: 52px !important;
  border-radius: 15px !important;
  box-shadow: 0 6px 14px -6px rgb(0 0 0 / .35), inset 0 1px 0 rgb(255 255 255 / .25) !important;
}
[role="dialog"]:has(input[placeholder*="التطبيقات"]) .max-w-5xl > .grid > button > span:first-child > span:first-child svg {
  width: 24px; height: 24px;
}
[role="dialog"]:has(input[placeholder*="التطبيقات"]) .max-w-5xl > .grid > button > span:last-child {
  display: -webkit-box !important;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  max-width: 100%;
  min-height: 2.6em;
  font-size: .8125rem !important;
  line-height: 1.3 !important;
  font-weight: 500;
  text-align: center;
  color: hsl(var(--foreground)) !important;
}
[role="dialog"]:has(input[placeholder*="التطبيقات"]) .max-w-5xl > .mt-6.text-center {
  margin-top: 12px !important;
  padding-top: 12px;
  border-top: 1px solid hsl(var(--border) / .7);
}
@media (max-width: 640px) {
  [role="dialog"]:has(input[placeholder*="التطبيقات"]) {
    top: 0 !important;
    width: 100vw !important;
    max-height: 92dvh !important;
    border-radius: 0 0 20px 20px !important;
    padding: 16px 16px 12px !important;
  }
  [role="dialog"]:has(input[placeholder*="التطبيقات"]) .max-w-5xl > .grid {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    gap: 2px !important;
  }
  [role="dialog"]:has(input[placeholder*="التطبيقات"]) .max-w-5xl > .grid > button { padding: 10px 2px 8px !important; }
  [role="dialog"]:has(input[placeholder*="التطبيقات"]) .max-w-5xl > .grid > button > span:first-child > span:first-child {
    width: 48px !important; height: 48px !important; border-radius: 14px !important;
  }
  [role="dialog"]:has(input[placeholder*="التطبيقات"]) .max-w-5xl > .grid > button > span:last-child { font-size: .75rem !important; }
}
@media (prefers-reduced-motion: reduce) {
  [role="dialog"]:has(input[placeholder*="التطبيقات"]) .max-w-5xl > .grid > button:hover { transform: none; }
}
