:root {
  --ap-primary: #4F46E5;
  --ap-primary-600: #4338CA;
  --ap-primary-100: #EEF0FD;
  --ap-secondary: #64748B;
  --ap-success: #16A34A;
  --ap-success-100: #E7F6EC;
  --ap-warning: #F59E0B;
  --ap-warning-100: #FEF3E2;
  --ap-danger: #DC2626;
  --ap-danger-100: #FCEAEA;
  --ap-info: #0EA5E9;
  --ap-info-100: #E6F6FD;
  --ap-light: #F8FAFC;
  --ap-dark: #0F172A;
  --ap-surface: #FFFFFF;
  --ap-text: #475569;
  --ap-text-strong: #0F172A;
  --ap-border: #E7EBF1;
  --ap-radius: 0.75rem;
  --ap-radius-sm: 0.5rem;
  --ap-shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 8px 24px -12px rgba(15, 23, 42, .10);
  --ap-sidebar-w: 264px;
  --ap-sidebar-w-collapsed: 80px;
  --ap-topbar-h: 68px;
  --ap-font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --ap-mono: 'Roboto Mono', monospace;
  --ap-bg: #F5F7FB;
}

[data-theme="dark"] {
  --ap-surface: #151B2C;
  --ap-bg: #0B1120;
  --ap-text: #93A0B8;
  --ap-text-strong: #EEF1F7;
  --ap-border: #232C42;
  --ap-primary-100: #1E2247;
  --ap-success-100: #12261C;
  --ap-warning-100: #2B2211;
  --ap-danger-100: #2B1616;
  --ap-info-100: #132434;
}

* {
  box-sizing: border-box;
}

body {
  font-family: var(--ap-font);
  background: var(--ap-bg);
  color: var(--ap-text);
  font-size: 14px;
  transition: background .2s ease, color .2s ease;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  color: var(--ap-text-strong);
  font-weight: 700;
  letter-spacing: -0.01em;
}

a {
  text-decoration: none;
}

.mono {
  font-family: var(--ap-mono);
}

/* ============ Layout ============ */
.ap-shell {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.ap-sidebar {
  width: var(--ap-sidebar-w);
  flex-shrink: 0;
  background: var(--ap-surface);
  border-right: 1px solid var(--ap-border);
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  z-index: 1030;
  transition: width .2s ease, transform .2s ease;
}

.ap-shell.collapsed .ap-sidebar {
  width: var(--ap-sidebar-w-collapsed);
}

.ap-shell.collapsed .ap-main {
  margin-left: var(--ap-sidebar-w-collapsed);
}

.ap-shell.collapsed .ap-brand-name,
.ap-shell.collapsed .ap-nav-label,
.ap-shell.collapsed .ap-nav-section-title,
.ap-shell.collapsed .ap-nav-badge {
  display: none;
}

.ap-shell.collapsed .ap-nav-link {
  justify-content: center;
}

.ap-brand {
  height: var(--ap-topbar-h);
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: 0 1.35rem;
  border-bottom: 1px solid var(--ap-border);
  flex-shrink: 0;
}

.ap-brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--ap-primary), #7C74F0);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 800;
  font-size: 15px;
  flex-shrink: 0;
}

.ap-brand-name {
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--ap-text-strong);
  white-space: nowrap;
}

.ap-nav {
  flex: 1;
  overflow-y: auto;
  padding: 1rem .85rem;
}

.ap-nav-section-title {
  font-size: .68rem;
  font-weight: 700;
  color: var(--ap-secondary);
  letter-spacing: .06em;
  padding: 1rem .6rem .4rem;
}

.ap-nav-link {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .6rem .75rem;
  border-radius: var(--ap-radius-sm);
  color: var(--ap-text);
  font-weight: 500;
  font-size: .87rem;
  margin-bottom: .15rem;
  position: relative;
}

