*, *::before, *::after { box-sizing: border-box; }
html { height: 100%; -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100%; font-family: var(--font); font-size: 15px; line-height: 1.65; color: var(--fg); background: var(--bg); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
code, pre, kbd { font-family: var(--mono); font-size: .92em; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: var(--radius-xs); }
::selection { background: var(--brand-soft); }
h1, h2, h3, h4 { margin: 0 0 .5em; font-weight: 700; line-height: 1.3; }
h1 { font-size: 1.5rem; } h2 { font-size: 1.2rem; } h3 { font-size: 1.05rem; }
p { margin: 0 0 .8em; }
[hidden] { display: none !important; }

/* هيكل التطبيق */
.app-shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100dvh; }
.sidebar { position: sticky; top: 0; height: 100dvh; background: var(--sidebar-bg); color: var(--sidebar-fg); display: flex; flex-direction: column; overflow: hidden; }
.main { min-width: 0; display: flex; flex-direction: column; min-height: 100dvh; }
.page { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.page-header { height: var(--header-h); display: flex; align-items: center; gap: 12px; padding: 0 20px; border-bottom: 1px solid var(--border); background: var(--bg-elev); position: sticky; top: 0; z-index: 5; }
.page-header h1 { font-size: 1.05rem; margin: 0; font-weight: 700; }
.page-body { padding: 20px; flex: 1; min-height: 0; }
.page-body.narrow { max-width: var(--content-max); width: 100%; margin: 0 auto; }
.spacer { flex: 1; }

/* الجوال */
.menu-btn { display: none; }
@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; right: 0; left: auto; width: min(86vw, 320px); transform: translateX(100%); transition: transform var(--dur) var(--ease); z-index: 50; box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 49; }
  .menu-btn { display: inline-flex; }
  .page-body { padding: 14px; }
}

/* سكرول أنيق */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 8px; }

/* حركة دخول خفيفة */
@keyframes fade-up { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.fade-up { animation: fade-up var(--dur) var(--ease) both; }
@keyframes pulse { 0%,100% { opacity: 1 } 50% { opacity: .35 } }
.pulse { animation: pulse 1.2s ease-in-out infinite; }
