/* ==========================================================================
   AegisVision™ Admin ERP / OMS / CRM Design System
   Modern Executive Glassmorphism & High-Density Operational Console
   ========================================================================== */

:root {
  --color-primary: #0f172a;
  --color-primary-dark: #020617;
  --color-accent: #2563eb;
  --color-accent-hover: #1d4ed8;
  --color-accent-light: #eff6ff;
  --color-fast-track: #f59e0b;
  --color-fast-track-bg: #fffbeb;
  --color-success: #10b981;
  --color-success-bg: #ecfdf5;
  --color-warning: #f59e0b;
  --color-danger: #ef4444;
  --color-danger-bg: #fef2f2;
  
  --bg-main: #f1f5f9;
  --bg-sidebar: #0b1120;
  --bg-card: #ffffff;
  --bg-elevated: #ffffff;
  
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --text-inverse: #ffffff;
  
  --border-color: #e2e8f0;
  --border-dark: #1e293b;
  
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-full: 9999px;
  
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
  
  --transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.5;
  height: 100vh;
  overflow: hidden;
}

/* App Shell Layout */
.app-container {
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

/* Sidebar */
.sidebar {
  width: 260px;
  background-color: var(--bg-sidebar);
  color: #94a3b8;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  border-right: 1px solid var(--border-dark);
  z-index: 50;
}

.sidebar-header {
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand-badge {
  background: linear-gradient(135deg, #2563eb, #06b6d4);
  color: white;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  font-size: 1.2rem;
  box-shadow: 0 0 15px rgba(37, 99, 235, 0.4);
}

.brand-text h1 {
  font-size: 1.05rem;
  font-weight: 800;
  color: white;
  letter-spacing: -0.3px;
  line-height: 1.2;
}

.brand-text span {
  font-size: 0.65rem;
  color: #38bdf8;
  letter-spacing: 1px;
  font-weight: 700;
  text-transform: uppercase;
}

.sidebar-nav {
  flex: 1;
  padding: 1rem 0.75rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-section-title {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #64748b;
  font-weight: 700;
  padding: 0.75rem 0.75rem 0.35rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-md);
  color: #94a3b8;
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid transparent;
}

.nav-item:hover {
  color: white;
  background-color: rgba(255, 255, 255, 0.05);
}

.nav-item.active {
  color: white;
  background-color: rgba(37, 99, 235, 0.15);
  border-color: rgba(37, 99, 235, 0.3);
}

.nav-item.highlight-fast {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.15), rgba(234, 88, 12, 0.15));
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.4);
  font-weight: 700;
}
.nav-item.highlight-fast:hover {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.25), rgba(234, 88, 12, 0.25));
  color: #fde68a;
}

.nav-item .icon {
  font-size: 1.15rem;
  width: 22px;
  text-align: center;
}

.nav-item .badge {
  margin-left: auto;
  font-size: 0.7rem;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  background: #2563eb;
  color: white;
  font-weight: 700;
}
.nav-item .badge.warning {
  background: #f59e0b;
}

.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.user-snippet {
  display: flex;
  align-items: center;
  gap: 10px;
}
.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #2563eb;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
}
.user-info .name {
  font-size: 0.85rem;
  font-weight: 700;
  color: white;
  line-height: 1.2;
}
.user-info .role {
  font-size: 0.7rem;
  color: #94a3b8;
}

/* Main Content Area */
.main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background-color: var(--bg-main);
}

/* Top Navigation Bar */
.topbar {
  height: 64px;
  background-color: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.75rem;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.page-title {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--color-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.fast-track-pill {
  font-size: 0.75rem;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  background-color: #ecfdf5;
  color: #059669;
  border: 1px solid #a7f3d0;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 5px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.btn-fast-order-top {
  background: linear-gradient(135deg, #f59e0b, #ea580c);
  color: white;
  border: none;
  padding: 0.55rem 1.15rem;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 3px 10px rgba(245, 158, 11, 0.35);
  transition: var(--transition);
}
.btn-fast-order-top:hover {
  transform: translateY(-1px);
  box-shadow: 0 5px 15px rgba(245, 158, 11, 0.45);
}

.link-storefront {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-accent);
  text-decoration: none;
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-md);
  background: var(--color-accent-light);
  display: flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition);
}
.link-storefront:hover {
  background: #dbeafe;
}