.ap-nav-link i {
  font-size: 1.05rem;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.ap-nav-link:hover {
  background: var(--ap-bg);
  color: var(--ap-text-strong);
}

.ap-nav-link.active {
  background: var(--ap-primary-100);
  color: var(--ap-primary);
  font-weight: 600;
}

.ap-nav-badge {
  margin-left: auto;
  font-size: .68rem;
  font-weight: 700;
  background: var(--ap-primary);
  color: #fff;
  border-radius: 20px;
  padding: .1rem .45rem;
}


.ap-nav-parent {
  cursor: pointer;
}

.ap-submenu-caret {
  margin-left: auto;
  font-size: .68rem;
  color: var(--ap-secondary);
  transition: transform .2s ease;
  flex-shrink: 0;
}

.ap-nav-parent.open .ap-submenu-caret {
  transform: rotate(180deg);
  color: var(--ap-primary);
}

.ap-submenu {
  max-height: 0;
  overflow: hidden;
  transition: max-height .25s ease;
}

.ap-submenu.open {
  max-height: 500px;
}

.ap-submenu-link {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .5rem .75rem .5rem 2.55rem;
  font-size: .82rem;
  color: var(--ap-text);
  border-radius: var(--ap-radius-sm);
  margin-bottom: .1rem;
  position: relative;
}

.ap-submenu-link::before {
  content: '';
  position: absolute;
  left: 1.55rem;
  top: 50%;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--ap-border);
  transform: translateY(-50%);
}

.ap-submenu-link:hover {
  background: var(--ap-bg);
  color: var(--ap-text-strong);
}

.ap-submenu-link.active {
  color: var(--ap-primary);
  font-weight: 600;
}

.ap-submenu-link.active::before {
  background: var(--ap-primary);
}

.ap-shell.collapsed .ap-submenu,
.ap-shell.collapsed .ap-submenu-caret {
  display: none;
}




.ap-nav-foot {
  padding: 1rem 0.35rem;
  border-top: 1px solid var(--ap-border);
  flex-shrink: 0;
}

.ap-storage {
  font-size: .75rem;
}

.ap-storage .progress {
  height: 6px;
  border-radius: 10px;
}

/* Main */
.ap-main {
  margin-left: var(--ap-sidebar-w);
  flex: 1;
  min-width: 0;
  transition: margin-left .2s ease;
}

/* Topbar */
.ap-topbar {
  height: var(--ap-topbar-h);
  background: var(--ap-surface);
  border-bottom: 1px solid var(--ap-border);
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 1020;
}

.ap-icon-btn {
  width: 38px;
  height: 38px;
  border-radius: var(--ap-radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ap-text);
  background: transparent;
  border: 1px solid transparent;
  position: relative;
  font-size: 1.05rem;
}

.ap-icon-btn:hover {
  background: var(--ap-bg);
  color: var(--ap-text-strong);
}

.ap-icon-btn .dot {
  position: absolute;
  top: 6px;
  right: 7px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ap-danger);
  border: 2px solid var(--ap-surface);
}

.ap-search {
  position: relative;
  max-width: 360px;
  flex: 1;
}

.ap-search input {
  background: var(--ap-bg);
  border: 1px solid var(--ap-border);
  border-radius: var(--ap-radius-sm);
  padding: .5rem .8rem .5rem 2.2rem;
  font-size: .85rem;
  width: 100%;
  color: var(--ap-text-strong);
}

.ap-search input:focus {
  outline: none;
  border-color: var(--ap-primary);
  background: var(--ap-surface);
}

.ap-search i {
  position: absolute;
  left: .75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ap-secondary);
}

.ap-search kbd {
  position: absolute;
  right: .6rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: .68rem;
  color: var(--ap-secondary);
  background: var(--ap-surface);
  border: 1px solid var(--ap-border);
  border-radius: 4px;
  padding: .05rem .35rem;
}

.ap-user {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .3rem .5rem .3rem .3rem;
  border-radius: 30px;
  border: 1px solid var(--ap-border);
}

.ap-user img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
}

.ap-user-name {
  font-size: .82rem;
  font-weight: 600;
  color: var(--ap-text-strong);
  line-height: 1.1;
}

.ap-user-role {
  font-size: .7rem;
  color: var(--ap-secondary);
}

/* Content */
.ap-content {
  padding: 1.5rem;
}

.ap-page-title {
  font-size: 1.4rem;
  margin-bottom: .15rem;
}

.ap-breadcrumb {
  font-size: .8rem;
  color: var(--ap-secondary);
  padding-top: 8px;
}

.ap-breadcrumb .active {
  color: var(--ap-primary);
  font-weight: 600;
}

