:root {
  --crm-bg: #080e1d;
  --crm-bg-soft: #0b1222;
  --crm-surface: #111b2d;
  --crm-surface-2: #141f33;
  --crm-border: #23304a;
  --crm-border-soft: #2d3b56;
  --crm-text: #f4f7ff;
  --crm-muted: #8390aa;
  --crm-purple: #7c4dff;
  --crm-blue: #3e8cf7;
  --crm-green: #32c978;
  --crm-orange: #f5a524;
  --crm-red: #f24f70;
  --bs-body-bg: var(--crm-bg);
  --bs-body-color: var(--crm-text);
  --bs-heading-color: var(--crm-text);
  --bs-border-color: var(--crm-border);
  --bs-tertiary-bg: var(--crm-surface);
}

html,
body {
  min-height: 100%;
  background: radial-gradient(circle at 68% -30%, #172341 0, transparent 42%), var(--crm-bg) !important;
  color: var(--crm-text);
  font-family: Inter, Instrument Sans, system-ui, -apple-system, "Segoe UI", sans-serif;
}

a {
  color: #a787ff;
}

a:hover {
  color: #c6b7ff;
}

.page-layout {
  min-height: 100vh;
  display: block;
}

.page-layout:has(.sidebar) {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  grid-row: 1 / span 3;
  height: 100vh;
  padding: 28px 18px 20px;
  display: flex;
  flex-direction: column;
  background: #0b1222 !important;
  border-right: 1px solid var(--crm-border) !important;
  box-shadow: none !important;
  z-index: 1040;
}

html[data-app-sidebar] .page-layout:has(.sidebar),
html[data-app-sidebar=mini] .page-layout:has(.sidebar),
html[data-app-sidebar=mini-hover] .page-layout:has(.sidebar) {
  grid-template-columns: 240px minmax(0, 1fr) !important;
}

html[data-app-sidebar] :has(.sidebar) .app-wrapper,
html[data-app-sidebar] :has(.sidebar) .footer-wrapper {
  margin-left: 0 !important;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 8px 28px;
}

.brand a {
  display: block;
  width: 100%;
}

.brand img {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  border-radius: 50%;
  object-fit: contain;
}

.sidebar nav {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-height: 0;
  overflow-y: auto;
  padding-right: 2px;
  scrollbar-width: thin;
  scrollbar-color: #2f3d59 transparent;
}

.sidebar nav::-webkit-scrollbar {
  width: 6px;
}

.sidebar nav::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar nav::-webkit-scrollbar-thumb {
  background: #2f3d59;
  border-radius: 999px;
}

.sidebar .nav {
  border: 0;
  background: transparent;
  color: #8996af !important;
  display: flex !important;
  align-items: center;
  gap: 12px;
  padding: 12px 13px !important;
  border-radius: 10px !important;
  text-align: left !important;
  font: inherit;
  text-decoration: none;
  cursor: pointer;
  transition: background .16s ease, color .16s ease, box-shadow .16s ease;
}

.sidebar .nav em {
  margin-left: auto;
  background: #292f49;
  color: #b89cff;
  border-radius: 7px;
  padding: 2px 7px;
  font-style: normal;
  font-size: 11px;
  line-height: 1.4;
}

.sidebar .nav:hover,
.sidebar .nav.active {
  color: #fff !important;
  background: linear-gradient(90deg, rgba(116, 69, 233, .2), rgba(116, 69, 233, .04)) !important;
  box-shadow: inset 3px 0 var(--crm-purple) !important;
}

.mobile-nav {
  display: none;
}

.app-header {
  min-height: 0;
  margin: 0;
  padding: 76px 42px 0;
  background: transparent !important;
  backdrop-filter: none;
  pointer-events: none;
  z-index: 1030;
}

.app-header-inner {
  min-height: 44px;
  display: flex;
  justify-content: flex-end;
  pointer-events: auto;
}

.app-header-end {
  display: flex;
  align-items: center;
  gap: 10px;
}

.head-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.primary,
.secondary {
  border-radius: 8px;
  padding: 10px 13px;
  border: 1px solid;
  font: inherit;
  font-size: 11px;
  font-weight: 750;
  cursor: pointer;
}

.primary {
  background: linear-gradient(135deg, #794dea, #6936d5);
  border-color: #916eff;
  color: #fff;
}

.secondary {
  background: transparent;
  border-color: #3a4965;
  color: #a8b3c8;
}

.secondary:hover {
  background: rgba(107, 67, 226, .20);
  border-color: #7f57ea;
  color: #fff;
}

.bell {
  position: relative;
  width: 40px;
  height: 40px;
  border: 1px solid var(--crm-border);
  background: var(--crm-surface);
  color: #cbd4e7;
  border-radius: 10px;
  display: grid;
  place-items: center;
  cursor: pointer;
}

.bell b {
  position: absolute;
  right: -3px;
  top: -5px;
  display: grid;
  place-items: center;
  background: var(--crm-red);
  color: #fff;
  font-size: 9px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border: 2px solid var(--crm-bg);
  border-radius: 999px;
  line-height: 1;
}

.is-hidden {
  display: none !important;
}

.courier-notifications,
.courier-role-check {
  position: relative;
}

.courier-notification-menu,
.role-check-menu {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  z-index: 1050;
  background: #111b2d;
  border: 1px solid #30405c;
  border-radius: 14px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .52);
  overflow: hidden;
}

.courier-notification-menu.open,
.role-check-menu.open {
  display: block;
}

.courier-notification-menu {
  width: 320px;
  max-width: calc(100vw - 28px);
}

.courier-notification-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--crm-border);
}

