:root {
  --neu-bg: #e8eaf0;
  --neu-bg-2: #d4d8e2;
  --neu-shadow-dark: #b8bcc8;
  --neu-shadow-light: #ffffff;
  --neu-shadow-d: #b8bcc8;
  --neu-shadow-l: #ffffff;
  --neu-primary: #5c4699;
  --neu-primary-d: #1b1254;
  --neu-text: #374151;
  --neu-text-muted: #6b7280;
  --neu-border: rgba(0,0,0,0.06);
}

.dark {
  --neu-bg: #1e2433;
  --neu-bg-2: #151924;
  --neu-shadow-dark: #0d1018;
  --neu-shadow-light: #2a3347;
  --neu-shadow-d: #0d1018;
  --neu-shadow-l: #2a3347;
  --neu-text: #e5e7eb;
  --neu-text-muted: #9ca3af;
  --neu-border: rgba(255,255,255,0.06);
}

::selection {
  color: #fff;
  background: var(--neu-primary);
  text-shadow: none;
}

* {
  box-sizing: border-box;
}

body {
  font-family: 'Geist', system-ui, sans-serif;
  background: var(--neu-bg);
  color: var(--neu-text);
  min-height: 100vh;
  transition: background 0.4s, color 0.4s;
  margin: 0;
}

.neu-body {
  display: flex;
  justify-content: center;
  align-items: center;
}

.main-content {
  flex: 1;
  padding: 28px;
  justify-content: center;
  align-content: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.main-index {
  flex: 1;
  padding: 28px;
  display: flex;
  justify-content: center;
  flex-direction: column;
  align-items: center;
}

/* ─── Neuromorphic surfaces ─── */

.neu-raised, .neu-raised-sm {
  background: linear-gradient(145deg, var(--neu-bg), var(--neu-bg-2));
  box-shadow: 6px 6px 14px var(--neu-shadow-dark), -3px -3px 5px var(--neu-border);
}

.neu-inset {
  background: linear-gradient(145deg, var(--neu-bg-2), var(--neu-bg));
  box-shadow: inset 3px 3px 7px var(--neu-shadow-dark), inset -3px -3px 7px var(--neu-shadow-light);
}

/* ─── Page loader ─── */

#page-loader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--neu-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.4s;
}

#page-loader.hidden {
  opacity: 0;
  pointer-events: none;
}

#page-loader .spinner {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  box-shadow: 6px 6px 14px var(--neu-shadow-dark), -6px -6px 14px var(--neu-shadow-light);
  border: 3px solid transparent;
  border-top-color: var(--neu-primary);
  animation: spin 0.8s linear infinite;
}

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

/* ── Theme toggle (bottom) ── */

.theme-row {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 20px;
}

.theme-btn {
  padding: 6px 12px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--neu-text-muted);
  background: none;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: background 0.15s, color 0.15s;
}

.theme-btn:hover {
  background: rgba(124,58,237,0.07);
  color: var(--neu-text);
}

.theme-btn.active {
  background: linear-gradient(145deg, var(--neu-bg), var(--neu-bg-2));
  box-shadow: 2px 2px 5px var(--neu-shadow-d), -1px -1px 3px var(--neu-shadow-l);
  color: var(--neu-primary);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ─── Layout ─── */

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

/* Sidebar slot — sidebar.js injects here; just needs correct width */

#sidebar-root {
  flex-shrink: 0;
}

.main-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* ─── Topbar ─── */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 28px;
  border-bottom: 1px solid var(--neu-border);
  gap: 6px;
  flex-wrap: wrap;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

/* ─── Alert banners ─── */

.neu-alert {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-radius: 14px;
  font-size: 0.8rem;
  font-weight: 500;
}

.neu-alert.danger {
  background: var(--neu-bg);
  color: var(--bs-danger);
  border: 1px solid rgba(239,68,68,0.2);
}

.neu-alert.warning {
  background: var(--neu-bg);
  color: var(--bs-warning);
  border: 1px solid rgba(234,179,8,0.2);
}

.dark .neu-alert.danger {
  color: #f87171;
  border-color: rgba(239,68,68,0.3);
}

.dark .neu-alert.warning {
  color: #fbbf24;
  border-color: rgba(234,179,8,0.3);
}

.neu-alert.show {
  display: flex;
}

.neu-alert a {
  color: inherit;
  text-decoration: underline;
  font-weight: 600;
}

/* ─── Icon button ─── */

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  background: none;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--neu-text-muted);
  transition: color 0.2s, transform 0.15s;
}

.icon-btn:hover {
  color: var(--neu-text);
  transform: translateY(-1px);
}