/* Cards */
.ap-card {
  background: var(--ap-surface);
  border: 1px solid var(--ap-border);
  border-radius: var(--ap-radius);
  box-shadow: var(--ap-shadow);
}

.ap-card-head {
  padding: 1.1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: between;
  border-bottom: 1px solid var(--ap-border);
}

.ap-card-body {
  padding: 1.25rem;
}

/* Stat widgets */
.ap-stat {
  padding: 1.35rem;
}

.ap-stat-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--ap-radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

.ap-stat-label {
  font-size: .8rem;
  color: var(--ap-secondary);
  font-weight: 600;
}

.ap-stat-value {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--ap-text-strong);
  letter-spacing: -0.02em;
}

.ap-stat-change {
  font-size: .78rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: .2rem;
}

.ap-stat-change.up {
  color: var(--ap-success);
}

.ap-stat-change.down {
  color: var(--ap-danger);
}

.ap-sparkline {
  height: 34px;
  position: relative;
  width: 100%;
}

.ap-sparkline canvas {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
}

/* Table */
.ap-table thead th {
  font-size: .72rem;
  text-transform: none;
  color: var(--ap-secondary);
  font-weight: 700;
  border-bottom: 1px solid var(--ap-border);
  padding: .7rem .5rem;
  white-space: nowrap;
}

.ap-table tbody td {
  padding: .85rem .5rem;
  border-bottom: 1px solid var(--ap-border);
  vertical-align: middle;
  font-size: .85rem;
  color: var(--ap-text);
}

.ap-table tbody tr:last-child td {
  border-bottom: none;
}

.ap-table tbody tr:hover {
  background: var(--ap-bg);
}

.ap-avatar-sm {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  object-fit: cover;
}

.ap-cell-strong {
  color: var(--ap-text-strong);
  font-weight: 600;
}

.ap-badge {
  font-size: .72rem;
  font-weight: 700;
  padding: .32rem .6rem;
  border-radius: 20px;
  display: inline-flex;
  align-items: center;
  gap: .3rem;
}

.ap-badge.success {
  background: var(--ap-success-100);
  color: var(--ap-success);
}

.ap-badge.warning {
  background: var(--ap-warning-100);
  color: var(--ap-warning);
}

.ap-badge.danger {
  background: var(--ap-danger-100);
  color: var(--ap-danger);
}

.ap-badge.info {
  background: var(--ap-info-100);
  color: var(--ap-info);
}

.ap-badge .bi {
  font-size: .5rem;
}

/* Product / customer rows */
.ap-product-row {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .7rem 0;
  border-bottom: 1px solid var(--ap-border);
}

.ap-product-row:last-child {
  border-bottom: none;
}

.ap-product-thumb {
  width: 42px;
  height: 42px;
  border-radius: var(--ap-radius-sm);
  object-fit: cover;
  flex-shrink: 0;
}

.ap-progress-thin {
  height: 5px;
  border-radius: 10px;
  background: var(--ap-bg);
}

/* Timeline */
.ap-timeline {
  position: relative;
  padding-left: 1.6rem;
}

.ap-timeline::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 4px;
  bottom: 4px;
  width: 2px;
  background: var(--ap-border);
}

.ap-timeline-item {
  position: relative;
  padding-bottom: 1.25rem;
}

.ap-timeline-item:last-child {
  padding-bottom: 0;
}

.ap-timeline-dot {
  position: absolute;
  left: -1.6rem;
  top: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--ap-surface);
  box-shadow: 0 0 0 2px var(--ap-border);
}

.ap-timeline-time {
  font-size: .72rem;
  color: var(--ap-secondary);
}

/* Buttons */
.btn-ap-primary {
  background: var(--ap-primary);
  border-color: var(--ap-primary);
  color: #fff;
  font-weight: 600;
  font-size: .85rem;
}

.btn-ap-primary:hover {
  background: var(--ap-primary-600);
  border-color: var(--ap-primary-600);
  color: #fff;
}

.btn-ap-light {
  background: var(--ap-bg);
  border-color: var(--ap-border);
  color: var(--ap-text-strong);
  font-weight: 600;
  font-size: .85rem;
}

.btn-ap-light:hover {
  background: var(--ap-border);
}

