/* ════════════════════════════════════════════════════════════════════════════
   MGIoT Dashboard — Unified Design System v1.0
   Approved UX/UI specification — RTL Arabic ERP professional layout
   Brand: #0B5CA8 | Background: #F6F8FB | White cards | Rounded corners
   ════════════════════════════════════════════════════════════════════════════ */

/* ─── Override brand tokens to approved values ─────────────────────────── */
:root {
  --mg-brand:        #0B5CA8;
  --mg-brand-dark:   #094D8D;
  --mg-brand-hover:  #094D8D;
  --mg-brand-active: #083D70;
  --mg-brand-50:     #EBF3FB;
  --mg-brand-100:    #D0E5F5;
  --mg-brand-200:    #A1CAE9;

  --primary:        #0B5CA8;
  --primary-hover:  #094D8D;
  --primary-active: #083D70;
  --primary-50:     #EBF3FB;
  --primary-100:    #D0E5F5;

  /* Page background */
  --page-bg: #F6F8FB;

  /* Sidebar */
  --sidebar-w: 286px;
  --sidebar-w-sm: 72px;

  /* Card */
  --card-radius: 20px;
  --card-shadow: 0 1px 4px rgba(15,23,42,.06);
  --card-border: #E2E8F0;
}

/* ─── Page background ──────────────────────────────────────────────────── */
body {
  background: var(--page-bg) !important;
  font-family: 'Cairo', 'Segoe UI', Tahoma, sans-serif;
}

/* ─── App layout (RTL fixed sidebar) ──────────────────────────────────── */
.app-page.active {
  display: block !important;
  min-height: 100vh;
}

/* ─── SIDEBAR ──────────────────────────────────────────────────────────── */
html[dir="rtl"] .app-page.active > .sidebar {
  position: fixed !important;
  top: 0; right: 0; left: auto;
  width: var(--sidebar-w) !important;
  height: 100vh;
  z-index: 40;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
html[dir="rtl"] .app-page.active > .main {
  margin-right: var(--sidebar-w) !important;
  margin-left: 0 !important;
  width: calc(100% - var(--sidebar-w)) !important;
  min-height: 100vh;
  background: var(--page-bg);
}

/* Sidebar base */
.sidebar {
  background: #fff !important;
  border-left: 1px solid #E2E8F0 !important;
  border-right: none !important;
  border-inline-end: 1px solid #E2E8F0 !important;
  width: var(--sidebar-w) !important;
  box-shadow: -2px 0 12px rgba(11,92,168,.05) !important;
}

/* Sidebar header */
.sidebar-header {
  padding: 18px 16px 14px !important;
  border-bottom: 1px solid #F1F5F9 !important;
  background: #fff;
  flex-wrap: nowrap !important;
  gap: 10px !important;
  align-items: center !important;
  flex-shrink: 0;
}
.sidebar-logo-box {
  width: 48px !important; height: 48px !important;
  background: #EBF3FB !important;
  border-radius: 14px !important;
  padding: 8px !important;
  flex-shrink: 0;
}
.sidebar-header h2 {
  font-size: 18px !important;
  font-weight: 900 !important;
  color: #0B5CA8 !important;
  letter-spacing: 0 !important;
  margin: 0 !important;
}
.sidebar-header p {
  font-size: 11px !important;
  color: #94A3B8 !important;
  margin: 0 !important;
  flex-basis: auto !important;
}

/* Sidebar nav scroll area */
.sidebar-nav {
  flex: 1 !important;
  overflow-y: auto !important;
  padding: 12px 10px !important;
  gap: 4px !important;
  scrollbar-width: thin;
  scrollbar-color: #E2E8F0 transparent;
}

/* ── Section headers (accordion toggle buttons) ── */
.nav-section-hdr {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px !important;
  border-radius: 14px !important;
  font-size: 13px !important;
  font-weight: 800 !important;
  color: #475569 !important;
  cursor: pointer;
  user-select: none;
  transition: background 150ms ease, color 150ms ease;
  width: 100%;
  text-align: right;
}
.nav-section-hdr:hover {
  background: #F8FAFC !important;
  color: #334155 !important;
}

/* Active section header */
.nav-section:not(.collapsed) > .nav-section-hdr {
  background: #0B5CA8 !important;
  color: #fff !important;
  box-shadow: 0 2px 8px rgba(11,92,168,.18) !important;
}

/* Section icon inside header */
.nav-section-hdr .section-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  flex-shrink: 0;
  background: #F1F5F9;
  color: #64748B;
  transition: background 150ms, color 150ms;
}
.nav-section:not(.collapsed) > .nav-section-hdr .section-icon {
  background: rgba(255,255,255,.18) !important;
  color: #fff !important;
}