/* ─── Dropdown ─── */

.dropdown-wrapper {
  position: relative;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 45px;
  height: 45px;
}

.dropdown-menu-neu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 190px;
  z-index: 200;
  border-radius: 16px;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px);
  transition: all 0.2s;
  padding: 6px;
}

.dropdown-menu-neu.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown-menu-neu .divider {
  height: 1px;
  background: var(--neu-border);
  margin: 4px 0;
}

.dropdown-menu-neu button, .dropdown-menu-neu a {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  border: none;
  background: none;
  border-radius: 10px;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--neu-text);
  text-decoration: none;
  transition: background 0.15s;
}

.dropdown-menu-neu button:hover, .dropdown-menu-neu a:hover {
  background: rgba(124,58,237,0.08);
}

.dropdown-menu-neu .danger {
  color: #ef4444;
}

.dropdown-menu-neu .danger:hover {
  background: rgba(239,68,68,0.08);
}

.dropdown-menu-neu .user-info {
  padding: 10px 12px 8px;
  border-bottom: 1px solid var(--neu-border);
  margin-bottom: 4px;
}

.dropdown-menu-neu .user-info .name {
  font-size: 0.85rem;
  font-weight: 600;
}

.dropdown-menu-neu .user-info .email {
  font-size: 0.72rem;
  color: var(--neu-text-muted);
}

/* ─── Breadcrumb ─── */

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--neu-text-muted);
}

.breadcrumb a {
  color: var(--neu-text-muted);
  text-decoration: none;
}

.breadcrumb a:hover {
  color: var(--neu-primary);
}

.breadcrumb span.sep {
  opacity: 0.4;
}

.breadcrumb span.active {
  color: var(--neu-text);
  font-weight: 500;
}

/* ─── Main content ─── */

/* ─── Page heading ─── */

.page-title {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  /*margin: 4px 0 24px;*/
}

/* ─── Stat cards ─── */

.stat-card {
  border-radius: 20px;
  padding: 16px 22px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: transform 0.2s;
}

.stat-card:hover {
  transform: translateY(-3px);
}

.stat-card .label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--neu-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.stat-card .value {
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
}

.stat-card .sub {
  font-size: 0.72rem;
  color: var(--neu-text-muted);
}

.stat-card .badge-pill {
  align-self: flex-end;
  margin-top: auto;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  color: #fff;
  width: 100%;
  text-align: end;
}

/* ─── Section card ─── */

.section-card {
  border-radius: 20px;
  overflow: hidden;
  width: 100%;
}

.section-card-header {
  padding: 16px 22px;
  border-bottom: 1px solid var(--neu-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.section-card-header h5 {
  font-size: 0.92rem;
  font-weight: 600;
  margin: 0;
}

.section-card-body {
  padding: 22px;
}

.section-card-body.flush {
  padding: 0;
}

/* ─── Status breakdown ─── */

.status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 16px;
}

.status-item .count {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.1;
}

.status-item .name {
  font-size: 0.73rem;
  font-weight: 500;
  color: var(--neu-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}

/* ─── Status badges ─── */

.status-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: capitalize;
  letter-spacing: 0.04em;
}

.s-delivered {
  background: rgba(34,197,94,0.15);
  color: #16a34a;
}

.s-shipped {
  background: rgba(6,182,212,0.15);
  color: #0891b2;
}

.s-processing, .s-in_process {
  background: rgba(234,179,8,0.15);
  color: #b45309;
}

.s-cancelled, .s-canceled {
  background: rgba(239,68,68,0.15);
  color: #dc2626;
}

.s-refunded, .s-returned {
  background: rgba(107,114,128,0.15);
  color: #6b7280;
}

.s-pending {
  background: rgba(234,179,8,0.15);
  color: #b45309;
}

.dark .s-delivered {
  color: #4ade80;
}

.dark .s-shipped {
  color: #22d3ee;
}

.dark .s-processing, .dark .s-in_process {
  color: #fbbf24;
}

.dark .s-cancelled, .dark .s-canceled {
  color: #f87171;
}

.dark .s-refunded, .dark .s-returned {
  color: #9ca3af;
}

.dark .s-pending {
  color: #fbbf24;
}

/* ─── Table ─── */

.neu-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.neu-table thead tr {
  border-bottom: 1px solid var(--neu-border);
}

.neu-table thead th {
  padding: 12px 16px;
  font-weight: 600;
  font-size: 0.73rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--neu-text);
  text-align: left;
}

.neu-table tbody tr {
  border-bottom: 1px solid var(--neu-border);
  transition: background 0.15s;
}

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