/* Theme toggle switch */
.ap-theme-toggle {
  width: 38px;
  height: 38px;
  border-radius: var(--ap-radius-sm);
  border: 1px solid var(--ap-border);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--ap-bg);
  color: var(--ap-text);
}

/* Mobile */
@media (max-width: 991.98px) {
  .ap-sidebar {
    transform: translateX(-100%);
  }

  .ap-shell.mobile-open .ap-sidebar {
    transform: translateX(0);
  }

  .ap-main {
    margin-left: 0;
  }

  .ap-shell.collapsed .ap-main {
    margin-left: 0;
  }

  .ap-search {
    display: none;
  }
}

.ap-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .45);
  z-index: 1025;
  display: none;
}

.ap-shell.mobile-open .ap-backdrop {
  display: block;
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-thumb {
  background: var(--ap-border);
  border-radius: 10px;
}

/* ============ Preloader ============ */
#apPreloader {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: var(--ap-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity .4s ease, visibility .4s ease;
}

#apPreloader.hide {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.ap-loader-mark {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--ap-primary), #7C74F0);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 800;
  font-size: 24px;
  animation: apPulse 1.1s ease-in-out infinite;
  box-shadow: 0 10px 30px -8px rgba(79, 70, 229, .45);
  margin-top: 15px;
  margin-bottom: 10px;
}

@keyframes apPulse {

  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.08);
  }
}

.ap-loader-ring {
  position: absolute;
  width: 88px;
  height: 88px;
  border-radius: 50%;
  border: 3px solid var(--ap-border);
  border-top-color: var(--ap-primary);
  animation: apSpin .8s linear infinite;
}

@keyframes apSpin {
  to {
    transform: rotate(360deg);
  }
}

.ap-loader-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.ap-loader-text {
  font-size: .82rem;
  font-weight: 600;
  color: var(--ap-secondary);
  letter-spacing: .02em;
}

.active>.page-link,
.page-link.active {
  z-index: 3;
  color: var(--bs-pagination-active-color);
  background-color: var(--ap-primary);
  border-color: var(--ap-primary);
}

.page-link {
  color: var(--ap-primary);
}

.table-responsive {
  padding-bottom: 10px;
  margin-left: 2%;
}

.ap-topbar li {
  margin-bottom: 8px;
}

/* ============ Page-specific ============ */
.ap-card {
  background: var(--ap-surface);
  border: 1px solid var(--ap-border);
  border-radius: var(--ap-radius);
  box-shadow: var(--ap-shadow);
}

.ap-card-head {
  padding: 1.1rem 1.25rem;
  border-bottom: 1px solid var(--ap-border);
}

.ap-card-body {
  padding: 1.25rem;
}

.btn-ap-primary {
  background: var(--ap-primary);
  border-color: var(--ap-primary);
  color: #fff;
  font-weight: 600;
  font-size: .85rem;
}

.btn-ap-primary:hover {
  background: var(--ap-primary-600);
  border-color: var(--ap-primary-600);
  color: #fff;
}

.btn-ap-light {
  background: var(--ap-bg);
  border-color: var(--ap-border);
  color: var(--ap-text-strong);
  font-weight: 600;
  font-size: .85rem;
}

.btn-ap-light:hover {
  background: var(--ap-border);
}

.btn-ap-light.active {
  background: var(--ap-primary-100);
  border-color: var(--ap-primary-100);
  color: var(--ap-primary);
}

/* KPI cards */
.ap-kpi {
  padding: 1.3rem;
}

.ap-kpi-label {
  font-size: .8rem;
  color: var(--ap-secondary);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: .4rem;
}

.ap-kpi-value {
  font-size: 1.55rem;
  font-weight: 800;
  color: var(--ap-text-strong);
  letter-spacing: -.02em;
  margin: .35rem 0;
}

.ap-kpi-change {
  font-size: .78rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: .15rem;
}

.ap-kpi-change.up {
  color: var(--ap-success);
}

.ap-kpi-change.down {
  color: var(--ap-danger);
}

.ap-kpi-sub {
  font-size: .72rem;
  color: var(--ap-secondary);
}

/* legend rows */
.ap-legend-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: .83rem;
  padding: .5rem 0;
}

.ap-legend-row .dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
  margin-right: .5rem;
}

.ap-legend-row .val {
  font-weight: 700;
  color: var(--ap-text-strong);
}

