:root {
  /* === New design tokens === */
  --accent: #6366f1;
  --accent-light: #eef2ff;
  --accent-hover: #818cf8;

  /* === Semantic colors === */
  --success: #10b981;
  --success-light: #ecfdf5;
  --success-dark: #059669;
  --warning: #f59e0b;
  --warning-light: #fffbeb;
  --warning-dark: #d97706;
  --danger: #ef4444;
  --danger-light: #fef2f2;
  --danger-dark: #dc2626;
  --info: #3b82f6;
  --info-light: #eff6ff;

  /* === Neutral scale (warm gray) === */
  --n-950: #0f1117;
  --n-900: #1a1c25;
  --n-850: #22252f;
  --n-800: #2a2d39;
  --n-700: #3a3d4c;
  --n-600: #4b4f5e;
  --n-500: #6b7084;
  --n-400: #8b8fa3;
  --n-300: #b0b4c5;
  --n-200: #d1d4de;
  --n-150: #e2e4ea;
  --n-100: #ededf1;
  --n-50: #f7f7f9;
  --white: #ffffff;

  /* === Shadows (Notion-inspired) === */
  --shadow-xs: 0 1px 2px rgba(15, 17, 23, 0.04);
  --shadow-sm:
    0 1px 3px rgba(15, 17, 23, 0.06), 0 1px 2px rgba(15, 17, 23, 0.04);
  --shadow-md:
    0 4px 6px -1px rgba(15, 17, 23, 0.06), 0 2px 4px -2px rgba(15, 17, 23, 0.04);
  --shadow-lg:
    0 10px 15px -3px rgba(15, 17, 23, 0.06),
    0 4px 6px -4px rgba(15, 17, 23, 0.04);
  --shadow-xl:
    0 20px 25px -5px rgba(15, 17, 23, 0.08),
    0 8px 10px -6px rgba(15, 17, 23, 0.04);

  /* === Border radius === */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;

  /* === Spacing === */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;

  /* === Transitions === */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);

  /* === Borders === */
  --border-default: 1px solid var(--n-150);
  --border-subtle: 1px solid var(--n-100);

  /* === Typography === */
  --font-sans:
    "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", "Fira Code", monospace;

  /* === Backward compatibility aliases for inline styles in JS === */
  --primary: #3b3f5c;
  --primary-dark: #4a4f72;
  --primary-light: #f0f1f5;
  --primary-hover: #4a4f72;
  --secondary: #64748b;
  --dark: #1a1c25;
  --gray-900: #1a1c25;
  --gray-800: #2a2d39;
  --gray-700: #3a3d4c;
  --gray-600: #4b4f5e;
  --gray-500: #6b7084;
  --gray-400: #8b8fa3;
  --gray-300: #b0b4c5;
  --gray-200: #d1d4de;
  --gray-100: #ededf1;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-sans);
  background: var(--n-50);
  color: var(--n-900);
  line-height: 1.6;
  display: flex;
  height: 100vh;
  overflow: hidden;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* === Sidebar === */
.sidebar {
  width: 88px;
  background: var(--white);
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--space-6) 0;
  border-right: var(--border-subtle);
  z-index: 100;
  flex-shrink: 0;
  position: relative;
}

.logo-icon {
  width: 40px;
  height: 40px;
  background: var(--n-900);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  margin-bottom: var(--space-8);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition-base);
}
.logo-icon:hover {
  box-shadow: var(--shadow-md);
}

.nav-menu {
  list-style: none;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: 0 var(--space-3);
}
.nav-item {
  width: 100%;
}
.nav-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 52px;
  border-radius: var(--radius-md);
  color: var(--n-400);
  text-decoration: none;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.02em;
  transition: all var(--transition-fast);
  cursor: pointer;
  gap: var(--space-1);
  position: relative;
}
.nav-link:hover {
  background: var(--n-50);
  color: var(--n-700);
}
.nav-icon {
  font-size: 20px;
  line-height: 1;
}
.nav-link.active {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
}
.nav-link.active::before {
  content: "";
  position: absolute;
  left: -12px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  background: var(--primary);
  border-radius: 0 3px 3px 0;
}

