:root {
  --bg-dark: #090d16;
  --bg-card: rgba(18, 26, 43, 0.7);
  --bg-card-hover: rgba(25, 36, 60, 0.85);
  --border-glass: rgba(255, 255, 255, 0.08);
  --border-glass-glow: rgba(99, 102, 241, 0.3);
  --text-main: #f3f4f6;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --accent: #6366f1;
  --accent-light: #818cf8;
  --accent-glow: rgba(99, 102, 241, 0.25);
  --cyan: #06b6d4;
  --cyan-glow: rgba(6, 182, 212, 0.25);
  --success: #10b981;
  --success-bg: rgba(16, 185, 129, 0.12);
  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.12);
  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.12);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

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

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: var(--font-sans);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
  -webkit-font-smoothing: antialiased;
}

/* Ambient dynamic background lighting */
.background-mesh {
  position: fixed;
  top: -200px;
  left: 10%;
  width: 80vw;
  height: 80vw;
  background: radial-gradient(circle at 30% 30%, rgba(99, 102, 241, 0.15) 0%, transparent 50%),
              radial-gradient(circle at 70% 60%, rgba(6, 182, 212, 0.1) 0%, transparent 60%);
  filter: blur(80px);
  pointer-events: none;
  z-index: 0;
}

.app-container {
  position: relative;
  z-index: 1;
  max-width: 1280px;
  margin: 0 auto;
  padding: 32px 24px 60px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Cards & Glassmorphism */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
  border-color: rgba(255, 255, 255, 0.14);
}

/* Top App Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  padding: 8px 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-logo {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, var(--accent), var(--cyan));
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 4px 20px var(--accent-glow);
}

.brand-title {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(120deg, #ffffff 40%, #a5b4fc);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 100px;
  font-size: 0.8rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-glass);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--text-dim);
}

.status-pill.online {
  background: var(--success-bg);
  border-color: rgba(16, 185, 129, 0.3);
  color: #6ee7b7;
}
.status-pill.online .status-dot {
  background-color: var(--success);
  box-shadow: 0 0 8px var(--success);
}

.status-pill.offline {
  background: rgba(100, 116, 139, 0.15);
  color: var(--text-muted);
}

/* Metric Cards Grid */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.metric-card {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.metric-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.metric-value-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.metric-value {
  font-size: 2rem;
  font-weight: 800;
  font-family: var(--font-mono);
  line-height: 1;
}

.metric-badge {
  font-size: 0.72rem;
  padding: 3px 8px;
  border-radius: 6px;
  font-weight: 600;
}
.metric-badge.neutral { background: rgba(255, 255, 255, 0.07); color: var(--text-muted); }
.metric-badge.accent { background: var(--accent-glow); color: var(--accent-light); }
.metric-badge.success { background: var(--success-bg); color: #6ee7b7; }
.metric-badge.warning { background: var(--warning-bg); color: #fcd34d; }

.text-accent { color: var(--accent-light); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }

/* Control & Dropzone Section */
.control-card {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.dropzone-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.dropzone {
  border: 2px dashed rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-sm);
  padding: 28px 20px;
  text-align: center;
  position: relative;
  cursor: pointer;
  background: rgba(0, 0, 0, 0.2);
  transition: all 0.2s ease;
}

.dropzone:hover, .dropzone.dragover {
  border-color: var(--accent-light);
  background: rgba(99, 102, 241, 0.06);
}

.file-input {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.dropzone-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.drop-icon {
  color: var(--accent-light);
}

.dropzone-title {
  font-weight: 600;
  font-size: 0.95rem;
}

.highlight {
  color: var(--cyan);
  text-decoration: underline;
}

.dropzone-sub {
  font-size: 0.8rem;
  color: var(--text-dim);
}

.file-shortcuts {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.shortcut-label {
  font-size: 0.8rem;
  color: var(--text-dim);
  font-weight: 500;
}

.btn-chip {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-glass);
  color: var(--text-muted);
  font-size: 0.78rem;
  padding: 5px 12px;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.btn-chip:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
  border-color: rgba(255, 255, 255, 0.2);
}

/* Toolbar & Buttons */
.toolbar-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  border-top: 1px solid var(--border-glass);
  padding-top: 18px;
}

.action-buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), #4f46e5);
  color: #fff;
  box-shadow: 0 4px 14px var(--accent-glow);
}
.btn-primary:not(:disabled):hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--border-glass);
  color: var(--text-main);
}
.btn-secondary:not(:disabled):hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-danger {
  background: linear-gradient(135deg, var(--danger), #dc2626);
  color: #fff;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
}

/* Toggle Switch */
.toggle-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
}

.switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: rgba(255, 255, 255, 0.12);
  transition: .2s;
}

.slider.round {
  border-radius: 22px;
}

.slider.round:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .2s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: var(--cyan);
}

input:checked + .slider:before {
  transform: translateX(18px);
}

.toggle-label {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* Progress bar */
.progress-container {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 6px;
}
.progress-container.hidden { display: none; }

.progress-info {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--cyan);
  font-weight: 600;
}

.progress-bar-bg {
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--cyan), var(--accent));
  transition: width 0.3s ease;
}

/* Table Section */
.table-card {
  padding: 0;
  overflow: hidden;
}

