@font-face { font-family: "Cairo"; font-weight: 400; src: url("../assets/fonts/Cairo-Regular.ttf") format("truetype"); font-display: swap; }
@font-face { font-family: "Cairo"; font-weight: 600; src: url("../assets/fonts/Cairo-SemiBold.ttf") format("truetype"); font-display: swap; }
@font-face { font-family: "Cairo"; font-weight: 700; src: url("../assets/fonts/Cairo-Bold.ttf") format("truetype"); font-display: swap; }

:root {
  --primary: #1d4ed8;
  --primary-hover: #1e40af;
  --primary-soft: #eff6ff;
  --primary-muted: #bfdbfe;
  --primary-glow: rgba(29, 78, 216, 0.35);
  --sidebar: #1e3a8a;
  --sidebar-dark: #0f172a;
  --sidebar-text: rgba(255,255,255,0.95);
  --sidebar-muted: rgba(255,255,255,0.65);
  --bg: #f0f4f8;
  --surface: #ffffff;
  --border: #e2e8f0;
  --text: #0f172a;
  --text-2: #334155;
  --muted: #64748b;
  --success: #059669;
  --success-soft: #ecfdf5;
  --warning: #d97706;
  --warning-soft: #fffbeb;
  --error: #dc2626;
  --error-soft: #fef2f2;
  --info: #2563eb;
  --shadow: 0 1px 2px rgba(15,23,42,0.04), 0 4px 12px rgba(15,23,42,0.04);
  --shadow-md: 0 8px 24px rgba(15,23,42,0.08), 0 2px 6px rgba(15,23,42,0.04);
  --shadow-lg: 0 20px 50px rgba(15,23,42,0.14), 0 4px 12px rgba(15,23,42,0.06);
  --radius: 16px;
  --glass: rgba(255,255,255,0.72);
  --ring: 0 0 0 3px rgba(29,78,216,0.18);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --dur: 0.35s;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: "Cairo", system-ui, sans-serif;
  font-size: 14px;
  background:
    radial-gradient(1200px 600px at 100% -10%, rgba(29,78,216,0.08), transparent 50%),
    radial-gradient(800px 400px at 0% 100%, rgba(37,99,235,0.05), transparent 45%),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
h1, h2, h3 { margin: 0; }

/* ---------- عناصر النموذج ---------- */
button, input, select, textarea {
  font: inherit; border-radius: 10px; border: 1px solid var(--border);
  padding: 9px 14px; background: #fff; color: var(--text);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease),
    background var(--dur) var(--ease), transform 0.2s var(--ease), color var(--dur) var(--ease);
}
button {
  cursor: pointer; background: #f1f5f9;
  position: relative; overflow: hidden;
}
button::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(120deg, transparent 30%, rgba(255,255,255,0.25) 50%, transparent 70%);
  transform: translateX(-120%);
  transition: transform 0.5s var(--ease);
  pointer-events: none;
}
button:hover::after { transform: translateX(120%); }
button:active { transform: scale(0.97); }
button.primary {
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 50%, #1e3a8a 100%);
  color: #fff; border-color: transparent;
  box-shadow: 0 4px 14px var(--primary-glow);
}
button.primary:hover {
  background: linear-gradient(135deg, #60a5fa 0%, #1d4ed8 60%, #1e3a8a 100%);
  box-shadow: 0 6px 20px var(--primary-glow);
  transform: translateY(-1px);
}
button.primary:active { transform: translateY(0) scale(0.98); }
button.ghost { background: transparent; }
button.ghost:hover { background: var(--primary-soft); color: var(--primary); }
button.danger {
  background: var(--error-soft); color: var(--error); border-color: #fecaca;
}
button.danger:hover { background: #fee2e2; }
button.small { padding: 5px 10px; font-size: 12px; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(29,78,216,0.15);
}
input:hover, select:hover, textarea:hover { border-color: #cbd5e1; }

/* ---------- الهيكل ---------- */
.layout {
  display: grid;
  grid-template-columns: 260px minmax(0,1fr);
  min-height: 100vh;
}
.sidebar {
  background: linear-gradient(175deg, #1e3a8a 0%, #172554 40%, #0f172a 100%);
  padding: 18px 14px;
  color: var(--sidebar-text);
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: 2px;
  box-shadow: 4px 0 24px rgba(15, 23, 42, 0.12);
  z-index: 30;
  animation: slideInRight 0.5s var(--ease) both;
}
@keyframes slideInRight {
  from { transform: translateX(24px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
.brand {
  display: flex; align-items: center; gap: 12px;
  padding: 6px 10px 18px;
  animation: fadeUp 0.5s 0.1s var(--ease) both;
}
.brand-icon {
  width: 44px; height: 44px; border-radius: 12px;
  background: linear-gradient(145deg, #fff 0%, #dbeafe 100%);
  display: grid; place-items: center; font-size: 22px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  transition: transform 0.35s var(--ease-spring);
}
.brand:hover .brand-icon { transform: rotate(-8deg) scale(1.08); }
.brand b { display: block; color: #fff; font-size: 16px; letter-spacing: -0.02em; }
.brand span { font-size: 11px; color: var(--sidebar-muted); }
.menu-search {
  margin-bottom: 12px;
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.18);
  color: #fff;
  backdrop-filter: blur(8px);
}
.menu-search::placeholder { color: rgba(255,255,255,0.5); }
.menu-search:focus {
  background: rgba(255,255,255,0.16);
  border-color: rgba(255,255,255,0.4);
  box-shadow: 0 0 0 3px rgba(255,255,255,0.12);
}
.nav-group {
  font-size: 10px; color: var(--sidebar-muted);
  padding: 14px 12px 6px; letter-spacing: 0.06em;
  text-transform: uppercase; opacity: 0.85;
}
.nav {
  display: block; padding: 10px 14px; border-radius: 10px;
  color: var(--sidebar-text); font-size: 13.5px; margin: 2px 0;
  transition: background 0.25s var(--ease), color 0.25s var(--ease),
    transform 0.25s var(--ease), box-shadow 0.25s var(--ease);
  position: relative;
}
.nav:hover {
  background: rgba(255,255,255,0.12);
  transform: translateX(-3px);
}
.nav.active {
  background: #fff;
  color: var(--sidebar-dark);
  font-weight: 700;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  transform: translateX(-4px);
}
.nav.active::before {
  content: "";
  position: absolute;
  right: 0; top: 20%; bottom: 20%;
  width: 3px; border-radius: 3px 0 0 3px;
  background: var(--primary);
}

.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 24px;
  background: rgba(255,255,255,0.82);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(226,232,240,0.8);
  position: sticky; top: 0; z-index: 20;
  animation: fadeDown 0.4s var(--ease) both;
}
@keyframes fadeDown {
  from { transform: translateY(-12px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.topbar h1 {
  font-size: 19px;
  background: linear-gradient(90deg, var(--text) 0%, #1e3a8a 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.topbar .sub { margin: 3px 0 0; font-size: 12px; color: var(--muted); }
.topbar-end { margin-inline-start: auto; display: flex; align-items: center; gap: 10px; }
.menu-btn {
  display: none; width: 42px; height: 42px; place-items: center;
  background: var(--primary-soft); border: none; font-size: 18px;
  border-radius: 12px;
}
.content {
  padding: 22px 24px 40px;
  animation: pageIn 0.45s var(--ease) both;
}
@keyframes pageIn {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- حركة دخول متدرجة ---------- */
.anim-stagger > * {
  animation: fadeUp 0.45s var(--ease) both;
}
.anim-stagger > *:nth-child(1) { animation-delay: 0.03s; }
.anim-stagger > *:nth-child(2) { animation-delay: 0.07s; }
.anim-stagger > *:nth-child(3) { animation-delay: 0.11s; }
.anim-stagger > *:nth-child(4) { animation-delay: 0.15s; }
.anim-stagger > *:nth-child(5) { animation-delay: 0.19s; }
.anim-stagger > *:nth-child(6) { animation-delay: 0.23s; }
.anim-stagger > *:nth-child(7) { animation-delay: 0.27s; }
.anim-stagger > *:nth-child(8) { animation-delay: 0.31s; }
.anim-stagger > *:nth-child(n+9) { animation-delay: 0.35s; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.92); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes pop {
  0% { transform: scale(0.8); opacity: 0; }
  70% { transform: scale(1.05); }
  100% { transform: scale(1); opacity: 1; }
}

.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; align-items: center; gap: 8px; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }
.gap { gap: 8px; }
.page-title { font-size: 18px; }

/* ---------- كروت ---------- */
.card {
  background: var(--surface);
  border: 1px solid rgba(226,232,240,0.9);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  transition: box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease),
    border-color var(--dur) var(--ease);
}
.card:hover {
  box-shadow: var(--shadow-md);
  border-color: #d1e7e3;
}
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 16px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
  transition: transform 0.3s var(--ease-spring), box-shadow 0.3s var(--ease);
}
.stat::before {
  content: "";
  position: absolute; top: 0; right: 0; left: 0; height: 3px;
  background: linear-gradient(90deg, var(--primary), #60a5fa);
  opacity: 0;
  transition: opacity 0.3s var(--ease);
}
.stat:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}
.stat:hover::before { opacity: 1; }
.stat .label { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.stat .value {
  font-size: 24px; font-weight: 700; color: var(--text);
  letter-spacing: -0.02em;
  transition: color 0.25s var(--ease);
}
.stat.teal .value { color: var(--primary); }
.stat.blue .value { color: var(--info); }
.stat.amber .value { color: var(--warning); }
.stat.red .value { color: var(--error); }
.stat.teal { background: linear-gradient(160deg, #fff 60%, #eff6ff 100%); }
.stat.blue { background: linear-gradient(160deg, #fff 60%, #eff6ff 100%); }
.stat.amber { background: linear-gradient(160deg, #fff 60%, #fffbeb 100%); }
.stat.red { background: linear-gradient(160deg, #fff 60%, #fef2f2 100%); }

/* ---------- جداول ---------- */
.table-wrap { overflow-x: auto; border-radius: 10px; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td {
  padding: 11px 14px; text-align: right;
  border-bottom: 1px solid var(--border);
  transition: background 0.2s var(--ease);
}
th {
  background: linear-gradient(180deg, #f8fafc, #f1f5f9);
  color: var(--muted); font-weight: 600; font-size: 12px;
  position: sticky; top: 0;
}
tr { transition: background 0.2s var(--ease), transform 0.2s var(--ease); }
tr:hover td { background: #eff6ff; }
table.clickable tr { cursor: pointer; }
table.clickable tr:active { transform: scale(0.995); }
.sel-row td { background: var(--primary-soft) !important; }
.empty {
  text-align: center; color: var(--muted); padding: 32px;
  animation: fadeUp 0.4s var(--ease) both;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 12px; color: var(--muted); font-weight: 600; }
.field.full { grid-column: 1 / -1; }

.badge {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: 11px; font-weight: 600;
  transition: transform 0.2s var(--ease-spring);
}
.badge:hover { transform: scale(1.05); }
.badge.demo {
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  color: #92400e;
  animation: pulseSoft 2.5s ease-in-out infinite;
}
@keyframes pulseSoft {
  0%, 100% { box-shadow: 0 0 0 0 rgba(217, 119, 6, 0.3); }
  50% { box-shadow: 0 0 0 6px rgba(217, 119, 6, 0); }
}
.badge.ok { background: var(--success-soft); color: var(--success); }
.badge.warn { background: var(--warning-soft); color: var(--warning); }
.badge.err { background: var(--error-soft); color: var(--error); }

.muted { color: var(--muted); }
.accent { color: var(--primary); font-weight: 600; }

/* ---------- توست ---------- */
.toast {
  position: fixed; bottom: 28px; left: 50%;
  transform: translateX(-50%) translateY(24px) scale(0.95);
  background: linear-gradient(135deg, #0f172a, #1e293b);
  color: #fff; padding: 14px 22px; border-radius: 14px;
  opacity: 0; transition: 0.35s var(--ease-spring);
  z-index: 200; box-shadow: 0 12px 32px rgba(15,23,42,0.25);
  max-width: 90%; font-weight: 600;
  backdrop-filter: blur(8px);
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0) scale(1);
}
.toast.error { background: linear-gradient(135deg, #dc2626, #b91c1c); }
.toast.ok { background: linear-gradient(135deg, #059669, #047857); }

/* ---------- مودال ---------- */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(6px);
  display: grid; place-items: center;
  z-index: 100; padding: 16px;
  animation: overlayIn 0.25s var(--ease) both;
}
@keyframes overlayIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
.modal {
  max-height: 90vh; overflow-y: auto; width: 100%; max-width: 720px;
  animation: modalIn 0.4s var(--ease-spring) both;
  border-radius: 16px !important;
  box-shadow: var(--shadow-lg) !important;
  border: 1px solid rgba(255,255,255,0.5) !important;
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.9) translateY(20px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.tabs-bar {
  display: flex; gap: 0; border-bottom: 1px solid var(--border);
  margin-bottom: 12px; overflow-x: auto;
}
.tabs-bar button {
  border: none; border-bottom: 2px solid transparent;
  background: transparent; padding: 10px 14px;
  color: var(--muted); border-radius: 0; font-weight: 600;
  transition: color 0.2s, border-color 0.2s;
}
.tabs-bar button:hover { color: var(--text); background: transparent; }
.tabs-bar button.on {
  color: var(--primary); border-bottom-color: var(--primary);
}

/* ---------- هيرو ---------- */
.hero-banner {
  background:
    linear-gradient(135deg, rgba(30,58,138,0.95) 0%, rgba(19,78,74,0.98) 100%),
    radial-gradient(circle at 80% 20%, rgba(96,165,250,0.35), transparent 50%);
  color: #fff; border-radius: 18px;
  padding: 24px 28px;
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 14px;
  box-shadow: 0 12px 32px rgba(30, 58, 138, 0.25);
  position: relative; overflow: hidden;
  animation: scaleIn 0.5s var(--ease) both;
}
.hero-banner::after {
  content: "";
  position: absolute; width: 200px; height: 200px;
  border-radius: 50%;
  background: rgba(255,255,255,0.06);
  top: -60px; left: -40px;
  animation: floatBlob 8s ease-in-out infinite;
}
.hero-banner::before {
  content: "";
  position: absolute; width: 140px; height: 140px;
  border-radius: 50%;
  background: rgba(96, 165, 250, 0.15);
  bottom: -40px; right: 10%;
  animation: floatBlob 6s ease-in-out infinite reverse;
}
@keyframes floatBlob {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(12px, -16px); }
}
.hero-banner h2 { font-size: 22px; margin-bottom: 6px; position: relative; z-index: 1; }
.hero-banner p { margin: 0; opacity: 0.88; font-size: 13px; position: relative; z-index: 1; }
.hero-banner .row { position: relative; z-index: 1; }
.hero-banner button {
  border-radius: 12px;
  transition: transform 0.25s var(--ease-spring), box-shadow 0.25s;
}
.hero-banner button:hover { transform: translateY(-2px) scale(1.02); }

/* ---------- شيمر تحميل ---------- */
.shimmer {
  background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
  border-radius: 8px; min-height: 16px;
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ---------- سكرول بار أنيق ---------- */
.sidebar::-webkit-scrollbar { width: 5px; }
.sidebar::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.25); border-radius: 5px;
}
.content::-webkit-scrollbar { width: 8px; }

/* ---------- تقليل الحركة للي يفضّل ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; right: 0; top: 0; z-index: 50;
    transform: translateX(105%);
    transition: transform 0.35s var(--ease);
    width: 280px;
    animation: none;
  }
  .layout.nav-open .sidebar { transform: translateX(0); }
  .menu-btn { display: grid; }
  .content { padding: 16px; }
}


/* ========== تنقل احترافي v3 ========== */
.nprogress {
  position: fixed; top: 0; right: 0; left: 0; height: 3px;
  width: 0%; z-index: 9999;
  background: linear-gradient(90deg, #60a5fa, #1d4ed8, #2563eb);
  box-shadow: 0 0 12px rgba(29,78,216,0.6);
  opacity: 0;
  transition: width 0.4s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.2s;
  pointer-events: none;
}
.nprogress.active { opacity: 1; }

.page-leave {
  animation: pageOut 0.18s ease forwards !important;
}
.page-leave-soft { opacity: 0.85; transition: opacity 0.15s; }
@keyframes pageOut {
  to { opacity: 0; transform: translateY(-8px) scale(0.99); }
}

.sidebar-nav { flex: 1; overflow-y: auto; padding-bottom: 8px; }
.sidebar-foot {
  margin-top: auto; padding: 12px 10px 4px;
  border-top: 1px solid rgba(255,255,255,0.1);
}
.sidebar-hint {
  font-size: 11px; color: var(--sidebar-muted); text-align: center;
}

.nav {
  display: flex !important; align-items: center; gap: 10px;
}
.nav-ic {
  width: 22px; height: 22px; display: grid; place-items: center;
  font-size: 13px; opacity: 0.85; flex-shrink: 0;
}
.nav.active .nav-ic { opacity: 1; }
.nav-label { flex: 1; }

.breadcrumb {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; color: var(--muted); margin-bottom: 2px;
  flex-wrap: wrap;
}
.bc-sep { opacity: 0.45; }
.bc-link {
  color: var(--primary); font-weight: 600;
  transition: color 0.2s;
}
.bc-link:hover { text-decoration: underline; }
.bc-current { color: var(--text-2); font-weight: 600; }
.bc-group { color: var(--muted); }

.topbar-title { min-width: 0; }
.top-search-btn {
  width: 38px; height: 38px; padding: 0;
  display: grid; place-items: center;
  border-radius: 10px; font-size: 16px;
}
.top-search-btn:hover { background: var(--primary-soft); color: var(--primary); }

.quick-wrap { position: relative; }
.quick-menu {
  position: absolute; top: calc(100% + 8px); left: 0;
  min-width: 180px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  padding: 6px;
  z-index: 40;
  animation: modalIn 0.25s var(--ease-spring) both;
}
.quick-item {
  display: block; padding: 10px 12px; border-radius: 8px;
  font-size: 13px; font-weight: 600;
  transition: background 0.15s, color 0.15s;
}
.quick-item:hover {
  background: var(--primary-soft); color: var(--primary);
}

/* لوحة أوامر */
.cmd-overlay {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(8px);
  display: grid; place-items: start center;
  padding-top: 12vh;
  animation: overlayIn 0.2s ease both;
}
.cmd-overlay[hidden] { display: none !important; }
.cmd-palette {
  width: min(520px, 92vw);
  padding: 12px !important;
  border-radius: 16px !important;
  box-shadow: 0 24px 64px rgba(15,23,42,0.3) !important;
  animation: modalIn 0.3s var(--ease-spring) both;
}
.cmd-palette input {
  width: 100%;
  padding: 14px 16px;
  font-size: 15px;
  border-radius: 12px;
  border: 1px solid var(--border);
  margin-bottom: 8px;
}
.cmd-results {
  max-height: 320px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 2px;
}
.cmd-row {
  display: flex; align-items: center; gap: 10px;
  width: 100%; text-align: right;
  padding: 11px 12px; border: none; background: transparent;
  border-radius: 10px; cursor: pointer; font: inherit;
  transition: background 0.15s;
}
.cmd-row:hover, .cmd-row.on {
  background: var(--primary-soft);
  color: var(--primary-hover);
}
.cmd-group { margin-inline-start: auto; font-size: 11px; }
.cmd-foot {
  margin-top: 8px; padding-top: 8px;
  border-top: 1px solid var(--border);
  font-size: 11px; text-align: center;
}

.clock { font-size: 12px; font-variant-numeric: tabular-nums; }

/* تحسين الجداول الاحترافي */
.card .table-wrap {
  margin: 0 -4px;
}
table tbody tr {
  animation: fadeUp 0.35s var(--ease) both;
}
table tbody tr:nth-child(1) { animation-delay: 0.02s; }
table tbody tr:nth-child(2) { animation-delay: 0.04s; }
table tbody tr:nth-child(3) { animation-delay: 0.06s; }
table tbody tr:nth-child(4) { animation-delay: 0.08s; }
table tbody tr:nth-child(5) { animation-delay: 0.1s; }
table tbody tr:nth-child(6) { animation-delay: 0.12s; }
table tbody tr:nth-child(7) { animation-delay: 0.14s; }
table tbody tr:nth-child(8) { animation-delay: 0.16s; }

/* حالة فارغة أجمل */
.empty {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 40px 20px !important;
}
.empty::before {
  content: "◇";
  font-size: 28px; opacity: 0.25;
  animation: floatBlob 3s ease-in-out infinite;
}

/* ظل سايدبار أوضح على الديسكتوب */
@media (min-width: 901px) {
  .sidebar {
    border-left: 1px solid rgba(255,255,255,0.06);
  }
}


/* ============================================================
   WOW LAYER — احترافية عالية
   ============================================================ */

body {
  background:
    radial-gradient(900px 500px at 100% 0%, rgba(29,78,216,0.11), transparent 55%),
    radial-gradient(700px 400px at 0% 100%, rgba(37,99,235,0.07), transparent 50%),
    radial-gradient(500px 300px at 50% 50%, rgba(30,58,138,0.03), transparent 60%),
    #eef2f6 !important;
}

/* سايدبار فاخر */
.sidebar {
  background:
    linear-gradient(165deg, #1d4ed8 0%, #1e3a8a 28%, #172554 55%, #0f172a 100%) !important;
  border-left: 1px solid rgba(255,255,255,0.08);
}
.sidebar::before {
  content: "";
  position: absolute; inset: 0;
  background:
    radial-gradient(circle at 20% 10%, rgba(255,255,255,0.12), transparent 40%),
    radial-gradient(circle at 80% 90%, rgba(96,165,250,0.12), transparent 40%);
  pointer-events: none;
}
.sidebar > * { position: relative; z-index: 1; }

.brand-icon {
  background: linear-gradient(145deg, #ffffff 0%, #dbeafe 100%) !important;
  box-shadow: 0 6px 20px rgba(0,0,0,0.2), inset 0 1px 0 rgba(255,255,255,0.9) !important;
}

.nav.active {
  background: linear-gradient(90deg, #fff 0%, #eff6ff 100%) !important;
  box-shadow: 0 6px 20px rgba(0,0,0,0.15) !important;
}

/* توب بار زجاجي فاخر */
.topbar {
  background: rgba(255,255,255,0.75) !important;
  backdrop-filter: blur(16px) saturate(1.4) !important;
  -webkit-backdrop-filter: blur(16px) saturate(1.4) !important;
  border-bottom: 1px solid rgba(226,232,240,0.65) !important;
  box-shadow: 0 1px 0 rgba(255,255,255,0.8) inset;
}

.topbar h1 {
  font-size: 20px !important;
  font-weight: 700;
  letter-spacing: -0.03em;
  background: linear-gradient(105deg, #0f172a 10%, #1e3a8a 90%) !important;
  -webkit-background-clip: text !important;
  background-clip: text !important;
  color: transparent !important;
}

/* كروت بمستوى منتج SaaS */
.card {
  background: linear-gradient(180deg, #ffffff 0%, #fafbfc 100%);
  border: 1px solid rgba(226,232,240,0.85) !important;
  box-shadow:
    0 1px 0 rgba(255,255,255,0.9) inset,
    var(--shadow) !important;
  border-radius: 16px !important;
}
.card:hover {
  box-shadow:
    0 1px 0 rgba(255,255,255,0.9) inset,
    var(--shadow-md) !important;
  transform: translateY(-1px);
}

/* إحصائيات بطابع dashboard حديث */
.stat {
  border-radius: 16px !important;
  padding: 20px 18px !important;
  border: 1px solid rgba(226,232,240,0.9) !important;
  background: #fff !important;
  isolation: isolate;
}
.stat::after {
  content: "";
  position: absolute;
  width: 80px; height: 80px;
  border-radius: 50%;
  right: -20px; bottom: -20px;
  background: radial-gradient(circle, rgba(29,78,216,0.12), transparent 70%);
  z-index: 0;
  transition: transform 0.4s var(--ease);
}
.stat:hover::after { transform: scale(1.4); }
.stat .label, .stat .value { position: relative; z-index: 1; }
.stat .value {
  font-size: 26px !important;
  font-weight: 800 !important;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}
.stat .label {
  font-size: 11px !important;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}

/* هيرو سينمائي */
.hero-banner {
  border-radius: 20px !important;
  padding: 28px 32px !important;
  background:
    linear-gradient(125deg, #1e3a8a 0%, #1d4ed8 40%, #172554 100%),
    radial-gradient(ellipse at 90% 10%, rgba(96,165,250,0.45), transparent 50%) !important;
  box-shadow:
    0 20px 40px rgba(30, 58, 138, 0.28),
    0 1px 0 rgba(255,255,255,0.15) inset !important;
}
.hero-banner h2 {
  font-size: 24px !important;
  font-weight: 800;
  letter-spacing: -0.02em;
  text-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

/* أزرار بمستوى premium */
button.primary {
  background: linear-gradient(135deg, #60a5fa 0%, #3b82f6 35%, #1d4ed8 70%, #1e3a8a 100%) !important;
  background-size: 160% 160% !important;
  animation: gradientShift 6s ease infinite;
  border: none !important;
  box-shadow:
    0 4px 16px rgba(29,78,216,0.35),
    0 1px 0 rgba(255,255,255,0.25) inset !important;
  font-weight: 700;
  letter-spacing: -0.01em;
}
@keyframes gradientShift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}
button.primary:hover {
  box-shadow:
    0 8px 24px rgba(29,78,216,0.45),
    0 1px 0 rgba(255,255,255,0.3) inset !important;
}

/* جداول فاخرة */
th {
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%) !important;
  font-size: 11px !important;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  border-bottom: 1px solid #e2e8f0 !important;
}
tr:hover td {
  background: linear-gradient(90deg, rgba(240,253,250,0.9), rgba(255,255,255,0.5)) !important;
}

/* مخططات CSS بسيطة */
.mini-bars {
  display: flex; align-items: flex-end; gap: 6px;
  height: 72px; padding-top: 8px;
}
.mini-bars span {
  flex: 1; border-radius: 6px 6px 2px 2px;
  background: linear-gradient(180deg, #93c5fd, #1d4ed8);
  min-height: 8px;
  transition: height 0.6s var(--ease), opacity 0.3s;
  opacity: 0.85;
  animation: barGrow 0.7s var(--ease) both;
}
.mini-bars span:hover { opacity: 1; filter: brightness(1.1); }
@keyframes barGrow {
  from { transform: scaleY(0); transform-origin: bottom; }
  to { transform: scaleY(1); transform-origin: bottom; }
}
.mini-bars span:nth-child(1) { animation-delay: 0.05s; }
.mini-bars span:nth-child(2) { animation-delay: 0.1s; }
.mini-bars span:nth-child(3) { animation-delay: 0.15s; }
.mini-bars span:nth-child(4) { animation-delay: 0.2s; }
.mini-bars span:nth-child(5) { animation-delay: 0.25s; }
.mini-bars span:nth-child(6) { animation-delay: 0.3s; }
.mini-bars span:nth-child(7) { animation-delay: 0.35s; }

.spark-row {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 16px;
}
@media (max-width: 800px) {
  .spark-row { grid-template-columns: 1fr; }
}

.panel-title {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.panel-title h3 {
  font-size: 15px; font-weight: 700;
  letter-spacing: -0.01em;
}
.panel-title .tag {
  font-size: 11px; color: var(--primary);
  background: var(--primary-soft);
  padding: 3px 10px; border-radius: 999px; font-weight: 600;
}

/* شريط جانبي للبطاقة */
.accent-card {
  position: relative;
  overflow: hidden;
}
.accent-card::before {
  content: "";
  position: absolute; right: 0; top: 0; bottom: 0; width: 4px;
  background: linear-gradient(180deg, #60a5fa, #1d4ed8);
  border-radius: 0 16px 16px 0;
}

/* عدّاد متحرك */
.count-up { font-variant-numeric: tabular-nums; }

/* شارة حالة نابضة */
.live-dot {
  display: inline-block; width: 8px; height: 8px;
  border-radius: 50%; background: #34d399;
  box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.5);
  animation: livePulse 2s ease infinite;
  margin-inline-end: 6px; vertical-align: middle;
}
@keyframes livePulse {
  0% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.5); }
  70% { box-shadow: 0 0 0 8px rgba(52, 211, 153, 0); }
  100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0); }
}

/* مودال أرقى */
.modal-overlay {
  background: rgba(15, 23, 42, 0.55) !important;
  backdrop-filter: blur(10px) !important;
}
.modal {
  border: 1px solid rgba(255,255,255,0.6) !important;
  box-shadow: 0 25px 60px rgba(15,23,42,0.25) !important;
}

/* توست أفخم */
.toast {
  border-radius: 14px !important;
  padding: 14px 24px !important;
  font-size: 13.5px;
  letter-spacing: -0.01em;
  box-shadow: 0 16px 40px rgba(15,23,42,0.3) !important;
}

/* سكرول ناعم للمحتوى */
.content {
  padding: 24px 28px 48px !important;
}

/* تأثير لمعان خفيف على الكروت المهمة */
.shine {
  position: relative; overflow: hidden;
}
.shine::after {
  content: "";
  position: absolute; top: 0; left: -100%;
  width: 60%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.25), transparent);
  animation: shineMove 4s ease-in-out infinite;
  pointer-events: none;
}
@keyframes shineMove {
  0%, 60% { left: -100%; }
  100% { left: 150%; }
}

/* قائمة سريعة أجمل */
.quick-menu {
  border: 1px solid rgba(226,232,240,0.9) !important;
  backdrop-filter: blur(12px);
  background: rgba(255,255,255,0.95) !important;
}

/* لوحة أوامر سينمائية */
.cmd-palette {
  border: 1px solid rgba(255,255,255,0.5) !important;
  box-shadow:
    0 0 0 1px rgba(15,23,42,0.04),
    0 28px 80px rgba(15,23,42,0.35) !important;
}
.cmd-row.on {
  background: linear-gradient(90deg, #eff6ff, #eff6ff) !important;
  box-shadow: inset 3px 0 0 var(--primary);
}

/* تحسين الموبايل */
@media (max-width: 900px) {
  .content { padding: 16px !important; }
  .hero-banner { padding: 20px !important; }
  .stat .value { font-size: 22px !important; }
}


/* ============================================================
   DARK MODE + INVOICE / FORM PRO LAYER
   ============================================================ */

html.dark {
  --bg: #0b1220;
  --surface: #111827;
  --border: #1f2a3a;
  --text: #e5eef7;
  --text-2: #b6c2d0;
  --muted: #8b9bb0;
  --primary-soft: rgba(29,78,216,0.15);
  --shadow: 0 1px 2px rgba(0,0,0,0.3);
  --shadow-md: 0 10px 30px rgba(0,0,0,0.35);
  --shadow-lg: 0 24px 50px rgba(0,0,0,0.45);
}

html.dark body {
  background:
    radial-gradient(900px 500px at 100% 0%, rgba(29,78,216,0.14), transparent 55%),
    radial-gradient(700px 400px at 0% 100%, rgba(37,99,235,0.1), transparent 50%),
    #0b1220 !important;
}

html.dark .topbar {
  background: rgba(17, 24, 39, 0.82) !important;
  border-bottom-color: rgba(255,255,255,0.06) !important;
}
html.dark .topbar h1 {
  background: linear-gradient(105deg, #f8fafc 10%, #93c5fd 90%) !important;
  -webkit-background-clip: text !important;
  background-clip: text !important;
}
html.dark .card,
html.dark .stat {
  background: linear-gradient(180deg, #131c2e 0%, #111827 100%) !important;
  border-color: rgba(255,255,255,0.06) !important;
}
html.dark th {
  background: linear-gradient(180deg, #1a2436, #151e2e) !important;
  color: #8b9bb0 !important;
}
html.dark tr:hover td {
  background: rgba(29,78,216,0.1) !important;
}
html.dark button:not(.primary):not(.danger) {
  background: #1a2436; color: var(--text); border-color: #2a3648;
}
html.dark input, html.dark select, html.dark textarea {
  background: #0f172a; color: var(--text); border-color: #2a3648;
}
html.dark .quick-menu,
html.dark .cmd-palette {
  background: #111827 !important;
  border-color: #2a3648 !important;
}
html.dark .modal { background: #111827 !important; }
html.dark .badge.demo { background: #422006; color: #fbbf24; }

/* theme toggle */
.theme-btn {
  width: 38px; height: 38px; padding: 0;
  display: grid; place-items: center;
  border-radius: 10px; font-size: 16px;
  transition: transform 0.25s var(--ease-spring), background 0.2s;
}
.theme-btn:hover { transform: rotate(-12deg) scale(1.08); background: var(--primary-soft); }

/* invoice detail premium */
.invoice-hero {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 16px; flex-wrap: wrap;
  padding: 18px 20px;
  border-radius: 14px;
  background:
    linear-gradient(120deg, rgba(29,78,216,0.1), rgba(37,99,235,0.06)),
    var(--surface);
  border: 1px solid var(--border);
  margin-bottom: 4px;
}
.invoice-hero .big-num {
  font-size: 28px; font-weight: 800; letter-spacing: -0.03em;
  background: linear-gradient(90deg, var(--primary), #2563eb);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.invoice-totals {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px; margin-top: 12px;
}
.invoice-totals .box {
  background: var(--primary-soft);
  border-radius: 12px; padding: 12px 14px;
  border: 1px solid rgba(29,78,216,0.15);
}
.invoice-totals .box span { display: block; font-size: 11px; color: var(--muted); margin-bottom: 4px; }
.invoice-totals .box b { font-size: 16px; font-variant-numeric: tabular-nums; }

/* form polish */
.field label {
  font-size: 11px !important;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.field input, .field select, .field textarea {
  transition: box-shadow 0.25s var(--ease), border-color 0.25s, transform 0.15s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  transform: translateY(-1px);
  box-shadow: var(--ring), 0 4px 12px rgba(29,78,216,0.08);
}

/* page toolbar */
.page-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
  padding: 4px 0 8px;
}
.page-toolbar h2 {
  font-size: 20px; font-weight: 800; letter-spacing: -0.02em;
}

/* floating tip */
.kbd {
  display: inline-block; padding: 2px 7px;
  border-radius: 6px; font-size: 11px;
  background: rgba(15,23,42,0.06);
  border: 1px solid var(--border);
  font-family: ui-monospace, monospace;
}
html.dark .kbd { background: rgba(255,255,255,0.06); }

/* selection */
::selection {
  background: rgba(29,78,216,0.25);
  color: inherit;
}


/* ============================================================
   PRO LAYER V9 — صبّة جبّارة
   ============================================================ */

.layout { animation: layoutFade 0.5s var(--ease) both; }
@keyframes layoutFade {
  from { opacity: 0; }
  to { opacity: 1; }
}

.sidebar .nav {
  border: 1px solid transparent;
}
.sidebar .nav.active {
  border-color: rgba(255,255,255,0.35) !important;
  letter-spacing: -0.01em;
}

.stat .value {
  background: linear-gradient(135deg, currentColor 0%, currentColor 100%);
}

/* شريط تقدم داخل التقارير */
.meter {
  height: 10px; border-radius: 999px;
  background: rgba(15,23,42,0.06);
  overflow: hidden; margin-top: 8px;
}
html.dark .meter { background: rgba(255,255,255,0.08); }
.meter > i {
  display: block; height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, #60a5fa, #1d4ed8, #2563eb);
  background-size: 200% 100%;
  animation: meterFill 1s var(--ease) both, gradientShift 4s linear infinite;
  transform-origin: right center;
}
@keyframes meterFill {
  from { width: 0% !important; }
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
}
.kpi {
  border-radius: 16px;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  transition: transform 0.3s var(--ease-spring), box-shadow 0.3s;
  position: relative;
  overflow: hidden;
}
.kpi:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.kpi .kpi-label { font-size: 11px; color: var(--muted); font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }
.kpi .kpi-value { font-size: 22px; font-weight: 800; margin-top: 6px; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.kpi .kpi-sub { font-size: 12px; color: var(--muted); margin-top: 4px; }

.section-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 12px; flex-wrap: wrap;
}
.section-head h3 { font-size: 15px; font-weight: 800; letter-spacing: -0.01em; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 12px; border-radius: 999px;
  font-size: 12px; font-weight: 600;
  background: var(--primary-soft); color: var(--primary);
  border: 1px solid rgba(29,78,216,0.2);
}

.table-card { padding: 0 !important; overflow: hidden; }
.table-card .table-wrap { margin: 0; }
.table-card .table-head {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}

/* زر عائم للموبايل */
.fab-pro {
  position: fixed; bottom: 24px; left: 24px;
  z-index: 40;
  border-radius: 16px !important;
  padding: 14px 18px !important;
  box-shadow: 0 12px 28px rgba(29,78,216,0.4) !important;
  animation: pop 0.5s var(--ease-spring) both;
}
@media (min-width: 901px) {
  .fab-pro { display: none !important; }
}

/* تحسين حالة التحميل الأولى */
#app > .empty {
  min-height: 100vh; display: grid; place-items: center;
  font-size: 15px; color: var(--muted);
  background:
    radial-gradient(600px 300px at 50% 40%, rgba(29,78,216,0.08), transparent 60%),
    var(--bg);
}
#app > .empty::before {
  content: "◈";
  display: block; font-size: 36px; margin-bottom: 12px;
  color: var(--primary); opacity: 0.5;
  animation: livePulse 1.5s ease infinite;
}


/* ============================================================
   MOTION LAYER V10 — أنيميشن عالي المستوى
   ============================================================ */

:root {
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out-soft: cubic-bezier(0.45, 0, 0.55, 1);
  --spring: cubic-bezier(0.34, 1.4, 0.64, 1);
}

/* دخول الصفحة بمراحل */
.content.anim-stagger {
  animation: contentReveal 0.55s var(--ease-out-expo) both;
}
@keyframes contentReveal {
  from { opacity: 0; filter: blur(4px); transform: translateY(20px) scale(0.985); }
  to { opacity: 1; filter: blur(0); transform: translateY(0) scale(1); }
}

.anim-stagger > * {
  animation: riseIn 0.55s var(--ease-out-expo) both;
}
@keyframes riseIn {
  from { opacity: 0; transform: translateY(28px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* خروج الصفحة */
.page-leave {
  animation: contentExit 0.2s var(--ease-in-out-soft) forwards !important;
}
@keyframes contentExit {
  to { opacity: 0; filter: blur(3px); transform: translateY(-12px) scale(0.98); }
}

/* شريط التقدّم أكثر حيوية */
.nprogress.active {
  animation: nprogressGlow 0.8s ease infinite alternate;
}
@keyframes nprogressGlow {
  from { filter: brightness(1); box-shadow: 0 0 8px rgba(29,78,216,0.4); }
  to { filter: brightness(1.25); box-shadow: 0 0 16px rgba(96,165,250,0.7); }
}

/* سايدبار: توهج العنصر النشط */
.nav.active {
  animation: navPulse 2.8s ease-in-out infinite;
}
@keyframes navPulse {
  0%, 100% { box-shadow: 0 4px 16px rgba(0,0,0,0.12); }
  50% { box-shadow: 0 6px 22px rgba(0,0,0,0.18), 0 0 0 1px rgba(255,255,255,0.4); }
}

.nav {
  transition:
    background 0.28s var(--ease-out-expo),
    color 0.28s,
    transform 0.28s var(--spring),
    box-shadow 0.28s var(--ease-out-expo) !important;
}
.nav:hover {
  transform: translateX(-4px) scale(1.01);
}

/* كروت: ميل خفيف ثلاثي الأبعاد */
.card, .stat, .kpi {
  transform-style: preserve-3d;
  transition:
    transform 0.4s var(--spring),
    box-shadow 0.4s var(--ease-out-expo),
    border-color 0.3s !important;
}
.stat:hover, .kpi:hover {
  transform: translateY(-6px) rotateX(2deg) scale(1.01);
}
.card:hover {
  transform: translateY(-2px);
}

/* أزرار: موجة ضغط */
button.primary {
  transition: transform 0.25s var(--spring), box-shadow 0.3s, background-position 0.4s !important;
}
button.primary:hover {
  transform: translateY(-2px) scale(1.03);
}
button.primary:active {
  transform: translateY(0) scale(0.97);
  transition-duration: 0.1s !important;
}

/* مودال سينمائي */
.modal-overlay {
  animation: overlayBloom 0.3s var(--ease-out-expo) both !important;
}
@keyframes overlayBloom {
  from { opacity: 0; backdrop-filter: blur(0); }
  to { opacity: 1; backdrop-filter: blur(10px); }
}
.modal {
  animation: modalRise 0.45s var(--spring) both !important;
}
@keyframes modalRise {
  from { opacity: 0; transform: translateY(32px) scale(0.88); filter: blur(6px); }
  to { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); }
}

/* توست نابض */
.toast.show {
  animation: toastIn 0.45s var(--spring) both;
}
@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(28px) scale(0.85); }
  to { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
}

/* صفوف الجدول: انزلاق من اليمين */
table tbody tr {
  animation: rowSlide 0.4s var(--ease-out-expo) both;
}
@keyframes rowSlide {
  from { opacity: 0; transform: translateX(16px); }
  to { opacity: 1; transform: translateX(0); }
}

/* أعمدة المخطط */
.mini-bars span {
  animation: barSpring 0.8s var(--spring) both !important;
}
@keyframes barSpring {
  0% { transform: scaleY(0); opacity: 0; }
  60% { transform: scaleY(1.08); opacity: 1; }
  100% { transform: scaleY(1); }
}

/* هيرو: نبض إضاءة */
.hero-banner {
  animation: heroIn 0.7s var(--ease-out-expo) both, heroGlow 5s ease-in-out infinite alternate;
}
@keyframes heroIn {
  from { opacity: 0; transform: translateY(24px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes heroGlow {
  from { box-shadow: 0 20px 40px rgba(30, 58, 138, 0.28); }
  to { box-shadow: 0 24px 50px rgba(13, 148, 136, 0.4), 0 0 40px rgba(96,165,250,0.15); }
}

/* عدّادات */
.count-up {
  animation: countPop 0.5s var(--spring) both;
}
@keyframes countPop {
  from { transform: scale(0.7); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* شريط meter */
.meter > i {
  animation: meterGrow 1.1s var(--ease-out-expo) both, gradientShift 3.5s linear infinite !important;
}
@keyframes meterGrow {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}
.meter > i {
  transform-origin: right center;
}

/* لوحة الأوامر */
.cmd-overlay {
  animation: overlayBloom 0.25s var(--ease-out-expo) both !important;
}
.cmd-palette {
  animation: modalRise 0.4s var(--spring) both !important;
}
.cmd-row {
  transition: background 0.15s, transform 0.2s var(--spring), box-shadow 0.2s;
}
.cmd-row:hover, .cmd-row.on {
  transform: translateX(-3px);
}

/* قائمة سريعة */
.quick-menu {
  animation: dropMenu 0.3s var(--spring) both !important;
}
@keyframes dropMenu {
  from { opacity: 0; transform: translateY(-8px) scale(0.92); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* invoice hero */
.invoice-hero {
  animation: riseIn 0.5s var(--ease-out-expo) both;
}
.invoice-totals .box {
  animation: riseIn 0.45s var(--ease-out-expo) both;
}
.invoice-totals .box:nth-child(1) { animation-delay: 0.05s; }
.invoice-totals .box:nth-child(2) { animation-delay: 0.1s; }
.invoice-totals .box:nth-child(3) { animation-delay: 0.15s; }
.invoice-totals .box:nth-child(4) { animation-delay: 0.2s; }
.invoice-totals .box:nth-child(5) { animation-delay: 0.25s; }

/* focus ring متحرك */
input:focus, select:focus, textarea:focus {
  animation: focusRing 0.4s var(--ease-out-expo);
}
@keyframes focusRing {
  from { box-shadow: 0 0 0 0 rgba(29,78,216,0); }
  to { box-shadow: 0 0 0 4px rgba(29,78,216,0.15); }
}

/* badge نبض خفيف */
.badge.ok {
  animation: softGlow 2.5s ease-in-out infinite;
}
@keyframes softGlow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(5, 150, 105, 0.25); }
  50% { box-shadow: 0 0 0 6px rgba(5, 150, 105, 0); }
}

/* skeleton shimmer أقوى */
.shimmer {
  background: linear-gradient(
    100deg,
    transparent 20%,
    rgba(255,255,255,0.45) 40%,
    transparent 60%
  ) !important;
  background-size: 200% 100% !important;
  animation: shimmerSweep 1.2s ease-in-out infinite !important;
}
@keyframes shimmerSweep {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

/* احترام تقليل الحركة */
@media (prefers-reduced-motion: reduce) {
  .nav.active, .hero-banner, .badge.ok, .nprogress.active,
  .shine::after, .mini-bars span {
    animation: none !important;
  }
  .content.anim-stagger, .anim-stagger > *, .card, .stat, .kpi {
    animation: none !important;
    transition: none !important;
  }
}


/* ============================================================
   MOTION INTERACTIVE V11
   ============================================================ */

.stat, .kpi, .hero-banner, .invoice-hero {
  position: relative;
  overflow: hidden;
  will-change: transform;
  transition: transform 0.15s ease-out, box-shadow 0.3s var(--ease-out-expo, ease) !important;
}

.motion-glare {
  pointer-events: none;
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.25s ease;
  z-index: 2;
  border-radius: inherit;
  mix-blend-mode: soft-light;
}

.stat > *, .kpi > *, .hero-banner > *, .invoice-hero > * {
  position: relative;
  z-index: 3;
}

button.primary {
  will-change: transform;
  transition: transform 0.15s ease-out, box-shadow 0.3s ease !important;
}

/* توهج مسار الماوس على السايدبار */
.sidebar {
  position: relative;
}
.sidebar::after {
  content: "";
  position: absolute;
  width: 180px; height: 180px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,0.12), transparent 70%);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s;
  z-index: 0;
  transform: translate(-50%, -50%);
}

/* صفحة: staggered children أعمق */
.anim-stagger > *:nth-child(1) { animation-delay: 0.04s; }
.anim-stagger > *:nth-child(2) { animation-delay: 0.09s; }
.anim-stagger > *:nth-child(3) { animation-delay: 0.14s; }
.anim-stagger > *:nth-child(4) { animation-delay: 0.19s; }
.anim-stagger > *:nth-child(5) { animation-delay: 0.24s; }
.anim-stagger > *:nth-child(6) { animation-delay: 0.29s; }
.anim-stagger > *:nth-child(7) { animation-delay: 0.34s; }
.anim-stagger > *:nth-child(8) { animation-delay: 0.39s; }

/* انتقال سلس للثيم */
html, body, .card, .stat, .kpi, .topbar, .sidebar, input, select, button {
  transition: background-color 0.35s ease, color 0.25s ease, border-color 0.25s ease;
}

/* نبض خفيف لشريط التقدم عند النشاط */
@keyframes nprogressShine {
  0% { background-position: 0% 50%; }
  100% { background-position: 100% 50%; }
}
.nprogress.active {
  background-size: 200% 100% !important;
  animation: nprogressGlow 0.8s ease infinite alternate, nprogressShine 1.2s linear infinite !important;
}

@media (prefers-reduced-motion: reduce) {
  .motion-glare { display: none !important; }
  .stat, .kpi, .hero-banner, button.primary {
    transform: none !important;
    transition: none !important;
  }
}


/* PRO V12 */
.row-danger td { background: rgba(220, 38, 38, 0.06) !important; }
.row-danger:hover td { background: rgba(220, 38, 38, 0.1) !important; }
.stats { margin-bottom: 4px; }
.page-toolbar {
  padding-bottom: 4px;
  border-bottom: 1px solid transparent;
  background: linear-gradient(180deg, rgba(255,255,255,0.4), transparent);
}
html.dark .page-toolbar {
  background: linear-gradient(180deg, rgba(255,255,255,0.03), transparent);
}


/* PRO V13 */
#activity-feed .row {
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(29,78,216,0.04);
  border: 1px solid rgba(29,78,216,0.08);
  transition: transform 0.25s var(--spring, ease), background 0.2s;
  animation: riseIn 0.45s both;
}
#activity-feed .row:hover {
  transform: translateX(-4px);
  background: rgba(29,78,216,0.09);
}
#activity-feed .row:nth-child(1) { animation-delay: 0.05s; }
#activity-feed .row:nth-child(2) { animation-delay: 0.1s; }
#activity-feed .row:nth-child(3) { animation-delay: 0.15s; }
#activity-feed .row:nth-child(4) { animation-delay: 0.2s; }
#activity-feed .row:nth-child(5) { animation-delay: 0.25s; }

.stats .stat {
  animation: riseIn 0.5s var(--ease-out-expo, ease) both;
}


/* PRO V14 ERP identity */
.sidebar-ver {
  margin-top: 6px;
  font-size: 10px;
  color: rgba(255,255,255,0.4);
  text-align: center;
  letter-spacing: 0.04em;
}
.brand b {
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px !important;
}

.empty-pro {
  text-align: center;
  padding: 48px 24px;
  color: var(--muted);
}
.empty-pro .icon {
  width: 64px; height: 64px;
  margin: 0 auto 14px;
  border-radius: 18px;
  display: grid; place-items: center;
  font-size: 28px;
  background: linear-gradient(145deg, var(--primary-soft), #fff);
  border: 1px solid rgba(29,78,216,0.15);
  box-shadow: var(--shadow);
  animation: pop 0.5s var(--spring, ease) both;
}
html.dark .empty-pro .icon {
  background: linear-gradient(145deg, rgba(29,78,216,0.2), #1a2436);
}
.empty-pro h4 {
  margin: 0 0 6px;
  color: var(--text);
  font-size: 16px;
}
.empty-pro p { margin: 0; font-size: 13px; }

.pro-note {
  font-size: 12px;
  color: var(--muted);
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--primary-soft);
  border: 1px solid rgba(29,78,216,0.12);
}

.status-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 12px; border-radius: 999px;
  font-size: 11px; font-weight: 700;
  background: var(--success-soft); color: var(--success);
}
.status-pill::before {
  content: "";
  width: 7px; height: 7px; border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 3px rgba(5,150,105,0.2);
}


/* ============================================================
   ACCOUNTING BLUE THEME — أزرق · رمادي · أحمر · أبيض
   ============================================================ */
:root {
  --primary: #1d4ed8;
  --primary-hover: #1e40af;
  --primary-soft: #eff6ff;
  --primary-muted: #bfdbfe;
  --primary-glow: rgba(29, 78, 216, 0.35);
  --sidebar: #1e3a8a;
  --sidebar-dark: #0f172a;
  --bg: #f3f4f6;
  --surface: #ffffff;
  --border: #e5e7eb;
  --text: #111827;
  --text-2: #374151;
  --muted: #6b7280;
  --success: #059669;
  --success-soft: #ecfdf5;
  --warning: #d97706;
  --warning-soft: #fffbeb;
  --error: #dc2626;
  --error-soft: #fef2f2;
  --info: #2563eb;
}

body {
  background:
    radial-gradient(900px 500px at 100% 0%, rgba(29,78,216,0.08), transparent 55%),
    radial-gradient(700px 400px at 0% 100%, rgba(15,23,42,0.04), transparent 50%),
    #f3f4f6 !important;
}

.sidebar {
  background:
    linear-gradient(165deg, #1e3a8a 0%, #1e40af 35%, #172554 70%, #0f172a 100%) !important;
}

button.primary {
  background: linear-gradient(135deg, #60a5fa 0%, #3b82f6 35%, #1d4ed8 70%, #1e3a8a 100%) !important;
  box-shadow: 0 4px 16px rgba(29,78,216,0.35), 0 1px 0 rgba(255,255,255,0.25) inset !important;
}

.hero-banner {
  background:
    linear-gradient(125deg, #1e3a8a 0%, #1d4ed8 45%, #172554 100%),
    radial-gradient(ellipse at 90% 10%, rgba(96,165,250,0.35), transparent 50%) !important;
  box-shadow: 0 20px 40px rgba(30, 58, 138, 0.28) !important;
}

.topbar h1 {
  background: linear-gradient(105deg, #111827 10%, #1d4ed8 90%) !important;
  -webkit-background-clip: text !important;
  background-clip: text !important;
  color: transparent !important;
}

.nprogress {
  background: linear-gradient(90deg, #60a5fa, #1d4ed8, #dc2626) !important;
}

.stat.teal .value, .stat.teal { /* remap old teal class to blue */ }
.stat.teal .value { color: #1d4ed8 !important; }
.stat.teal { background: linear-gradient(160deg, #fff 60%, #eff6ff 100%) !important; }

.meter > i {
  background: linear-gradient(90deg, #60a5fa, #1d4ed8, #dc2626) !important;
}

.invoice-hero .big-num {
  background: linear-gradient(90deg, #1d4ed8, #dc2626) !important;
  -webkit-background-clip: text !important;
  background-clip: text !important;
  color: transparent !important;
}

html.dark {
  --primary-soft: rgba(29,78,216,0.15);
  --bg: #0b1220;
  --surface: #111827;
  --border: #1f2a3a;
}
html.dark body {
  background:
    radial-gradient(900px 500px at 100% 0%, rgba(29,78,216,0.12), transparent 55%),
    #0b1220 !important;
}
html.dark .topbar h1 {
  background: linear-gradient(105deg, #f8fafc 10%, #93c5fd 90%) !important;
  -webkit-background-clip: text !important;
  background-clip: text !important;
}


/* ============================================================
   SIDEBAR FIX v16 — ثابتة + تصميم محاسبي نظيف
   ============================================================ */

.layout {
  display: block !important;
  min-height: 100vh;
  position: relative;
}

/* سايدبار ثابتة لا تتحرك مع التمرير */
.sidebar {
  position: fixed !important;
  top: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  left: auto !important;
  width: 260px !important;
  height: 100vh !important;
  height: 100dvh !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  z-index: 100 !important;
  margin: 0 !important;
  transform: none !important;
  animation: none !important;
  /* تصميم هادئ محاسبي */
  background: #0f172a !important;
  background-image: none !important;
  border-left: 1px solid #1e293b !important;
  box-shadow: none !important;
  padding: 0 !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 0 !important;
}

.sidebar::before,
.sidebar::after {
  display: none !important;
  content: none !important;
  animation: none !important;
}

.sidebar > * {
  position: relative;
  z-index: 1;
}

.brand {
  padding: 20px 18px 16px !important;
  border-bottom: 1px solid #1e293b;
  margin: 0 !important;
  gap: 12px !important;
  animation: none !important;
  flex-shrink: 0;
}
.brand-icon {
  width: 40px !important;
  height: 40px !important;
  border-radius: 10px !important;
  background: #1d4ed8 !important;
  color: #fff !important;
  font-size: 18px !important;
  box-shadow: none !important;
  display: grid !important;
  place-items: center !important;
}
.brand:hover .brand-icon {
  transform: none !important;
}
.brand b {
  color: #f8fafc !important;
  font-size: 13.5px !important;
  font-weight: 700 !important;
  max-width: 160px;
}
.brand span {
  color: #94a3b8 !important;
  font-size: 11px !important;
}

.sidebar-search-wrap {
  padding: 12px 14px 8px;
  flex-shrink: 0;
}
.menu-search {
  width: 100%;
  margin: 0 !important;
  background: #1e293b !important;
  border: 1px solid #334155 !important;
  color: #e2e8f0 !important;
  border-radius: 8px !important;
  padding: 9px 12px !important;
  font-size: 13px !important;
  backdrop-filter: none !important;
}
.menu-search::placeholder {
  color: #64748b !important;
}
.menu-search:focus {
  border-color: #3b82f6 !important;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2) !important;
  background: #1e293b !important;
}

.sidebar-nav {
  flex: 1 1 auto !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  padding: 4px 10px 16px !important;
  min-height: 0;
}

.nav-group {
  font-size: 10px !important;
  color: #64748b !important;
  padding: 14px 10px 6px !important;
  letter-spacing: 0.08em !important;
  text-transform: uppercase !important;
  font-weight: 600 !important;
  opacity: 1 !important;
}

.nav {
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  padding: 9px 12px !important;
  margin: 1px 0 !important;
  border-radius: 8px !important;
  color: #cbd5e1 !important;
  font-size: 13px !important;
  font-weight: 500 !important;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  transform: none !important;
  animation: none !important;
  transition: background 0.15s ease, color 0.15s ease !important;
}
.nav:hover {
  background: #1e293b !important;
  color: #f1f5f9 !important;
  transform: none !important;
}
.nav.active {
  background: #1d4ed8 !important;
  color: #ffffff !important;
  font-weight: 600 !important;
  box-shadow: none !important;
  transform: none !important;
  animation: none !important;
  border: none !important;
}
.nav.active::before {
  display: none !important;
}
.nav-ic {
  width: 20px !important;
  height: 20px !important;
  opacity: 0.85 !important;
  font-size: 12px !important;
}
.nav.active .nav-ic {
  opacity: 1 !important;
}

.sidebar-foot {
  flex-shrink: 0 !important;
  margin-top: 0 !important;
  padding: 12px 14px 16px !important;
  border-top: 1px solid #1e293b !important;
}
.sidebar-hint {
  font-size: 11px !important;
  color: #64748b !important;
  text-align: center !important;
}
.sidebar-ver {
  margin-top: 4px !important;
  font-size: 10px !important;
  color: #475569 !important;
  text-align: center !important;
}

.sidebar::-webkit-scrollbar {
  width: 4px;
}
.sidebar::-webkit-scrollbar-thumb {
  background: #334155;
  border-radius: 4px;
}

/* المحتوى لا يختبئ تحت السايدبار */
.main {
  margin-right: 260px !important;
  margin-left: 0 !important;
  min-width: 0;
  min-height: 100vh;
  width: auto !important;
}

/* موبايل: درج من اليمين */
@media (max-width: 900px) {
  .sidebar {
    width: 280px !important;
    transform: translateX(105%) !important;
    transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1) !important;
    box-shadow: -8px 0 30px rgba(0,0,0,0.35) !important;
  }
  .layout.nav-open .sidebar {
    transform: translateX(0) !important;
  }
  .main {
    margin-right: 0 !important;
  }
  /* طبقة تعتيم عند فتح القائمة */
  .layout.nav-open::before {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    z-index: 90;
  }
}
