/* إعادة تعيين وأساسيات */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--surface-muted);
  color: var(--text);
  font-family: var(--font-arabic);
  font-size: var(--font-size-base);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  min-height: 100vh;
  direction: rtl;
}

h1, h2, h3, h4, h5, h6 {
  margin: 0 0 var(--space-3);
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0;
}

h1 { font-size: var(--font-size-2xl); }
h2 { font-size: var(--font-size-xl); }
h3 { font-size: var(--font-size-lg); }

p { margin: 0 0 var(--space-3); color: var(--text); }

a {
  color: var(--primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}
a:hover { color: var(--primary-hover); text-decoration: underline; }

button {
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
}

input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

img, svg { max-width: 100%; display: block; }

::selection { background: var(--moe-green-100); color: var(--moe-green-900); }

/* شريط تمرير أنيق */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--ink-300) transparent;
}
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--ink-300); border-radius: 999px; }
*::-webkit-scrollbar-thumb:hover { background: var(--ink-400); }

/* شاشة الإقلاع */
.app-root {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.boot-screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  background: radial-gradient(
    circle at 50% 20%,
    var(--moe-green-800),
    var(--moe-green-900) 70%
  );
  color: #fff;
  text-align: center;
  padding: var(--space-8);
}
.boot-crest { color: var(--moe-gold-200); }
.boot-title { font-size: var(--font-size-2xl); font-weight: 700; }
.boot-sub { color: rgba(255, 255, 255, 0.72); font-size: var(--font-size-sm); }
.boot-progress {
  width: 220px; height: 4px; background: rgba(255, 255, 255, 0.14);
  border-radius: 999px; overflow: hidden; margin-top: var(--space-4);
}
.boot-progress span {
  display: block; height: 100%; width: 40%;
  background: var(--moe-gold-500);
  animation: bootSlide 1.2s ease-in-out infinite;
}
@keyframes bootSlide {
  0% { transform: translateX(100%); }
  100% { transform: translateX(-240%); }
}

/* أدوات مساعدة */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.hidden { display: none !important; }
.stack { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; gap: var(--space-3); }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }
.grow { flex: 1 1 auto; }
.muted { color: var(--text-muted); }
.text-sm { font-size: var(--font-size-sm); }
.text-xs { font-size: var(--font-size-xs); }

@media print {
  .no-print, .app-sidebar, .app-topbar { display: none !important; }
  .app-main { margin: 0; padding: 0; }
}