/* Section label */
.nav-section-hdr .section-label {
  flex: 1;
  font-size: 13px;
  font-weight: 800;
}

/* Arrow */
.nav-section-hdr .section-arrow {
  font-size: 11px !important;
  width: 18px !important;
  text-align: center;
  flex-shrink: 0;
  transition: transform 200ms ease;
  color: currentColor;
  opacity: .7;
}
html[dir="rtl"] .nav-section .nav-section-hdr .section-arrow { transform: rotate(90deg) !important; }
html[dir="rtl"] .nav-section:not(.collapsed) .nav-section-hdr .section-arrow { transform: rotate(0deg) !important; }

/* Section body */
.nav-section-body {
  margin-top: 4px;
  padding: 6px 8px 6px 8px;
  border-radius: 16px;
  border-right: 4px solid #0B5CA8;
  background: #EBF3FB;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
html[dir="ltr"] .nav-section-body { border-right: none; border-left: 4px solid #0B5CA8; }

/* Nav items inside section */
.nav-section-body .nav-item {
  padding: 10px 12px !important;
  border-radius: 12px !important;
  font-size: 13px !important;
  font-weight: 700 !important;
  color: #475569 !important;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  transition: background 120ms, color 120ms;
}
.nav-section-body .nav-item:hover {
  background: rgba(255,255,255,.75) !important;
  color: #0B5CA8 !important;
}
.nav-section-body .nav-item.active {
  background: #0B5CA8 !important;
  color: #fff !important;
  font-weight: 800 !important;
  box-shadow: 0 2px 6px rgba(11,92,168,.18) !important;
}
.nav-section-body .nav-item.active::before { display: none !important; }

/* Nav item icon */
.nav-section-body .nav-item .nav-item-icon {
  width: 32px; height: 32px;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  background: rgba(255,255,255,.7);
  color: #64748B;
  transition: background 120ms, color 120ms;
}
.nav-section-body .nav-item.active .nav-item-icon {
  background: rgba(255,255,255,.18) !important;
  color: #fff !important;
}

/* Top-level nav item (رئيسية) */
.nav-top-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  font-size: 13px;
  font-weight: 800;
  color: #475569;
  cursor: pointer;
  user-select: none;
  transition: background 120ms, color 120ms;
  width: 100%;
  text-align: right;
}
.nav-top-item:hover { background: #F1F5F9; color: #0B5CA8; }
.nav-top-item.active {
  background: #0B5CA8;
  color: #fff;
  box-shadow: 0 2px 8px rgba(11,92,168,.18);
}
.nav-top-item .section-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  background: #F1F5F9;
  color: #64748B;
  flex-shrink: 0;
}
.nav-top-item.active .section-icon {
  background: rgba(255,255,255,.18);
  color: #fff;
}

/* Sidebar footer */
.sidebar-footer {
  border-top: 1px solid #F1F5F9 !important;
  padding: 12px !important;
  flex-shrink: 0;
}
.footer-brand {
  background: #F8FAFC !important;
  border: 1px solid #E2E8F0 !important;
  border-radius: 14px !important;
  padding: 10px 12px !important;
  gap: 10px !important;
}
.footer-brand .footer-logout {
  border-radius: 10px !important;
}

/* Sidebar backdrop (mobile) */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.35);
  z-index: 38;
  backdrop-filter: blur(2px);
}
body.sidebar-open .sidebar-backdrop { display: block; }

/* Mobile sidebar */
@media (max-width: 900px) {
  html[dir="rtl"] .app-page.active > .sidebar {
    transform: translateX(105%) !important;
    transition: transform 300ms cubic-bezier(.4,0,.2,1);
  }
  body.sidebar-open .app-page.active > .sidebar {
    transform: translateX(0) !important;
  }
  html[dir="rtl"] .app-page.active > .main {
    margin-right: 0 !important;
    width: 100% !important;
  }
}