/* === Main content === */
.main-content {
  flex: 1;
  height: 100vh;
  overflow-y: auto;
  padding: var(--space-8) var(--space-10);
  -webkit-overflow-scrolling: touch;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-6);
}
.header h2 {
  font-size: 22px;
  font-weight: 700;
  color: var(--n-900);
  letter-spacing: -0.02em;
}
.header-actions {
  display: flex;
  gap: var(--space-2);
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.header-actions .btn {
  border-radius: var(--radius-md);
}
.view-toggle-btn {
  width: 38px;
  min-width: 38px;
  height: 38px;
  padding: 0;
  border: var(--border-default);
  border-radius: var(--radius-md);
  background: var(--white);
  color: var(--n-400);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  line-height: 1;
  transition: all var(--transition-fast);
}
.view-toggle-btn:hover {
  border-color: var(--n-300);
  color: var(--n-700);
  background: var(--n-50);
}
.view-toggle-btn:active {
  transform: scale(0.96);
}
.view-toggle-btn.is-list {
  background: var(--primary-light);
  color: var(--primary);
  border-color: transparent;
}

/* === Buttons === */
.btn {
  padding: 0 var(--space-4);
  height: 38px;
  border: none;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  letter-spacing: 0.01em;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  transition: all var(--transition-fast);
}
.btn:active {
  transform: scale(0.97);
}
.btn-primary {
  background: var(--primary);
  color: var(--white);
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover {
  background: var(--primary-hover);
  box-shadow: var(--shadow-md);
}
.btn-success {
  background: var(--success);
  color: var(--white);
}
.btn-warning {
  background: var(--warning-light);
  color: var(--warning-dark);
  border: 1px solid var(--warning);
}
.btn-danger {
  background: var(--danger-light);
  color: var(--danger-dark);
  border: 1px solid var(--danger);
}
.btn-secondary {
  background: var(--white);
  color: var(--n-600);
  border: var(--border-default);
}
.btn-secondary:hover {
  background: var(--n-50);
  border-color: var(--n-200);
}
.btn-sm {
  height: 32px;
  padding: 0 var(--space-3);
  font-size: 12px;
}
.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* === Stats grid with trend indicators === */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}
.stat-card {
  background: var(--white);
  padding: var(--space-5);
  border-radius: var(--radius-lg);
  border: var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  position: relative;
  overflow: hidden;
  transition:
    box-shadow var(--transition-base),
    border-color var(--transition-base);
}
.stat-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--n-200);
}
.stat-card::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    transparent 8%,
    var(--stat-accent, var(--n-200)) 18%,
    var(--stat-accent, var(--n-200)) 28%,
    transparent 38%,
    transparent 48%,
    var(--stat-accent, var(--n-200)) 58%,
    var(--stat-accent, var(--n-200)) 68%,
    transparent 78%,
    transparent 85%,
    var(--stat-accent, var(--n-200)) 92%,
    var(--stat-accent, var(--n-200)) 100%
  );
  opacity: 0.5;
}
.stat-card::before {
  content: "";
  position: absolute;
  top: var(--space-4);
  right: var(--space-4);
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-bottom: 6px solid var(--stat-accent, var(--n-300));
  opacity: 0.6;
}
.stat-card:nth-child(1) {
  --stat-accent: var(--warning);
}
.stat-card:nth-child(2) {
  --stat-accent: var(--accent);
}
.stat-card:nth-child(3) {
  --stat-accent: var(--success);
}
.stat-card:nth-child(4) {
  --stat-accent: var(--n-300);
}
.stat-label {
  font-size: 12px;
  color: var(--n-400);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--n-900);
  line-height: 1.1;
  letter-spacing: -0.02em;
}

/* === Data grid & cards === */
.data-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-8);
}
#auditLogsGrid.data-grid {
  display: block;
}
#productsGrid.data-grid:not(.list-view-grid) {
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: var(--space-3);
}
#productsGrid.data-grid:not(.list-view-grid) .data-card {
  padding: var(--space-4);
  gap: var(--space-2);
}
#productsGrid.data-grid:not(.list-view-grid) .data-card-title {
  font-size: 15px;
}
#productsGrid.data-grid:not(.list-view-grid) .data-card-body {
  gap: var(--space-1);
  font-size: 13px;
}
#productsGrid.data-grid:not(.list-view-grid) .data-card-footer {
  padding-top: var(--space-2);
  gap: var(--space-2);
}
.data-grid.list-view-grid {
  display: block;
  overflow-x: auto;
}
.data-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  border: var(--border-subtle);
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  transition: all var(--transition-base);
}
.data-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--n-200);
}
.data-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: var(--border-subtle);
  padding-bottom: var(--space-3);
}
.data-card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--n-900);
}
.data-card-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  font-size: 13px;
  color: var(--n-600);
}
.data-card-footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
  padding-top: var(--space-3);
  border-top: var(--border-subtle);
}
.info-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 13px;
}
/* === List tables === */
.list-table {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.list-table-header,
.list-table-row {
  display: grid;
  gap: var(--space-3);
  align-items: start;
  justify-items: start;
}
.list-table-header {
  padding: var(--space-3) var(--space-4);
  color: var(--n-400);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border-bottom: var(--border-subtle);
}
.list-table-header > span {
  text-align: left;
}
.list-table-row {
  background: var(--white);
  border-radius: var(--radius-md);
  border: var(--border-subtle);
  padding: var(--space-3) var(--space-4);
  transition: all var(--transition-fast);
}
.list-table-row:hover {
  border-color: var(--n-200);
  box-shadow: var(--shadow-sm);
}
.list-table-cell {
  min-width: 0;
  font-size: 13px;
  color: var(--n-600);
  width: 100%;
}
.list-table-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.list-table-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--n-900);
}
.list-table-meta {
  font-size: 11px;
  color: var(--n-400);
}
.list-table-emphasis {
  font-size: 14px;
  font-weight: 700;
  color: var(--n-900);
  font-variant-numeric: tabular-nums;
}
.list-table-description {
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.5;
}
.list-table-badges {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  align-items: flex-start;
}
.list-table-actions {
  display: flex;
  justify-content: flex-start;
  gap: var(--space-2);
  flex-wrap: wrap;
  align-self: start;
}
.view-mode-empty {
  grid-column: 1 / -1;
  background: var(--white);
  border-radius: var(--radius-lg);
  border: var(--border-subtle);
  padding: var(--space-10) var(--space-5);
  text-align: center;
  color: var(--n-400);
  font-size: 14px;
}
.product-list-table {
  min-width: 920px;
}
.product-list-table .list-table-header,
.product-list-table .list-table-row {
  grid-template-columns:
    minmax(140px, 1.05fr) minmax(92px, 0.82fr)
    68px 120px 84px minmax(140px, 1.2fr) minmax(170px, 1.35fr) minmax(
      120px,
      140px
    );
}
.order-list-table {
  min-width: 980px;
}
.order-list-table .list-table-header,
.order-list-table .list-table-row {
  grid-template-columns:
    minmax(84px, 0.75fr) minmax(160px, 1.25fr)
    100px minmax(140px, 1.15fr) 76px 110px 140px minmax(152px, 168px);
}
.order-list-table .list-table-actions {
  flex-wrap: nowrap;
  min-width: 0;
}
.order-list-table .list-table-actions .btn {
  flex: 0 0 auto;
  white-space: nowrap;
}
.customer-list-table {
  min-width: 760px;
}
.customer-list-table .list-table-header,
.customer-list-table .list-table-row {
  grid-template-columns:
    minmax(130px, 1.05fr) minmax(120px, 1fr) minmax(180px, 1.5fr)
    90px minmax(120px, 150px);
}
.staff-list-table {
  min-width: 960px;
}
.staff-list-table .list-table-header,
.staff-list-table .list-table-row {
  grid-template-columns:
    minmax(140px, 1.05fr) minmax(120px, 0.95fr)
    100px minmax(260px, 1.8fr) 110px minmax(180px, 220px);
}

