:root {
  --so-accent: #4f35e8;
  --so-accent-2: #7058f5;
  --so-pale: #eceaff;
  --so-ink: #16162a;
  --so-muted: #7b7b96;
  --so-faint: #c4c4d8;
  --so-border: #e6e6f0;
  --so-surface: #ffffff;
  --so-bg: #f2f3f7;
  --so-success: #10b981;
  --so-success-bg: #d1fae5;
  --so-warning: #f59e0b;
  --so-warning-bg: #fef3c7;
  --so-danger: #ef4444;
  --so-danger-bg: #fee2e2;
  --so-info: #3b82f6;
  --so-info-bg: #dbeafe;
  --so-orange: #f97316;
  --so-orange-bg: #ffedd5;
  --so-r: 14px;
  --so-r-sm: 8px;
  --so-sh: 0 2px 10px rgba(0, 0, 0, 0.06);
  --so-sh-hover: 0 8px 28px rgba(79, 53, 232, 0.1);
  --t: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  font-family: "DM Sans", system-ui, sans-serif;
  background: var(--so-bg);
  color: var(--so-ink);
  -webkit-font-smoothing: antialiased;
}

/* ── Header ─────────────────────────── */
.so-header {
  background: var(--so-surface);
  border-bottom: 1px solid var(--so-border);
  padding: 18px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 24px;
}

.so-header h1 {
  font-family: "Sora", sans-serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--so-ink);
  margin: 0;
}

.so-header small {
  font-size: 12px;
  color: var(--so-muted);
  display: block;
  margin-top: 3px;
}