/* Funnel */
.ap-funnel-row {
  margin-bottom: .9rem;
}

.ap-funnel-label {
  display: flex;
  justify-content: space-between;
  font-size: .82rem;
  margin-bottom: .35rem;
}

.ap-funnel-label .name {
  color: var(--ap-text-strong);
  font-weight: 600;
}

.ap-funnel-label .pct {
  color: var(--ap-secondary);
}

.ap-funnel-bar-bg {
  background: var(--ap-bg);
  border-radius: 20px;
  height: 14px;
  overflow: hidden;
}

.ap-funnel-bar {
  height: 100%;
  border-radius: 20px;
  display: flex;
  align-items: center;
  transition: width .4s ease;
}

.ap-date-range {
  background: var(--ap-bg);
  border: 1px solid var(--ap-border);
  border-radius: var(--ap-radius-sm);
  font-size: .85rem;
  color: var(--ap-text-strong);
  padding: .5rem .8rem;
}

[data-theme="dark"] .ap-table {
  --bs-table-bg: transparent;
  --bs-table-color: var(--ap-text);
  color: var(--ap-text);
}

[data-theme="dark"] .ap-table thead th {
  background: transparent;
  color: var(--ap-secondary);
  border-color: var(--ap-border);
}

[data-theme="dark"] .ap-table tbody td {
  background: transparent;
  color: var(--ap-text);
  border-color: var(--ap-border);
}

[data-theme="dark"] .ap-table tbody tr:hover {
  background: var(--ap-bg);
}

[data-theme="dark"] .pagination .page-link {
  background: var(--ap-bg);
  border-color: var(--ap-border);
  color: var(--ap-text-strong);
}

[data-theme="dark"] .pagination .page-link:hover {
  background: var(--ap-border);
  color: var(--ap-text-strong);
}

[data-theme="dark"] .pagination .page-item.active .page-link {
  background: var(--ap-primary);
  border-color: var(--ap-primary);
  color: #fff;
}

[data-theme="dark"] .pagination .page-item.disabled .page-link {
  background: var(--ap-bg);
  border-color: var(--ap-border);
  color: var(--ap-secondary);
  opacity: .6;
}

[data-theme="dark"] #orderSearch,
[data-theme="dark"] .ap-card .form-control {
  background: var(--ap-bg) !important;
  border-color: var(--ap-border) !important;
  color: var(--ap-text-strong) !important;
}

[data-theme="dark"] #orderSearch::placeholder,
[data-theme="dark"] .ap-card .form-control::placeholder {
  color: var(--ap-secondary);
}


/* ---------- Utilities ---------- */
.ap-icon-lg {
  font-size: 1.3rem;
}

.ap-dropdown-sm {
  font-size: .85rem;
}

.ap-dropdown-300 {
  width: 300px;
}

.ap-truncate-200 {
  max-width: 200px;
}

.ap-user-btn {
  background: transparent;
}

.ap-breadcrumb-sep {
  font-size: .6rem;
}

/* ---------- Text colors ---------- */
.ap-text-strong {
  color: var(--ap-text-strong);
}

.ap-text-secondary {
  color: var(--ap-secondary);
}

.ap-text-primary {
  color: var(--ap-primary);
}

.ap-text-warning {
  color: var(--ap-warning);
}

.ap-text-info {
  color: var(--ap-info);
}

/* ---------- Sidebar storage bar ---------- */
.ap-progress-bar-72 {
  width: 72%;
  background: var(--ap-primary);
}

/* ---------- Stat icon variants ---------- */
.ap-stat-primary {
  background: var(--ap-primary-100);
  color: var(--ap-primary);
}

.ap-stat-info {
  background: var(--ap-info-100);
  color: var(--ap-info);
}

.ap-stat-success {
  background: var(--ap-success-100);
  color: var(--ap-success);
}

.ap-stat-warning {
  background: var(--ap-warning-100);
  color: var(--ap-warning);
}

/* ---------- Chart legend dots ---------- */
.ap-legend-dot {
  font-size: .55rem;
}

.ap-legend-primary {
  color: var(--ap-primary);
}

.ap-legend-info {
  color: var(--ap-info);
}

.ap-legend-warning {
  color: var(--ap-warning);
}