/* === Badges === */
.badge {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 var(--space-2);
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.badge-pending {
  background: var(--warning-light);
  color: var(--warning-dark);
}
.badge-sorted {
  background: var(--info-light);
  color: var(--info);
}
.badge-delivered {
  background: var(--success-light);
  color: var(--success-dark);
}
.badge-paid {
  background: var(--accent-light);
  color: var(--accent);
}
.badge-cancelled {
  background: var(--danger-light);
  color: var(--danger-dark);
}

/* === Filter section === */
.filter-section {
  background: var(--white);
  padding: var(--space-5);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-6);
  border: var(--border-subtle);
}
.filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--space-4);
}

/* === Form controls === */
.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.form-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--n-500);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.form-control {
  height: 42px;
  padding: 0 var(--space-3);
  border: var(--border-default);
  border-radius: var(--radius-md);
  font-size: 14px;
  font-family: inherit;
  background: var(--white);
  color: var(--n-900);
  transition: all var(--transition-fast);
  outline: none;
  appearance: none;
}
.form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}
.form-control::placeholder {
  color: var(--n-300);
}
select.form-control {
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7084' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  padding-right: 36px;
}
.product-image-preview {
  width: 100%;
  height: 160px;
  border: 1.5px dashed var(--n-200);
  border-radius: var(--radius-md);
  background: var(--n-50);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.product-image-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.product-upload-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 8px;
}
.product-upload-row input[type="file"] {
  flex: 1;
  min-width: 0;
  font-size: 12px;
}

/* === Modal / Drawer === */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 17, 23, 0.4);
  backdrop-filter: blur(4px);
  z-index: 2000;
  justify-content: flex-end;
  opacity: 0;
  transition: opacity var(--transition-slow);
}
.modal.show {
  display: flex;
  opacity: 1;
}

.modal-content {
  background: var(--white);
  width: 100%;
  max-width: 540px;
  height: 100%;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-xl);
  transform: translateX(100%);
  transition: transform var(--transition-slow) cubic-bezier(0.2, 0.8, 0.2, 1);
  border-left: var(--border-subtle);
}
.modal.show .modal-content {
  transform: translateX(0);
}

.modal-center {
  justify-content: center;
  align-items: center;
}
.modal-center .modal-content {
  height: auto;
  max-height: 90vh;
  border-radius: var(--radius-xl);
  transform: scale(0.95) translateY(10px);
  transition: all var(--transition-slow) cubic-bezier(0.2, 0.8, 0.2, 1);
  border-left: none;
}
.modal-center.show .modal-content {
  transform: scale(1) translateY(0);
}

.modal-header {
  padding: var(--space-5) var(--space-6);
  border-bottom: var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--n-900);
  letter-spacing: -0.01em;
}
.modal-close {
  background: var(--n-50);
  border: none;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  font-size: 18px;
  color: var(--n-500);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}
.modal-close:hover {
  background: var(--n-100);
  color: var(--n-700);
}

.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-6);
  -webkit-overflow-scrolling: touch;
}
.modal-footer {
  padding: var(--space-4) var(--space-6);
  border-top: var(--border-subtle);
  background: var(--white);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  justify-content: flex-end;
}

