/* ================================================================
   NIMROD Ops — UI Component Library v1.1
   static/assets/css/components.css
   ================================================================

   ════════════════════════════════════════════════════════════════
   CSS Architecture:
     • All component classes prefixed with descriptive section title
     • Dark mode variants use [data-bs-theme="dark"]
     • Design tokens use CSS custom properties (--fc-*, --nimrod-*)
     • Base responsive breakpoints included at component level
     • Animations use prefers-reduced-motion media query where possible
   ════════════════════════════════════════════════════════════════
*/

/* ════════════════════════════════════════════════════════
   🃏 STAT CARD
   ════════════════════════════════════════════════════════ */
.stat-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
  background: var(--fc-surface, #fff);
  border: 1px solid var(--fc-line, rgba(15,23,42,0.14));
  border-radius: var(--fc-radius-md, 16px);
  box-shadow: var(--fc-shadow-soft, 0 8px 24px rgba(15,23,42,0.08));
  transition: all 0.25s cubic-bezier(0.22, 1, 0.36, 1);
  position: relative;
  overflow: hidden;
  min-height: 92px;
}
.stat-card:hover {
  box-shadow: var(--fc-shadow-hover, 0 16px 40px rgba(15,23,42,0.13));
  transform: translateY(-2px);
}
.stat-card-clickable { cursor: pointer; }
.stat-card-clickable:hover { background: var(--fc-cream-soft, #F8FAFC); }

.stat-card-icon {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  font-size: 1.5rem;
  background: rgba(var(--user-primary-rgb, 236, 106, 74), 0.10);
  color: var(--user-primary, #EC6A4A);
}
/* ألوان المتغيّرات ترمز إلى الرموز (Phase 2): primary = العلامي المرجاني، لا النيلي */
.stat-card-primary .stat-card-icon { background: rgba(var(--n-accent-rgb), 0.1); color: var(--n-accent); }
.stat-card-success .stat-card-icon { background: rgba(var(--bs-success-rgb), 0.1); color: var(--n-success); }
.stat-card-danger .stat-card-icon { background: rgba(var(--bs-danger-rgb), 0.1); color: var(--n-danger); }
.stat-card-warning .stat-card-icon { background: rgba(var(--bs-warning-rgb), 0.1); color: var(--n-warning); }
.stat-card-info .stat-card-icon { background: rgba(var(--bs-info-rgb), 0.1); color: var(--n-info); }
.stat-card-secondary .stat-card-icon { background: rgba(var(--bs-secondary-rgb), 0.1); color: var(--bs-secondary); }
.stat-card-dark .stat-card-icon { background: rgba(var(--bs-dark-rgb), 0.1); color: var(--bs-dark); }

.stat-card-body { flex: 1; min-width: 0; }
.stat-card-label {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--fc-muted, #6B7280);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-bottom: 4px;
}
.stat-card-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--fc-ink, #15171A);
  line-height: 1.1;
  font-feature-settings: "tnum";
}
.stat-card-subtext {
  font-size: 0.7rem;
  color: var(--fc-muted, #6B7280);
  margin-top: 2px;
}
.stat-card-trend {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-top: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 6px;
}
.stat-card-trend-up { color: var(--n-success); background: rgba(var(--bs-success-rgb), 0.1); }
.stat-card-trend-down { color: var(--n-danger); background: rgba(var(--bs-danger-rgb), 0.1); }
.stat-card-trend-neutral { color: var(--bs-secondary); background: rgba(var(--bs-secondary-rgb), 0.1); }
.stat-card-trend i { font-size: 0.8rem; }
.stat-card-sparkline { width: 60px; height: 30px; flex-shrink: 0; }

/* نسق متمركز (centered) — للشبكات الكثيفة: أيقونة فوق، ثم القيمة، ثم العنوان */
.stat-card-centered {
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--n-space-xs);
  padding: var(--n-space-md);
  min-height: auto;
}
.stat-card-centered .stat-card-icon { width: 40px; height: 40px; border-radius: 12px; font-size: 1.15rem; }
.stat-card-centered .stat-card-body { display: flex; flex-direction: column; align-items: center; width: 100%; }
.stat-card-centered .stat-card-value { order: 1; font-size: 1.35rem; }
.stat-card-centered .stat-card-label {
  order: 2;
  text-transform: none;
  letter-spacing: normal;
  margin: 2px 0 0;
}
.stat-card-centered .stat-card-subtext { order: 3; }

/* نسق مقسوم (split) — النص على جهة والأيقونة على الجهة المقابلة (نمط التقارير) */
.stat-card-split { justify-content: space-between; }
.stat-card-split .stat-card-body { order: 1; }
.stat-card-split .stat-card-icon { order: 2; }
.stat-card-split .stat-card-label { text-transform: none; letter-spacing: normal; }

/* ---- section_card: ألوان أيقونة الترويسة + الوصف (Phase 2) ---- */
.sec-icon-primary   { background: var(--n-accent-soft); color: var(--n-accent); }
.sec-icon-success   { background: rgba(var(--bs-success-rgb), 0.1); color: var(--n-success); }
.sec-icon-danger    { background: rgba(var(--bs-danger-rgb), 0.1); color: var(--n-danger); }
.sec-icon-warning   { background: rgba(var(--bs-warning-rgb), 0.1); color: var(--n-warning); }
.sec-icon-info      { background: rgba(var(--bs-info-rgb), 0.1); color: var(--n-info); }
.sec-icon-secondary { background: rgba(var(--bs-secondary-rgb), 0.1); color: var(--bs-secondary); }
.sec-icon i { font-size: 1.1rem; }
.sec-subtitle { font-size: 0.72rem; color: var(--n-text-muted); margin: 0; }

/* شريط جانبي ملوّن (accent border) — يميّز البطاقة بلون حالتها */
.stat-card-accent { border-inline-start-width: 4px; border-inline-start-style: solid; }
.stat-card-accent-primary { border-inline-start-color: var(--n-accent); }
.stat-card-accent-success { border-inline-start-color: var(--n-success); }
.stat-card-accent-danger  { border-inline-start-color: var(--n-danger); }
.stat-card-accent-warning { border-inline-start-color: var(--n-warning); }
.stat-card-accent-info    { border-inline-start-color: var(--n-info); }
.stat-card-accent-secondary { border-inline-start-color: var(--bs-secondary); }
.sparkline-svg { width: 100%; height: 100%; color: var(--user-primary, #EC6A4A); }
.stat-card-footer {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 6px 1.5rem;
  background: rgba(var(--user-primary-rgb, 236, 106, 74), 0.04);
  font-size: 0.7rem;
  color: var(--fc-muted, #6B7280);
  border-top: 1px solid var(--fc-line, rgba(15,23,42,0.08));
}

/* ════════════════════════════════════════════════════════
   📊 CHART WIDGET
   ════════════════════════════════════════════════════════ */
.chart-widget {
  background: var(--fc-surface, #fff);
  border: 1px solid var(--fc-line, rgba(15,23,42,0.14));
  border-radius: var(--fc-radius-md, 16px);
  overflow: hidden;
}
.chart-widget-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--fc-line, rgba(15,23,42,0.08));
}
.chart-widget-title h6 { font-weight: 700; color: var(--fc-ink, #15171A); }
.chart-widget-actions { display: flex; align-items: center; gap: 0.5rem; }
.chart-filter-group .chart-filter-btn {
  font-size: 0.72rem;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
}
.chart-widget-body { padding: 1rem 1.25rem; }
.chart-loading {
  display: flex; align-items: center; justify-content: center;
  height: 100%; min-height: 200px;
}

/* ════════════════════════════════════════════════════════
   🗂️ FILTER BAR
   ════════════════════════════════════════════════════════ */
.filter-bar {
  background: var(--fc-surface, #fff);
  border: 1px solid var(--fc-line, rgba(15,23,42,0.14));
  border-radius: var(--fc-radius-md, 16px);
  margin-bottom: 1.5rem;
}
.filter-bar-toggle {
  display: flex; align-items: center; gap: 0.5rem;
  width: 100%;
  padding: 0.85rem 1.25rem;
  background: transparent;
  border: none;
  font-weight: 600;
  color: var(--fc-ink, #15171A);
  font-size: 0.95rem;
}
.filter-bar-toggle:hover { background: var(--fc-cream-soft, #F8FAFC); }
.filter-bar-chevron {
  margin-right: auto;
  transition: transform 0.2s;
}
.filter-bar-toggle[aria-expanded="true"] .filter-bar-chevron {
  transform: rotate(180deg);
}
.filter-bar-body {
  padding: 0 1.25rem 1.25rem 1.25rem;
  border-top: 1px solid var(--fc-line, rgba(15,23,42,0.08));
}
.filter-bar-actions {
  display: flex; gap: 0.5rem;
  margin-top: 0.5rem;
  padding-top: 1rem;
  border-top: 1px dashed var(--fc-line, rgba(15,23,42,0.14));
}

/* ════════════════════════════════════════════════════════
   💬 EMPTY STATE — Enterprise Edition v2
   
   Variants:
   - .empty-state-default   → generic no-data (database-off icon)
   - .empty-state-search    → no search results
   - .empty-state-filtered  → filters returned nothing
   - .empty-state-error     → loading/network failure
   - .empty-state-success   → all-clear / nothing pending
   
   Features:
   • Animated illustration pulsing placeholder (empty-state-fig)
   • Three-level typography (icon → title → description → suggestion)
   • Optional CTA button with icon
   • Smooth fade-in animation on mount
   • Dark mode via [data-bs-theme="dark"]
   ════════════════════════════════════════════════════════ */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 3rem 1.5rem;
  min-height: 240px;
  animation: empty-state-fadein 0.4s ease-out;
}
@keyframes empty-state-fadein {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .empty-state { animation: none; }
  @keyframes empty-state-fadein { from { opacity: 1; } to { opacity: 1; } }
}

/* ── Animated illustration placeholder ── */
.empty-state-fig {
  position: relative;
  width: 120px;
  height: 80px;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.empty-state-fig::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 32px;
  background: rgba(var(--user-primary-rgb, 236, 106, 74), 0.06);
  animation: empty-state-pulse 2.4s ease-in-out infinite;
}
@keyframes empty-state-pulse {
  0%, 100% { transform: scale(1); opacity: 0.5; }
  50%      { transform: scale(1.06); opacity: 0.85; }
}
@media (prefers-reduced-motion: reduce) {
  .empty-state-fig::before { animation: none; }
}
.empty-state-fig i {
  font-size: 3rem;
  color: var(--user-primary, #EC6A4A);
  position: relative;
  z-index: 1;
}

/* ── Icon container ── */
.empty-state-icon {
  display: flex; align-items: center; justify-content: center;
  width: 80px; height: 80px;
  border-radius: 24px;
  background: rgba(var(--user-primary-rgb, 236, 106, 74), 0.10);
  color: var(--user-primary, #EC6A4A);
  font-size: 2.5rem;
  margin-bottom: 1.25rem;
}
.empty-state-search .empty-state-icon { background: rgba(0, 207, 232, 0.10); color: #00CFE8; }
.empty-state-filtered .empty-state-icon { background: rgba(240, 169, 75, 0.10); color: #F0A94B; }
.empty-state-error .empty-state-icon { background: rgba(234, 84, 85, 0.10); color: #EA5455; }
.empty-state-success .empty-state-icon { background: rgba(40, 199, 111, 0.10); color: #28C76F; }

/* ── Typography hierarchy ── */
.empty-state-title {
  color: var(--fc-ink, #15171A);
  font-weight: 700;
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
}
.empty-state-description {
  color: var(--fc-muted, #6B7280);
  max-width: 480px;
  font-size: 0.9rem;
  line-height: 1.55;
}
.empty-state-suggestion {
  color: var(--fc-muted, #6B7280);
  font-size: 0.85rem;
  margin-top: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  justify-content: center;
}

/* ── CTA button spacing ── */
.empty-state .btn {
  margin-top: 1.25rem;
}

/* ── Dark mode ── */
[data-bs-theme="dark"] .empty-state {
  background: transparent;
}
[data-bs-theme="dark"] .empty-state-fig::before {
  background: rgba(255, 255, 255, 0.04);
}
[data-bs-theme="dark"] .empty-state-icon {
  background: rgba(255, 255, 255, 0.06);
}
[data-bs-theme="dark"] .empty-state-icon { background: rgba(255, 255, 255, 0.06); }
[data-bs-theme="dark"] .empty-state-title { color: #e0e0e0; }
[data-bs-theme="dark"] .empty-state-description { color: rgba(255, 255, 255, 0.45); }
[data-bs-theme="dark"] .empty-state-suggestion { color: rgba(255, 255, 255, 0.35); }

/* ════════════════════════════════════════════════════════
   🧭 BREADCRUMBS
   ════════════════════════════════════════════════════════ */
.breadcrumbs-nav {
  padding: 0.75rem 0;
  margin-bottom: 0.5rem;
}
.breadcrumbs-nav .breadcrumb {
  background: transparent;
  padding: 0;
  font-size: 0.85rem;
}
.breadcrumbs-nav .breadcrumb-item a {
  color: var(--fc-muted, #6B7280);
  text-decoration: none;
  transition: color 0.2s;
}
.breadcrumbs-nav .breadcrumb-item a:hover {
  color: var(--user-primary, #EC6A4A);
}
.breadcrumbs-nav .breadcrumb-item.active { color: var(--fc-ink, #15171A); font-weight: 600; }
.breadcrumbs-nav .breadcrumb-item + .breadcrumb-item::before {
  content: var(--bs-breadcrumb-divider, ">");
  color: var(--fc-muted, #6B7280);
}

/* ════════════════════════════════════════════════════════
   ⚡ ACTION MENU
   ════════════════════════════════════════════════════════ */
.action-menu-dropdown {
  min-width: 200px;
  border: 1px solid var(--fc-line, rgba(15,23,42,0.14));
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.12);
  padding: 0.5rem;
}
.action-menu-dropdown .dropdown-item {
  display: flex; align-items: center;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  font-size: 0.85rem;
  transition: all 0.15s;
}
.action-menu-dropdown .dropdown-item:hover {
  background: var(--fc-cream-soft, #F8FAFC);
  color: var(--user-primary, #EC6A4A);
}
.action-menu-dropdown .dropdown-divider {
  margin: 0.35rem 0;
  border-color: var(--fc-line, rgba(15,23,42,0.08));
}

/* ════════════════════════════════════════════════════════
   ⏳ SKELETON LOADING
   ════════════════════════════════════════════════════════ */
.skeleton-card,
.skeleton-list-item,
.skeleton-row,
.skeleton-line,
.skeleton-avatar,
.skeleton-button,
.skeleton-bar {
  background: linear-gradient(
    90deg,
    rgba(0, 0, 0, 0.04) 25%,
    rgba(0, 0, 0, 0.08) 50%,
    rgba(0, 0, 0, 0.04) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s infinite;
  border-radius: 6px;
}
@keyframes skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.skeleton-card { padding: 1rem; margin-bottom: 0.75rem; min-height: 100px; }
.skeleton-line { height: 12px; margin-bottom: 8px; }
.skeleton-line-icon { width: 40px; height: 40px; border-radius: 12px; margin-bottom: 12px; }
.skeleton-line-title { width: 60%; height: 14px; }
.skeleton-line-value { width: 40%; height: 18px; }
.skeleton-line-meta { width: 30%; height: 10px; }
.skeleton-line-text { width: 100%; height: 10px; }
.skeleton-row { height: 32px; margin-bottom: 4px; }
.skeleton-row-header { background: rgba(0,0,0,0.08); }
.skeleton-list { padding: 0.5rem 0; }
.skeleton-list-item {
  display: flex; gap: 0.75rem; padding: 0.75rem 1rem;
  align-items: center; margin-bottom: 0.5rem;
  border-radius: 8px;
}
.skeleton-avatar { width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0; }
.skeleton-list-content { flex: 1; }
.skeleton-button { width: 120px; height: 38px; border-radius: 8px; }
.skeleton-chart {
  padding: 1rem;
  background: rgba(0, 0, 0, 0.02);
  border-radius: 12px;
}
.skeleton-chart-bars {
  display: flex; align-items: flex-end; gap: 8px;
  height: 200px;
}
.skeleton-bar { width: 100%; background: rgba(0,0,0,0.08); border-radius: 4px 4px 0 0; }

/* Dark mode skeleton */
[data-bs-theme="dark"] .skeleton-card,
[data-bs-theme="dark"] .skeleton-list-item,
[data-bs-theme="dark"] .skeleton-row,
[data-bs-theme="dark"] .skeleton-line,
[data-bs-theme="dark"] .skeleton-avatar,
[data-bs-theme="dark"] .skeleton-button,
[data-bs-theme="dark"] .skeleton-bar {
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.04) 25%,
    rgba(255, 255, 255, 0.08) 50%,
    rgba(255, 255, 255, 0.04) 75%
  );
  background-size: 200% 100%;
}

/* ════════════════════════════════════════════════════════
   🧮 KPI GRID
   ════════════════════════════════════════════════════════ */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(var(--kpi-cols, 4), 1fr);
  gap: 1rem;
}
.kpi-grid-cols-2 { --kpi-cols: 2; }
.kpi-grid-cols-3 { --kpi-cols: 3; }
.kpi-grid-cols-4 { --kpi-cols: 4; }
.kpi-grid-cols-5 { --kpi-cols: 5; }
.kpi-grid-cols-6 { --kpi-cols: 6; }
.kpi-grid-gap-small { gap: 0.5rem; }
.kpi-grid-gap-default { gap: 1rem; }
.kpi-grid-gap-large { gap: 1.5rem; }
.kpi-grid-responsive { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
@media (max-width: 1199.98px) {
  .kpi-grid:not(.kpi-grid-responsive) { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 767.98px) {
  .kpi-grid:not(.kpi-grid-responsive) { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 575.98px) {
  .kpi-grid { grid-template-columns: 1fr !important; }
}

/* ════════════════════════════════════════════════════════
   📝 FORM CARD
   ════════════════════════════════════════════════════════ */
.form-card {
  background: var(--fc-surface, #fff);
  border: 1px solid var(--fc-line, rgba(15,23,42,0.14));
  border-radius: var(--fc-radius-md, 16px);
  box-shadow: var(--fc-shadow-soft, 0 8px 24px rgba(15,23,42,0.08));
}
.form-card .card-header {
  background: transparent;
  border-bottom: 1px solid var(--fc-line, rgba(15,23,42,0.08));
  padding: 1.25rem 1.5rem;
}
.form-card .card-body { padding: 1.5rem; }

/* ════════════════════════════════════════════════════════
   🏷️ BADGE
   ════════════════════════════════════════════════════════ */
.badge-dot {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  margin-left: 6px;
  vertical-align: middle;
}
.badge { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; }
.badge-sm { font-size: 0.65rem; padding: 0.2rem 0.5rem; }
.badge-lg { font-size: 0.85rem; padding: 0.4rem 0.75rem; }

/* ════════════════════════════════════════════════════════
   🪟 MODAL
   ════════════════════════════════════════════════════════ */
.modal-content {
  border: none;
  border-radius: var(--fc-radius-md, 16px);
  box-shadow: 0 24px 60px rgba(0,0,0,0.20);
}
.modal-header {
  border-bottom: 1px solid var(--fc-line, rgba(15,23,42,0.08));
  padding: 1.25rem 1.5rem;
}
.modal-title { font-weight: 700; }
.modal-body { padding: 1.5rem; }
.modal-footer {
  border-top: 1px solid var(--fc-line, rgba(15,23,42,0.08));
  padding: 1rem 1.5rem;
}
.modal-dialog-fullscreen { width: 100%; max-width: 100%; margin: 0; }

/* ════════════════════════════════════════════════════════
   🔍 SEARCH INPUT
   ════════════════════════════════════════════════════════ */
.nimrod-search .input-group-text {
  background: var(--fc-cream-soft, #F8FAFC);
  border-color: var(--fc-line, rgba(15,23,42,0.14));
  color: var(--fc-muted, #6B7280);
}
.nimrod-search-input {
  border-color: var(--fc-line, rgba(15,23,42,0.14));
}
.nimrod-search-input:focus {
  border-color: var(--user-primary, #EC6A4A);
  box-shadow: 0 0 0 0.2rem rgba(var(--user-primary-rgb, 236, 106, 74), 0.15);
}
.nimrod-search-clear { display: none; }
.nimrod-search-input:not(:placeholder-shown) ~ .nimrod-search-clear { display: inline-flex; }

/* ════════════════════════════════════════════════════════
   🔔 NOTIFICATION BELL
   ════════════════════════════════════════════════════════ */
.notification-bell .notif-panel { animation: notif-fade-in 0.2s ease-out; }
@keyframes notif-fade-in {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ════════════════════════════════════════════════════════
   RESPONSIVE
   ════════════════════════════════════════════════════════ */
@media (max-width: 575.98px) {
  .stat-card { padding: 1rem; }
  .stat-card-value { font-size: 1.25rem; }
  .stat-card-icon { width: 40px; height: 40px; font-size: 1.25rem; }
  .filter-bar-body { padding: 0 1rem 1rem 1rem; }
  .chart-widget-header { flex-direction: column; gap: 0.5rem; align-items: flex-start; }
}


/* ════════════════════════════════════════════════════════════════════════
   ⌘  COMMAND PALETTE — Phase 3
   ════════════════════════════════════════════════════════════════════════ */

.nimrod-palette-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1090;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding-top: 10vh;
  opacity: 0;
  transition: opacity 160ms ease-out;
}
.nimrod-palette-overlay.is-open {
  display: flex;
  opacity: 1;
}
.nimrod-palette {
  width: min(640px, 92vw);
  max-height: 70vh;
  background: var(--bs-body-bg, #fff);
  border: 1px solid var(--bs-border-color, rgba(0,0,0,.12));
  border-radius: 14px;
  box-shadow: 0 24px 60px rgba(0,0,0,.35), 0 4px 12px rgba(0,0,0,.18);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: inherit;
  direction: inherit;
  transform: translateY(-12px) scale(.98);
  transition: transform 160ms ease-out;
}
.nimrod-palette-overlay.is-open .nimrod-palette {
  transform: translateY(0) scale(1);
}
[data-bs-theme="dark"] .nimrod-palette {
  background: #1f1f24;
  border-color: rgba(255,255,255,.08);
}
.nimrod-palette-input-wrap {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .9rem 1.1rem;
  border-bottom: 1px solid var(--bs-border-color, rgba(0,0,0,.08));
}
.nimrod-palette-input-wrap > i {
  font-size: 1.15rem;
  color: var(--user-primary, #ec6a4a);
  flex-shrink: 0;
}
.nimrod-palette-input {
  flex: 1;
  background: transparent;
  border: 0;
  outline: 0;
  color: var(--bs-body-color, inherit);
  font-size: 1.05rem;
  padding: .25rem 0;
}
.nimrod-palette-kbd-hint {
  font-size: .72rem;
  color: var(--bs-secondary-color, #6c757d);
  background: var(--bs-secondary-bg, rgba(0,0,0,.05));
  padding: .15rem .45rem;
  border-radius: 6px;
  border: 1px solid var(--bs-border-color, rgba(0,0,0,.08));
}
.nimrod-palette-results {
  flex: 1;
  overflow-y: auto;
  padding: .35rem 0;
  min-height: 60px;
}
.nimrod-palette-section-label {
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--bs-secondary-color, #6c757d);
  padding: .6rem 1.1rem .25rem;
}
.nimrod-palette-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .55rem 1.1rem;
  cursor: pointer;
  color: var(--bs-body-color, inherit);
  text-decoration: none;
  border-left: 3px solid transparent;
  transition: background-color 90ms ease-out, border-color 90ms ease-out;
}
.nimrod-palette-item:hover,
.nimrod-palette-item.is-active {
  background: rgba(var(--user-primary-rgb, 236,106,74), .08);
  border-left-color: var(--user-primary, #ec6a4a);
}
.nimrod-palette-item-icon {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: rgba(var(--user-primary-rgb, 236,106,74), .12);
  color: var(--user-primary, #ec6a4a);
  font-size: 1.05rem;
  flex-shrink: 0;
}
.nimrod-palette-item-body {
  flex: 1;
  min-width: 0;
}
.nimrod-palette-item-title {
  font-size: .9rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nimrod-palette-item-sub {
  font-size: .72rem;
  color: var(--bs-secondary-color, #6c757d);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nimrod-palette-item-kbd {
  font-size: .68rem;
  color: var(--bs-secondary-color, #6c757d);
  background: var(--bs-secondary-bg, rgba(0,0,0,.05));
  padding: .1rem .4rem;
  border-radius: 5px;
  border: 1px solid var(--bs-border-color, rgba(0,0,0,.08));
  flex-shrink: 0;
}
.nimrod-palette-empty {
  padding: 2rem 1rem;
  text-align: center;
  color: var(--bs-secondary-color, #6c757d);
  font-size: .85rem;
}
.nimrod-palette-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .55rem 1.1rem;
  border-top: 1px solid var(--bs-border-color, rgba(0,0,0,.08));
  font-size: .72rem;
  color: var(--bs-secondary-color, #6c757d);
  background: var(--bs-tertiary-bg, rgba(0,0,0,.02));
}
.nimrod-palette-footer kbd {
  font-size: .68rem;
  background: var(--bs-body-bg, #fff);
  border: 1px solid var(--bs-border-color, rgba(0,0,0,.08));
  border-radius: 4px;
  padding: .05rem .35rem;
  margin: 0 .1rem;
}
[data-bs-theme="dark"] .nimrod-palette-footer {
  background: rgba(255,255,255,.03);
}
[data-bs-theme="dark"] .nimrod-palette-input-wrap {
  border-color: rgba(255,255,255,.08);
}
[data-bs-theme="dark"] .nimrod-palette-footer {
  border-color: rgba(255,255,255,.08);
}

/* Trigger button in navbar */
.nimrod-cmd-trigger {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .4rem .75rem;
  background: var(--bs-tertiary-bg, rgba(0,0,0,.04));
  border: 1px solid var(--bs-border-color, rgba(0,0,0,.08));
  border-radius: 8px;
  color: var(--bs-secondary-color, #6c757d);
  font-size: .8rem;
  cursor: pointer;
  transition: all 120ms ease-out;
}
.nimrod-cmd-trigger:hover {
  background: var(--bs-secondary-bg, rgba(0,0,0,.06));
  border-color: var(--user-primary, #ec6a4a);
  color: var(--bs-body-color, inherit);
}
.nimrod-cmd-trigger > i {
  font-size: .95rem;
}
.nimrod-cmd-trigger-text {
  display: inline-block;
}
.nimrod-cmd-trigger-kbd {
  font-size: .68rem;
  background: var(--bs-body-bg, #fff);
  border: 1px solid var(--bs-border-color, rgba(0,0,0,.08));
  border-radius: 4px;
  padding: .05rem .35rem;
}
[data-bs-theme="dark"] .nimrod-cmd-trigger-kbd {
  background: rgba(255,255,255,.06);
}

/* Star/bookmark toggle for sidebar items */
.nimrod-bookmark-toggle {
  background: transparent;
  border: 0;
  color: var(--bs-secondary-color, #9aa0a6);
  padding: .15rem .35rem;
  margin-inline-start: auto;
  cursor: pointer;
  border-radius: 4px;
  font-size: .9rem;
  opacity: 0;
  transition: opacity 100ms, color 100ms;
}
.menu-item:hover .nimrod-bookmark-toggle,
.nimrod-bookmark-toggle.is-on {
  opacity: 1;
}
.nimrod-bookmark-toggle.is-on,
.nimrod-bookmark-toggle:hover {
  color: #f5b400;
}

/* Mobile bottom nav (Phase 9) */
.nimrod-mobile-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bs-body-bg, #fff);
  border-top: 1px solid var(--bs-border-color, rgba(0,0,0,.08));
  z-index: 1030;
  box-shadow: 0 -4px 12px rgba(0,0,0,.06);
}
[data-bs-theme="dark"] .nimrod-mobile-nav {
  background: #1f1f24;
}
@media (max-width: 1199.98px) {
  .nimrod-mobile-nav { display: flex; }
  body { padding-bottom: 64px; }
  /* Hide sidebar on mobile, mobile-nav takes over */
  #layout-menu { display: none; }
}
.nimrod-mobile-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .15rem;
  padding: .5rem .25rem;
  color: var(--bs-secondary-color, #6c757d);
  text-decoration: none;
  font-size: .68rem;
  font-weight: 500;
  position: relative;
}
.nimrod-mobile-nav-item > i {
  font-size: 1.35rem;
}
.nimrod-mobile-nav-item.is-active {
  color: var(--user-primary, #ec6a4a);
}
.nimrod-mobile-nav-item.is-active::before {
  content: "";
  position: absolute;
  top: 0;
  inset-inline-start: 25%;
  inset-inline-end: 25%;
  height: 2px;
  background: var(--user-primary, #ec6a4a);
  border-radius: 0 0 2px 2px;
}

/* Keyboard shortcuts help modal */
.nimrod-shortcuts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: .65rem;
}
.nimrod-shortcut-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .55rem .75rem;
  background: var(--bs-tertiary-bg, rgba(0,0,0,.03));
  border: 1px solid var(--bs-border-color, rgba(0,0,0,.06));
  border-radius: 8px;
}
.nimrod-shortcut-row-label {
  font-size: .82rem;
  color: var(--bs-body-color, inherit);
}
.nimrod-shortcut-row-keys {
  display: inline-flex;
  gap: .2rem;
}
.nimrod-shortcut-row-keys kbd {
  font-size: .68rem;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  background: var(--bs-body-bg, #fff);
  border: 1px solid var(--bs-border-color, rgba(0,0,0,.1));
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: .1rem .4rem;
  min-width: 22px;
  text-align: center;
  color: var(--bs-body-color, inherit);
}
[data-bs-theme="dark"] .nimrod-shortcut-row {
  background: rgba(255,255,255,.04);
  border-color: rgba(255,255,255,.06);
}
[data-bs-theme="dark"] .nimrod-shortcut-row-keys kbd {
  background: rgba(255,255,255,.06);
  border-color: rgba(255,255,255,.1);
}

/* ================================================================
   Sidebar Section Collapse — Phase 1
   Smooth expand/collapse for multi-level menu sections
   ================================================================ */

/* Collapse trigger icon rotation */
.nimrod-section-collapse {
  transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}
.nimrod-section-collapse.is-collapsed {
  transform: rotate(-90deg);
}
[dir="rtl"] .nimrod-section-collapse.is-collapsed {
  transform: rotate(90deg);
}

/* Smooth max-height animation for menu-sub */
.menu-item[data-collapsible] > .menu-sub {
  overflow: hidden;
  transition: max-height 0.35s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.25s ease, margin 0.25s ease;
  max-height: var(--section-max-height, 800px);
  opacity: 1;
}
.menu-item[data-collapsible].is-collapsed > .menu-sub {
  max-height: 0 !important;
  opacity: 0;
  margin-top: 0 !important;
  margin-bottom: 0 !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  overflow: hidden;
}

/* ================================================================
   Dark Mode — all components
   ================================================================ */
[data-bs-theme="dark"] {
  /* stat_card */
  .stat-card { background: var(--bs-dark, #1e1e2d); border-color: rgba(255,255,255,.06); }
  .stat-card:hover { border-color: rgba(255,255,255,.12); background: rgba(255,255,255,.03); }
  .stat-card-icon { background: rgba(255,255,255,.06); }
  .stat-card-label { color: rgba(255,255,255,.55); }
  .stat-card-value { color: #fff; }
  .stat-card-subtext { color: rgba(255,255,255,.45); }
  .stat-card-trend-up { color: #34d399; }
  .stat-card-trend-down { color: #f87171; }

  /* kpi_grid */
  .kpi-grid { gap: 1rem; }

  /* filter_bar */
  .filter-bar { background: var(--bs-dark, #1e1e2d); border-color: rgba(255,255,255,.08); }
  .filter-bar .form-label { color: rgba(255,255,255,.7); }
  .filter-bar .form-select, .filter-bar .form-control {
    background: rgba(255,255,255,.05); border-color: rgba(255,255,255,.1); color: #e0e0e0;
  }
  .filter-bar .form-select:focus, .filter-bar .form-control:focus {
    background: rgba(255,255,255,.08); border-color: var(--user-primary, #EC6A4A);
  }

  /* empty_state */
  .empty-state-icon { background: rgba(255,255,255,.06); }
  .empty-state-title { color: #e0e0e0; }
  .empty-state-desc { color: rgba(255,255,255,.45); }

  /* nimrod_badge */
  .nimrod-badge { background: rgba(255,255,255,.06); color: rgba(255,255,255,.7); }
  .nimrod-badge-primary { background: rgba(var(--user-primary-rgb, 236,106,74), .15); color: var(--user-primary, #EC6A4A); }
  .nimrod-badge-success { background: rgba(52,211,153,.15); color: #34d399; }
  .nimrod-badge-warning { background: rgba(251,191,36,.15); color: #fbbf24; }
  .nimrod-badge-danger { background: rgba(248,113,113,.15); color: #f87171; }
  .nimrod-badge-info { background: rgba(56,189,248,.15); color: #38bdf8; }
  .nimrod-badge-secondary { background: rgba(255,255,255,.06); color: rgba(255,255,255,.55); }
  .nimrod-badge-dot::before { box-shadow: 0 0 0 2px var(--bs-dark, #1e1e2d); }

  /* breadcrumbs */
  .nimrod-breadcrumb { background: transparent; }
  .nimrod-breadcrumb-item { color: rgba(255,255,255,.45); }
  .nimrod-breadcrumb-item.active { color: rgba(255,255,255,.8); }
  .nimrod-breadcrumb-divider { color: rgba(255,255,255,.2); }

  /* action_menu */
  .action-menu .dropdown-toggle { background: rgba(255,255,255,.05); border-color: rgba(255,255,255,.1); color: #e0e0e0; }
  .action-menu .dropdown-menu { background: #1e1e2d; border-color: rgba(255,255,255,.08); }
  .action-menu .dropdown-item { color: #e0e0e0; }
  .action-menu .dropdown-item:hover { background: rgba(255,255,255,.05); color: #fff; }

  /* chart_widget */
  .chart-widget { background: var(--bs-dark, #1e1e2d); border-color: rgba(255,255,255,.06); }
  .chart-widget-header { border-color: rgba(255,255,255,.06); }
  .chart-widget-title h6 { color: #e0e0e0; }
  .chart-filter-btn { background: rgba(255,255,255,.05); border-color: rgba(255,255,255,.1); color: rgba(255,255,255,.6); }
  .chart-filter-btn.active, .chart-filter-btn:hover { background: var(--user-primary, #EC6A4A); border-color: var(--user-primary, #EC6A4A); color: #fff; }

  /* form_card */
  .form-card { background: var(--bs-dark, #1e1e2d); border-color: rgba(255,255,255,.06); }
  .form-card-header { border-color: rgba(255,255,255,.06); }
  .form-card-title { color: #e0e0e0; }
  .form-card .form-label { color: rgba(255,255,255,.7); }
  .form-card .form-control, .form-card .form-select {
    background: rgba(255,255,255,.05); border-color: rgba(255,255,255,.1); color: #e0e0e0;
  }

  /* notification_bell */
  .notification-bell { color: rgba(255,255,255,.7); }
  .notification-bell:hover { color: #fff; }
  .notification-badge { background: var(--user-primary, #EC6A4A); color: #fff; }

  /* search_input */
  .nimrod-search-wrap { background: rgba(255,255,255,.05); border-color: rgba(255,255,255,.1); }
  .nimrod-search-wrap:focus-within { border-color: var(--user-primary, #EC6A4A); background: rgba(255,255,255,.08); }
  .nimrod-search-input { color: #e0e0e0; }
  .nimrod-search-input::placeholder { color: rgba(255,255,255,.35); }
  .nimrod-search-icon { color: rgba(255,255,255,.4); }

  /* modal */
  .nimrod-modal .modal-content { background: #1e1e2d; border-color: rgba(255,255,255,.08); }
  .nimrod-modal .modal-header { border-color: rgba(255,255,255,.06); }
  .nimrod-modal .modal-footer { border-color: rgba(255,255,255,.06); }
  .nimrod-modal .modal-title { color: #e0e0e0; }
}

/* ================================================================
   Sidebar Collapse — Dark mode
   ================================================================ */
[data-bs-theme="dark"] .menu-item[data-collapsible] > .menu-sub {
  border-color: rgba(255,255,255,.06);
}

[data-bs-theme="dark"] .nimrod-section-collapse {
  color: rgba(255,255,255,.45);
}

/* ================================================================
   Responsive — mobile-first breakpoints
   ================================================================ */
@media (max-width: 767.98px) {
  .kpi-grid-cols-4, .kpi-grid-cols-5, .kpi-grid-cols-6 { grid-template-columns: repeat(2, 1fr); }
  .kpi-grid-cols-2, .kpi-grid-cols-3 { grid-template-columns: repeat(2, 1fr); }
  .kpi-grid-cols-1 { grid-template-columns: 1fr; }
  .filter-bar { flex-direction: column; gap: 0.5rem; }
  .filter-bar > * { width: 100%; }
  .chart-widget { min-height: 250px; }
  .nimrod-modal .modal-dialog { margin: 0.5rem; }
}
@media (max-width: 575.98px) {
  .kpi-grid-cols-2, .kpi-grid-cols-3, .kpi-grid-cols-4, .kpi-grid-cols-5, .kpi-grid-cols-6 { grid-template-columns: 1fr; }
  .stat-card { flex-direction: column; align-items: flex-start; }
  .stat-card-icon { margin-bottom: 0.5rem; }
  .empty-state { padding: 2rem 1rem; min-height: 180px; }
  .empty-state-icon { width: 60px; height: 60px; font-size: 1.8rem; }
  .empty-state-fig { width: 80px; height: 60px; }
  .empty-state-fig i { font-size: 2rem; }
}

/* ================================================================
   Print styles — hide interactive elements when printing
   ================================================================ */
@media print {
  .nimrod-palette-overlay,
  .nimrod-mobile-nav,
  .nimrod-cmd-trigger,
  .filter-bar,
  .action-menu-dropdown { display: none !important; }
}

/* ════════════════════════════════════════════════════════
   PHASE 2 COMPONENTS — page_header · alert · tabs · data_table
   ترمز إلى ‎--n-*‎ حصراً (عقد الرموز، Phase 1). بلا ألوان خام ولا تجاوزات أولوية.
   ════════════════════════════════════════════════════════ */

/* ---- page_header ---- */
.n-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--n-space-md);
  flex-wrap: wrap;
  margin-bottom: var(--n-space-lg);
}
.n-page-header-text { display: flex; align-items: center; gap: var(--n-space-sm); min-width: 0; }
.n-page-header-icon {
  flex-shrink: 0;
  width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--n-radius-sm);
  background: var(--n-accent-soft);
  color: var(--n-accent);
  font-size: 1.35rem;
}
.n-page-header-title { font-size: 1.25rem; font-weight: 700; color: var(--n-text); margin: 0; line-height: 1.2; }
.n-page-header-subtitle { font-size: 0.82rem; color: var(--n-text-muted); margin: 2px 0 0; }
.n-page-header-actions { display: flex; align-items: center; gap: var(--n-space-xs); flex-wrap: wrap; }

/* ---- alert ---- */
.n-alert {
  display: flex;
  align-items: flex-start;
  gap: var(--n-space-sm);
  padding: var(--n-space-sm) var(--n-space-md);
  border-radius: var(--n-radius-sm);
  border: 1px solid var(--n-border);
  background: var(--n-surface);
  margin-bottom: var(--n-space-md);
}
.n-alert-icon { flex-shrink: 0; font-size: 1.15rem; line-height: 1.4; }
.n-alert-body { flex: 1; min-width: 0; }
.n-alert-title { font-weight: 700; font-size: 0.9rem; color: var(--n-text); margin-bottom: 2px; }
.n-alert-message { font-size: 0.84rem; color: var(--n-text-soft); }
.n-alert-close {
  flex-shrink: 0; border: none; background: transparent;
  color: var(--n-text-muted); cursor: pointer; padding: 2px; line-height: 1;
}
.n-alert-close:hover { color: var(--n-text); }
.n-alert-primary   { border-inline-start: 3px solid var(--n-accent); }
.n-alert-primary   .n-alert-icon { color: var(--n-accent); }
.n-alert-success   { border-inline-start: 3px solid var(--n-success); }
.n-alert-success   .n-alert-icon { color: var(--n-success); }
.n-alert-danger    { border-inline-start: 3px solid var(--n-danger); }
.n-alert-danger    .n-alert-icon { color: var(--n-danger); }
.n-alert-warning   { border-inline-start: 3px solid var(--n-warning); }
.n-alert-warning   .n-alert-icon { color: var(--n-warning); }
.n-alert-info      { border-inline-start: 3px solid var(--n-info); }
.n-alert-info      .n-alert-icon { color: var(--n-info); }
.n-alert-secondary { border-inline-start: 3px solid var(--n-border-strong); }
.n-alert-secondary .n-alert-icon { color: var(--n-text-muted); }

/* ---- tabs ---- */
.n-tabs { border-bottom: 1px solid var(--n-border); gap: var(--n-space-2xs); flex-wrap: wrap; }
.n-tabs .nav-link {
  border: none; background: transparent;
  color: var(--n-text-muted); font-weight: 600; font-size: 0.86rem;
  padding: var(--n-space-xs) var(--n-space-md);
  border-bottom: 2px solid transparent;
  border-radius: var(--n-radius-sm) var(--n-radius-sm) 0 0;
  transition: color var(--n-motion-fast), border-color var(--n-motion-fast), background var(--n-motion-fast);
}
.n-tabs .nav-link:hover { color: var(--n-text); background: var(--n-bg-soft); }
.n-tabs .nav-link.active { color: var(--n-accent); border-bottom-color: var(--n-accent); background: transparent; }
.n-tabs-badge {
  display: inline-block; margin-inline-start: 6px;
  padding: 0 6px; font-size: 0.66rem; font-weight: 700; line-height: 1.5;
  border-radius: var(--n-radius-pill);
  background: var(--n-accent-soft); color: var(--n-accent);
}

/* ---- data_table ---- */
.n-table-card {
  background: var(--n-surface);
  border: 1px solid var(--n-border);
  border-radius: var(--n-radius-card);
  box-shadow: var(--n-shadow);
  overflow: hidden;
}
.n-table-head {
  display: flex; align-items: center; justify-content: space-between; gap: var(--n-space-sm);
  padding: var(--n-space-sm) var(--n-space-md);
  border-bottom: 1px solid var(--n-border);
}
.n-table-title { margin: 0; font-size: 0.92rem; font-weight: 700; color: var(--n-text); }
.n-table-toolbar { display: flex; align-items: center; gap: var(--n-space-xs); }
.n-table-scroll { overflow-x: auto; }
.n-table { margin: 0; width: 100%; }
.n-table > thead > tr > th {
  font-size: 0.74rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.3px;
  color: var(--n-text-muted); background: var(--n-bg-soft);
  white-space: nowrap; border-bottom: 1px solid var(--n-border);
}
.n-table > tbody > tr > td { font-size: 0.85rem; color: var(--n-text-soft); vertical-align: middle; }
.n-table-empty { display: flex; flex-direction: column; align-items: center; gap: var(--n-space-xs); padding: var(--n-space-xl); color: var(--n-text-muted); }
.n-table-empty i { font-size: 1.8rem; opacity: 0.6; }