/* Page Body */
.content-body {
  flex: 1;
  padding: 1.5rem 1.75rem;
  overflow-y: auto;
  scrollbar-gutter: stable;
}

/* Tab Panels */
.tab-panel {
  display: none;
  animation: fadeIn 0.25s ease;
}
.tab-panel.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 1; transform: translateY(2px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Metric Cards Grid */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.metric-card {
  background: var(--bg-card);
  padding: 1.25rem 1.4rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.metric-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--color-accent);
}
.metric-card.accent-gold::before { background: var(--color-fast-track); }
.metric-card.accent-green::before { background: var(--color-success); }
.metric-card.accent-purple::before { background: #8b5cf6; }

.metric-card .header-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.825rem;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.metric-card .number {
  font-size: 1.85rem;
  font-weight: 800;
  color: var(--color-primary);
  line-height: 1.1;
  margin-bottom: 0.35rem;
}

.metric-card .sub-caption {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}
.metric-card .sub-caption .trend-up {
  color: var(--color-success);
  font-weight: 700;
}

/* Two Column Layout */
.dashboard-grid-2 {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

/* Section Card */
.section-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  margin-bottom: 1.25rem;
}

.section-header {
  padding: 1.1rem 1.4rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.section-header h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-body {
  padding: 1.25rem 1.4rem;
}

/* Data Tables */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.875rem;
}

.data-table th {
  background-color: #f8fafc;
  color: #475569;
  font-weight: 700;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-color);
}

.data-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-main);
  vertical-align: middle;
}

.data-table tr:hover td {
  background-color: #f8fafc;
}

