body:has(.local-dashboard-drawer) { --mud-appbar-height: 40px; }
.dashboard-appbar, .dashboard-appbar .mud-toolbar { height: 40px; min-height: 40px !important; }
.dashboard-appbar .mud-icon-button { padding: 4px; }
body:has(.local-dashboard-drawer) .dashboard-main-content { padding-top: 40px !important; height: var(--webexchanger-viewport-height, 100dvh); }
.local-dashboard-drawer { position: fixed; top: var(--mud-appbar-height, 64px); bottom: 0; right: 0; width: 240px; overflow-y: auto; background: var(--mud-palette-drawer-background, white); color: var(--mud-palette-drawer-text, #333); box-shadow: 0 2px 6px #0003; z-index: 1100; }
body:has(.local-dashboard-drawer) .dashboard-main-content { margin-right: 240px; }
body.local-drawer-closed .local-dashboard-drawer { display: none; }
body.local-drawer-closed .dashboard-main-content { margin-right: 0; }
.local-nav-group > summary, .local-nav-subgroup > summary { list-style: none; cursor: pointer; }
.local-nav-group > summary::-webkit-details-marker, .local-nav-subgroup > summary::-webkit-details-marker { display: none; }
.local-nav-group-content { position: fixed; top: var(--local-flyout-top, 72px); right: 244px; width: 224px; max-width: calc(100vw - 24px); max-height: calc(100dvh - var(--local-flyout-top, 72px) - 12px); overflow-y: auto; background: var(--mud-palette-surface, white); color: var(--mud-palette-text-primary, #333); border-radius: 6px; box-shadow: 0 5px 18px #0003; z-index: 1200; padding: 6px 0; }
.local-nav-group-content .flyout-subgroup-container { min-width: 0; }
.local-nav-group-content .local-nav-link { margin: 0; border-radius: 0; padding: 10px 18px; font-size: .875rem; }
.local-nav-group-content .flyout-subgroup-items .local-nav-link { padding-inline: 20px 10px; }
.local-nav-group-content { direction: rtl; }
.local-nav-group-content .local-nav-link, .local-nav-group-content .flyout-subgroup-header { display: flex; align-items: center; gap: 8px; text-align: right; box-sizing: border-box; }
.local-nav-group-content .local-nav-link > .mud-icon-root, .local-nav-group-content .flyout-subgroup-header > .mud-icon-root { flex: 0 0 20px; width: 20px; margin: 0 !important; }
.local-nav-group-content .local-nav-link > span:first-of-type, .local-nav-group-content .flyout-subgroup-header > span:first-of-type { flex: 1; min-width: 0; white-space: normal; overflow-wrap: anywhere; }
.local-nav-group-content .flyout-subgroup-header { padding-inline: 10px; }
.local-nav-group-content .flyout-subgroup-header > .flyout-subgroup-chevron { margin-inline-start: auto !important; }
@media (max-width: 599px) { .local-nav-group-content { right: 12px; width: calc(100vw - 24px); } }
.local-nav-link { width: 100%; border: 0; background: transparent; color: inherit; font: inherit; text-align: start; }
.local-nav-group > summary:focus-visible, .local-nav-subgroup > summary:focus-visible, .local-nav-link:focus-visible { outline: 2px solid var(--mud-palette-primary, #1976d2); outline-offset: -2px; }
.local-nav-group[open] > summary .flyout-chevron { transform: rotate(-90deg); }
.local-nav-subgroup[open] > summary .flyout-subgroup-chevron { transform: rotate(180deg); }
@media (max-width: 959px) {
    body:has(.local-dashboard-drawer) .dashboard-main-content { margin-right: 0; }
    .local-dashboard-drawer { max-width: 85vw; }
}

html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

/* ═══ Narrow popover for date-mode select ═══ */
.narrow-select-popover {
  min-width: unset !important;
  max-width: 160px !important;
  width: auto !important;
}
.narrow-select-popover .mud-list {
  min-width: unset !important;
}

/* ═══ Narrow popover for type filter ═══ */
.type-filter-popover,
.type-filter-popover.mud-popover,
.type-filter-popover > .mud-paper,
.type-filter-popover .mud-paper {
  min-width: 0 !important;
  max-width: 120px !important;
  width: 120px !important;
}
.type-filter-popover .mud-list,
.type-filter-popover .mud-select-list,
.type-filter-popover .mud-list-padding {
  min-width: 0 !important;
  max-width: 120px !important;
  width: 120px !important;
  padding: 4px 0 !important;
}
.type-filter-popover .mud-list-item {
  min-height: 32px !important;
  padding: 4px 12px !important;
}

/* Small text tabs for details dialog */
.tabs-small-text .mud-tab {
  font-size: 0.75rem !important;
  padding: 8px 12px !important;
  min-width: auto !important;
}

.tabs-small-text .mud-tabs-toolbar {
  min-height: 36px !important;
}

/* Hide scroll arrows completely */
.tabs-small-text .mud-tabs-scroll-btn {
  display: none !important;
}

/* Make tabs wrap instead of scroll */
.tabs-small-text .mud-tabs-tabbar {
  flex-wrap: wrap !important;
  overflow: visible !important;
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

body {
  position: relative;
}

/* ═══════════════════════════════════════════════════════════════
   Flyout Navigation Menu — قائمة التنقّل المنبثقة الجانبية
   ═══════════════════════════════════════════════════════════════ */

.flyout-nav-menu {
  padding: 4px 0;
  width: 100%;
}

/* ═══ عنصر قائمة رئيسي — عرض كامل بلا هوامش ═══ */
.flyout-nav-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  cursor: pointer;
  color: rgba(0, 0, 0, 0.78);
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  user-select: none;
  position: relative;
  width: 100%;
  box-sizing: border-box;
  margin: 0;
  border-radius: 0;
  border-right: 4px solid transparent;
  /* الانتقالات الشاملة */
  transition: background-color 0.25s ease,
              color 0.25s ease,
              transform 0.2s ease,
              border-color 0.25s ease,
              box-shadow 0.25s ease,
              font-size 0.2s ease,
              font-weight 0.2s ease,
              letter-spacing 0.2s ease,
              padding 0.2s ease;
}

/* ═══ أيقونة العنصر الرئيسي ═══ */
.flyout-nav-item .mud-icon-root {
  font-size: 1.35rem !important;
  color: #616161;
  transition: color 0.25s ease, transform 0.3s ease, filter 0.25s ease;
}

/* ═══════ تأثير HOVER — تمرير الماوس ═══════ */
.flyout-nav-item:hover {
  background: linear-gradient(135deg, rgba(25, 118, 210, 0.06), rgba(25, 118, 210, 0.12));
  color: #1565c0;
  border-right-color: #1976d2;
  transform: translateX(-3px);
  box-shadow: inset 0 0 0 1px rgba(25, 118, 210, 0.08),
              0 2px 8px rgba(25, 118, 210, 0.08);
  font-weight: 600;
  letter-spacing: 0.02em;
}

.flyout-nav-item:hover .mud-icon-root {
  color: #1976d2 !important;
  transform: scale(1.2);
  filter: drop-shadow(0 1px 3px rgba(25, 118, 210, 0.3));
}

/* ═══════ تأثير ACTIVE — لحظة النقر ═══════ */
.flyout-nav-item:active {
  background: linear-gradient(135deg, rgba(25, 118, 210, 0.15), rgba(25, 118, 210, 0.22)) !important;
  transform: translateX(-1px) scale(0.98);
  border-right-color: #0d47a1;
  box-shadow: inset 0 2px 6px rgba(25, 118, 210, 0.2);
  transition-duration: 0.08s;
}

.flyout-nav-item:active .mud-icon-root {
  transform: scale(0.95);
  color: #0d47a1 !important;
}

/* ═══════ العنصر النشط (التاب المفتوح حالياً) ═══════ */
.flyout-nav-active {
  background: linear-gradient(135deg, rgba(25, 118, 210, 0.1), rgba(25, 118, 210, 0.16)) !important;
  color: #0d47a1 !important;
  font-weight: 700 !important;
  font-size: 0.96rem;
  border-right-color: #1976d2 !important;
  box-shadow: inset 0 0 0 1px rgba(25, 118, 210, 0.12);
}

.flyout-nav-active .mud-icon-root {
  color: #1976d2 !important;
  transform: scale(1.1);
}

.flyout-nav-active::before {
  content: '';
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 5px;
  background: linear-gradient(to bottom, #1976d2, #0d47a1);
  border-radius: 4px 0 0 4px;
  box-shadow: -2px 0 8px rgba(25, 118, 210, 0.3);
}

/* ═══ عنصر مجموعة (له قائمة فرعية) ═══ */
.flyout-group-trigger {
  justify-content: flex-start;
}

/* سهم الانتقال الجانبي */
.flyout-chevron {
  margin-right: auto !important;
  opacity: 0.4;
  transition: opacity 0.25s ease, transform 0.3s ease, color 0.25s ease;
}

.flyout-nav-item:hover .flyout-chevron {
  opacity: 1;
  transform: translateX(-6px);
  color: #1976d2;
}

.flyout-nav-item:active .flyout-chevron {
  transform: translateX(-3px) scale(0.9);
}

/* ═══ MudMenu — عرض كامل ═══ */
.flyout-menu-wrapper {
  width: 100%;
}

.flyout-menu-wrapper .mud-menu-activator {
  width: 100%;
}

/* ═══════════════════════════════════════════════════════════════
   Sub-Group Headers — رؤوس المجموعات الفرعية (تهيئة، العمليات)
   ═══════════════════════════════════════════════════════════════ */

.flyout-subgroup-container {
  min-width: 240px;
  padding: 6px 0;
}

.flyout-subgroup-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  cursor: pointer;
  color: rgba(0, 0, 0, 0.82);
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  user-select: none;
  border-right: 3px solid transparent;
  transition: background 0.22s ease, color 0.22s ease, border-color 0.22s ease;
}

.flyout-subgroup-header:hover {
  background: linear-gradient(135deg, rgba(25, 118, 210, 0.05), rgba(25, 118, 210, 0.1));
  color: #1565c0;
  border-right-color: rgba(25, 118, 210, 0.4);
}

.flyout-subgroup-header:hover .mud-icon-root {
  color: #1976d2 !important;
}

.flyout-subgroup-expanded {
  background: linear-gradient(135deg, rgba(25, 118, 210, 0.06), rgba(25, 118, 210, 0.12));
  color: #1565c0;
  border-right-color: #1976d2;
}

.flyout-subgroup-expanded .mud-icon-root {
  color: #1976d2 !important;
}

.flyout-subgroup-chevron {
  margin-right: auto !important;
  opacity: 0.5;
  transition: opacity 0.2s ease, transform 0.25s ease;
}

.flyout-subgroup-header:hover .flyout-subgroup-chevron {
  opacity: 1;
}

.flyout-subgroup-expanded .flyout-subgroup-chevron {
  opacity: 1;
  color: #1976d2 !important;
}

.flyout-subgroup-items {
  animation: subgroup-slide-in 0.2s ease;
}

.flyout-subgroup-items .mud-menu-item {
  padding-right: 36px !important;
  font-size: 0.83rem !important;
}

@keyframes subgroup-slide-in {
  from {
    opacity: 0;
    max-height: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    max-height: 500px;
    transform: translateY(0);
  }
}

/* ═══════════════════════════════════════════════════════════════
   Flyout Popover — القائمة الفرعية المنبثقة (محسّنة)
   ═══════════════════════════════════════════════════════════════ */

/* ═══ حاوية Popover — تصميم بطاقة أنيقة ═══ */
.mud-popover.mud-popover-open {
  min-width: 290px !important;
  max-width: 340px !important;
  border-radius: 14px !important;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.18),
              0 4px 16px rgba(25, 118, 210, 0.08),
              0 0 0 1px rgba(25, 118, 210, 0.06) !important;
  overflow: hidden;
  backdrop-filter: blur(8px);
  animation: flyout-appear 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ═══ أنيميشن الظهور — انزلاق + تلاشي + تكبير ═══ */
@keyframes flyout-appear {
  0% {
    opacity: 0;
    transform: translateX(16px) scale(0.92);
    filter: blur(4px);
  }
  60% {
    opacity: 1;
    filter: blur(0);
  }
  100% {
    opacity: 1;
    transform: translateX(0) scale(1);
    filter: blur(0);
  }
}

/* ═══ قائمة داخل Popover ═══ */
.mud-popover .mud-list {
  padding: 10px 6px !important;
  background: linear-gradient(180deg, #ffffff, #fafcff);
}

/* ═══ عنصر فرعي — خط أكبر + تأثيرات مطابقة للرئيسية ═══ */
.mud-popover .mud-list .mud-list-item,
.mud-popover .mud-list-item {
  padding: 12px 18px !important;
  min-height: 46px !important;
  font-size: 0.85rem !important;
  font-weight: 500 !important;
  gap: 12px !important;
  color: rgba(0, 0, 0, 0.78) !important;
  letter-spacing: 0.01em;
  border-right: 4px solid transparent !important;
  margin: 3px 4px !important;
  border-radius: 10px !important;
  position: relative;
  overflow: hidden;
  background: transparent !important;
  /* انتقالات ناعمة شاملة — مطابقة للرئيسية */
  transition: background 0.25s ease,
              color 0.25s ease,
              transform 0.2s ease,
              border-color 0.25s ease,
              box-shadow 0.25s ease,
              font-size 0.2s ease,
              font-weight 0.2s ease,
              letter-spacing 0.2s ease,
              padding 0.2s ease !important;
}

/* ═══ خط سفلي فاصل بين العناصر ═══ */
.mud-popover .mud-list .mud-list-item:not(:last-child)::before,
.mud-popover .mud-list-item:not(:last-child)::before {
  content: '';
  position: absolute;
  bottom: -2px;
  right: 20px;
  left: 20px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(25, 118, 210, 0.08), transparent);
  pointer-events: none;
}

/* ═══════ HOVER — تمرير الماوس على العنصر الفرعي (مطابق للرئيسية) ═══════ */
.mud-popover .mud-list .mud-list-item:hover,
.mud-popover .mud-list-item:hover {
  background: linear-gradient(135deg, rgba(25, 118, 210, 0.06), rgba(25, 118, 210, 0.12)) !important;
  color: #1565c0 !important;
  font-weight: 600 !important;
  font-size: 0.87rem !important;
  letter-spacing: 0.02em;
  border-right-color: #1976d2 !important;
  transform: translateX(-5px);
  box-shadow: inset 0 0 0 1px rgba(25, 118, 210, 0.08),
              0 3px 12px rgba(25, 118, 210, 0.1) !important;
}

/* ═══════ ACTIVE — لحظة النقر (مطابق للرئيسية) ═══════ */
.mud-popover .mud-list .mud-list-item:active,
.mud-popover .mud-list-item:active {
  background: linear-gradient(135deg, rgba(25, 118, 210, 0.15), rgba(25, 118, 210, 0.22)) !important;
  transform: translateX(-1px) scale(0.98) !important;
  border-right-color: #0d47a1 !important;
  box-shadow: inset 0 2px 6px rgba(25, 118, 210, 0.2) !important;
  transition-duration: 0.08s !important;
}

/* ═══ تأثير ripple مُحسّن ═══ */
.mud-popover .mud-list .mud-list-item::after,
.mud-popover .mud-list-item::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 50%,
              rgba(25, 118, 210, 0.25) 0%,
              rgba(25, 118, 210, 0.08) 30%,
              transparent 55%);
  opacity: 0;
  transform: scale(0);
  transition: opacity 0.5s ease, transform 0.5s ease;
  pointer-events: none;
  z-index: 0;
}

.mud-popover .mud-list .mud-list-item:active::after,
.mud-popover .mud-list-item:active::after {
  opacity: 1;
  transform: scale(2.5);
  transition: opacity 0.08s, transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ═══ أيقونة العنصر الفرعي — تأثيرات محسّنة ═══ */
.mud-popover .mud-list .mud-list-item .mud-icon-root,
.mud-popover .mud-list-item .mud-icon-root {
  font-size: 1.4rem !important;
  color: #78909c !important;
  transition: color 0.3s ease,
              transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
              filter 0.3s ease !important;
  flex-shrink: 0;
}

.mud-popover .mud-list .mud-list-item:hover .mud-icon-root,
.mud-popover .mud-list-item:hover .mud-icon-root {
  color: #1976d2 !important;
  transform: scale(1.2) !important;
  filter: drop-shadow(0 1px 3px rgba(25, 118, 210, 0.3)) !important;
}

.mud-popover .mud-list .mud-list-item:active .mud-icon-root,
.mud-popover .mud-list-item:active .mud-icon-root {
  transform: scale(0.95) !important;
  color: #0d47a1 !important;
  filter: none !important;
}

/* ═══ نص العنصر الفرعي ═══ */
.mud-popover .mud-list-item .mud-list-item-text,
.mud-popover .mud-list .mud-list-item .mud-list-item-text {
  transition: transform 0.25s ease;
}

/* ═══ تصغير الخط داخل عناصر MudBlazor Typography ═══ */
.mud-popover .mud-list-item .mud-typography,
.mud-popover .mud-list-item p,
.mud-popover .mud-list .mud-list-item .mud-typography,
.mud-popover .mud-list .mud-list-item p {
  font-size: 0.85rem !important;
}

.mud-popover .mud-list-item:hover .mud-list-item-text,
.mud-popover .mud-list .mud-list-item:hover .mud-list-item-text {
  transform: translateX(-2px);
}

/* ═══════════════════════════════════════════════════════════════
   Responsive — تجاوب مع الشاشات الصغيرة
   ═══════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
  .flyout-nav-item {
    padding: 12px 14px;
    font-size: 0.88rem;
    gap: 10px;
  }

  .flyout-nav-item .mud-icon-root {
    font-size: 1.2rem !important;
  }

  .mud-popover.mud-popover-open {
    min-width: 240px !important;
    max-width: 280px !important;
  }

  .mud-popover .mud-list .mud-list-item,
  .mud-popover .mud-list-item {
    padding: 12px 14px !important;
    min-height: 44px !important;
    font-size: 0.88rem !important;
  }

  .tab-header {
    padding: 6px 6px 6px 3px;
    font-size: 0.75rem;
    max-width: 150px;
    min-width: 100px;
    flex-shrink: 0;
  }
}

@media (max-width: 480px) {
  .mud-popover.mud-popover-open {
    min-width: 200px !important;
    max-width: 250px !important;
    border-radius: 10px !important;
  }

  .mud-menu .mud-list .mud-list-item {
    padding: 10px 12px !important;
    min-height: 40px !important;
  }

  .tab-header-bar {
    padding: 0 4px;
  }

  .tab-header {
    max-width: 120px;
    min-width: 80px;
    flex-shrink: 0;
  }
}

/* ═══ لمسات — تفاعل باللمس على الأجهزة المحمولة ═══ */
@media (hover: none) {
  .flyout-nav-item:hover {
    background: transparent;
    transform: none;
    box-shadow: none;
    border-right-color: transparent;
  }

  .flyout-nav-item:active {
    background: linear-gradient(135deg, rgba(25, 118, 210, 0.12), rgba(25, 118, 210, 0.2)) !important;
    transform: scale(0.98) !important;
  }

  .mud-popover .mud-list .mud-list-item:hover,
  .mud-popover .mud-list-item:hover {
    background: transparent !important;
    transform: none;
    box-shadow: none;
    border-right-color: transparent;
  }

  .mud-popover .mud-list .mud-list-item:active,
  .mud-popover .mud-list-item:active {
    background: linear-gradient(135deg, rgba(25, 118, 210, 0.14), rgba(25, 118, 210, 0.24)) !important;
    transform: scale(0.97) !important;
  }
}

/* ═══════════════════════════════════════════════════════════════
   Tab System — نظام التبويبات المتعدد
   ═══════════════════════════════════════════════════════════════ */

.dashboard-main-content {
  display: flex;
  flex-direction: column;
  height: calc(var(--webexchanger-viewport-height, 100vh) - 64px);
  min-height: 0;
  overflow: hidden;
}

.tab-container {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

/* شريط التبويبات العلوي */
.tab-header-bar {
  display: flex;
  align-items: flex-end;
  background: linear-gradient(to bottom, #f5f5f5, #eeeeee);
  border-bottom: 2px solid #e0e0e0;
  min-height: 42px;
  overflow-x: auto;
  overflow-y: hidden;
  direction: rtl;
  padding: 0 8px;
  gap: 2px;
  flex-shrink: 0;
  scrollbar-width: thin;
}

.tab-header-bar::-webkit-scrollbar {
  height: 3px;
}

.tab-header-bar::-webkit-scrollbar-thumb {
  background: #bdbdbd;
  border-radius: 3px;
}

/* تبويب واحد */
.tab-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 8px 8px 4px;
  cursor: pointer;
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  background: transparent;
  white-space: nowrap;
  font-size: 0.8rem;
  color: #757575;
  transition: all 0.2s ease;
  position: relative;
  top: 2px;
  min-width: 120px;
  max-width: 200px;
  flex-shrink: 0;
}

.tab-header:hover {
  background: #e8e8e8;
  color: #424242;
}

/* التبويب النشط */
.tab-header.tab-active {
  background: white;
  color: #1976d2;
  border-color: #e0e0e0;
  font-weight: 600;
  box-shadow: 0 -2px 6px rgba(25, 118, 210, 0.1);
}

.tab-header.tab-active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  right: 0;
  left: 0;
  height: 2px;
  background: white;
}

.tab-header-icon {
  font-size: 1rem !important;
  flex-shrink: 0;
}

.tab-header-title {
  overflow: hidden;
  text-overflow: ellipsis;
}

/* زر إغلاق التبويب */
.tab-close-btn {
  padding: 2px !important;
  min-width: 0 !important;
  width: 20px !important;
  height: 20px !important;
  opacity: 0.4;
  transition: opacity 0.2s, color 0.2s;
  flex-shrink: 0;
}

.tab-close-btn .mud-icon-root {
  font-size: 0.85rem !important;
}

.tab-header:hover .tab-close-btn {
  opacity: 0.7;
}

.tab-close-btn:hover {
  opacity: 1 !important;
  color: #f44336 !important;
}

/* عدّاد التبويبات */
.tab-counter {
  margin-right: auto;
  padding: 6px 8px;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

/* منطقة محتوى التبويب */
.tab-content-area {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  overflow: auto;
  padding: 16px;
  background: #fafafa;
}

.tab-pane {
  min-height: 100%;
}

@media (max-width: 959px) {
  body:has(.local-dashboard-drawer) .dashboard-main-content {
    height: var(--webexchanger-viewport-height, 100dvh);
    padding-top: var(--mud-appbar-height, 64px) !important;
    width: 100%;
    min-width: 0;
  }
  .dashboard-appbar .mud-toolbar { padding-inline: 8px; gap: 4px; }
  .dashboard-user-name { margin-inline: 4px !important; max-width: 100px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .dashboard-app-title { display: none; }
  .tab-header-bar { min-height: 48px; padding-inline: 4px; overscroll-behavior-x: contain; }
  .tab-header { min-height: 44px; min-width: 110px; max-width: 180px; padding-block: 4px; }
  .tab-close-btn { width: 32px !important; height: 36px !important; opacity: 1; }
  .tab-content-area { padding: 8px; overscroll-behavior: contain; }
  .tab-counter { padding: 4px; }
  .local-dashboard-drawer { width: min(280px, 85vw); }
  .local-dashboard-drawer summary, .local-dashboard-drawer .local-nav-link { min-height: 44px; }
  .local-nav-group-content { right: 12px; width: calc(100vw - 24px); }
}

@media (max-width: 700px) {
  .tab-pane:has(.inc-entry-panel, .imp-create-panel, .dlv-entry-panel, .exp-sticky-bar, .sync-workspace, .despatch-table, .summary-table) {
    min-width: 0;
  }
  .tab-pane:has(.inc-entry-panel, .imp-create-panel, .dlv-entry-panel, .exp-sticky-bar, .sync-workspace, .despatch-table, .summary-table) :is(.mud-input.mud-input-outlined, .mud-button-root) {
    min-height: 44px !important;
    height: auto !important;
  }
  .tab-pane:has(.inc-entry-panel, .imp-create-panel, .dlv-entry-panel, .exp-sticky-bar, .sync-workspace, .despatch-table, .summary-table) .mud-input-slot {
    font-size: 16px !important;
  }
  .tab-pane:has(.inc-entry-panel, .imp-create-panel, .dlv-entry-panel, .exp-sticky-bar, .sync-workspace, .despatch-table, .summary-table) .mud-table-container {
    max-width: 100%;
    max-height: 55dvh;
    overflow: auto;
  }
  .inc-entry-grid, .imp-create-panel .imp-entry-grid, .dlv-filter-grid { grid-template-columns: minmax(0, 1fr) !important; }
  .inc-toolbar, .dlv-action-bar { flex-wrap: wrap; gap: 8px !important; }
  .exp-sticky-bar { position: static !important; padding: 8px !important; }
  .exp-sticky-bar .d-flex { flex-wrap: wrap; }
  .tab-content-area:has(.tab-pane:not([style*="none"]) .sync-workspace) { overflow: auto !important; }
  .tab-pane:has(.sync-workspace) { flex: 1 0 auto !important; }
  .sync-workspace { overflow: visible !important; flex: 1 0 auto !important; }
  .sync-workspace > .sync-results { flex: 1 0 280px !important; min-height: 280px !important; }
  .sync-filters .sync-interval { max-width: 100px; }
  .sync-filters .sync-actions { gap: 8px; }
  .sync-results .mud-table-container { max-height: 55dvh; }
}

/* حالة فارغة */
.tab-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  gap: 8px;
  text-align: center;
  flex: 1;
}

/* ═══ إخفاء السكرولبار الأفقي من القوائم المنسدلة ═══ */
.mud-autocomplete .mud-popover-provider .mud-popover,
.mud-select .mud-popover-provider .mud-popover,
.mud-popover .mud-list {
    overflow-x: hidden !important;
}

.mud-autocomplete .mud-popover.mud-popover-open,
.mud-select .mud-popover.mud-popover-open {
    max-width: none !important;
    min-width: unset !important;
}

/* ═══════════════════════════════════════════════════════
   📋 دليل الحسابات — Chart of Accounts
   ═══════════════════════════════════════════════════════ */
.coa-container {
  max-width: 1600px;
  margin: 0 auto;
}

.coa-header {
  background: linear-gradient(135deg, #f8f9ff 0%, #e8eaf6 100%) !important;
  border-right: 4px solid #1a237e;
  border-radius: 12px !important;
}

.coa-avatar {
  background: linear-gradient(135deg, #1a237e, #283593) !important;
  box-shadow: 0 4px 15px rgba(26, 35, 126, 0.3);
}

.coa-tree-panel {
  border-radius: 12px !important;
  overflow: hidden;
  min-height: 600px;
  display: flex;
  flex-direction: column;
}

.coa-tree-header {
  background: linear-gradient(135deg, #1565c0, #1976d2);
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.coa-search-field .mud-input-outlined {
  border-radius: 10px !important;
}

.coa-tree-body {
  flex: 1;
  overflow-y: auto;
  max-height: 520px;
  padding: 8px;
}

.coa-tree-body::-webkit-scrollbar {
  width: 6px;
}

.coa-tree-body::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.15);
  border-radius: 10px;
}

.coa-tree-body::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.25);
}

.coa-node {
  padding: 2px 4px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.coa-node-number {
  font-weight: 700;
  color: #1565c0;
  font-size: 0.8rem;
  min-width: 60px;
  direction: ltr;
  text-align: left;
}

.coa-node-name {
  font-weight: 500;
  color: #37474f;
  flex: 1;
}

.coa-node-parent .coa-node-name {
  font-weight: 600;
  color: #1a237e;
}

.coa-node-leaf .coa-node-name {
  font-weight: 400;
}

.coa-form-panel {
  border-radius: 12px !important;
  overflow: hidden;
}

.coa-form-header {
  background: linear-gradient(135deg, #2e7d32, #43a047);
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.coa-field .mud-input-outlined {
  border-radius: 10px !important;
}

.coa-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.coa-btn {
  border-radius: 10px !important;
  min-width: 130px;
  font-weight: 600 !important;
  letter-spacing: 0.3px;
  transition: all 0.3s ease !important;
}

.coa-btn-save {
  box-shadow: 0 4px 15px rgba(46, 125, 50, 0.3) !important;
}

.coa-btn-save:hover {
  box-shadow: 0 6px 20px rgba(46, 125, 50, 0.4) !important;
  transform: translateY(-1px);
}

.coa-btn-delete {
  box-shadow: 0 4px 15px rgba(211, 47, 47, 0.3) !important;
}

.coa-btn-delete:hover {
  box-shadow: 0 6px 20px rgba(211, 47, 47, 0.4) !important;
  transform: translateY(-1px);
}

.coa-info-field .mud-input-outlined {
  border-radius: 8px !important;
  background: #f5f5f5;
}

.coa-tree .mud-treeview-item {
  transition: all 0.15s ease;
}

.coa-tree .mud-treeview-item:hover {
  background: rgba(25, 118, 210, 0.06);
  border-radius: 6px;
}

@media (max-width: 960px) {
  .coa-tree-body {
    max-height: 350px;
  }

  .coa-actions {
    justify-content: center;
  }

  .coa-btn {
    flex: 1;
    min-width: 100px;
  }
}

.coa-table-panel {
  border-radius: 12px !important;
  overflow: hidden;
}

.coa-table-header {
  background: linear-gradient(135deg, #37474f, #455a64);
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.coa-table-search .mud-input-outlined {
  border-radius: 8px !important;
  color: white !important;
}

.coa-table-search .mud-input-outlined input {
  color: white !important;
}

.coa-table-search .mud-input-outlined input::placeholder {
  color: rgba(255, 255, 255, 0.6) !important;
}

.coa-table .mud-table-cell {
  font-size: 0.85rem;
  padding: 6px 12px !important;
}

.coa-table .mud-table-head .mud-table-cell {
  font-size: 0.85rem;
  white-space: nowrap;
}

.coa-row-main {
  background: rgba(25, 118, 210, 0.05) !important;
  font-weight: 600;
}

.coa-row-main:hover {
  background: rgba(25, 118, 210, 0.1) !important;
}