/* ── Filter row ──────────────────────── */
.so-filters {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.so-ctrl {
  border: 1.5px solid var(--so-border);
  border-radius: var(--so-r-sm);
  padding: 0 12px;
  height: 38px;
  font-size: 13px;
  font-family: inherit;
  color: var(--so-ink);
  background: var(--so-surface);
  outline: none;
  transition: border-color var(--t);
}

.so-ctrl:focus {
  border-color: var(--so-accent);
  box-shadow: 0 0 0 3px rgba(79, 53, 232, 0.1);
}

.so-btn {
  border-radius: var(--so-r-sm);
  padding: 0 16px;
  height: 38px;
  font-size: 13px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  border: none;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: all var(--t);
}

.so-btn-apply {
  background: linear-gradient(135deg, var(--so-accent), var(--so-accent-2));
  color: #fff;
  box-shadow: 0 2px 10px rgba(79, 53, 232, 0.24);
}

.so-btn-apply:hover {
  opacity: 0.88;
}

.so-btn-ghost {
  background: var(--so-surface);
  color: var(--so-muted);
  border: 1.5px solid var(--so-border);
}

.so-btn-ghost:hover {
  border-color: var(--so-accent);
  color: var(--so-accent);
  background: var(--so-pale);
}

/* ── Search + export bar ─────────────── */
.so-toolbar {
  padding: 0 0 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.so-search-wrap {
  position: relative;
  flex: 1;
  max-width: 320px;
}

.so-search-wrap i {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--so-muted);
  font-size: 13px;
  pointer-events: none;
}

.so-search-input {
  width: 100%;
  padding: 0 12px 0 36px;
  height: 38px;
  border: 1.5px solid var(--so-border);
  border-radius: var(--so-r-sm);
  font-size: 13px;
  font-family: inherit;
  color: var(--so-ink);
  background: var(--so-surface);
  outline: none;
  transition: border-color var(--t);
}

.so-search-input:focus {
  border-color: var(--so-accent);
  box-shadow: 0 0 0 3px rgba(79, 53, 232, 0.1);
}

.so-toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.so-results-count {
  font-size: 12.5px;
  color: var(--so-muted);
}

.so-results-count strong {
  color: var(--so-ink);
  font-weight: 700;
}

/* ── Status tabs ─────────────────────── */
.so-tabs {
  padding: 0 0 16px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.so-tab {
  border-radius: 20px;
  padding: 5px 14px;
  font-size: 12.5px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  border: 1.5px solid var(--so-border);
  background: var(--so-surface);
  color: var(--so-muted);
  transition: all var(--t);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.so-tab:hover {
  border-color: var(--so-accent);
  color: var(--so-accent);
  background: var(--so-pale);
}

.so-tab.active {
  background: var(--so-accent);
  color: #fff;
  border-color: var(--so-accent);
  box-shadow: 0 2px 8px rgba(79, 53, 232, 0.28);
}

.so-tab-count {
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.25);
  color: #fff;
  font-size: 10.5px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
}

.so-tab:not(.active) .so-tab-count {
  background: var(--so-bg);
  color: var(--so-muted);
}

/* ── Order cards grid ────────────────── */
.so-grid {
  padding: 0 0 40px;
}

.so-card {
  background: var(--so-surface);
  border: 1px solid var(--so-border);
  border-radius: var(--so-r);
  padding: 16px 18px;
  margin-bottom: 10px;
  box-shadow: var(--so-sh);
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 14px;
  align-items: center;
  transition:
    box-shadow var(--t),
    transform var(--t),
    border-color var(--t);
  cursor: pointer;
  position: relative;
  animation: so-fadein 0.25s ease both;
  text-decoration: none;
  color: inherit;
}

.so-card:hover {
  box-shadow: var(--so-sh-hover);
  transform: translateY(-1px);
  border-color: rgba(79, 53, 232, 0.18);
}

@keyframes so-fadein {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

/* Stagger */
.so-card:nth-child(1) {
  animation-delay: 0ms;
}

.so-card:nth-child(2) {
  animation-delay: 30ms;
}

.so-card:nth-child(3) {
  animation-delay: 60ms;
}

.so-card:nth-child(4) {
  animation-delay: 90ms;
}

.so-card:nth-child(5) {
  animation-delay: 120ms;
}

.so-card:nth-child(6) {
  animation-delay: 150ms;
}

.so-card:nth-child(7) {
  animation-delay: 180ms;
}

.so-card:nth-child(8) {
  animation-delay: 210ms;
}

/* Left: product images */
.so-card-images {
  display: flex;
  align-items: center;
  gap: -4px;
  position: relative;
  flex-shrink: 0;
}

.so-card-img {
  width: 46px;
  height: 46px;
  border-radius: var(--so-r-sm);
  border: 2px solid var(--so-surface);
  background: #f5f5fa;
  object-fit: contain;
  padding: 3px;
  box-shadow: var(--so-sh);
  margin-left: -8px;
}

.so-card-img:first-child {
  margin-left: 0;
}

.so-card-img-more {
  width: 46px;
  height: 46px;
  border-radius: var(--so-r-sm);
  border: 2px solid var(--so-surface);
  background: var(--so-pale);
  color: var(--so-accent);
  font-size: 11px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: -8px;
  box-shadow: var(--so-sh);
}

/* Middle: order info */
.so-card-body {
  min-width: 0;
}

.so-card-top {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 5px;
}

.so-card-order-no {
  font-family: "SF Mono", "Fira Code", monospace;
  font-size: 13px;
  font-weight: 700;
  color: var(--so-accent);
  background: var(--so-pale);
  border-radius: 6px;
  padding: 2px 9px;
  text-decoration: none;
  transition: background var(--t);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.so-card-order-no:hover {
  background: var(--so-accent);
  color: #fff;
}

.so-card-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.so-card-meta-item {
  font-size: 12px;
  color: var(--so-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}

.so-card-meta-item i {
  font-size: 10px;
  opacity: 0.7;
}

.so-card-po {
  font-family: "SF Mono", "Fira Code", monospace;
  font-size: 11.5px;
  color: var(--so-muted);
  background: var(--so-bg);
  border: 1px solid var(--so-border);
  border-radius: 4px;
  padding: 1px 7px;
}

/* Right: amount + status + action */
.so-card-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  flex-shrink: 0;
}

.so-card-amount {
  font-family: "Sora", sans-serif;
  font-size: 17px;
  font-weight: 700;
  color: var(--so-ink);
}

.so-card-qty {
  font-size: 11.5px;
  color: var(--so-muted);
  margin-top: -5px;
}

/* Status badges */
.so-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-radius: 20px;
  padding: 4px 11px;
  font-size: 11.5px;
  font-weight: 700;
  white-space: nowrap;
}

.so-badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.so-badge.placed {
  background: var(--so-warning-bg);
  color: var(--so-warning);
}

.so-badge.placed .so-badge-dot {
  background: var(--so-warning);
}

.so-badge.processed {
  background: var(--so-info-bg);
  color: var(--so-info);
}

.so-badge.processed .so-badge-dot {
  background: var(--so-info);
}

.so-badge.shipped {
  background: var(--so-info-bg);
  color: var(--so-info);
}

.so-badge.shipped .so-badge-dot {
  background: var(--so-info);
  animation: so-pulse 1.8s ease infinite;
}

.so-badge.transit {
  background: var(--so-orange-bg);
  color: var(--so-orange);
}

.so-badge.transit .so-badge-dot {
  background: var(--so-orange);
}

.so-badge.delivered {
  background: var(--so-success-bg);
  color: var(--so-success);
}

.so-badge.delivered .so-badge-dot {
  background: var(--so-success);
  animation: so-pulse 1.8s ease infinite;
}

.so-badge.cancelled {
  background: var(--so-danger-bg);
  color: var(--so-danger);
}

.so-badge.cancelled .so-badge-dot {
  background: var(--so-danger);
}

.so-badge.unpaid {
  background: #fef3c7;
  color: #92400e;
}

.so-badge.unpaid .so-badge-dot {
  background: #92400e;
}

@keyframes so-pulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }

  50% {
    opacity: 0.4;
    transform: scale(1.5);
  }
}

.so-payment-chip {
  font-size: 11px;
  font-weight: 700;
  color: var(--so-success);
  background: var(--so-success-bg);
  border-radius: 20px;
  padding: 2px 9px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.so-btn-detail {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--so-pale);
  color: var(--so-accent);
  border: 1.5px solid rgba(79, 53, 232, 0.2);
  border-radius: var(--so-r-sm);
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  transition: all var(--t);
}

.so-btn-detail:hover {
  background: var(--so-accent);
  color: #fff;
  border-color: var(--so-accent);
}

/* ── Card wrapper (new) ──────────────────── */
.so-card-wrap {
  background: var(--so-surface);
  border: 1px solid var(--so-border);
  border-radius: var(--so-r);
  margin-bottom: 10px;
  box-shadow: var(--so-sh);
  overflow: hidden;
  transition:
    box-shadow var(--t),
    transform var(--t),
    border-color var(--t);
  animation: so-fadein 0.25s ease both;
}

.so-card-wrap:hover {
  box-shadow: var(--so-sh-hover);
  transform: translateY(-1px);
  border-color: rgba(79, 53, 232, 0.18);
}

/* Stagger on wrapper */
.so-card-wrap:nth-child(1) {
  animation-delay: 0ms;
}

.so-card-wrap:nth-child(2) {
  animation-delay: 30ms;
}

.so-card-wrap:nth-child(3) {
  animation-delay: 60ms;
}

.so-card-wrap:nth-child(4) {
  animation-delay: 90ms;
}

.so-card-wrap:nth-child(5) {
  animation-delay: 120ms;
}

.so-card-wrap:nth-child(6) {
  animation-delay: 150ms;
}

.so-card-wrap:nth-child(7) {
  animation-delay: 180ms;
}

.so-card-wrap:nth-child(8) {
  animation-delay: 210ms;
}

.so-card-wrap .so-card {
  margin-bottom: 0;
  border: none;
  border-radius: 0;
  box-shadow: none;
  animation: none;
  transform: none;
}

.so-card-wrap .so-card:hover {
  box-shadow: none;
  transform: none;
}

/* ── Card action footer ───────────────────── */
.so-card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px 12px;
  border-top: 1px solid var(--so-border);
  background: var(--so-bg);
  flex-wrap: wrap;
}