.table-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-glass);
  flex-wrap: wrap;
  gap: 12px;
}

.tab-filters {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.tab-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.tab-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

.tab-btn.active {
  color: #fff;
  background: var(--accent-glow);
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.2);
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  width: 260px;
}

.search-box input {
  background: none;
  border: none;
  color: #fff;
  font-family: var(--font-sans);
  font-size: 0.82rem;
  outline: none;
  width: 100%;
}

.table-container {
  overflow-x: auto;
  max-height: 520px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.data-table th {
  background: rgba(13, 21, 35, 0.95);
  color: var(--text-muted);
  font-weight: 600;
  text-align: left;
  padding: 12px 16px;
  position: sticky;
  top: 0;
  z-index: 2;
  border-bottom: 1px solid var(--border-glass);
}

.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  vertical-align: middle;
}

.data-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.cell-sku {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--cyan);
}

.cell-price {
  font-family: var(--font-mono);
  font-weight: 600;
}

.delta-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.78rem;
  padding: 3px 8px;
  border-radius: 4px;
}
.delta-badge.pos { background: var(--success-bg); color: #6ee7b7; }
.delta-badge.neg { background: var(--warning-bg); color: #fcd34d; }
.delta-badge.zero { background: rgba(255, 255, 255, 0.06); color: var(--text-dim); }

.status-tag {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  text-align: center;
}
.status-tag.update { background: var(--accent-glow); color: var(--accent-light); }
.status-tag.unchanged { background: var(--success-bg); color: #6ee7b7; }
.status-tag.missing { background: var(--danger-bg); color: #f87171; }
.status-tag.skipped { background: rgba(245, 158, 11, 0.15); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.3); }
.status-tag.covered { background: rgba(148, 163, 184, 0.15); color: #94a3b8; border: 1px solid rgba(148, 163, 184, 0.3); }
.status-tag.sibling { background: rgba(168, 85, 247, 0.15); color: #c084fc; border: 1px solid rgba(168, 85, 247, 0.3); }

.sale-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 6px;
  background: rgba(236, 72, 153, 0.15);
  color: #f472b6;
  border: 1px solid rgba(236, 72, 153, 0.3);
  border-radius: 4px;
  margin-left: 6px;
}
.was-price {
  text-decoration: line-through;
  color: var(--text-dim);
  font-size: 0.78rem;
  margin-right: 4px;
}

.empty-row td {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-dim);
}

/* Pagination bar */
.pagination-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  border-top: 1px solid var(--border-glass);
  font-size: 0.8rem;
  color: var(--text-muted);
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Modal dialogs */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.modal-overlay.hidden { display: none; }

.modal-card {
  background: #111827;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-md);
  width: 90%;
  max-width: 500px;
  padding: 24px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal-header h2 { font-size: 1.15rem; font-weight: 700; }

.btn-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
}

.modal-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
}

.form-group label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-main);
}

.form-input {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border-glass);
  color: #fff;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  outline: none;
}
.form-input:focus {
  border-color: var(--accent);
}

.field-hint {
  font-size: 0.72rem;
  color: var(--text-dim);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 8px;
}

.confirm-stat-box {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: var(--radius-sm);
  padding: 14px;
  margin: 12px 0;
  color: #fca5a5;
  font-weight: 600;
}

.confirm-count {
  font-size: 1.8rem;
  font-weight: 800;
  font-family: var(--font-mono);
  color: var(--danger);
}

/* Multi-Channel Marketplace Switcher Bar */
.channel-selector-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  background: rgba(18, 26, 43, 0.6);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 10px 18px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
  flex-wrap: wrap;
}

.channel-selector-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.channel-pills {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.channel-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-glass);
  color: var(--text-muted);
  padding: 8px 16px;
  border-radius: 9999px;
  font-family: var(--font-sans);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.channel-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
  color: #fff;
  transform: translateY(-1px);
}

.channel-btn.active {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(6, 182, 212, 0.15));
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 0 16px var(--accent-glow);
}

.channel-btn.active.channel-onbuy {
  background: linear-gradient(135deg, rgba(249, 115, 22, 0.2), rgba(234, 88, 12, 0.15));
  border-color: #f97316;
  box-shadow: 0 0 16px rgba(249, 115, 22, 0.3);
}

.channel-btn.active.channel-ebay {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(37, 99, 235, 0.15));
  border-color: #3b82f6;
  box-shadow: 0 0 16px rgba(59, 130, 246, 0.3);
}

.channel-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-dim);
}

.channel-dot.shopify { background: #10b981; }
.channel-dot.onbuy { background: #f97316; }
.channel-dot.ebay { background: #3b82f6; }

.channel-status-tag {
  font-size: 0.68rem;
  padding: 2px 7px;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-dim);
  font-weight: 500;
}

.channel-status-tag.online {
  background: rgba(16, 185, 129, 0.16);
  color: #34d399;
}

.channel-status-tag.mock {
  background: rgba(245, 158, 11, 0.16);
  color: #fbbf24;
}

/* Master channel tab selector in Settings Modal */
.channel-nav-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 18px;
  background: rgba(0, 0, 0, 0.3);
  padding: 4px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-glass);
}

.channel-nav-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.channel-nav-btn.active {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