/* Badges */
.badge-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.725rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-full);
}
.badge-status.COMPLETED { background: #dcfce7; color: #15803d; }
.badge-status.SHIPPED { background: #dbeafe; color: #1d4ed8; }
.badge-status.PROCESSING { background: #fef3c7; color: #b45309; }
.badge-status.PAID_AUDIT { background: #ede9fe; color: #6d28d9; }
.badge-status.PENDING_PAYMENT { background: #f1f5f9; color: #64748b; }
.badge-status.REFUNDED { background: #fee2e2; color: #b91c1c; }

.badge-route {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.725rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
}
.badge-route.FAST_TRACK {
  background: #fffbeb;
  color: #b45309;
  border: 1px solid #fde68a;
}
.badge-route.ONLINE_STANDARD {
  background: #f0fdf4;
  color: #166534;
  border: 1px solid #bbf7d0;
}

/* Action Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}
.btn-sm {
  padding: 0.35rem 0.7rem;
  font-size: 0.775rem;
}
.btn-primary {
  background-color: var(--color-accent);
  color: white;
}
.btn-primary:hover {
  background-color: var(--color-accent-hover);
}
.btn-secondary {
  background-color: white;
  border-color: var(--border-color);
  color: var(--text-main);
}
.btn-secondary:hover {
  background-color: #f8fafc;
}
.btn-fast {
  background: linear-gradient(135deg, #f59e0b, #ea580c);
  color: white;
}
.btn-fast:hover {
  opacity: 0.95;
}
.btn-danger {
  background: var(--color-danger);
  color: white;
}

/* Filter Bar */
.filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.search-input-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  background: white;
  border: 1px solid var(--border-color);
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-md);
  width: 320px;
}
.search-input-wrap input {
  border: none;
  outline: none;
  font-size: 0.85rem;
  width: 100%;
}

.filter-select {
  padding: 0.45rem 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  background: white;
  color: var(--text-main);
  outline: none;
  cursor: pointer;
}

/* Direct Order Modal / Drawer */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.2s ease;
}
.modal-overlay.active {
  display: flex;
}

.modal-card {
  background: #ffffff !important;
  background-color: #ffffff !important;
  border-radius: var(--radius-lg);
  width: 900px;
  max-width: 95vw;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
  overflow: hidden;
  position: relative;
  z-index: 1001;
  transform: translateZ(0);
  isolation: isolate;
}

.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f8fafc !important;
}
.modal-header h2 {
  font-size: 1.15rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1;
  background: #ffffff !important;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f8fafc !important;
}

/* Quick Order Form Layout */
.form-row-grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

.form-row-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.form-group label {
  font-size: 0.8rem;
  font-weight: 700;
  color: #475569;
}
.form-group input, .form-group select, .form-group textarea {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  outline: none;
  transition: var(--transition);
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

/* Universal Form Input & Theme Styling */
.form-input {
  width: 100%;
  padding: 0.6rem 0.85rem;
  background: #ffffff;
  border: 1.5px solid var(--border-color, #cbd5e1);
  border-radius: var(--radius-sm, 8px);
  font-size: 0.875rem;
  font-family: inherit;
  color: var(--text-main, #0f172a);
  outline: none;
  transition: var(--transition, all 0.2s cubic-bezier(0.16, 1, 0.3, 1));
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.02);
  box-sizing: border-box;
}

.form-input:hover {
  border-color: #94a3b8;
}

.form-input:focus {
  border-color: var(--color-accent, #2563eb);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
  background: #ffffff;
}

/* WhatsApp Card & Form Controls */
.wa-card {
  border: 1.5px solid #a7f3d0 !important;
  background: linear-gradient(135deg, #f0fdf4 0%, #ecfdf5 100%) !important;
  border-radius: 12px !important;
  padding: 1.25rem !important;
  margin-bottom: 1.25rem !important;
  box-shadow: 0 2px 6px rgba(16, 185, 129, 0.06) !important;
}

.wa-input, .wa-textarea {
  width: 100% !important;
  background: #ffffff !important;
  border: 1.5px solid #86efac !important;
  border-radius: 8px !important;
  color: #0f172a !important;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif !important;
  outline: none !important;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.03) !important;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
  box-sizing: border-box !important;
}

.wa-input {
  padding: 0.6rem 0.85rem !important;
  font-size: 0.875rem !important;
  font-weight: 600 !important;
}

.wa-textarea {
  padding: 0.75rem 0.85rem !important;
  font-size: 0.85rem !important;
  line-height: 1.6 !important;
  resize: vertical !important;
  min-height: 85px !important;
  scrollbar-width: thin !important;
  scrollbar-color: #86efac #f0fdf4 !important;
}

.wa-input:hover, .wa-textarea:hover {
  border-color: #4ade80 !important;
}

.wa-input:focus, .wa-textarea:focus {
  border-color: #16a34a !important;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2) !important;
  background: #ffffff !important;
}

.wa-textarea::-webkit-scrollbar {
  width: 6px;
}
.wa-textarea::-webkit-scrollbar-thumb {
  background-color: #86efac;
  border-radius: 4px;
}
.wa-textarea::-webkit-scrollbar-track {
  background: #f0fdf4;
}

.order-items-box {
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  margin-bottom: 1rem;
}

.order-item-row {
  display: grid;
  grid-template-columns: 3fr 1fr 1fr 1fr 40px;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 8px;
}

/* Reconciliation Banner */
.reconciliation-card {
  background: linear-gradient(135deg, #ecfdf5, #f0fdf4);
  border: 1px solid #a7f3d0;
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}
.reconciliation-card .status-icon {
  font-size: 2.2rem;
  color: #10b981;
}
.reconciliation-card .title {
  font-weight: 800;
  color: #065f46;
  font-size: 1.05rem;
}
.reconciliation-card .details {
  font-size: 0.8rem;
  color: #047857;
}

/* Progress bar */
.progress-bar-wrap {
  width: 100%;
  height: 8px;
  background: #e2e8f0;
  border-radius: var(--radius-full);
  overflow: hidden;
  margin: 6px 0;
}
.progress-bar-inner {
  height: 100%;
  background: linear-gradient(90deg, #2563eb, #06b6d4);
  border-radius: var(--radius-full);
}

/* ==========================================================================
   Universal Custom Dialog (Alert, Confirm, Prompt) & Toast System
   ========================================================================== */

/* Toast Container (Top-Right Floating) */
.custom-toast-container {
  position: fixed;
  top: 20px;
  right: 24px;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.custom-toast {
  pointer-events: auto;
  min-width: 320px;
  max-width: 440px;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(12px);
  border-radius: var(--radius-md);
  box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.15), 0 8px 10px -6px rgba(15, 23, 42, 0.1);
  padding: 0.9rem 1.15rem;
  display: flex;
  align-items: center;
  gap: 12px;
  border-left: 4px solid #2563eb;
  transform: translateX(110%);
  opacity: 0;
  transition: all 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

.custom-toast.custom-toast-visible {
  transform: translateX(0);
  opacity: 1;
}

.custom-toast.custom-toast-hiding {
  transform: translateX(110%);
  opacity: 0;
}

.custom-toast-success { border-left-color: #10b981; }
.custom-toast-error { border-left-color: #ef4444; }
.custom-toast-warning { border-left-color: #f59e0b; }
.custom-toast-info { border-left-color: #2563eb; }

.custom-toast-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 800;
  flex-shrink: 0;
}
.custom-toast-success .custom-toast-icon { background: #dcfce7; color: #15803d; }
.custom-toast-error .custom-toast-icon { background: #fee2e2; color: #b91c1c; }
.custom-toast-warning .custom-toast-icon { background: #fef3c7; color: #b45309; }
.custom-toast-info .custom-toast-icon { background: #dbeafe; color: #1d4ed8; }

.custom-toast-body {
  flex: 1;
  font-size: 0.875rem;
  font-weight: 600;
  color: #1e293b;
  line-height: 1.4;
}

.custom-toast-close {
  background: transparent;
  border: none;
  font-size: 1.25rem;
  color: #94a3b8;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  transition: color 0.15s ease;
}
.custom-toast-close:hover {
  color: #0f172a;
}

/* Modal Dialog Backdrop & Card */
.custom-dialog-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(6px);
  z-index: 99998;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  animation: cdFadeIn 0.2s ease forwards;
}

.custom-dialog-backdrop.active {
  display: flex;
}

@keyframes cdFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.custom-dialog-card {
  background: #ffffff;
  border-radius: var(--radius-lg);
  box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.25);
  width: 100%;
  max-width: 440px;
  overflow: hidden;
  border: 1px solid rgba(226, 232, 240, 0.8);
  transform: scale(0.92);
  opacity: 0;
  transition: all 0.24s cubic-bezier(0.16, 1, 0.3, 1);
  text-align: center;
  padding: 2rem 1.75rem 1.5rem;
}

.custom-dialog-card.active {
  transform: scale(1);
  opacity: 1;
}

.custom-dialog-icon-wrap {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  margin: 0 auto 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.custom-dialog-icon-wrap.type-success {
  background: #dcfce7;
  color: #15803d;
}
.custom-dialog-icon-wrap.type-error, .custom-dialog-icon-wrap.type-danger {
  background: #fee2e2;
  color: #b91c1c;
}
.custom-dialog-icon-wrap.type-warning {
  background: #fef3c7;
  color: #b45309;
}
.custom-dialog-icon-wrap.type-info {
  background: #eff6ff;
  color: #2563eb;
}

.custom-dialog-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 0.6rem;
  letter-spacing: -0.3px;
}

.custom-dialog-message {
  font-size: 0.9rem;
  color: #475569;
  line-height: 1.6;
  margin-bottom: 1.25rem;
  word-break: break-word;
}

.custom-dialog-input-wrap {
  margin-bottom: 1.25rem;
}

.custom-dialog-input {
  width: 100%;
  padding: 0.65rem 0.9rem;
  border: 1.5px solid #cbd5e1;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  outline: none;
  transition: all 0.2s ease;
  box-sizing: border-box;
}

.custom-dialog-input:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.custom-dialog-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.cd-btn {
  flex: 1;
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.cd-btn-confirm {
  background: #2563eb;
  color: white;
}
.cd-btn-confirm:hover {
  background: #1d4ed8;
  transform: translateY(-1px);
}

.cd-btn-danger {
  background: #ef4444;
  color: white;
}
.cd-btn-danger:hover {
  background: #dc2626;
  transform: translateY(-1px);
}

.cd-btn-cancel {
  background: #f1f5f9;
  color: #475569;
  border-color: #e2e8f0;
}
.cd-btn-cancel:hover {
  background: #e2e8f0;
  color: #1e293b;
}

/* ==========================================================================
   Product Management (PIM) UI Enhancements
   ========================================================================== */
.product-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #f8fafc;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
  flex-wrap: wrap;
  gap: 12px;
}

.product-thumb-preview {
  width: 58px;
  height: 58px;
  min-width: 58px;
  min-height: 58px;
  flex-shrink: 0;
  display: block;
  border-radius: var(--radius-md);
  object-fit: cover;
  border: 1px solid #cbd5e1;
  box-shadow: 0 2px 5px rgba(0,0,0,0.06);
}

.product-image-uploader {
  display: flex;
  gap: 15px;
  align-items: center;
  background: #f8fafc;
  padding: 1rem;
  border: 1.5px dashed #cbd5e1;
  border-radius: var(--radius-md);
}

.product-image-uploader:hover {
  border-color: #3b82f6;
  background: #eff6ff;
}

.product-image-uploader img {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  background: #fff;
}

.sku-builder-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  margin-top: 8px;
}

.sku-builder-table th {
  background: #f1f5f9;
  padding: 8px;
  font-weight: 700;
  text-align: left;
  border: 1px solid #e2e8f0;
}

.sku-builder-table td {
  padding: 6px 8px;
  border: 1px solid #e2e8f0;
}

.sku-builder-table input {
  width: 100%;
  padding: 4px 8px;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  font-size: 0.825rem;
  box-sizing: border-box;
}

.product-specs-preview {
  font-size: 0.8rem;
  color: #475569;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 8px 12px;
  margin: 10px 1.25rem;
  line-height: 1.6;
}

/* ==========================================================================
   Multi-Image Gallery Manager (详情页相册与首图主图管理)
   ========================================================================== */
.gallery-manager-wrap {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-md);
  padding: 1rem;
  margin-top: 6px;
}
.gallery-manager-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #e2e8f0;
}
.gallery-items-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 300px;
  overflow-y: auto;
  padding-right: 4px;
}
.gallery-item-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #ffffff;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.03);
  transition: all 0.2s ease;
}
.gallery-item-card.is-primary {
  border-color: #3b82f6;
  background: #eff6ff;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.15);
}
.gallery-item-thumb {
  width: 62px;
  height: 62px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  background: #fff;
  flex-shrink: 0;
}
.gallery-item-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.gallery-item-tag {
  font-size: 0.75rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.gallery-item-tag.primary {
  color: #1d4ed8;
}
.gallery-item-tag.secondary {
  color: #64748b;
}
.gallery-item-input-wrap {
  display: flex;
  gap: 8px;
  align-items: center;
}
.gallery-item-input-wrap input {
  flex: 1;
  padding: 6px 10px;
  font-size: 0.825rem;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
}
.gallery-item-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.gallery-actions-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed #cbd5e1;
}

/* ==========================================================================
   Admin Authentication Gate & RBAC Management Center Styles
   ========================================================================== */

/* Fullscreen Admin Login Screen */
.admin-login-overlay {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at 50% 20%, #1e293b 0%, #0f172a 60%, #020617 100%);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  transition: opacity 0.3s ease;
}
.admin-login-overlay.hidden,
html.has-admin-token #admin-login-overlay {
  opacity: 0;
  pointer-events: none;
  display: none !important;
}

.admin-login-card {
  width: 100%;
  max-width: 480px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 24px;
  padding: 40px;
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.7), 0 0 40px rgba(37, 99, 235, 0.2);
  color: #ffffff;
}

.admin-login-brand {
  text-align: center;
  margin-bottom: 28px;
}
.admin-login-logo {
  font-size: 3rem;
  margin-bottom: 12px;
  display: inline-block;
  filter: drop-shadow(0 0 16px rgba(37, 99, 235, 0.6));
}
.admin-login-brand h1 {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: #ffffff;
  margin-bottom: 6px;
}
.admin-login-brand p {
  font-size: 0.85rem;
  color: #94a3b8;
}

.admin-login-form .form-group {
  margin-bottom: 18px;
}
.admin-login-form label {
  color: #cbd5e1;
  font-size: 0.825rem;
  font-weight: 700;
  margin-bottom: 6px;
}
.admin-login-input {
  width: 100%;
  padding: 12px 16px;
  background: rgba(30, 41, 59, 0.7);
  border: 1.5px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  color: #ffffff;
  font-size: 0.95rem;
  outline: none;
  transition: all 0.2s;
}
.admin-login-input:focus {
  border-color: #3b82f6;
  background: rgba(30, 41, 59, 0.95);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.2);
}

.btn-admin-login-submit {
  width: 100%;
  padding: 13px;
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(37, 99, 235, 0.4);
  transition: all 0.2s;
  margin-top: 8px;
}
.btn-admin-login-submit:hover {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.5);
}

.admin-demo-roles-box {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px dashed rgba(255, 255, 255, 0.15);
}
.admin-demo-title {
  font-size: 0.75rem;
  color: #94a3b8;
  font-weight: 700;
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.admin-demo-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.btn-demo-role {
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: #cbd5e1;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s;
}
.btn-demo-role:hover {
  background: rgba(37, 99, 235, 0.2);
  border-color: rgba(37, 99, 235, 0.5);
  color: #ffffff;
}

/* Sidebar Footer User & Logout */
.sidebar-footer {
  padding: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.sidebar-footer .user-snippet {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.sidebar-logout-btn {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #94a3b8;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}
.sidebar-logout-btn:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: #ef4444;
  color: #ef4444;
}

/* RBAC Permission Checkbox Matrix */
.permissions-matrix-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 8px;
}
.permission-checkbox-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
}
.permission-checkbox-card:hover {
  border-color: #cbd5e1;
  background: #f1f5f9;
}
.permission-checkbox-card.checked {
  background: #eff6ff;
  border-color: #93c5fd;
}
.permission-checkbox-card input[type="checkbox"] {
  margin-top: 3px;
  cursor: pointer;
  width: 16px;
  height: 16px;
}
.permission-info {
  flex: 1;
  font-size: 0.8rem;
}
.permission-info strong {
  display: block;
  color: #0f172a;
  margin-bottom: 2px;
}
.permission-info span {
  color: #64748b;
  font-size: 0.725rem;
  line-height: 1.3;
  display: block;
}

/* Role Badges */
.badge-role {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 700;
}
.badge-role.admin { background: #fee2e2; color: #991b1b; }
.badge-role.sales { background: #eff6ff; color: #1d4ed8; }
.badge-role.warehouse { background: #fef3c7; color: #92400e; }
.badge-role.finance { background: #ecfdf5; color: #065f46; }
.badge-role.custom { background: #f3e8ff; color: #6b21a8; }

.badge-perm-pill {
  display: inline-block;
  padding: 2px 6px;
  background: #f1f5f9;
  color: #475569;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  margin: 1px;
}

/* ==========================================================================
   Statistical Reports & Channel Breakdown Center
   ========================================================================== */
.report-admin-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px 18px;
  border-radius: 10px;
  margin-bottom: 1.5rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.report-admin-bar.super-admin-bar {
  background: linear-gradient(135deg, #eef2ff 0%, #f5f3ff 100%);
  border: 1px solid #c7d2fe;
}
.report-admin-bar.regular-admin-bar {
  background: linear-gradient(135deg, #ecfdf5 0%, #f0fdf4 100%);
  border: 1px solid #a7f3d0;
}

.report-time-pills {
  display: inline-flex;
  background: #f1f5f9;
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
}
.report-time-pill {
  padding: 6px 14px;
  border: none;
  background: transparent;
  color: #64748b;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}
.report-time-pill:hover {
  color: #0f172a;
}
.report-time-pill.active {
  background: #fff;
  color: #4338ca;
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.channel-split-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.channel-metric-card {
  background: #fff;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  padding: 1.25rem 1.5rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  position: relative;
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
}
.channel-metric-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
.channel-metric-card.storefront-theme {
  border-top: 4px solid #2563eb;
}
.channel-metric-card.admin-direct-theme {
  border-top: 4px solid #8b5cf6;
}
.channel-metric-card.overall-theme {
  border-top: 4px solid #10b981;
}

.channel-bar-container {
  margin: 1rem 0;
  background: #f1f5f9;
  height: 12px;
  border-radius: 6px;
  overflow: hidden;
  display: flex;
}
.channel-bar-seg-sf {
  background: linear-gradient(90deg, #3b82f6, #2563eb);
  height: 100%;
  transition: width 0.4s ease;
}
.channel-bar-seg-ad {
  background: linear-gradient(90deg, #a855f7, #7c3aed);
  height: 100%;
  transition: width 0.4s ease;
}

.channel-source-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.775rem;
  font-weight: 700;
}
.channel-source-badge.storefront {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}
.channel-source-badge.admin-direct {
  background: #f5f3ff;
  color: #6d28d9;
  border: 1px solid #ddd6fe;
}

/* ==========================================================================
   Stats Row & Stat Cards (保修提醒与通用四卡片网格)
   ========================================================================== */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}
@media (max-width: 1200px) {
  .stats-row {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 640px) {
  .stats-row {
    grid-template-columns: 1fr;
  }
}

.stat-card {
  background: #fff;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  padding: 1.25rem 1.4rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
  transition: transform 0.2s, box-shadow 0.2s;
  position: relative;
  overflow: hidden;
}
.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}
.stat-label {
  font-size: 0.875rem;
  font-weight: 700;
  color: #334155;
  margin-bottom: 0.5rem;
}
.stat-value {
  font-size: 2.2rem;
  font-weight: 900;
  line-height: 1.1;
  margin-bottom: 0.35rem;
}
.stat-desc {
  font-size: 0.775rem;
  color: #64748b;
  margin-top: auto;
}

/* =============================================================== */
/* 📜 System Logs & Audit Center Custom Styles                      */
/* =============================================================== */
.logs-date-btn {
  font-size: 0.75rem;
  padding: 4px 10px;
  border-radius: 6px;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #475569;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.logs-date-btn:hover {
  background: #e2e8f0;
  color: #1e293b;
}

.logs-date-btn.active {
  background: #2563eb;
  border-color: #2563eb;
  color: #ffffff;
  box-shadow: 0 1px 3px rgba(37, 99, 235, 0.3);
}

.log-table-row {
  transition: background 0.15s ease;
}

.log-table-row:hover {
  background-color: #f8fafc !important;
}

.log-level-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 700;
}

/* Oceanpayment Pulsing Radar Animation */
@keyframes pulse-animation {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.7);
  }
  70% {
    transform: scale(1);
    box-shadow: 0 0 0 8px rgba(37, 99, 235, 0);
  }
  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(37, 99, 235, 0);
  }
}

.pulsing-radar-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #2563eb;
  animation: pulse-animation 1.8s infinite;
}