.neu-table tbody tr:hover {
  background: rgba(124,58,237,0.04);
}

.neu-table td {
  padding: 6px 16px;
}

.neu-table td a {
  display: flex;
  align-items: center;
  padding: 6px 16px;
  text-decoration: none;
  color: inherit;
}

.neu-table td.fw a {
  font-weight: 600;
  color: var(--neu-primary);
}

/* ─── Progress bar ─── */

.mini-progress {
  height: 4px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--neu-border);
}

.mini-progress-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--neu-primary), #a855f7);
}

/* ─── GA section heading ─── */

.ga-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}

.ga-heading h5 {
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
}

.ga-badge {
  font-size: 0.68rem;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--neu-border);
  color: var(--neu-text-muted);
}

/* ─── Loading spinner ─── */

.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  gap: 14px;
}

.loading-ring {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 3px solid var(--neu-border);
  border-top-color: var(--neu-primary);
  animation: spin 0.8s linear infinite;
}

/* ─── Modal ─── */

.neu-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 400;
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  visibility: hidden;
  transition: all 0.25s;
}

.neu-modal-backdrop.open {
  opacity: 1;
  visibility: visible;
}

.neu-modal {
  position: fixed;
  z-index: 401;
  top: 50%;
  left: 50%;
  transform: translate(-50%,-50%) scale(0.95);
  width: min(680px, calc(100vw - 32px));
  max-height: min(80vh, 700px);
  border-radius: 24px!important;
  opacity: 0;
  visibility: hidden;
  transition: all 0.25s;
  display: flex;
  flex-direction: column;
  overflow: visible;
}

.neu-modal.open {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%,-50%) scale(1);
}

.neu-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--neu-border);
  background: var(--neu-bg);
  border-radius: 24px 24px 0 0;
}

.neu-modal-header h5 {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.neu-modal-body {
  overflow-y: auto;
  flex: 1;
  padding: 0;
  background: var(--neu-bg-2);
}

.neu-modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 22px;
  border-top: 1px solid var(--neu-border);
  background: var(--neu-bg);
  border-radius: 0 0 24px 24px;
}

/* ─── Activity list item ─── */

.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--neu-border);
  font-size: 0.82rem;
}

.activity-item:last-child {
  border-bottom: none;
}

/* ─── Buttons ─── */

.btn-neu {
  padding: 8px 18px;
  border-radius: 12px;
  border: none;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}

.btn-neu:hover {
  transform: translateY(-1px);
}

.btn-neu:active {
  transform: translateY(1px);
}

.btn-primary-neu {
  background: linear-gradient(135deg, var(--neu-primary), var(--neu-primary-d));
  color: #fff;
  box-shadow: 0 4px 12px rgba(124,58,237,0.3);
}

.btn-secondary-neu {
  background: linear-gradient(145deg, var(--neu-bg), var(--neu-bg-2));
  color: var(--neu-text);
  box-shadow: 3px 3px 7px var(--neu-shadow-dark), -3px -3px 7px var(--neu-shadow-light);
}

.btn-warning-neu {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #fff;
  box-shadow: 0 4px 12px rgba(245,158,11,0.3);
}

/* ─── Footer ─── */

.page-footer {
  text-align: center;
  padding: 32px 20px;
  font-size: 0.75rem;
  color: var(--neu-text-muted);
  border-top: 1px solid var(--neu-border);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.page-footer a {
  text-decoration: none;
  color: var(--neu-text-muted);
}

/* ─── Avatar ─── */

#avatarBtn {
  border-radius: 50%;
}

.avatar-circle {
  width: 40px;
  height: 40px;
  border-radius: 50%!important;
  background: linear-gradient(135deg, var(--neu-primary), #a855f7);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.avatar-circle img {
  border-radius: 50%;
}

/* ─── Responsive ─── */

@media (max-width: 900px) {
  .main-content {
    padding: 6px;
  }
}

@media (max-width: 900px) {
  .topbar {
    padding: 16px 16px;
  }
}

@media (max-width: 900px) {
  .stat-cards-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

@media (max-width: 900px) {
  .stat-cards-grid {
    grid-template-columns: 1fr !important;
  }
}

/* ─── Reduced motion ─── */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* Preserve sidebar.js injected sidebar styles by not touching #sidebar-root layout */

#sidebar-root {
  display: contents;
}

.sb-logo-wrap {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--neu-bg);
  display: flex;
  align-items: center;
  justify-content: center;
}

.sb-brand-name {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--bs-emphasis-color);
}

.sb-mobile-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--sb-text);
  font-size: 0.95rem;
  font-weight: 700;
}

