/* تطبيق الجوال (PWA، 2026-10-22): بطاقة «ثبّت التطبيق» ونافذة الإرشادات — partials/aag-pwa-install. */
.aag-pwa-hint[hidden],
.aag-pwa-sheet[hidden],
.aag-pwa-sheet [hidden] { display: none !important; }

/* البطاقة العائمة فوق الشريط السفلي (جوال فقط) */
.aag-pwa-hint {
    position: fixed;
    inset-inline: 12px;
    bottom: calc(var(--aag-bottom-h, 64px) + 12px + env(safe-area-inset-bottom, 0px));
    z-index: 1029;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 10px 10px 12px;
    background: var(--aag-surface, #fff);
    color: var(--aag-text, #1E2323);
    border: 1px solid var(--aag-line, #DDE1E1);
    border-radius: 16px;
    box-shadow: var(--aag-shadow-pop, 0 10px 30px rgba(0, 0, 0, .14));
    font-family: var(--aag-font-body, inherit);
}
.aag-pwa-hint-icon { width: 40px; height: 40px; border-radius: 10px; flex: none; border: 1px solid var(--aag-line, #DDE1E1); }
.aag-pwa-hint-text { flex: 1; min-width: 0; display: grid; gap: 2px; line-height: 1.45; }
.aag-pwa-hint-text strong { font-size: 13.5px; }
.aag-pwa-hint-text span { font-size: 12px; color: var(--aag-muted, #5B6262); }
.aag-pwa-hint-go {
    flex: none; min-height: 40px; padding: 0 12px; border: 0; border-radius: 10px;
    background: var(--aag-gray-900, #1E2323); color: #fff; font: inherit; font-size: 12.5px; font-weight: 700; cursor: pointer;
}
.aag-pwa-hint-x,
.aag-pwa-sheet-x {
    flex: none; width: 40px; height: 40px; display: grid; place-items: center; border: 0; border-radius: 10px;
    background: transparent; color: var(--aag-muted, #5B6262); font-size: 18px; cursor: pointer;
}
@media (min-width: 768px) { .aag-pwa-hint { display: none !important; } }

/* نافذة الإرشادات: ورقة سفلية في الجوال، ونافذة في المنتصف على الحاسب */
.aag-pwa-sheet {
    position: fixed; inset: 0; z-index: 2000;
    display: flex; align-items: flex-end; justify-content: center;
    background: rgba(18, 21, 21, .45);
    padding: 12px 12px calc(12px + env(safe-area-inset-bottom, 0px));
}
body.aag-pwa-sheet-open { overflow: hidden; }
.aag-pwa-sheet-card {
    width: 100%; max-width: 440px; max-height: calc(100vh - 24px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
    overflow-y: auto; outline: none;
    background: var(--aag-surface, #fff); color: var(--aag-text, #1E2323);
    border-radius: 20px; padding: 18px 18px 14px;
    font-family: var(--aag-font-body, inherit);
    box-shadow: var(--aag-shadow-pop, 0 10px 30px rgba(0, 0, 0, .18));
}
@media (min-width: 768px) { .aag-pwa-sheet { align-items: center; } }
.aag-pwa-sheet-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.aag-pwa-sheet-head img { width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--aag-line, #DDE1E1); flex: none; }
.aag-pwa-sheet-head > div { flex: 1; min-width: 0; }
.aag-pwa-sheet-head h2 { font-size: 16px; font-weight: 700; margin: 0 0 2px; color: inherit; }
.aag-pwa-sheet-head p { font-size: 12.5px; margin: 0; color: var(--aag-muted, #5B6262); }
.aag-pwa-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.aag-pwa-steps li {
    display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px;
    background: var(--aag-surface-2, #F4F5F5); font-size: 14px; line-height: 1.6;
}
.aag-pwa-steps li i { font-size: 18px; vertical-align: -3px; margin-inline: 2px; }
.aag-pwa-n {
    flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
    background: var(--aag-surface, #fff); border: 1px solid var(--aag-line, #DDE1E1); font-size: 12.5px; font-weight: 700;
}
.aag-pwa-share { width: 18px; height: 18px; vertical-align: -3px; margin-inline: 2px; fill: none; stroke: #0A84FF; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.aag-pwa-install {
    width: 100%; min-height: 46px; margin-bottom: 10px; border: 0; border-radius: 12px;
    background: var(--aag-gray-900, #1E2323); color: #fff; font: inherit; font-size: 15px; font-weight: 700; cursor: pointer;
    display: flex; align-items: center; justify-content: center; gap: 6px;
}
.aag-pwa-note { font-size: 13.5px; line-height: 1.7; color: var(--aag-muted, #5B6262); margin: 10px 0 0; }
.aag-pwa-foot { font-size: 12px; color: var(--aag-muted, #5B6262); margin: 14px 0 0; padding-top: 10px; border-top: 1px solid var(--aag-line, #DDE1E1); }

/* الداكن: الأزرار الأساسية فاتحة كما في «بوصلة» */
html[data-aag-theme="dark"] .aag-pwa-hint-go,
html[data-aag-theme="dark"] .aag-pwa-install { background: #EEF1F1; color: #121515; }

/* ── إصلاحات الجوال (تحت 768px فقط) لتجربة التطبيق المثبت — لا تغيّر سطح المكتب ──
   ١) خط الحقول 16px: آيفون يكبّر الصفحة عند التركيز على حقل خطه أصغر من 16px.
   ٢) أزرار إجراءات الصفحة والجداول 38px على الأقل للمس (أزرار الرأس ارتفاعها 38 أصلًا؛ توسيعها يدفع قائمة اللغة خارج الشاشة).
   ٣) القائمة المنزلقة والنوافذ تبتعد عن مؤشر الرجوع للرئيسية (safe-area-inset-bottom). */
@media (max-width: 767.98px) {
    html body.aag-ui input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color]):not([type=file]):not([type=hidden]),
    html body.aag-ui select,
    html body.aag-ui textarea,
    html body.aag-auth input:not([type=checkbox]):not([type=radio]):not([type=hidden]),
    html body.aag-auth select { font-size: 16px !important; }

    body.aag-ui .page-header .btn-sm,
    body.aag-ui .dataTable .btn-sm,
    body.aag-ui .action-btn .btn-sm { min-width: 38px; min-height: 38px; display: inline-flex; align-items: center; justify-content: center; }

    body.aag-ui .dash-sidebar .navbar-content { padding-bottom: env(safe-area-inset-bottom, 0px); }
    body.aag-ui .modal-dialog { margin-bottom: calc(.5rem + env(safe-area-inset-bottom, 0px)); }
}