.ap-legend-success {
  color: var(--ap-success);
}

/* ---------- Orders search input ---------- */
.ap-search-input {
  max-width: 180px;
  background: var(--ap-bg);
  border-color: var(--ap-border);
  color: var(--ap-text-strong);
}

/* ---------- Progress fills (top products) ---------- */
.ap-progress-fill {
  height: 100%;
  border-radius: 10px;
}

.ap-fill-primary {
  background: var(--ap-primary);
}

.ap-fill-info {
  background: var(--ap-info);
}

.ap-fill-success {
  background: var(--ap-success);
}

.ap-fill-warning {
  background: var(--ap-warning);
}

.ap-w-82 {
  width: 82%;
}

.ap-w-67 {
  width: 67%;
}

.ap-w-51 {
  width: 51%;
}

.ap-w-38 {
  width: 38%;
}

/* ---------- Timeline dots ---------- */
.ap-dot-success {
  background: var(--ap-success);
}

.ap-dot-info {
  background: var(--ap-info);
}

.ap-dot-warning {
  background: var(--ap-warning);
}

.ap-dot-primary {
  background: var(--ap-primary);
}

 .ap-theme-toggle {
      top: 1.5rem;
      right: 1.5rem;
      width: 38px;
      height: 38px;
      border-radius: var(--ap-radius-sm);
      border: 1px solid var(--ap-border);
      background: var(--ap-surface);
      color: var(--ap-text);
      display: flex;
      align-items: center;
      justify-content: center;
    }

    .ap-error-code {
      font-size: 7rem;
      font-weight: 800;
      color: var(--ap-primary);
      line-height: 1;
      letter-spacing: -.03em;
    }

    .ap-error-illustration {
      font-size: 3.5rem;
      color: var(--ap-primary);
      margin-bottom: .5rem;
    }

/* ============================================================
   Horizontal Nav variant — layout overrides (horizontal-* pages)
   ============================================================ */
.ap-shell {
  flex-direction: column !important;
}

.ap-sidebar {
  position: sticky !important;
  top: 0 !important;
  left: auto !important;
  bottom: auto !important;
  right: auto !important;
  width: 100% !important;
  height: auto !important;
  flex-direction: row !important;
  align-items: center !important;
  border-right: 0 !important;
  border-bottom: 1px solid var(--ap-border) !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  transform: none !important;
}

.ap-shell.collapsed .ap-sidebar,
.ap-shell.mobile-open .ap-sidebar {
  width: 100% !important;
  transform: none !important;
}

.ap-brand {
  border-bottom: 0 !important;
  border-right: 1px solid var(--ap-border) !important;
  flex-shrink: 0 !important;
}

.ap-nav {
  flex: 1 1 auto !important;
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  padding: 0 .5rem !important;
  white-space: nowrap !important;
}

.ap-nav-section-title {
  display: flex !important;
  align-items: center !important;
  padding: 0 .7rem !important;
  margin: 0 !important;
  border-left: 1px solid var(--ap-border) !important;
  height: 20px !important;
  flex-shrink: 0 !important;
  white-space: nowrap !important;
}

.ap-nav-link {
  margin-bottom: 0 !important;
  margin-right: .15rem !important;
  flex-shrink: 0 !important;
}

.ap-shell.collapsed .ap-nav-label,
.ap-shell.collapsed .ap-nav-section-title {
  display: none !important;
}

.ap-shell.mobile-open .ap-nav-label,
.ap-shell.mobile-open .ap-nav-section-title {
  display: flex !important;
}

.ap-nav-foot {
  display: none !important;
}

.ap-main {
  margin-left: 0 !important;
}

.ap-shell.collapsed .ap-main {
  margin-left: 0 !important;
}

.ap-backdrop {
  display: none !important;
}

@media (max-width: 991.98px) {
  .ap-search {
    display: flex !important;
    max-width: 200px !important;
  }
}

::-webkit-scrollbar {
  height: 6px;
}

/* Make equal-height cards (h-100) let their body/canvas fill the extra space */
.ap-card.h-100 {
  display: flex;
  flex-direction: column;
}

.ap-card.h-100 .ap-card-body {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.ap-card.h-100 .ap-card-body canvas {
  flex: 1 1 auto;
  min-height: 0;
}