/* === Order item card === */
.order-item-card {
  background: var(--n-50);
  padding: var(--space-4);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.input-group {
  display: flex;
  gap: var(--space-2);
  align-items: center;
  width: 100%;
}
.input-group .form-control {
  flex: 1;
  margin: 0;
}

.hidden {
  display: none !important;
}
.truncate {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 150px;
}

/* === Invoice === */
.invoice-container {
  font-family: var(--font-mono);
  padding: var(--space-4);
}
.invoice-header {
  text-align: center;
  margin-bottom: var(--space-6);
  border-bottom: 2px solid var(--n-900);
  padding-bottom: var(--space-4);
}
.invoice-number {
  font-size: 18px;
  font-weight: 700;
  color: var(--primary);
}
.invoice-table {
  width: 100%;
  border-collapse: collapse;
  margin: var(--space-4) 0;
  font-size: 13px;
}
.invoice-table th,
.invoice-table td {
  padding: var(--space-2) var(--space-1);
  text-align: left;
  border-bottom: 1px dashed var(--n-200);
}
.invoice-total {
  text-align: right;
  font-size: 16px;
  font-weight: 700;
  margin-top: var(--space-4);
  color: var(--primary);
}

/* === Settings === */
.settings-section {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  margin-bottom: var(--space-5);
  border: var(--border-subtle);
}
.settings-section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--n-400);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: var(--space-5);
  padding-bottom: var(--space-3);
  border-bottom: var(--border-subtle);
}
.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-5);
}
.settings-toggle-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-4);
  background: var(--n-50);
  border-radius: var(--radius-md);
  cursor: pointer;
  border: var(--border-subtle);
  transition: background var(--transition-fast);
}
.settings-toggle-row:hover {
  background: var(--n-100);
}
.settings-toggle-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--n-900);
  margin-bottom: var(--space-1);
}
.settings-toggle-desc {
  font-size: 12px;
  color: var(--n-500);
  line-height: 1.4;
}
/* Toggle switch */
.toggle-switch {
  position: relative;
  flex-shrink: 0;
  width: 40px;
  height: 24px;
}
.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--n-200);
  border-radius: 12px;
  transition: var(--transition-fast);
}
.toggle-slider::before {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  top: 3px;
  background: white;
  border-radius: 50%;
  transition: var(--transition-fast);
  box-shadow: var(--shadow-xs);
}
.toggle-switch input:checked + .toggle-slider {
  background: var(--accent);
}
.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(16px);
}
/* === Unit tag === */
.unit-tag {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-3);
  background: var(--primary-light);
  color: var(--primary);
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 600;
}
.unit-tag button {
  background: none;
  border: none;
  color: var(--primary);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 0;
  opacity: 0.6;
}
.unit-tag button:hover {
  opacity: 1;
}

