/* ==========================================================================
   Dizal - YRBSO Enterprise Theme (ثيم العطاب إكسبرس المحاسبي الموحد)
   Replicated from Al-Attab YRBSO Enterprise System:
   - Official Arabic font stack: Tahoma, Arial, Cairo, Segoe UI, sans-serif
   - Dual-Mode Engine: Desktop Multi-Column Accounting Tables & Mobile 2-Column Cards
   - Deep Marine Slate (#1e3243) header & sidebar with customizable accent color
   - Vibrant Cyan (#06b6d4) & Royal Blue (#0284c7) accents
   - Accounting table headers (#e2edf7) with solid grid borders (#d6e3ec)
   - Alternating zebra row striping (#ffffff / #f8fbfd)
   - Double Header: Master Topbar + Operational Sub-bar with live metrics
   - Mobile vertical 2-column key-value cards with dashed dividers (#e2e8f0)
   ========================================================================== */

:root {
  --yrbso-primary: #1e3243;
  --yrbso-header-bg: #1e3243;
  --yrbso-header-accent: #243f55;
  --yrbso-cyan: #06b6d4;
  --yrbso-cyan-hover: #0891b2;
  --yrbso-blue: #0284c7;
  --yrbso-blue-hover: #0369a1;
  --yrbso-red: #dc2626;
  --yrbso-gold: #f59e0b;
  --yrbso-yellow: #facc15;
  --yrbso-th-bg: #e2edf7;
  --yrbso-border: #d6e3ec;
  --yrbso-zebra-even: #ffffff;
  --yrbso-zebra-odd: #f8fbfd;
  --yrbso-submenu-bg: #f0f6fa;
  --yrbso-submenu-border: #dce8f2;
  --yrbso-submenu-active: #e0f2fe;
  --yrbso-text-main: #0f172a;
  --yrbso-text-dim: #475569;
  --yrbso-radius-sm: 4px;
  --yrbso-radius-md: 6px;
  --yrbso-topbar-height: 52px;
}

/* ==========================================================================
   1. Universal Typography Engine
   ========================================================================== */
body.theme-yrbso,
body.theme-yrbso *,
body.theme-yrbso h1,
body.theme-yrbso h2,
body.theme-yrbso h3,
body.theme-yrbso h4,
body.theme-yrbso h5,
body.theme-yrbso h6,
body.theme-yrbso p,
body.theme-yrbso span,
body.theme-yrbso div,
body.theme-yrbso a,
body.theme-yrbso button,
body.theme-yrbso input,
body.theme-yrbso select,
body.theme-yrbso textarea,
body.theme-yrbso th,
body.theme-yrbso td,
body.theme-yrbso b,
body.theme-yrbso strong,
body.theme-yrbso label,
body.theme-yrbso .nav-item,
body.theme-yrbso .nav-section-head,
body.theme-yrbso .top-user,
body.theme-yrbso .stat-card,
body.theme-yrbso .yrbso-pill {
  font-family: 'Tahoma', Arial, 'Cairo', 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif !important;
  letter-spacing: normal !important;
}

/* Scroll lock when mobile drawer is open */
html.sidebar-open-lock,
body.sidebar-open-lock {
  overflow: hidden !important;
  height: 100vh !important;
  max-height: 100vh !important;
  touch-action: none !important;
}