/* ─── MAIN AREA ────────────────────────────────────────────────────────── */
.main {
  padding: 0 !important;
  background: var(--page-bg) !important;
}

/* Sticky top header bar */
.main-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255,255,255,.88) !important;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid #E2E8F0 !important;
  padding: 14px 28px !important;
  margin-bottom: 0 !important;
}
.main-header h1 {
  font-size: 22px !important;
  font-weight: 900 !important;
  color: #0B5CA8 !important;
}
.main-header p {
  font-size: 12px !important;
  color: #94A3B8 !important;
}

/* Content scroll area */
.main > .view.active,
.main > section.view.active {
  padding: 24px 28px 40px !important;
}
@media (max-width: 768px) {
  .main > .view.active { padding: 16px !important; }
  .main-header { padding: 12px 16px !important; }
}

/* ─── PAGE LAYOUT ──────────────────────────────────────────────────────── */
.mg-page { gap: 20px !important; }

/* ─── KPI / STAT CARDS ─────────────────────────────────────────────────── */
.mg-stat {
  background: #fff !important;
  border: 1px solid #E2E8F0 !important;
  border-radius: 20px !important;
  box-shadow: var(--card-shadow) !important;
  padding: 20px !important;
}
.mg-stat::before {
  display: none !important; /* remove old left stripe */
}
.mg-stat-grid { gap: 14px !important; }
.mg-stat-value {
  font-size: 26px !important;
  font-weight: 900 !important;
  color: #0F172A !important;
  text-align: inherit !important;
}
.mg-stat-label {
  font-size: 12px !important;
  font-weight: 700 !important;
  color: #64748B !important;
  margin-top: 8px !important;
}

/* ─── CARDS ─────────────────────────────────────────────────────────────── */
.mg-card {
  background: #fff !important;
  border: 1px solid #E2E8F0 !important;
  border-radius: 20px !important;
  box-shadow: var(--card-shadow) !important;
  padding: 20px !important;
}
.mg-card-title { font-size: 15px !important; font-weight: 900 !important; }
.mg-card-head { margin-bottom: 16px !important; }