.courier-notification-head h3 {
  font-size: 15px;
  margin: 0;
}

.courier-notification-head span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  margin-left: 6px;
  border-radius: 999px;
  background: #7547eb;
  color: #fff;
  font-size: 11px;
}

.notification-close {
  border: 0;
  background: transparent;
  color: #8390aa;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.courier-notification-list {
  list-style: none;
  margin: 0;
  padding: 8px;
  max-height: 300px;
  overflow: auto;
}

.courier-notification-list li {
  padding: 11px;
  border-radius: 10px;
  border: 1px solid transparent;
}

.courier-notification-list li + li {
  margin-top: 6px;
}

.courier-notification-list li.unread {
  background: rgba(111, 74, 227, .08);
  border-color: rgba(111, 74, 227, .20);
}

.courier-notification-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.courier-notification-icon {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #7547eb;
  color: #fff;
  flex: 0 0 auto;
}

.courier-notification-item h4 {
  font-size: 13px;
  margin: 0 0 4px;
  color: #f4f7ff;
}

.courier-notification-item p {
  font-size: 11px;
  margin: 0;
  color: #aab4c8;
}

.courier-notification-item small {
  display: block;
  margin-top: 5px;
  color: #64718a !important;
  font-size: 10px;
}

.courier-notification-empty {
  text-align: center;
  color: #8390aa;
}

.courier-notification-actions {
  padding: 10px;
  border-top: 1px solid var(--crm-border);
  display: grid;
  gap: 8px;
}

.courier-notification-actions .primary,
.courier-notification-actions .secondary {
  text-align: center;
  text-decoration: none;
}

.role-toggle,
.role-return {
  min-height: 40px;
}

.role-check-menu {
  width: 640px;
  max-width: calc(100vw - 28px);
  padding: 14px;
}

.role-check-title {
  color: #8390aa;
  font-size: 11px;
  margin: 0 0 12px;
}

.role-check-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  max-height: min(520px, calc(100vh - 140px));
  overflow: auto;
}

.role-check-column {
  border-left: 1px solid var(--crm-border);
  padding-left: 10px;
  min-width: 0;
}

.role-check-column:first-child {
  border-left: 0;
  padding-left: 0;
}

.role-check-column b {
  display: block;
  font-size: 12px;
  margin-bottom: 8px;
}

.role-check-column form + form {
  margin-top: 5px;
}