body.theme-yrbso {
  background-color: #f4f7f9 !important;
  color: var(--yrbso-text-main, #0f172a) !important;
  direction: rtl;
  min-height: 100vh;
}

body.theme-yrbso .app-shell {
  background-color: #f4f7f9 !important;
  display: flex !important;
  min-height: 100vh !important;
}

body.theme-yrbso .main-area {
  background-color: #f4f7f9 !important;
  flex: 1 1 auto !important;
  min-width: 0 !important;
}

body.theme-yrbso .page-wrap {
  background-color: #f4f7f9 !important;
  padding: 16px 20px !important;
}

@media (max-width: 768px) {
  body.theme-yrbso .page-wrap {
    padding: 10px !important;
  }
}

/* ==========================================================================
   2. Master Topbar Header
   ========================================================================== */
body.theme-yrbso .topbar,
body.theme-yrbso .erp-topbar {
  background: var(--yrbso-header-bg, #1e3243) !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12) !important;
  color: #ffffff !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12) !important;
  padding: 0 14px !important;
  min-height: 52px !important;
  height: 52px !important;
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  position: sticky !important;
  top: 0 !important;
  right: 0 !important;
  left: 0 !important;
  z-index: 1030 !important;
}

/* Topbar Brand Title */
body.theme-yrbso .topbar-brand {
  color: #ffffff !important;
  font-weight: 800 !important;
  font-size: 15px !important;
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  white-space: nowrap !important;
  text-decoration: none !important;
}

body.theme-yrbso .topbar-brand strong {
  color: #ffffff !important;
  font-size: 15px !important;
  font-weight: 800 !important;
}

body.theme-yrbso .topbar-right-group {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  flex-shrink: 0 !important;
}

body.theme-yrbso .topbar-center-actions {
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  flex-shrink: 0 !important;
}

body.theme-yrbso .topbar-left-group {
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
  flex-shrink: 0 !important;
}

/* Quick Action Buttons in Topbar */
body.theme-yrbso .yrbso-header-btn {
  color: #ffffff !important;
  text-decoration: none !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 4px !important;
  padding: 4px 10px !important;
  border-radius: var(--yrbso-radius-sm, 4px) !important;
  border: 1px solid transparent !important;
  white-space: nowrap !important;
  background: transparent !important;
  cursor: pointer !important;
  transition: all 0.15s ease !important;
}

body.theme-yrbso .yrbso-btn-action {
  background: rgba(255, 255, 255, 0.12) !important;
  color: var(--yrbso-yellow, #facc15) !important;
  border: 1px solid rgba(250, 204, 21, 0.4) !important;
  font-weight: 800 !important;
}

body.theme-yrbso .yrbso-btn-action:hover {
  background: rgba(255, 255, 255, 0.24) !important;
  color: #ffffff !important;
}

body.theme-yrbso .yrbso-btn-cyan {
  background: rgba(6, 182, 212, 0.18) !important;
  color: var(--yrbso-cyan, #06b6d4) !important;
  border: 1px solid rgba(6, 182, 212, 0.45) !important;
  font-weight: 800 !important;
}

body.theme-yrbso .yrbso-btn-cyan:hover {
  background: rgba(6, 182, 212, 0.3) !important;
  color: #ffffff !important;
}

/* Hamburger toggle */
body.theme-yrbso .topbar-menu-toggle {
  background: transparent !important;
  border: none !important;
  color: #ffffff !important;
  font-size: 26px !important;
  line-height: 1 !important;
  padding: 0 4px !important;
  cursor: pointer !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  outline: none !important;
  height: 38px !important;
}

/* Divider in topbar */
body.theme-yrbso .yrbso-header-divider {
  color: rgba(255, 255, 255, 0.25) !important;
  font-size: 13px !important;
  margin: 0 2px !important;
}

/* Header Live Color Circle Picker */
body.theme-yrbso .yrbso-color-picker-strip {
  display: inline-flex !important;
  align-items: center !important;
  gap: 4px !important;
}

body.theme-yrbso .yrbso-color-circle {
  width: 22px !important;
  height: 22px !important;
  padding: 0 !important;
  border: 2px solid #ffffff !important;
  border-radius: 50% !important;
  cursor: pointer !important;
  background: transparent !important;
}

body.theme-yrbso .yrbso-color-reset-btn {
  background: rgba(255, 255, 255, 0.15) !important;
  color: #ffffff !important;
  border: 1px solid rgba(255, 255, 255, 0.3) !important;
  border-radius: var(--yrbso-radius-sm, 4px) !important;
  font-size: 11px !important;
  font-weight: 700 !important;
  padding: 2px 6px !important;
  cursor: pointer !important;
}

body.theme-yrbso .yrbso-color-reset-btn:hover {
  background: rgba(255, 255, 255, 0.3) !important;
}

/* User Greeting */
body.theme-yrbso .topbar-user-greeting {
  color: #f1f5f9 !important;
  font-size: 12.5px !important;
  font-weight: 700 !important;
  white-space: nowrap !important;
}

/* Notification Bell */
body.theme-yrbso .yrbso-bell-btn {
  background: rgba(255, 255, 255, 0.1) !important;
  border: 1px solid rgba(255, 255, 255, 0.18) !important;
  color: #ffffff !important;
  border-radius: var(--yrbso-radius-sm, 4px) !important;
  padding: 4px 8px !important;
  font-size: 13px !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 4px !important;
  text-decoration: none !important;
  position: relative !important;
}

body.theme-yrbso .yrbso-bell-badge {
  background: #dc2626 !important;
  color: #ffffff !important;
  font-size: 10px !important;
  border-radius: 8px !important;
  padding: 1px 5px !important;
  font-weight: 800 !important;
}

/* Logout button */
body.theme-yrbso .yrbso-logout-btn {
  background: rgba(220, 38, 38, 0.2) !important;
  color: #fca5a5 !important;
  border: 1px solid rgba(220, 38, 38, 0.45) !important;
  border-radius: var(--yrbso-radius-sm, 4px) !important;
  padding: 3px 8px !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  cursor: pointer !important;
  white-space: nowrap !important;
}

body.theme-yrbso .yrbso-logout-btn:hover {
  background: rgba(220, 38, 38, 0.35) !important;
  color: #ffffff !important;
}

/* ==========================================================================
   3. Operational Sub-bar (#yrbsoSubbar)
   ========================================================================== */
body.theme-yrbso .yrbso-subbar {
  background: var(--yrbso-header-bg, #1e3243) !important;
  border-bottom: 2px solid var(--yrbso-cyan, #06b6d4) !important;
  padding: 6px 14px !important;
  color: #ffffff !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1) !important;
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  gap: 8px !important;
  z-index: 1025 !important;
}

body.theme-yrbso .yrbso-subbar-row {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  overflow-x: auto !important;
  white-space: nowrap !important;
  scrollbar-width: none !important;
}

body.theme-yrbso .yrbso-subbar-row::-webkit-scrollbar {
  display: none !important;
}

body.theme-yrbso .yrbso-pill {
  font-size: 11.5px !important;
  font-weight: 700 !important;
  padding: 3px 8px !important;
  background: rgba(255, 255, 255, 0.08) !important;
  border: 1px solid rgba(255, 255, 255, 0.16) !important;
  border-radius: var(--yrbso-radius-sm, 4px) !important;
  color: #ffffff !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 5px !important;
  text-decoration: none !important;
  cursor: pointer !important;
  transition: all 0.15s ease !important;
}

body.theme-yrbso .yrbso-pill:hover {
  background: rgba(255, 255, 255, 0.16) !important;
}

body.theme-yrbso .yrbso-pill.yrbso-pill-cash {
  color: #4ade80 !important;
  border-color: rgba(74, 222, 128, 0.4) !important;
  font-weight: 800 !important;
}

body.theme-yrbso .yrbso-pill.yrbso-pill-stock {
  color: var(--yrbso-cyan, #06b6d4) !important;
  border-color: rgba(6, 182, 212, 0.45) !important;
  font-weight: 800 !important;
}

body.theme-yrbso .yrbso-pill.yrbso-pill-gold {
  color: var(--yrbso-yellow, #facc15) !important;
  border-color: rgba(250, 204, 21, 0.45) !important;
  font-weight: 800 !important;
}

body.theme-yrbso .yrbso-pill.yrbso-pill-status {
  background: rgba(6, 182, 212, 0.15) !important;
  color: #e0f2fe !important;
  border: 1px solid rgba(6, 182, 212, 0.3) !important;
}

/* ==========================================================================
   4. Enterprise Sidebar
   ========================================================================== */
body.theme-yrbso .sidebar {
  background: var(--yrbso-primary, #1e3243) !important;
  border-left: 1px solid rgba(0, 0, 0, 0.2) !important;
  box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1) !important;
  z-index: 1040 !important;
}

body.theme-yrbso .sidebar-head {
  background: var(--yrbso-header-bg, #1e3243) !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
  padding: 14px 16px !important;
}

body.theme-yrbso .sidebar-head .brand-copy strong {
  color: #ffffff !important;
  font-weight: 800 !important;
}

body.theme-yrbso .sidebar-head .brand-copy small {
  color: #94a3b8 !important;
}

body.theme-yrbso .sidebar-head .brand-mark {
  background: var(--yrbso-cyan, #06b6d4) !important;
  border-radius: var(--yrbso-radius-sm, 4px) !important;
  color: #ffffff !important;
}

body.theme-yrbso .sidebar-scroll {
  padding: 0 !important;
  margin: 0 !important;
}

body.theme-yrbso .nav-section {
  border: none !important;
  border-radius: 0 !important;
  margin-bottom: 0 !important;
}

body.theme-yrbso .nav-section-head {
  background: var(--yrbso-primary, #1e3243) !important;
  color: #ffffff !important;
  font-size: 13.5px !important;
  font-weight: 700 !important;
  padding: 12px 16px !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
  border-radius: 0 !important;
  transition: background 0.15s ease !important;
  width: 100% !important;
}

body.theme-yrbso .nav-section-head span {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
}

body.theme-yrbso .nav-section-head i.bi {
  color: var(--yrbso-cyan, #06b6d4) !important;
  font-size: 15px !important;
}

body.theme-yrbso .nav-section-head .nav-chevron {
  color: var(--yrbso-cyan, #06b6d4) !important;
}

body.theme-yrbso .nav-section-head:hover {
  background: var(--yrbso-header-accent, #243f55) !important;
  color: #ffffff !important;
}

body.theme-yrbso .nav-children {
  background: var(--yrbso-submenu-bg, #f0f6fa) !important;
  border-top: 1px solid var(--yrbso-submenu-border, #dce8f2) !important;
  border-bottom: 1px solid var(--yrbso-submenu-border, #dce8f2) !important;
  padding: 0 !important;
}

body.theme-yrbso .nav-item {
  background: #ffffff !important;
  color: #1e293b !important;
  border-bottom: 1px solid #e2edf7 !important;
  margin: 0 !important;
  padding: 10px 18px !important;
  font-size: 13px !important;
  font-weight: 700 !important;
  border-radius: 0 !important;
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  text-decoration: none !important;
  transition: all 0.15s ease !important;
}

body.theme-yrbso .nav-item:hover {
  background: #edf5fb !important;
  color: var(--yrbso-blue, #0284c7) !important;
}

body.theme-yrbso .nav-item.active {
  background: var(--yrbso-submenu-active, #e0f2fe) !important;
  color: #0369a1 !important;
  font-weight: 800 !important;
  border-right: 4px solid var(--yrbso-cyan, #06b6d4) !important;
}

body.theme-yrbso .sidebar-account {
  background: var(--yrbso-primary, #1e3243) !important;
  border-top: 1px solid rgba(255, 255, 255, 0.1) !important;
  color: #f1f5f9 !important;
  font-weight: 700 !important;
}

body.theme-yrbso .sidebar-logout {
  background: var(--yrbso-primary, #1e3243) !important;
  border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
}

body.theme-yrbso .sidebar-logout button {
  background: rgba(220, 38, 38, 0.18) !important;
  color: #fca5a5 !important;
  border: 1px solid rgba(220, 38, 38, 0.35) !important;
  border-radius: var(--yrbso-radius-sm, 4px) !important;
  font-weight: 700 !important;
}

body.theme-yrbso .sidebar-credit {
  background: #162736 !important;
  border-top: 1px solid rgba(255, 255, 255, 0.06) !important;
  color: #94a3b8 !important;
}

body.theme-yrbso .sidebar-credit strong {
  color: #ffffff !important;
}

/* ==========================================================================
   5. Accounting Multi-Column Tables (Desktop >= 769px)
   ========================================================================== */
body.theme-yrbso .table,
body.theme-yrbso table.table,
body.theme-yrbso .erp-table {
  background: #ffffff !important;
  border-collapse: collapse !important;
  border: 1px solid var(--yrbso-border, #d6e3ec) !important;
  width: 100% !important;
  font-size: 13px !important;
}

body.theme-yrbso .table th,
body.theme-yrbso table.table th,
body.theme-yrbso .erp-table th {
  background: var(--yrbso-th-bg, #e2edf7) !important;
  color: #1e293b !important;
  font-weight: 800 !important;
  border: 1px solid var(--yrbso-border, #d6e3ec) !important;
  padding: 10px 12px !important;
  text-align: right !important;
  font-size: 13px !important;
  white-space: nowrap !important;
}

body.theme-yrbso .table td,
body.theme-yrbso table.table td,
body.theme-yrbso .erp-table td {
  border: 1px solid var(--yrbso-border, #d6e3ec) !important;
  color: #0f172a !important;
  padding: 8px 12px !important;
  vertical-align: middle !important;
  font-size: 13px !important;
}

/* Alternating Row Striping (Zebra) */
body.theme-yrbso .table tbody tr:nth-child(even),
body.theme-yrbso table.table tbody tr:nth-child(even) {
  background-color: var(--yrbso-zebra-even, #ffffff) !important;
}

body.theme-yrbso .table tbody tr:nth-child(odd),
body.theme-yrbso table.table tbody tr:nth-child(odd) {
  background-color: var(--yrbso-zebra-odd, #f8fbfd) !important;
}

body.theme-yrbso .table tbody tr:hover,
body.theme-yrbso table.table tbody tr:hover {
  background-color: #edf5fb !important;
}

/* ==========================================================================
   6. Mobile Table-to-Card Responsive Engine (Screens <= 768px)
   ========================================================================== */
@media (max-width: 768px) {
  body.theme-yrbso .desktop-only {
    display: none !important;
  }
  body.theme-yrbso .mobile-only {
    display: inline-flex !important;
  }

  body.theme-yrbso .table-responsive:not(.table-no-card),
  body.theme-yrbso table.table:not(.table-no-card) {
    display: block !important;
    width: 100% !important;
    border: none !important;
    background: transparent !important;
  }

  body.theme-yrbso .table-responsive:not(.table-no-card) thead,
  body.theme-yrbso table.table:not(.table-no-card) thead {
    display: none !important;
  }

  body.theme-yrbso .table-responsive:not(.table-no-card) tbody,
  body.theme-yrbso table.table:not(.table-no-card) tbody {
    display: block !important;
    width: 100% !important;
  }

  body.theme-yrbso .table-responsive:not(.table-no-card) tbody tr,
  body.theme-yrbso table.table:not(.table-no-card) tbody tr {
    display: block !important;
    width: 100% !important;
    background: #ffffff !important;
    border: 1px solid var(--yrbso-border, #d6e3ec) !important;
    border-radius: var(--yrbso-radius-md, 6px) !important;
    margin-bottom: 12px !important;
    padding: 10px 14px !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04) !important;
  }

  body.theme-yrbso .table-responsive:not(.table-no-card) tbody td,
  body.theme-yrbso table.table:not(.table-no-card) tbody td {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding: 8px 4px !important;
    border: none !important;
    border-bottom: 1px dashed #e2e8f0 !important;
    font-size: 13px !important;
    text-align: left !important;
  }

  body.theme-yrbso .table-responsive:not(.table-no-card) tbody td:last-child,
  body.theme-yrbso table.table:not(.table-no-card) tbody td:last-child {
    border-bottom: none !important;
  }

  body.theme-yrbso .table-responsive:not(.table-no-card) tbody td::before,
  body.theme-yrbso table.table:not(.table-no-card) tbody td::before {
    content: attr(data-label);
    font-weight: 700 !important;
    color: var(--yrbso-text-dim, #475569) !important;
    font-size: 12.5px !important;
    text-align: right !important;
    margin-left: 12px !important;
    flex-shrink: 0 !important;
  }
}

@media (min-width: 769px) {
  body.theme-yrbso .desktop-only {
    display: inline-flex !important;
  }
  body.theme-yrbso .mobile-only {
    display: none !important;
  }
}

/* ==========================================================================
   7. Stat Cards, Metric Panels & Form Controls
   ========================================================================== */
body.theme-yrbso .card,
body.theme-yrbso .stat-card,
body.theme-yrbso .card-form,
body.theme-yrbso .info-card,
body.theme-yrbso .document-card,
body.theme-yrbso .dashboard-kpi {
  background: #ffffff !important;
  border: 1px solid var(--yrbso-border, #d6e3ec) !important;
  border-radius: var(--yrbso-radius-md, 6px) !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04) !important;
}

body.theme-yrbso .form-control,
body.theme-yrbso .form-select {
  border: 1px solid var(--yrbso-border, #d6e3ec) !important;
  border-radius: var(--yrbso-radius-sm, 4px) !important;
  font-size: 13px !important;
}

body.theme-yrbso .form-control:focus,
body.theme-yrbso .form-select:focus {
  border-color: var(--yrbso-blue, #0284c7) !important;
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15) !important;
}

body.theme-yrbso .btn-primary {
  background-color: var(--yrbso-blue, #0284c7) !important;
  border-color: var(--yrbso-blue, #0284c7) !important;
  border-radius: var(--yrbso-radius-sm, 4px) !important;
  font-weight: 700 !important;
}

body.theme-yrbso .btn-primary:hover {
  background-color: var(--yrbso-blue-hover, #0369a1) !important;
  border-color: var(--yrbso-blue-hover, #0369a1) !important;
}

/* ==========================================================================
   8. Drawer & Scrim Responsiveness
   ========================================================================== */
@media (max-width: 991px) {
  body.theme-yrbso .sidebar {
    position: fixed !important;
    top: 0 !important;
    bottom: 0 !important;
    right: 0 !important;
    width: 285px !important;
    max-width: 85vw !important;
    transform: translateX(105%) !important;
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1) !important;
    visibility: hidden !important;
    z-index: 1050 !important;
  }
  body.theme-yrbso .sidebar.open {
    transform: translateX(0) !important;
    visibility: visible !important;
  }
  body.theme-yrbso .main-area {
    margin-right: 0 !important;
    width: 100% !important;
  }
  body.theme-yrbso .scrim {
    position: fixed !important;
    top: 0 !important;
    bottom: 0 !important;
    right: 0 !important;
    left: 0 !important;
    background: rgba(15, 23, 42, 0.45) !important;
    backdrop-filter: blur(2px) !important;
    -webkit-backdrop-filter: blur(2px) !important;
    z-index: 1045 !important;
  }
}
@media (min-width: 992px) {
  body.theme-yrbso .sidebar {
    transform: translateX(0) !important;
    visibility: visible !important;
  }
  body.theme-yrbso .main-area {
    margin-right: 285px !important;
  }
}