/* ─── TABLES ─────────────────────────────────────────────────────────────── */
.mg-table-wrap {
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid #E2E8F0;
}
.mg-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  background: #fff;
}
.mg-table thead tr {
  background: #F8FAFC !important;
}
.mg-table thead th {
  padding: 12px 16px !important;
  font-size: 11px !important;
  font-weight: 800 !important;
  color: #64748B !important;
  text-transform: uppercase;
  letter-spacing: .4px;
  border-bottom: 1px solid #E2E8F0;
  white-space: nowrap;
}
.mg-table tbody tr {
  border-bottom: 1px solid #F1F5F9;
  transition: background 120ms;
}
.mg-table tbody tr:last-child { border-bottom: none; }
.mg-table tbody tr:hover { background: rgba(11,92,168,.03) !important; }
.mg-table tbody td {
  padding: 12px 16px !important;
  color: #334155;
  vertical-align: middle;
}
.mg-table .mg-cell-strong { font-weight: 800; color: #0F172A; }

/* ─── STATUS BADGES ─────────────────────────────────────────────────────── */
.mg-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  border: 1px solid transparent;
  white-space: nowrap;
}
.mg-badge--success {
  background: #ECFDF5 !important;
  color: #047857 !important;
  border-color: #A7F3D0 !important;
}
.mg-badge--warn {
  background: #FFFBEB !important;
  color: #B45309 !important;
  border-color: #FDE68A !important;
}
.mg-badge--danger {
  background: #FFF1F2 !important;
  color: #BE123C !important;
  border-color: #FECDD3 !important;
}
.mg-badge--info {
  background: #EFF6FF !important;
  color: #1D4ED8 !important;
  border-color: #BFDBFE !important;
}
.mg-badge--neutral {
  background: #F8FAFC !important;
  color: #475569 !important;
  border-color: #E2E8F0 !important;
}
/* Legacy badge classes (keep working) */
.badge { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 800; border: 1px solid transparent; }
.badge-green  { background: #ECFDF5; color: #047857; border-color: #A7F3D0; }
.badge-blue   { background: #EFF6FF; color: #1D4ED8; border-color: #BFDBFE; }
.badge-orange { background: #FFFBEB; color: #B45309; border-color: #FDE68A; }
.badge-red    { background: #FFF1F2; color: #BE123C; border-color: #FECDD3; }

/* ─── BUTTONS ────────────────────────────────────────────────────────────── */
.mg-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 700;
  border: 1px solid #E2E8F0;
  background: #fff;
  color: #334155;
  cursor: pointer;
  transition: background 120ms, border-color 120ms, color 120ms, box-shadow 120ms;
  font-family: inherit;
  white-space: nowrap;
}
.mg-btn:hover { background: #F8FAFC; border-color: #CBD5E1; }
.mg-btn--primary {
  background: #0B5CA8 !important;
  color: #fff !important;
  border-color: #0B5CA8 !important;
}
.mg-btn--primary:hover { background: #094D8D !important; border-color: #094D8D !important; box-shadow: 0 4px 12px rgba(11,92,168,.22) !important; }
.mg-btn--danger {
  background: #FFF1F2 !important;
  color: #BE123C !important;
  border-color: #FECDD3 !important;
}
.mg-btn--danger:hover { background: #EF4444 !important; color: #fff !important; border-color: #EF4444 !important; }
.mg-btn--success {
  background: #ECFDF5 !important;
  color: #047857 !important;
  border-color: #A7F3D0 !important;
}
.mg-btn--success:hover { background: #10B981 !important; color: #fff !important; border-color: #10B981 !important; }

/* Legacy btn classes */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: 12px; font-size: 13px; font-weight: 700; border: 1px solid #E2E8F0; background: #fff; color: #334155; cursor: pointer; font-family: inherit; transition: background 120ms, border-color 120ms; }
.btn-primary   { background: #0B5CA8 !important; color: #fff !important; border-color: #0B5CA8 !important; }
.btn-primary:hover { background: #094D8D !important; }
.btn-success   { background: #ECFDF5 !important; color: #047857 !important; border-color: #A7F3D0 !important; }
.btn-success:hover { background: #10B981 !important; color: #fff !important; }
.btn-danger    { background: #FFF1F2 !important; color: #BE123C !important; border-color: #FECDD3 !important; }
.btn-danger:hover { background: #EF4444 !important; color: #fff !important; }
.btn-secondary { background: #F8FAFC !important; color: #475569 !important; border-color: #E2E8F0 !important; }
.btn-sm { padding: 5px 12px !important; font-size: 12px !important; border-radius: 8px !important; }

/* ─── SEARCH / FILTER BAR ────────────────────────────────────────────────── */
.mg-toolbar {
  background: #fff;
  border: 1px solid #E2E8F0;
  border-radius: 16px;
  padding: 12px 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  box-shadow: var(--card-shadow);
}
.mg-search {
  position: relative;
  flex: 1;
  min-width: 200px;
  display: flex;
  align-items: center;
}
.mg-search-icon {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: #94A3B8;
  font-size: 17px;
  pointer-events: none;
}
html[dir="ltr"] .mg-search-icon { right: auto; left: 14px; }
.mg-search-input {
  width: 100%;
  height: 40px;
  padding: 0 42px 0 14px;
  border: 1px solid #E2E8F0;
  border-radius: 12px;
  background: #F8FAFC;
  font-size: 13px;
  font-family: inherit;
  color: #0F172A;
  outline: none;
  transition: border-color 150ms, background 150ms, box-shadow 150ms;
}
html[dir="ltr"] .mg-search-input { padding: 0 14px 0 42px; }
.mg-search-input:focus { border-color: #0B5CA8; background: #fff; box-shadow: 0 0 0 3px rgba(11,92,168,.1); }
.mg-select {
  height: 40px;
  padding: 0 14px;
  border: 1px solid #E2E8F0;
  border-radius: 12px;
  background: #F8FAFC;
  font-size: 13px;
  font-family: inherit;
  color: #334155;
  font-weight: 700;
  outline: none;
  cursor: pointer;
  transition: border-color 150ms;
}
.mg-select:focus { border-color: #0B5CA8; box-shadow: 0 0 0 3px rgba(11,92,168,.1); }

/* ─── MODALS ─────────────────────────────────────────────────────────────── */
.modal-bg {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.45);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(3px);
}
.modal-bg:not(.show) { display: none !important; }
.modal-card {
  background: #fff;
  border: 1px solid #E2E8F0;
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(15,23,42,.14);
  width: 100%;
  max-height: 88vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.modal-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px 14px;
  border-bottom: 1px solid #F1F5F9;
  flex-shrink: 0;
}
.modal-hd h3 {
  font-size: 15px;
  font-weight: 900;
  color: #0F172A;
  margin: 0;
}
.modal-x {
  width: 34px; height: 34px;
  border-radius: 10px;
  border: 1px solid #E2E8F0;
  background: #F8FAFC;
  color: #64748B;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: background 120ms, color 120ms;
}
.modal-x:hover { background: #FFF1F2; color: #BE123C; border-color: #FECDD3; }
.modal-body {
  padding: 18px 22px 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Form rows in modals */
.form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.form-row input,
.form-row select,
.form-row textarea {
  flex: 1;
  min-width: 120px;
}
.modal-lbl {
  font-size: 11px;
  font-weight: 800;
  color: #64748B;
  margin-bottom: 4px;
  display: block;
}
.modal-body input,
.modal-body select,
.modal-body textarea {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 1px solid #E2E8F0;
  border-radius: 12px;
  font-size: 13px;
  font-family: inherit;
  color: #0F172A;
  background: #F8FAFC;
  outline: none;
  transition: border-color 150ms, background 150ms, box-shadow 150ms;
}
.modal-body textarea { height: auto; padding: 10px 12px; }
.modal-body input:focus,
.modal-body select:focus,
.modal-body textarea:focus {
  border-color: #0B5CA8;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(11,92,168,.1);
}
.modal-body .btn,
.modal-body .mg-btn {
  margin-top: 4px;
}
/* Quote modal inputs keep quote-input style */
.quote-input {
  flex: 1;
  height: 40px;
  padding: 0 12px;
  border: 1px solid #E2E8F0;
  border-radius: 12px;
  font-size: 13px;
  font-family: inherit;
  color: #0F172A;
  background: #F8FAFC;
  outline: none;
  transition: border-color 150ms, background 150ms, box-shadow 150ms;
  width: 100%;
}
.quote-input:focus { border-color: #0B5CA8; background: #fff; box-shadow: 0 0 0 3px rgba(11,92,168,.1); }
.quote-select {
  height: 40px;
  padding: 0 12px;
  border: 1px solid #E2E8F0;
  border-radius: 12px;
  font-size: 13px;
  font-family: inherit;
  color: #334155;
  font-weight: 700;
  background: #F8FAFC;
  outline: none;
  width: 100%;
  cursor: pointer;
}
.quote-select:focus { border-color: #0B5CA8; box-shadow: 0 0 0 3px rgba(11,92,168,.1); }
.quote-field-row { display: flex; flex-direction: column; gap: 4px; }
.quote-label { font-size: 11px; font-weight: 800; color: #64748B; }
.quote-divider { border: none; border-top: 1px solid #F1F5F9; margin: 4px 0; }

/* ─── EMPTY STATE ─────────────────────────────────────────────────────────── */
.mg-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
  gap: 10px;
}
.mg-empty-icon { font-size: 40px; opacity: .5; }
.mg-empty-title { font-size: 15px; font-weight: 800; color: #334155; }
.mg-empty-text { font-size: 13px; color: #94A3B8; max-width: 320px; line-height: 1.6; }

/* ─── LOADING ──────────────────────────────────────────────────────────────── */
.mg-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  font-size: 14px;
  color: #94A3B8;
  font-weight: 700;
}
.mg-error {
  padding: 16px;
  background: #FFF1F2;
  border: 1px solid #FECDD3;
  border-radius: 12px;
  color: #BE123C;
  font-size: 13px;
  font-weight: 700;
}

/* ─── ROW CARDS (products, etc.) ─────────────────────────────────────────── */
.mg-row-card {
  background: #fff;
  border: 1px solid #E2E8F0;
  border-radius: 16px;
  padding: 16px;
  box-shadow: var(--card-shadow);
  transition: box-shadow 150ms;
}
.mg-row-card:hover { box-shadow: 0 4px 12px rgba(11,92,168,.08); }
.mg-row-card-title { font-size: 14px; font-weight: 900; color: #0F172A; }
.mg-row-card-sub { font-size: 12px; color: #94A3B8; margin-top: 2px; }

/* ─── INFO BOXES (overview financial) ────────────────────────────────────── */
.mg-info-box {
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 12px;
  padding: 14px;
}
.mg-info-label { font-size: 11px; font-weight: 700; color: #94A3B8; }
.mg-info-value { font-size: 18px; font-weight: 900; color: #0F172A; margin-top: 4px; }
.mg-info-value--strong { font-size: 22px; font-weight: 900; }

/* ─── SIDEBAR TOGGLE (mobile) ─────────────────────────────────────────────── */
.sidebar-toggle {
  display: none;
  width: 38px; height: 38px;
  border-radius: 12px;
  border: 1px solid #E2E8F0;
  background: #fff;
  color: #475569;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 120ms;
}
.sidebar-toggle:hover { background: #F1F5F9; }
@media (max-width: 900px) { .sidebar-toggle { display: flex !important; } }

/* ─── WAREHOUSE SWITCHER ───────────────────────────────────────────────────── */
.wh-switcher {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.wh-btn {
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid #E2E8F0;
  background: #F8FAFC;
  color: #475569;
  cursor: pointer;
  transition: all 120ms;
}
.wh-btn:hover { border-color: #0B5CA8; color: #0B5CA8; }
.wh-btn.active { background: #0B5CA8; color: #fff; border-color: #0B5CA8; }

/* ─── RESULT COUNT ────────────────────────────────────────────────────────── */
.mg-result-count {
  font-size: 12px;
  font-weight: 700;
  color: #94A3B8;
  padding: 0 4px 12px;
}

/* ─── GRID HELPERS ────────────────────────────────────────────────────────── */
.mg-grid-2 {
  display: grid;
  gap: 20px;
  grid-template-columns: 1fr;
}
@media (min-width: 960px) { .mg-grid-2 { grid-template-columns: 1fr 1fr; } }

/* ─── LOGIN PAGE ──────────────────────────────────────────────────────────── */
.login-page {
  background: linear-gradient(135deg, #EBF3FB 0%, #F6F8FB 60%, #F0F4F8 100%) !important;
}
.login-card {
  border-radius: 24px !important;
  border: 1px solid #E2E8F0 !important;
  box-shadow: 0 8px 32px rgba(11,92,168,.1) !important;
}
.login-card::before {
  background: linear-gradient(90deg, #0B5CA8, #3B82F6) !important;
  border-top-left-radius: 24px !important;
  border-top-right-radius: 24px !important;
}
.login-card input {
  border-radius: 12px !important;
}
.login-card button {
  background: #0B5CA8 !important;
  border-radius: 12px !important;
}
.login-card button:hover { background: #094D8D !important; }

/* ─── REQUEST CARDS ───────────────────────────────────────────────────────── */
.req-card {
  background: #fff;
  border: 1px solid #E2E8F0;
  border-radius: 16px;
  padding: 16px;
  cursor: pointer;
  transition: box-shadow 120ms;
  margin-bottom: 10px;
}
.req-card:hover { box-shadow: 0 4px 12px rgba(11,92,168,.08); }
.req-btn {
  padding: 7px 16px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid;
  cursor: pointer;
  font-family: inherit;
  transition: all 120ms;
}
.req-btn--success { background: #ECFDF5; color: #047857; border-color: #A7F3D0; }
.req-btn--success:hover { background: #10B981; color: #fff; border-color: #10B981; }
.req-btn--danger { background: #FFF1F2; color: #BE123C; border-color: #FECDD3; }
.req-btn--danger:hover { background: #EF4444; color: #fff; border-color: #EF4444; }

/* ─── INSTALLATION DETAIL ─────────────────────────────────────────────────── */
.instP-box, .reqP-box {
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 12px;
  padding: 12px;
}
.instP-lbl, .reqP-lbl {
  font-size: 10px;
  font-weight: 800;
  color: #94A3B8;
  text-transform: uppercase;
  margin-bottom: 4px;
}
.instP-val, .reqP-val {
  font-size: 13px;
  font-weight: 700;
  color: #0F172A;
}

/* ─── PRODUCT WAREHOUSE BOX ──────────────────────────────────────────────── */
.prodWh-box {
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 12px;
  padding: 12px;
}
.prodWh-wh { font-size: 12px; font-weight: 700; color: #475569; }
.prodWh-qty { font-size: 22px; font-weight: 900; color: #0F172A; margin: 4px 0; }
.prodWh-actions { display: flex; gap: 6px; margin-top: 6px; }
.prodWh-total { font-size: 24px; font-weight: 900; color: #0B5CA8; }

/* ─── ATTENDANCE ──────────────────────────────────────────────────────────── */
.att-card {
  background: #fff;
  border: 1px solid #E2E8F0;
  border-radius: 16px;
  padding: 16px;
  box-shadow: var(--card-shadow);
}

/* ─── PAYROLL ────────────────────────────────────────────────────────────── */
.payroll-detail { padding: 4px; }

/* ─── FINANCE / COLLECTION SPECIFIC ──────────────────────────────────────── */
.fin-summary {
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 14px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.fin-summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
}
.fin-summary-row.grand { font-size: 16px; font-weight: 900; color: #0B5CA8; border-top: 1px solid #E2E8F0; padding-top: 8px; }

/* ─── CUSTODY ACCOUNT ─────────────────────────────────────────────────────── */
.cus-acc-card {
  background: #fff;
  border: 1px solid #E2E8F0;
  border-radius: 16px;
  padding: 16px;
  cursor: pointer;
  transition: box-shadow 120ms;
  box-shadow: var(--card-shadow);
}
.cus-acc-card:hover { box-shadow: 0 4px 14px rgba(11,92,168,.1); }

/* ─── READONLY FIELD ──────────────────────────────────────────────────────── */
.readonly-field {
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 13px;
  color: #475569;
  font-weight: 700;
}

/* ─── FIELD ERROR ─────────────────────────────────────────────────────────── */
.field-error {
  font-size: 12px;
  color: #BE123C;
  font-weight: 700;
  min-height: 0;
}
.field-error:not(:empty) { margin-top: 4px; }

/* ─── MAP WRAP ────────────────────────────────────────────────────────────── */
.map-wrap { border-radius: 16px; overflow: hidden; border: 1px solid #E2E8F0; }

/* ─── AUDIT LOG ───────────────────────────────────────────────────────────── */
.audit-row {
  padding: 12px 0;
  border-bottom: 1px solid #F1F5F9;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.audit-row:last-child { border-bottom: none; }
.audit-action { font-size: 13px; font-weight: 800; color: #0F172A; }
.audit-meta { font-size: 11px; color: #94A3B8; }

/* ─── REPORT SECTION ──────────────────────────────────────────────────────── */
.rpt-card {
  background: #fff;
  border: 1px solid #E2E8F0;
  border-radius: 16px;
  padding: 20px;
  cursor: pointer;
  transition: box-shadow 120ms, border-color 120ms;
  box-shadow: var(--card-shadow);
}
.rpt-card:hover { border-color: #0B5CA8; box-shadow: 0 4px 14px rgba(11,92,168,.1); }

/* ─── MGIOT CONFIRM DIALOG ────────────────────────────────────────────────── */
.mgiot-confirm-overlay {
  position: fixed; inset: 0;
  background: rgba(15,23,42,.45);
  z-index: 200;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  backdrop-filter: blur(3px);
}
.mgiot-confirm-card {
  background: #fff;
  border: 1px solid #E2E8F0;
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(15,23,42,.14);
  padding: 28px 28px 24px;
  max-width: 400px;
  width: 100%;
  text-align: center;
}

/* ─── SCROLLBAR ───────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #CBD5E1; border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: #94A3B8; }

/* ─── PRINT ───────────────────────────────────────────────────────────────── */
@media print {
  .sidebar, .main-header, .sidebar-backdrop { display: none !important; }
  .main { margin: 0 !important; width: 100% !important; }
}