.role-check-column button {
  width: 100%;
  border: 0;
  background: transparent;
  color: #cbd4e7;
  border-radius: 8px;
  padding: 8px;
  text-align: left;
  cursor: pointer;
}

.role-check-column button:hover {
  background: rgba(111, 74, 227, .08);
  color: #fff;
}

.role-check-column small,
.role-check-column span {
  display: block;
  color: #64718a !important;
  font-size: 11px;
  line-height: 1.35;
}

.role-check-column span {
  padding: 8px;
}

.app-wrapper {
  grid-column: 2;
  width: 100%;
  max-width: none;
  margin: 0 auto !important;
  padding: 64px 42px 90px !important;
  background: transparent !important;
}

.container-fluid {
  padding-left: 0;
  padding-right: 0;
}

.app-page-head {
  margin-bottom: 24px;
}

.breadcrumb {
  gap: 7px;
}

.breadcrumb,
.breadcrumb a,
.breadcrumb-item.active {
  color: #68758d !important;
  font-size: 12px;
  font-weight: 600;
}

.breadcrumb a {
  text-decoration: none;
}

.card,
.employee-stat-tile,
.withdrawal-stat-tile,
.product-stock-total,
.employee-filter-card,
.withdrawal-filter-panel,
.bg-white,
.bg-light,
.modal-content,
.dropdown-menu,
.list-group-item {
  background: linear-gradient(145deg, #141f33, #101829) !important;
  border: 1px solid var(--crm-border) !important;
  color: var(--crm-text) !important;
  box-shadow: none !important;
}

.card,
.modal-content,
.dropdown-menu {
  border-radius: 14px !important;
}

.card.transparent {
  background: transparent !important;
  border: 0 !important;
}

.card-header,
.card-footer,
.modal-header,
.modal-footer,
.dropdown-divider,
.border-top,
.border-bottom {
  border-color: var(--crm-border) !important;
}

.card-header {
  background: transparent !important;
  padding: 0 0 14px !important;
}

.card-body {
  padding: 22px !important;
}

.card-title,
h1,
h2,
h3,
h4,
h5,
h6,
.fw-bold,
.fw-semibold,
.text-dark {
  color: var(--crm-text) !important;
}

.text-muted,
.text-body,
small,
.form-label {
  color: var(--crm-muted) !important;
}

.bg-white *,
.bg-light *,
.card *,
.employee-stat-tile *,
.withdrawal-stat-tile *,
.product-stock-total * {
  color: inherit;
}

.bg-white .text-muted,
.bg-light .text-muted,
.card .text-muted,
.card small {
  color: var(--crm-muted) !important;
}

.bg-white b,
.bg-light b,
.card b,
.card h1,
.card h2,
.card h3,
.card h4,
.card h5,
.card h6 {
  color: var(--crm-text) !important;
}

.employee-stat-strip,
.withdrawal-stat-strip {
  gap: 12px !important;
  margin-bottom: 25px !important;
}

.employee-stat-tile,
.withdrawal-stat-tile,
.product-stock-total {
  min-height: 96px;
  border-radius: 13px !important;
  padding: 18px !important;
}

.employee-stat-tile small,
.withdrawal-stat-tile small,
.product-stock-total small {
  color: var(--crm-muted) !important;
  font-size: 11px !important;
}

.employee-stat-tile b,
.withdrawal-stat-tile b,
.product-stock-total b {
  color: var(--crm-text) !important;
  font-size: 20px !important;
  margin-top: 4px;
}

.employee-filter-card,
.withdrawal-filter-panel {
  border-radius: 14px !important;
  padding: 18px !important;
}

.btn {
  border-radius: 8px !important;
  font-weight: 750;
  box-shadow: none !important;
}

.btn-primary,
.btn-success {
  background: linear-gradient(135deg, #794dea, #6936d5) !important;
  border-color: #916eff !important;
  color: #fff !important;
}

.btn-outline-primary,
.btn-outline-secondary,
.btn-outline-success,
.btn-outline-danger,
.btn-light,
.btn-action-gray {
  background: rgba(107, 67, 226, .10) !important;
  border-color: #3a4965 !important;
  color: #a8b3c8 !important;
}

.btn-outline-primary:hover,
.btn-outline-secondary:hover,
.btn-outline-success:hover,
.btn-outline-danger:hover,
.btn-light:hover,
.btn-action-gray:hover {
  background: rgba(107, 67, 226, .20) !important;
  border-color: #7f57ea !important;
  color: #fff !important;
}

.btn-danger {
  background: rgba(242, 79, 112, .18) !important;
  border-color: rgba(242, 79, 112, .50) !important;
  color: #ff9aaa !important;
}

.btn-warning {
  background: rgba(245, 165, 36, .18) !important;
  border-color: rgba(245, 165, 36, .50) !important;
  color: #ffcd7b !important;
}

.form-control,
.form-select,
textarea,
input,
select {
  background-color: #0c1526 !important;
  border-color: #2a3852 !important;
  color: #edf2fb !important;
  border-radius: 8px !important;
}

.form-control:focus,
.form-select:focus,
textarea:focus,
input:focus,
select:focus {
  border-color: #7f57ea !important;
  box-shadow: 0 0 0 .2rem rgba(124, 77, 255, .18) !important;
}

.form-control::placeholder {
  color: #66738c !important;
}

.table {
  color: #cbd4e7 !important;
  --bs-table-bg: transparent;
  --bs-table-color: #cbd4e7;
  --bs-table-border-color: #1f2a40;
  --bs-table-hover-bg: rgba(124, 77, 255, .08);
}

.table-responsive {
  border: 1px solid var(--crm-border);
  border-radius: 14px;
  background: linear-gradient(145deg, #141f33, #101829);
  overflow: auto;
}

.table th {
  color: #6e7b92 !important;
  font-size: 11px !important;
  text-transform: uppercase;
  letter-spacing: 0;
  border-bottom-color: var(--crm-border) !important;
}

.table td {
  color: #cbd4e7 !important;
  border-bottom-color: #1f2a40 !important;
}

.table a {
  color: #b699ff;
  font-weight: 700;
  text-decoration: none;
}

.badge {
  border-radius: 6px !important;
  border: 1px solid transparent;
  font-weight: 750;
}

.bg-warning,
.status-new,
.status-pending,
.status-pending_admin,
.status-completed_pending_admin {
  color: #f6d173 !important;
  background: rgba(238, 189, 57, .10) !important;
  border-color: rgba(238, 189, 57, .28) !important;
}

.bg-success,
.status-approved,
.status-completed,
.status-shipment_created,
.status-done_by_employee {
  color: #65dc97 !important;
  background: rgba(54, 189, 114, .10) !important;
  border-color: rgba(54, 189, 114, .30) !important;
}

.bg-danger,
.status-rejected,
.status-cancelled,
.status-needs_revision {
  color: #ff7792 !important;
  background: rgba(242, 79, 112, .11) !important;
  border-color: rgba(242, 79, 112, .30) !important;
}

.bg-primary,
.status-accepted,
.status-in_progress,
.status-assigned,
.status-picked,
.status-picked_by_courier {
  color: #74b3ff !important;
  background: rgba(56, 140, 247, .11) !important;
  border-color: rgba(56, 140, 247, .30) !important;
}

.alert {
  border-radius: 13px !important;
  border-color: var(--crm-border) !important;
  background: linear-gradient(145deg, #141f33, #101829) !important;
  color: var(--crm-text) !important;
}

.avatar,
.avatar img {
  border-radius: 10px !important;
}

.avatar {
  background: linear-gradient(145deg, #7e55f1, #4d2bb3) !important;
  color: #fff !important;
}

.modal-backdrop.show {
  opacity: .72;
}

.modal-content {
  background: #111b2d !important;
}

.modal-footer {
  background: #111b2d !important;
}

.dropdown-item {
  color: #cbd4e7 !important;
}

.dropdown-item:hover,
.dropdown-item:focus {
  background: rgba(111, 74, 227, .12) !important;
  color: #fff !important;
}

nav[role="navigation"] a,
nav[role="navigation"] span[aria-current="page"] > span,
nav[role="navigation"] span[aria-disabled="true"] > span {
  background: #111b2d !important;
  border-color: var(--crm-border) !important;
  color: #a787ff !important;
}

nav[role="navigation"] span[aria-current="page"] > span {
  background: rgba(124, 77, 255, .18) !important;
  color: #fff !important;
}

.footer-wrapper {
  grid-column: 2;
  background: transparent !important;
  color: var(--crm-muted);
  border-top: 1px solid rgba(35, 48, 74, .7);
}

@media (max-width: 991.98px) {
  .page-layout,
  .page-layout:has(.sidebar) {
    display: block !important;
    grid-template-columns: none !important;
  }

  .app-header {
    padding: 12px 14px 8px;
  }

  .app-header-inner {
    min-height: 40px;
  }

  .head-actions {
    width: 100%;
    justify-content: flex-end;
    gap: 8px;
  }

  .role-check-menu {
    position: fixed;
    left: 14px;
    right: 14px;
    top: 62px;
    width: auto;
    max-width: none;
  }

  .role-check-grid {
    grid-template-columns: 1fr;
    max-height: calc(100vh - 100px);
  }

  .role-check-column {
    border-left: 0;
    border-top: 1px solid var(--crm-border);
    padding-left: 0;
    padding-top: 10px;
  }

  .role-check-column:first-child {
    border-top: 0;
    padding-top: 0;
  }

  .app-wrapper {
    max-width: 100vw;
    padding: 14px 14px calc(96px + env(safe-area-inset-bottom)) !important;
  }

  .sidebar {
    display: none !important;
  }

  .mobile-nav {
    position: fixed;
    inset: auto 0 0 0;
    width: 100%;
    height: calc(64px + env(safe-area-inset-bottom));
    display: flex;
    align-items: stretch;
    gap: 6px;
    padding: 7px 8px calc(7px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--crm-border) !important;
    background: rgba(11, 19, 35, .95) !important;
    z-index: 1040;
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-x: contain;
    box-shadow: 0 -14px 36px rgba(0, 0, 0, .28) !important;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .mobile-nav::-webkit-scrollbar {
    display: none;
  }

  .mobile-nav .nav {
    position: relative;
    flex: 0 0 92px;
    min-height: 50px;
    display: flex !important;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 4px;
    padding: 8px 7px !important;
    border: 0;
    border-radius: 10px !important;
    background: transparent;
    color: #8996af !important;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.15;
    text-align: center !important;
    text-decoration: none;
    white-space: nowrap;
  }

  .mobile-nav .nav:first-child:nth-last-child(-n + 5),
  .mobile-nav .nav:first-child:nth-last-child(-n + 5) ~ .nav {
    flex-basis: 0;
    flex-grow: 1;
    min-width: 72px;
  }

  .mobile-nav .nav:hover,
  .mobile-nav .nav.active {
    color: #fff !important;
    background: rgba(124, 77, 255, .18) !important;
    box-shadow: inset 0 3px var(--crm-purple) !important;
  }

  .mobile-nav .nav em {
    position: absolute;
    top: 4px;
    right: 8px;
    margin: 0;
    min-width: 16px;
    height: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    font-size: 9px;
  }

  html[data-app-sidebar] .page-layout:has(.sidebar),
  html[data-app-sidebar=mini] .page-layout:has(.sidebar),
  html[data-app-sidebar=mini-hover] .page-layout:has(.sidebar) {
    display: block !important;
    grid-template-columns: none !important;
  }

  .card-body {
    padding: 16px !important;
  }

  .table-responsive {
    border: 0;
    background: transparent;
  }

  .table tr {
    background: linear-gradient(145deg, #141f33, #101829) !important;
    border-color: var(--crm-border) !important;
    box-shadow: none !important;
  }
}
