/* AKM Manager — صفحة التطبيق (/akm-manager-app): هيكل كامل الشاشة + نموذج الدخول. */
:root { --akm-bg: #f3f4f6; --akm-primary: #0e7a68; --akm-text: #101c26; --akm-muted: #5b6773; --akm-border: #e3e6ea; --akm-nav-h: 0px; }
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; background: var(--akm-bg); color: var(--akm-text); font-family: "IBM Plex Sans Arabic", "Tajawal", "Cairo", system-ui, -apple-system, "Segoe UI", Tahoma, Arial, sans-serif; -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }

/* ---------- الهيكل ---------- */
#akm-shell { position: fixed; inset: 0; display: flex; flex-direction: column; padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); background: var(--akm-bg); }
#akm-frame { flex: 1 1 auto; width: 100%; min-height: 0; border: 0; background: var(--akm-bg); display: block; }
.akm-load { position: absolute; inset: 0 0 var(--akm-nav-h) 0; display: none; align-items: center; justify-content: center; background: var(--akm-bg); z-index: 5; }
.akm-load.is-on { display: flex; }
.akm-spin { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--akm-border); border-top-color: var(--akm-primary); animation: akm-spin .8s linear infinite; }
@keyframes akm-spin { to { transform: rotate(360deg); } }

/* ---------- الشريط السفلي ---------- */
.akm-sn { flex: none; display: flex; height: var(--akm-nav-h); padding-bottom: env(safe-area-inset-bottom, 0px); background: #fff; border-top: 1px solid var(--akm-border); box-shadow: 0 -4px 16px rgba(16, 28, 38, .08); }
.akm-sn-i { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--akm-muted); text-decoration: none; font-size: 11.5px; line-height: 1.2; font-weight: 600; }
.akm-sn-i svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.akm-sn-i.is-active { color: var(--akm-primary); }

/* ---------- الزر العائم ---------- */
.akm-ssync { position: absolute; inset-inline-start: 14px; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); z-index: 10; width: 48px; height: 48px; padding: 0; border: 0; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, var(--akm-primary), #0a6455); color: #fff; box-shadow: 0 1px 2px rgba(14, 122, 104, .3), 0 12px 22px -10px rgba(14, 122, 104, .75); cursor: pointer; }
.akm-ssync svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.akm-ssync:active { transform: scale(.94); }
.akm-ssync.is-busy svg { animation: akm-spin .8s linear infinite; }

/* ---------- لا صلاحية ---------- */
.akm-none { margin: auto; max-width: 360px; padding: 28px 22px; text-align: center; }
.akm-none h1 { font-size: 19px; margin: 0 0 8px; }
.akm-none p { margin: 0 0 18px; color: var(--akm-muted); line-height: 1.7; font-size: 15px; }