.so-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: var(--so-r-sm);
  padding: 6px 13px;
  font-size: 12px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  border: 1.5px solid transparent;
  transition: all var(--t);
  white-space: nowrap;
}

.so-action-btn-receipt {
  background: var(--so-pale);
  color: var(--so-accent);
  border-color: rgba(79, 53, 232, 0.2);
}

.so-action-btn-receipt:hover {
  background: var(--so-accent);
  color: #fff;
  border-color: var(--so-accent);
}

.so-action-btn-invoice {
  background: var(--so-success-bg);
  color: var(--so-success);
  border-color: rgba(16, 185, 129, 0.2);
}

.so-action-btn-invoice:hover {
  background: var(--so-success);
  color: #fff;
  border-color: var(--so-success);
}

.so-action-btn-track {
  background: var(--so-orange-bg);
  color: var(--so-orange);
  border-color: rgba(249, 115, 22, 0.2);
}

.so-action-btn-track:hover {
  background: var(--so-orange);
  color: #fff;
  border-color: var(--so-orange);
}

/* ── Cancel reason tooltip ───────────── */
.so-cancel-note {
  font-size: 11px;
  color: var(--so-danger);
  margin-top: 2px;
  max-width: 220px;
  text-align: right;
  line-height: 1.4;
}

/* ── Loading / empty ─────────────────── */
.so-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 64px 24px;
  color: var(--so-muted);
  font-size: 13.5px;
}