/* Desktop tabs visible only on md+ */

.neu-tabs-desktop {
  display: block;
}

.neu-tabs-mobile {
  display: none;
  margin-bottom: 16px;
}

/* Mobile behavior */

@media (max-width: 768px) {
  .neu-tabs-desktop {
    display: none;
  }
}

@media (max-width: 768px) {
  .neu-tabs-mobile {
    display: block;
  }
}

/* NEU select styling */

.neu-select {
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  font-size: 0.9rem;
  background: linear-gradient(145deg, var(--neu-bg), var(--neu-bg-2));
  box-shadow: inset 3px 3px 7px var(--neu-shadow-dark),inset -3px -3px 7px var(--neu-shadow-light);
  border: none;
  color: var(--neu-text);
}

.neu-select-sm {
  padding: 2px 10px;
  border-radius: 14px;
  font-size: 0.7rem;
  background: linear-gradient(145deg, var(--neu-bg), var(--neu-bg-2));
  box-shadow: inset 3px 3px 7px var(--neu-shadow-dark),inset -3px -3px 7px var(--neu-shadow-light);
  border: none;
  color: var(--bs-success);
}

.form-check-input {
  width: 36px;
  height: 20px;
  appearance: none;
  -webkit-appearance: none;
  border-radius: 999px;
  cursor: pointer;
  flex-shrink: 0;
  position: relative;
  background: linear-gradient(145deg, var(--neu-bg-2), var(--neu-bg));
  box-shadow: inset 2px 2px 4px var(--neu-shadow-dark), inset -1px -1px 3px var(--neu-shadow-light);
  transition: background 0.2s;
  margin-top: 0 !important;
  border-color: #b1b1b1;
}

.form-check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.form-check-input::after {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  top: 2px;
  left: 2px;
  background: linear-gradient(145deg, var(--neu-bg), var(--neu-bg-2));
  box-shadow: 1px 1px 3px var(--neu-shadow-dark);
  transition: left 0.2s;
}

.form-check-input:checked {
  background: linear-gradient(135deg, var(--neu-primary), var(--neu-primary-d));
  box-shadow: none;
  padding: 0;
}

.form-check-input:checked::after {
  left: 16px;
  background: #fff;
}

.form-check-label {
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

.form-check-label .text-muted {
  color: var(--neu-text-muted);
}

.toggle-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

.toggle-wrap input[type="checkbox"] {
  width: 36px;
  height: 20px;
  appearance: none;
  -webkit-appearance: none;
  border-radius: 999px;
  cursor: pointer;
  flex-shrink: 0;
  position: relative;
  background: linear-gradient(145deg, var(--neu-bg-2), var(--neu-bg));
  box-shadow: inset 2px 2px 4px var(--neu-shadow-dark), inset -1px -1px 3px var(--neu-shadow-light);
  transition: background 0.2s;
}

.toggle-wrap input[type="checkbox"]::after {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  top: 2px;
  left: 2px;
  background: linear-gradient(145deg, var(--bs-gray-400), var(--neu-bg-2));
  box-shadow: 1px 1px 3px var(--neu-shadow-dark);
  transition: left 0.2s;
}

.toggle-wrap input[type="checkbox"]:checked {
  background: linear-gradient(135deg, var(--bs-success), var(--bs-teal));
  box-shadow: none;
}

.truncate {
  width: 350px;
}

.toggle-wrap input[type="checkbox"]:checked::after {
  left: 19px;
  background: var(--bs-white);
}

.toggle-label svg {
  padding-top: 2px;
  width: 18px;
  height: 18px;
}

.toggle-label.on {
  color: var(--neu-text);
  font-weight: bolder;
  font-family: 'Anta';
}

.toggle-label.off {
  color: var(--bs-gray-500);
}

.dark .toggle-label.on {
  color: var(--neu-text);
}

.neu-form-input {
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: 0.75rem;
  font-size: 0.875rem;
  color: var(--neu-text);
  background: transparent;
  transition: all 0.2s ease;
  outline: none;
  border: none;
  box-shadow: inset 17px 4px 8px rgba(0,0,0,0.15), inset -4px -4px 8px var(--neu-bg);
}

.dark .neu-form-input {
  color: var(--neu-text);
}

.neu-form-input::placeholder {
  color: #9ca3af;
}

.neu-form-input:focus {
  box-shadow: inset 4px 4px 8px rgba(0,0,0,0.15), inset -4px -4px 8px var(--neu-bg), 0 0 0 2px #a855f7;
}

@media (max-width: 950px) {
  .truncate {
    width: 160px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