/* ---------- نموذج الدخول (2.24.0: بلغة بطاقات لوحة التحكم — وهج لوني ناعم، زوايا كبيرة، ظل طبقي) ---------- */
body:has(> .akm-login) { background: radial-gradient(90% 55% at 100% 0%, rgba(14, 122, 104, .13) 0%, transparent 60%), radial-gradient(70% 45% at 0% 100%, rgba(224, 144, 42, .09) 0%, transparent 60%), var(--akm-bg); }
.akm-login { min-height: 100%; display: flex; align-items: center; justify-content: center; padding: calc(20px + env(safe-area-inset-top, 0px)) 16px calc(20px + env(safe-area-inset-bottom, 0px)); }
.akm-login-card { position: relative; overflow: hidden; isolation: isolate; width: 100%; max-width: 400px; padding: 30px 24px 26px; border: 1px solid var(--akm-border); border-radius: 24px; background: radial-gradient(130% 70% at 100% 0%, #e6f4ef 0%, transparent 60%), #fff; box-shadow: 0 1px 2px rgba(16, 28, 38, .05), 0 24px 48px -24px rgba(16, 28, 38, .28); }
.akm-login-ic { width: 64px; height: 64px; margin: 0 auto 14px; border-radius: 20px; background: radial-gradient(120% 140% at 0% 0%, rgba(255, 255, 255, .28) 0%, transparent 55%), linear-gradient(135deg, var(--akm-primary), #0a5a4c); color: #fff; font: 800 18px/64px "IBM Plex Sans Arabic", "Tajawal", system-ui, sans-serif; letter-spacing: .02em; text-align: center; box-shadow: 0 14px 24px -14px rgba(14, 122, 104, .8); }
.akm-login-card h1 { font-size: 22px; font-weight: 800; text-align: center; margin: 0 0 4px; letter-spacing: -.005em; }
.akm-login-card > p { text-align: center; color: var(--akm-muted); margin: 0 0 20px; font-size: 14px; }
.akm-login-err { background: #fde9e7; color: #8a1c14; border: 1px solid #f3beb8; border-radius: 14px; padding: 11px 14px; margin-bottom: 14px; font-size: 14px; font-weight: 600; }
#akm-loginform p { margin: 0 0 14px; }
#akm-loginform label { display: block; font-size: 13px; font-weight: 700; margin-bottom: 6px; color: var(--akm-text); }
#akm-loginform input[type="text"], #akm-loginform input[type="password"] { width: 100%; min-height: 48px; padding: 0 14px; border: 1px solid #d2d7dc; border-radius: 14px; font-size: 16px; font-family: inherit; background: #fff; color: var(--akm-text); transition: border-color .12s, box-shadow .12s; }
#akm-loginform input[type="text"]:focus, #akm-loginform input[type="password"]:focus { outline: 0; border-color: var(--akm-primary); box-shadow: 0 0 0 3px rgba(14, 122, 104, .22); }
#akm-loginform .login-remember label { display: flex; align-items: center; gap: 8px; font-weight: 500; margin: 0; color: var(--akm-muted); }
#akm-loginform .login-remember input { width: 18px; height: 18px; accent-color: var(--akm-primary); }
#akm-loginform .login-submit { margin-bottom: 0; }
#akm-loginform input[type="submit"] { width: 100%; min-height: 50px; border: 0; border-radius: 14px; background: linear-gradient(135deg, var(--akm-primary), #0a6455); color: #fff; font-size: 16px; font-weight: 800; font-family: inherit; cursor: pointer; box-shadow: 0 1px 2px rgba(14, 122, 104, .25), 0 12px 22px -12px rgba(14, 122, 104, .7); transition: transform .12s, box-shadow .12s; }
#akm-loginform input[type="submit"]:active { transform: translateY(1px); box-shadow: 0 1px 2px rgba(14, 122, 104, .25); }
.akm-login-lost { text-align: center; margin: 16px 0 0; font-size: 14px; }
.akm-login-lost a, .akm-none a.akm-btn { color: var(--akm-primary); }
.akm-none a.akm-btn { display: inline-block; padding: 12px 22px; border: 1px solid var(--akm-primary); border-radius: 14px; text-decoration: none; font-weight: 700; }

/* أزرار شريط التثبيت (pwa.css يفترض أن أصناف ووردبريس موجودة) */
.akm-pwa-act .button { min-height: 40px; padding: 0 14px; border: 1px solid var(--akm-border); border-radius: 8px; background: #fff; color: var(--akm-text); font-size: 14px; cursor: pointer; }
.akm-pwa-act .button-primary { background: var(--akm-primary); border-color: var(--akm-primary); color: #fff; }

/* ---------- 2.30.4 — الوضع الداكن لغلاف التطبيق وشاشة الدخول (html.akm-dark يضيفه سكربت مبكر) ---------- */
@media screen {
  html.akm-dark { color-scheme: dark; --akm-bg: #080D18; --akm-primary: #10B981; --akm-text: #F8FAFC; --akm-muted: #AAB4C5; --akm-border: #293548; }
  html.akm-dark body:has(> .akm-login) { background: radial-gradient(90% 55% at 100% 0%, rgba(16, 185, 129, .16) 0%, transparent 60%), radial-gradient(70% 45% at 0% 100%, rgba(245, 158, 11, .08) 0%, transparent 60%), var(--akm-bg); }
  html.akm-dark .akm-sn { background: #111827; }
  html.akm-dark .akm-login-card { background: radial-gradient(130% 70% at 100% 0%, rgba(16, 185, 129, .16) 0%, transparent 60%), #111827; box-shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 24px 48px -24px rgba(0, 0, 0, .8); }
  html.akm-dark .akm-login-ic { color: #03130D; }
  html.akm-dark .akm-login-err { background: rgba(248, 113, 113, .15); color: #F87171; border-color: rgba(248, 113, 113, .4); }
  html.akm-dark #akm-loginform input[type="text"], html.akm-dark #akm-loginform input[type="password"] { background: #1E293B; border-color: #3A4B66; color: #F8FAFC; }
  html.akm-dark #akm-loginform input[type="submit"] { color: #03130D; background: linear-gradient(135deg, #10B981, #059669); }
  html.akm-dark .akm-ssync { color: #03130D; }
  html.akm-dark .akm-pwa-act .button { background: #1E293B; color: #F8FAFC; border-color: #3A4B66; }
  html.akm-dark .akm-pwa-act .button-primary { background: #10B981; border-color: #10B981; color: #03130D; }
}