.so-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 64px 24px;
  background: var(--so-surface);
  border: 2px dashed var(--so-border);
  border-radius: var(--so-r);
  margin: 0 24px 40px;
}

.so-empty-icon {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: var(--so-pale);
  color: var(--so-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  margin: 0 auto 18px;
}

.so-empty h5 {
  font-family: "Sora", sans-serif;
  font-size: 17px;
  font-weight: 700;
  color: var(--so-ink);
  margin-bottom: 6px;
}

.so-empty p {
  font-size: 13px;
  color: var(--so-muted);
  margin: 0;
}

/* ── Pagination ──────────────────────── */
.so-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 0 24px 40px;
  flex-wrap: wrap;
}

.so-pg-btn {
  min-width: 36px;
  height: 36px;
  border-radius: var(--so-r-sm);
  border: 1.5px solid var(--so-border);
  background: var(--so-surface);
  color: var(--so-muted);
  font-size: 13px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--t);
}

.so-pg-btn:hover {
  border-color: var(--so-accent);
  color: var(--so-accent);
  background: var(--so-pale);
}

.so-pg-btn.active {
  background: var(--so-accent);
  color: #fff;
  border-color: var(--so-accent);
  box-shadow: 0 2px 8px rgba(79, 53, 232, 0.28);
}

/* ── Responsive ──────────────────────── */
@media (max-width: 768px) {
  .so-header {
    padding: 14px 16px;
  }

  .so-toolbar,
  .so-tabs,
  .so-grid {
    padding-left: 0px;
    padding-right: 0px;
  }

  .so-card {
    grid-template-columns: auto 1fr;
  }

  .so-card-right {
    position: absolute;
    top: 14px;
    right: 14px;
  }

  .so-card-body {
    padding-right: 90px;
  }

  .so-card-amount {
    font-size: 15px;
  }

  .so-card-img {
    width: 40px;
    height: 40px;
  }
}

@media (max-width: 480px) {
  .so-card {
    grid-template-columns: 1fr;
  }

  .so-card-right {
    position: static;
    align-items: flex-start;
    flex-direction: row;
    flex-wrap: wrap;
  }

  .so-card-body {
    padding-right: 0;
  }
}

/* ── Dual currency amount display ─────────────────────────────────────── */
.so-card-amount-wrap {
  text-align: right;
}

.so-amount-main {
  font-size: 15px;
  font-weight: 700;
  color: var(--so-ink, #111827);
  line-height: 1.2;
}

.so-amount-bill {
  font-size: 13px;
  font-weight: 600;
  color: #4f46e5;
  margin-top: 3px;
  line-height: 1.2;
}

.so-amount-curr {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  line-height: 1;
  margin-bottom: 2px;
}

.so-amount-curr-ship {
  color: #9ca3af;
}
.so-amount-curr-bill {
  color: #a5b4fc;
}

/* ── Shipping line under meta ─────────────────────────────────────────── */
.so-shipping-line {
  font-size: 11px;
  color: #6b7280;
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ── Dual invoice buttons ─────────────────────────────────────────────── */
.so-action-btn-invoice {
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  color: #0369a1;
}
.so-action-btn-invoice:hover {
  background: #e0f2fe;
  color: #0284c7;
}

.so-action-btn-invoice-bill {
  background: #f5f3ff;
  border: 1px solid #ddd6fe;
  color: #6d28d9;
}
.so-action-btn-invoice-bill:hover {
  background: #ede9fe;
  color: #5b21b6;
}