/* === Order detail page === */
.order-detail-page {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.order-detail-main {
  display: flex;
  gap: var(--space-4);
  align-items: flex-start;
}
.order-detail-left {
  flex: 1 1 0;
  min-width: 0;
}
.order-detail-right {
  flex: 0 0 clamp(320px, 30vw, 380px);
  width: 100%;
  max-width: 380px;
  min-width: 300px;
}
.order-detail-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  border: var(--border-subtle);
  padding: var(--space-5);
  margin-bottom: var(--space-3);
}
.order-detail-section-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--n-400);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: var(--space-3);
}
.order-detail-summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 15px;
  font-weight: 700;
}
.order-detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-4);
  justify-content: flex-end;
}
.order-detail-left-scroll {
  max-height: calc(100vh - 200px);
  overflow-y: auto;
  padding-right: var(--space-1);
  -webkit-overflow-scrolling: touch;
}
.detail-order-meta-box {
  margin-top: var(--space-3);
  padding-top: var(--space-3);
  border-top: var(--border-subtle);
  font-size: 13px;
  color: var(--n-500);
}
.detail-order-meta-box strong {
  color: var(--n-900);
}
.detail-item-group {
  margin-bottom: var(--space-3);
}
.detail-item-group-title {
  font-size: 12px;
  font-weight: 700;
  margin-bottom: var(--space-2);
}
.detail-item-group-title.pending {
  color: var(--warning-dark);
}
.detail-item-group-title.sorted {
  color: var(--success-dark);
}
.detail-item-group-title.returned {
  color: var(--danger-dark);
}
.detail-item-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(136px, 1fr));
  gap: var(--space-2);
}
.detail-item-card {
  width: 100%;
  border: var(--border-default);
  background: var(--white);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  text-align: left;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.detail-item-card:hover {
  border-color: var(--n-300);
  box-shadow: var(--shadow-sm);
}
.detail-item-card.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}
.detail-item-card.pending {
  border-left: 3px solid var(--warning);
}
.detail-item-card.sorted {
  border-left: 3px solid var(--success);
  background: var(--success-light);
}
.detail-item-card.returned {
  border-left: 3px solid var(--danger);
  opacity: 0.6;
}
.detail-item-top {
  display: flex;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: var(--space-1);
}
.detail-item-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--n-900);
  line-height: 1.3;
}
.detail-item-amount {
  font-size: 12px;
  font-weight: 700;
  color: var(--n-700);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.detail-item-meta {
  font-size: 11px;
  color: var(--n-400);
  line-height: 1.4;
}
.detail-sort-panel {
  background: var(--n-50);
  border: var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-3);
}
.detail-sort-empty {
  font-size: 13px;
  color: var(--n-400);
}
.detail-sort-product {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}
.detail-sort-product-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--n-900);
}
.detail-sort-product-meta {
  font-size: 11px;
  color: var(--n-400);
}
.detail-sort-input-row {
  display: flex;
  gap: var(--space-2);
  align-items: stretch;
  margin-top: var(--space-2);
}
.detail-sort-input-row .form-control {
  flex: 1 1 auto;
  height: 44px;
  min-width: 0;
  font-size: 15px;
}
.detail-sort-input-row .btn {
  flex: 0 0 auto;
  height: 44px;
  padding: 0 var(--space-5);
  font-size: 14px;
}
.detail-sort-tip {
  margin-top: var(--space-2);
  font-size: 12px;
  color: var(--n-400);
}
.create-order-page {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.create-order-main {
  display: flex;
  gap: var(--space-4);
  align-items: flex-start;
}
.create-order-left {
  flex: 1.7;
  min-width: 0;
}
.create-order-right {
  flex: 0 0 clamp(300px, 30vw, 380px);
  max-width: 380px;
  min-width: 280px;
}
.create-order-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  border: var(--border-subtle);
  padding: var(--space-5);
  margin-bottom: var(--space-3);
}
.create-order-meta-grid {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(260px, 1.4fr);
  gap: var(--space-4);
  align-items: flex-start;
}
.create-order-customer-summary {
  margin-top: var(--space-4);
  padding: var(--space-4);
  border-radius: var(--radius-md);
  background: var(--n-50);
  border: var(--border-subtle);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3) var(--space-4);
}
.create-order-summary-item {
  min-width: 120px;
}
.create-order-summary-label {
  font-size: 12px;
  color: var(--n-400);
  margin-bottom: var(--space-1);
}
.create-order-summary-value {
  font-size: 14px;
  font-weight: 700;
  color: var(--n-900);
  word-break: break-word;
}
.create-order-toolbar {
  display: flex;
  justify-content: space-between;
  gap: var(--space-3);
  align-items: flex-start;
  margin-bottom: var(--space-2);
}
.create-order-toolbar-left {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}
.create-order-toolbar-desc {
  font-size: 13px;
  color: var(--n-400);
}
.create-order-toolbar-controls {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  flex: 1;
}
.create-order-search {
  min-width: 220px;
  flex: 1;
}
.create-order-filter-chip.active {
  background: var(--primary-light);
  color: var(--primary);
  border-color: transparent;
}
.create-order-results-meta {
  font-size: 13px;
  color: var(--n-400);
  margin-bottom: var(--space-3);
}
.create-order-product-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  max-height: calc(100vh - 330px);
  overflow-y: auto;
  padding-right: var(--space-1);
  -webkit-overflow-scrolling: touch;
}
.create-order-product-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  border: var(--border-subtle);
  background: var(--white);
  transition: all var(--transition-fast);
}
.create-order-product-row.selected {
  border-color: var(--accent);
  background: var(--accent-light);
}
.create-order-product-row.out-of-stock {
  opacity: 0.55;
}
.create-order-product-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--n-900);
}
.create-order-product-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-2);
}
.create-order-meta-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px var(--space-2);
  border-radius: var(--radius-full);
  background: var(--n-100);
  color: var(--n-500);
  font-size: 11px;
  font-weight: 600;
}
.create-order-product-desc {
  margin-top: var(--space-2);
  font-size: 12px;
  color: var(--n-400);
}
.create-order-product-actions {
  min-width: 132px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-2);
}
.create-order-selected-badge {
  display: inline-flex;
  align-items: center;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-full);
  background: var(--accent-light);
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
}
.create-order-empty {
  padding: var(--space-8) var(--space-4);
  border-radius: var(--radius-md);
  border: 1px dashed var(--n-200);
  background: var(--n-50);
  text-align: center;
  color: var(--n-400);
  font-size: 13px;
}
.create-order-sidebar {
  position: sticky;
  top: var(--space-6);
}
.create-order-selected-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  max-height: calc(100vh - 290px);
  overflow-y: auto;
  padding-right: var(--space-1);
  -webkit-overflow-scrolling: touch;
}
.create-order-selected-item {
  border: var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  background: var(--white);
}
.create-order-selected-item.warning {
  border-color: var(--warning);
  background: var(--warning-light);
}
.create-order-selected-top {
  display: flex;
  gap: var(--space-3);
  justify-content: space-between;
  align-items: flex-start;
}
.create-order-selected-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--n-900);
}
.create-order-selected-meta {
  margin-top: var(--space-1);
  font-size: 12px;
  color: var(--n-400);
}
.create-order-selected-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-3);
  margin-top: var(--space-3);
}
.create-order-qty-stepper {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1);
  border-radius: var(--radius-full);
  background: var(--n-100);
}
.create-order-qty-stepper button {
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 50%;
  background: var(--white);
  color: var(--n-700);
  font-size: 18px;
  cursor: pointer;
  box-shadow: var(--shadow-xs);
}
.create-order-qty-stepper input {
  width: 80px;
  border: none;
  background: transparent;
  text-align: center;
  font-size: 14px;
  font-weight: 700;
  color: var(--n-900);
  outline: none;
}
.create-order-selected-subtotal {
  font-size: 16px;
  font-weight: 700;
  color: var(--n-900);
  white-space: nowrap;
}
.create-order-product-list .create-order-empty,
.create-order-selected-list .create-order-empty {
  grid-column: 1 / -1;
}
.create-order-selected-warning {
  margin-top: 8px;
  font-size: 12px;
  color: #b26a00;
}
.create-order-sidebar-footer {
  margin-top: var(--space-4);
  padding-top: var(--space-4);
  border-top: var(--border-subtle);
}
.create-order-footer-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  color: var(--n-400);
  margin-bottom: var(--space-2);
}
.create-order-footer-row.total {
  margin-top: var(--space-2);
  font-size: 18px;
  font-weight: 700;
  color: var(--n-900);
}
.create-order-footer-actions {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-4);
}
.create-order-footer-actions .btn {
  flex: 1;
}
.modal-wide {
  justify-content: center;
  align-items: center;
}
.modal-wide .modal-content {
  width: min(980px, calc(100% - 48px));
  max-width: 980px;
  height: min(90vh, 860px);
  max-height: 90vh;
  border-radius: var(--radius-xl);
  transform: scale(0.95) translateY(20px);
}
.modal-wide.show .modal-content {
  transform: translateY(0);
}
.import-source-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: var(--space-4);
  margin-bottom: var(--space-5);
}
.import-source-card {
  background: var(--n-50);
  border: var(--border-default);
  border-radius: var(--radius-xl);
  padding: var(--space-4);
}
.import-source-card textarea {
  min-height: 180px;
  resize: vertical;
}
.import-source-actions {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  margin-top: var(--space-3);
}
.import-file-box {
  border: 1.5px dashed var(--n-200);
  border-radius: var(--radius-lg);
  background: var(--white);
  padding: var(--space-4);
}
.import-file-box input[type="file"] {
  width: 100%;
}
.import-file-meta {
  margin-top: var(--space-2);
  font-size: 12px;
  color: var(--n-400);
  line-height: 1.5;
}
.import-preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
  flex-wrap: wrap;
}
.import-preview-summary {
  font-size: 13px;
  color: var(--n-400);
}
.import-preview-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  max-height: 100%;
  overflow-y: auto;
  padding-right: var(--space-1);
  -webkit-overflow-scrolling: touch;
}
.import-preview-item {
  border: var(--border-default);
  border-radius: var(--radius-lg);
  background: var(--white);
  padding: var(--space-4);
}
.import-preview-item.status-high {
  border-color: var(--accent);
  background: var(--accent-light);
}
.import-preview-item.status-review {
  border-color: var(--warning);
  background: var(--warning-light);
}
.import-preview-item.status-unmatched,
.import-preview-item.status-invalid {
  border-color: var(--danger);
  background: var(--danger-light);
}
.import-preview-top {
  display: flex;
  justify-content: space-between;
  gap: var(--space-3);
  align-items: flex-start;
}
.import-preview-top-right {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
  justify-content: flex-end;
}
.import-preview-source {
  font-size: 14px;
  font-weight: 700;
  color: var(--n-900);
  white-space: pre-wrap;
  word-break: break-word;
}
.import-preview-select {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--n-500);
  white-space: nowrap;
}
.import-preview-select input {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
}
.import-preview-badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.import-preview-badge.high {
  background: var(--primary-light);
  color: var(--primary);
}
.import-preview-badge.review {
  background: var(--warning-light);
  color: var(--warning-dark);
}
.import-preview-badge.unmatched,
.import-preview-badge.invalid {
  background: var(--danger-light);
  color: var(--danger-dark);
}
.import-preview-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}
.import-preview-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  background: var(--n-100);
  color: var(--n-500);
  font-size: 12px;
  font-weight: 600;
}
.import-preview-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
  margin-top: var(--space-3);
}
.import-preview-control-wide {
  grid-column: 1 / -1;
}
.import-preview-readonly {
  background: var(--n-100);
  color: var(--n-500);
}
.import-preview-hint {
  margin-top: 10px;
  font-size: 12px;
  color: var(--n-400);
  line-height: 1.5;
  white-space: pre-wrap;
}
.import-preview-hint.error {
  color: var(--danger-dark);
}
.product-export-scope {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-4);
}
.product-export-card {
  background: var(--n-50);
  border: var(--border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
}
.product-export-card label {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  cursor: pointer;
  font-weight: 700;
  color: var(--n-900);
}
.product-export-card input[type="radio"],
.product-export-card input[type="checkbox"] {
  margin-top: 2px;
  accent-color: var(--primary);
}
.product-export-card small {
  display: block;
  margin-top: var(--space-1);
  color: var(--n-400);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.5;
}
.product-export-categories {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  max-height: 280px;
  overflow-y: auto;
  padding-right: var(--space-1);
}
.product-export-check {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  padding: var(--space-3);
  border-radius: var(--radius-md);
  background: var(--white);
  border: var(--border-default);
  cursor: pointer;
}
.product-export-check span {
  font-weight: 700;
  color: var(--n-900);
}
.product-export-check small {
  display: block;
  margin-top: var(--space-1);
  color: var(--n-400);
  font-size: 12px;
  font-weight: 500;
}
.product-import-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}
.product-import-summary-card {
  background: var(--n-50);
  border: var(--border-default);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
}
.product-import-summary-card strong {
  display: block;
  margin-top: var(--space-1);
  color: var(--n-900);
  font-size: 20px;
}
.product-import-summary-card span {
  color: var(--n-400);
  font-size: 12px;
  font-weight: 700;
}
.product-import-tag-list {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  margin-bottom: var(--space-4);
}
.product-import-tag {
  display: inline-flex;
  align-items: center;
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  background: var(--primary-light);
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
}
.product-import-tag.warning {
  background: var(--warning-light);
  color: var(--warning-dark);
}
.product-import-row-note {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  line-height: 1.5;
}
.product-import-row-note.error {
  color: var(--danger-dark);
}
.product-import-row-note.warning {
  color: var(--gray-600);
}
.product-import-source-note {
  font-size: 12px;
  color: var(--n-400);
  line-height: 1.6;
  margin-top: var(--space-3);
}
.import-diff-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-top: var(--space-3);
}
.import-diff-item {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: var(--space-2);
  align-items: flex-start;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  background: var(--n-50);
  border: 1px solid transparent;
}
.import-diff-item.is-changed {
  background: var(--warning-light);
  border-color: var(--warning);
}
.import-diff-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--n-500);
  line-height: 1.6;
}
.import-diff-values {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
  line-height: 1.6;
}
.import-diff-before,
.import-diff-after {
  display: inline-flex;
  align-items: center;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  word-break: break-word;
}
.import-diff-before {
  background: var(--n-100);
  color: var(--n-500);
}
.import-diff-after {
  background: var(--primary-light);
  color: var(--primary);
}
.import-diff-arrow {
  font-size: 12px;
  color: var(--n-400);
  font-weight: 700;
}
.temporary-product-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.temporary-product-row {
  border: var(--border-default);
  border-radius: var(--radius-lg);
  background: var(--white);
  padding: var(--space-4);
}
.temporary-product-row-top {
  display: flex;
  justify-content: space-between;
  gap: var(--space-3);
  align-items: center;
  margin-bottom: var(--space-3);
  flex-wrap: wrap;
}
.temporary-product-meta {
  font-size: 12px;
  color: var(--n-400);
}
.temporary-product-actions {
  display: flex;
  gap: var(--space-2);
  justify-content: flex-end;
  flex-wrap: wrap;
  margin-top: var(--space-3);
}
@media ((min-width: 768px) and (max-width: 1366px)),
  ((pointer: coarse) and (min-width: 768px) and (max-width: 1366px)) {
  .sidebar {
    width: 64px;
    padding: var(--space-4) 0;
  }
  .logo-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    font-size: 18px;
    margin-bottom: var(--space-6);
  }
  .nav-menu {
    gap: var(--space-2);
    padding: 0 var(--space-2);
  }
  .nav-link {
    height: 46px;
    border-radius: var(--radius-md);
    font-size: 9px;
  }
  .nav-icon {
    font-size: 18px;
  }
  .nav-link.active::before {
    left: -8px;
    height: 16px;
  }
  .main-content {
    padding: var(--space-5) var(--space-6);
  }
  .header {
    margin-bottom: var(--space-5);
  }
  .header h2 {
    font-size: 20px;
  }
  .stats-grid {
    gap: var(--space-3);
    margin-bottom: var(--space-5);
  }
  .stat-card,
  .filter-section,
  .settings-section {
    padding: var(--space-4);
  }
  .stat-label {
    font-size: 11px;
  }
  .stat-value {
    font-size: 24px;
  }
  .filter-grid {
    gap: var(--space-3);
  }
  .btn {
    height: 36px;
    padding: 0 var(--space-3);
    font-size: 13px;
  }
  .btn-sm {
    height: 30px;
    padding: 0 var(--space-2);
    font-size: 12px;
  }
  .view-toggle-btn {
    width: 34px;
    min-width: 34px;
    height: 34px;
    font-size: 15px;
  }
  .form-control {
    height: 38px;
    padding: 0 var(--space-3);
    font-size: 13px;
  }
  .order-detail-card,
  .create-order-card {
    padding: var(--space-4);
  }
  .modal-header,
  .modal-body,
  .modal-footer {
    padding-left: var(--space-5);
    padding-right: var(--space-5);
  }
}
@media ((min-width: 768px) and (max-width: 1600px)),
  ((pointer: coarse) and (min-width: 768px)) {
  #ordersGrid.data-grid,
  #customersGrid.data-grid,
  #staffGrid.data-grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: var(--space-3);
    margin-bottom: var(--space-4);
  }
  #ordersGrid .data-card,
  #customersGrid .data-card,
  #staffGrid .data-card {
    padding: var(--space-3);
    border-radius: var(--radius-lg);
    gap: var(--space-2);
  }
  #ordersGrid .data-card-header,
  #customersGrid .data-card-header,
  #staffGrid .data-card-header {
    padding-bottom: var(--space-2);
  }
  #ordersGrid .data-card-title,
  #customersGrid .data-card-title,
  #staffGrid .data-card-title {
    font-size: 14px;
  }
  #ordersGrid .data-card-body,
  #customersGrid .data-card-body,
  #staffGrid .data-card-body {
    font-size: 12.5px;
    gap: var(--space-1);
  }
  #ordersGrid .data-card-footer,
  #customersGrid .data-card-footer,
  #staffGrid .data-card-footer {
    gap: var(--space-2);
    padding-top: var(--space-2);
  }
  #ordersGrid .badge,
  #customersGrid .badge,
  #staffGrid .badge {
    height: 22px;
    padding: 0 var(--space-2);
    font-size: 11px;
  }
  #ordersGrid .data-card strong[style*="font-size:16px"],
  #customersGrid .data-card strong[style*="font-size:16px"],
  #staffGrid .data-card strong[style*="font-size:16px"] {
    font-size: 14px !important;
  }
  .data-grid.list-view-grid {
    margin-bottom: var(--space-4);
  }
  #productsGrid.data-grid:not(.list-view-grid) {
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: var(--space-3);
  }
  .list-table {
    gap: var(--space-2);
  }
  .product-list-table {
    min-width: 860px;
  }
  .product-list-table .list-table-header,
  .product-list-table .list-table-row {
    grid-template-columns:
      minmax(120px, 1fr) minmax(88px, 0.82fr)
      60px 108px 72px minmax(120px, 1.15fr) minmax(150px, 1.2fr) minmax(
        112px,
        128px
      );
  }
  .order-list-table {
    min-width: 860px;
  }
  .order-list-table .list-table-header,
  .order-list-table .list-table-row {
    grid-template-columns:
      minmax(76px, 0.7fr) minmax(130px, 1.1fr) 88px minmax(120px, 1fr)
      68px 96px 120px minmax(144px, 156px);
  }
  .customer-list-table {
    min-width: 680px;
  }
  .customer-list-table .list-table-header,
  .customer-list-table .list-table-row {
    grid-template-columns:
      minmax(110px, 1fr) minmax(110px, 0.95fr) minmax(150px, 1.35fr)
      80px minmax(112px, 128px);
  }
  .staff-list-table {
    min-width: 840px;
  }
  .staff-list-table .list-table-header,
  .staff-list-table .list-table-row {
    grid-template-columns:
      minmax(120px, 1fr) minmax(108px, 0.9fr) 88px minmax(180px, 1.5fr)
      96px minmax(170px, 200px);
  }
}
.audit-log-meta {
  color: var(--n-400);
  font-size: 12px;
  line-height: 1.5;
}
.audit-log-summary {
  white-space: normal;
  line-height: 1.5;
}
.audit-log-pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
  padding: var(--space-4) 0 var(--space-2);
}
.audit-log-table-shell {
  width: 100%;
  min-width: 0;
  overflow-x: auto;
  padding-bottom: var(--space-1);
}
.audit-log-json {
  background: var(--n-50);
  border: var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  font-size: 12px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 360px;
  overflow: auto;
  font-family: var(--font-mono);
}
.audit-log-retention-bar {
  background: var(--white);
  border: var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: var(--space-4) var(--space-5);
  margin-bottom: var(--space-5);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-4);
  flex-wrap: wrap;
}
.audit-log-retention-main {
  min-width: 220px;
  flex: 1 1 320px;
}
.audit-log-retention-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--n-900);
  margin-bottom: var(--space-1);
}
.audit-log-retention-desc {
  font-size: 13px;
  color: var(--n-400);
  line-height: 1.6;
}
.audit-log-retention-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-2);
  flex-wrap: wrap;
  flex: 0 1 auto;
}
.audit-log-retention-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--n-400);
  white-space: nowrap;
}
.audit-log-retention-controls .form-control {
  min-width: 132px;
  width: auto;
}
.audit-log-list-table {
  min-width: 1040px;
  width: max(100%, 1040px);
}
.audit-log-list-table .list-table-header,
.audit-log-list-table .list-table-row {
  grid-template-columns:
    124px 108px minmax(170px, 1.05fr) minmax(132px, 0.92fr)
    minmax(150px, 1fr) minmax(220px, 1.55fr) 84px;
}
.audit-log-cell-label {
  display: none;
}
@media (max-width: 1280px) {
  .audit-log-table-shell {
    overflow-x: visible;
  }
  .audit-log-list-table {
    min-width: 0;
    width: 100%;
  }
  .audit-log-list-table .list-table-header {
    display: none;
  }
  .audit-log-list-table .list-table-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-3) var(--space-4);
  }
  .audit-log-list-table .list-table-cell {
    min-width: 0;
    padding-top: 20px;
    position: relative;
  }
  .audit-log-list-table .list-table-actions {
    grid-column: 1 / -1;
    padding-top: var(--space-1);
  }
  .audit-log-cell-label {
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--n-400);
  }
  .audit-log-col-actor,
  .audit-log-col-target,
  .audit-log-col-summary,
  .audit-log-list-table .list-table-actions {
    grid-column: 1 / -1;
  }
}

@media (max-width: 860px) {
  .order-detail-main {
    flex-direction: column;
  }
  .order-detail-left {
    width: 100%;
  }
  .order-detail-right {
    max-width: 100%;
    min-width: 0;
    width: 100%;
  }
  .order-detail-left-scroll {
    max-height: none;
  }
  .detail-item-grid {
    grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
  }
  .create-order-main {
    flex-direction: column;
  }
  .create-order-left {
    width: 100%;
  }
  .create-order-right {
    max-width: 100%;
    min-width: 0;
    width: 100%;
  }
  .create-order-sidebar {
    position: static;
  }
  .create-order-selected-list,
  .create-order-product-list {
    max-height: none;
    padding-right: 0;
  }
  .create-order-meta-grid {
    grid-template-columns: 1fr;
  }
  .create-order-product-list,
  .create-order-selected-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: var(--space-3);
  }
  .create-order-product-row,
  .create-order-selected-item {
    height: 100%;
  }
  .create-order-product-row {
    grid-template-columns: 1fr;
    align-content: space-between;
  }
  .create-order-product-actions {
    min-width: 0;
    align-items: stretch;
  }
}
@media (max-width: 768px) {
  .create-order-toolbar {
    flex-direction: column;
  }
  .create-order-toolbar-controls {
    width: 100%;
    justify-content: flex-start;
  }
  .create-order-search {
    min-width: 0;
    width: 100%;
  }
  .create-order-product-list,
  .create-order-selected-list {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  }
  .create-order-product-row {
    grid-template-columns: 1fr;
  }
  .create-order-product-actions {
    min-width: 0;
    width: 100%;
    align-items: stretch;
  }
  .detail-sort-product {
    flex-direction: column;
  }
  .detail-sort-input-row {
    flex-wrap: wrap;
  }
  .detail-sort-input-row .btn {
    flex: 0 0 100%;
    width: 100%;
  }
  .create-order-selected-top,
  .create-order-selected-bottom,
  .create-order-footer-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .create-order-selected-subtotal {
    font-size: 16px;
  }
  .modal-wide .modal-content {
    width: calc(100% - 20px);
    height: calc(100% - 20px);
    max-height: none;
  }
  .import-source-grid,
  .import-preview-controls,
  .product-export-scope,
  .product-import-summary-grid {
    grid-template-columns: 1fr;
  }
  .audit-log-retention-bar {
    align-items: flex-start;
  }
  .audit-log-retention-controls {
    width: 100%;
    justify-content: flex-start;
  }
  .audit-log-retention-controls .form-control {
    min-width: 0;
    width: 100%;
  }
  .audit-log-list-table .list-table-row {
    grid-template-columns: 1fr;
    gap: var(--space-3);
  }
  .audit-log-col-time,
  .audit-log-col-action,
  .audit-log-col-customer,
  .audit-log-col-actor,
  .audit-log-col-target,
  .audit-log-col-summary,
  .audit-log-list-table .list-table-actions {
    grid-column: auto;
  }
}
