body {
  font-family: Arial, sans-serif;
  font-size: 15px;
  margin: 0;
  background: #f7f8fa;
  color: #222;
}

.container {
  max-width: 1500px;
  margin: 10px auto;
  padding: 0 16px;
}

#dashboardView {
  display: block;
}

.login-card {
  display: none;
  max-width: 420px;
  margin: 72px auto;
  background: #fff;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
  padding: 24px;
}

.login-card h1 {
  margin-top: 0;
}

.login-card form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.login-card input {
  width: 100%;
  margin-top: 6px;
  box-sizing: border-box;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 10px;
}

.login-status {
  min-height: 20px;
  color: #334155;
}


.login-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

.login-checkbox input {
  width: auto;
  margin-top: 0;
}

.login-mode #dashboardView {
  display: none;
}

.login-mode .login-card {
  display: block;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
  background: #000;
  color: #fff;
  padding: 8px 12px;
  border-radius: 8px;
}

.status-summary {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 240px;
  font-family: 'Courier New', Courier, monospace;
  font-size: 12px;
  line-height: 1.15;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: space-between;
}

.connection-indicators {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  flex-wrap: wrap;
}

.indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #111827;
  color: #fff;
  border: 1px solid #374151;
  border-radius: 8px;
  padding: 6px 10px;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.dot.connected {
  background: #16a34a;
}

.dot.disconnected {
  background: #dc2626;
}

.dot.unknown {
  background: #6b7280;
}

.controls {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  align-items: center;
  justify-content: flex-start;
  margin: 4px 0;
  background: #b91010;
  color: #fff;
  padding: 8px 12px;
  border-radius: 8px;
  overflow-x: auto;
}

.controls label,
.bulk-undercut-controls span {
  color: #fff;
}

.controls label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.controls select,
.controls input,
.pagination-controls select {
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 6px 8px;
  background: #fff;
  min-height: 34px;
  box-sizing: border-box;
}


.sales-sync-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
  white-space: nowrap;
}

.sales-sync-controls span {
  color: #fff;
  font-size: 14px;
}

.bulk-undercut-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
  white-space: nowrap;
}

.bulk-undercut-controls span {
  font-size: 14px;
}

.bulk-undercut-controls input,
.bulk-undercut-controls select {
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 6px 8px;
  background: #fff;
}

.competitor-voucher-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}

.competitor-voucher-toggle input[type='checkbox'] {
  width: 18px;
  height: 18px;
}

#undercutAmountInput {
  width: 72px;
}

#filterSelect {
  width: 100px;
}

#brandFilterSelect {
  width: 95px;
}

#searchInput {
  width: 95px;
}

#salesWindowSelect {
  width: 65px;
}

#syncSalesBtn,
#clearFiltersBtn,
#applyUndercutBtn,
#exportCurrentViewBtn,
#exportMissingSkusBtn {
  padding: 8px 12px;
}

.pagination-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 10px 0 0;
}

.pagination-buttons {
  display: flex;
  align-items: center;
  gap: 12px;
}

#pageInfo {
  font-size: 14px;
  color: #334155;
}

#status {
  margin: 0;
  color: #4dff72;
  text-shadow: 0 0 6px rgba(77, 255, 114, 0.5);
}

#salesCacheStatus {
  margin: 0;
  color: #4dff72;
  text-shadow: 0 0 6px rgba(77, 255, 114, 0.5);
}

#competitorSkuSummary {
  margin: 0;
  font-size: inherit;
  color: #4dff72;
  text-shadow: 0 0 6px rgba(77, 255, 114, 0.5);
}

button {
  background: #0b5ed7;
  color: white;
  border: none;
  border-radius: 6px;
  padding: 10px 16px;
  cursor: pointer;
}

.topbar-actions > button {
  min-width: 96px;
  min-height: 40px;
}

button.secondary {
  background: #475569;
}

#syncBtn {
  background: #15803d;
}

#syncBtn:hover {
  background: #166534;
}

button.danger {
  background: #dc2626;
}

button.danger:hover {
  background: #991b1b;
}

button:disabled {
  opacity: 0.6;
  cursor: wait;
}

.table-wrapper {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 100%;
  border-collapse: collapse;
  background: #fff;
  table-layout: auto;
}

th,
td {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

th,
td {
  padding: 10px;
  border-bottom: 1px solid #e5e7eb;
  text-align: left;
}

th {
  background: #f1f5f9;
}


.column-sort-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  border-radius: 6px;
  padding: 6px 8px;
  margin: 0;
  font: inherit;
  font-weight: 600;
  color: #0f172a;
  cursor: pointer;
}

.column-sort-btn:hover {
  background: #eff6ff;
  border-color: #93c5fd;
}

.column-sort-btn.is-active {
  background: #dbeafe;
  border-color: #60a5fa;
}

.column-sort-btn .sort-arrow {
  font-size: 13px;
  opacity: 1;
  color: #1d4ed8;
}


.negative {
  color: #0f766e;
}

.positive {
  color: #b91c1c;
}



.margin-column,
.margin-cell {
  width: 88px;
  min-width: 88px;
  max-width: 88px;
}

.margin-cell {
  font-weight: 600;
}

.margin-below-target {
  background: #fee2e2;
  color: #991b1b;
}

.margin-near-target {
  background: #fef3c7;
  color: #92400e;
}

.margin-above-target {
  background: #dcfce7;
  color: #166534;
}

.margin-unknown {
  background: #f1f5f9;
  color: #475569;
}


.image-column,
.image-cell {
  width: 60px;
  min-width: 60px;
  max-width: 60px;
}

.sales-column,
.sales-cell {
  width: 44px;
  min-width: 44px;
  max-width: 44px;
}

.competitor-column,
.competitor-cell {
  width: 100px;
  min-width: 100px;
  max-width: 100px;
}

.competitor-cell {
  padding: 8px 5px;
  text-align: center;
}


.competitor-cell-lowest {
  background: #dcfce7;
}


.product-thumb {
  width: 40px;
  height: 40px;
  object-fit: contain;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
  background: #fff;
  display: block;
}



.product-image-lightbox {
  position: fixed;
  width: 160px;
  height: 160px;
  padding: 8px;
  border-radius: 10px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.25);
  z-index: 9999;
  pointer-events: none;
  opacity: 0;
  transform: scale(0.97);
  transition: opacity 0.12s ease, transform 0.12s ease;
}

.product-image-lightbox.is-visible {
  opacity: 1;
  transform: scale(1);
}

.product-image-lightbox-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.product-thumb-placeholder {
  display: inline-block;
  color: #94a3b8;
}

.product-name-cell {
  width: 10ch;
  max-width: 10ch;
}

.product-name-text {
  display: inline-block;
  max-width: 10ch;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: bottom;
}

.reference-column,
.reference-cell {
  width: 95px;
  min-width: 95px;
  max-width: 95px;
}

.brand-column,
.brand-cell {
  width: 95px;
  min-width: 95px;
  max-width: 95px;
}

.reference-text {
  display: inline-block;
  max-width: 70px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
}

.brand-text {
  display: inline-block;
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
}

.reference-cell {
  white-space: nowrap;
}

.exclude-sku-btn {
  border: none;
  background: transparent;
  color: #dc2626;
  font-weight: 700;
  cursor: pointer;
  padding: 0;
  margin-right: 6px;
  line-height: 1;
  display: inline-block;
  vertical-align: middle;
}

.exclude-sku-btn:hover {
  color: #991b1b;
}

.competitors-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.competitor-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border: 1px solid #e5e7eb;
  border-radius: 999px;
  background: #f8fafc;
  white-space: nowrap;
}



.price-position-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid transparent;
}

.price-position-badge.cheapest {
  background: #dcfce7;
  color: #166534;
  border-color: #86efac;
}

.price-position-badge.tied-cheapest {
  background: #dbeafe;
  color: #1d4ed8;
  border-color: #93c5fd;
}

.price-position-badge.not-cheapest {
  background: #fee2e2;
  color: #991b1b;
  border-color: #fca5a5;
}

.price-position-badge.no-competitor-data {
  background: #f1f5f9;
  color: #475569;
  border-color: #cbd5e1;
}

.price-position-badge.loss {
  background: #fff7ed;
  color: #9a3412;
  border-color: #fdba74;
}


.suggested-cell-warning {
  background: #fff7ed;
  color: #9a3412;
  font-weight: 700;
}

.update-price-column,
.update-price-cell {
  width: 170px;
  min-width: 170px;
  max-width: 170px;
}

.update-price-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.update-price-input {
  width: 84px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 6px 8px;
}

.update-price-save-btn {
  padding: 6px 10px;
  font-size: 13px;
}

.update-price-saved-tick {
  min-width: 10px;
  color: #16a34a;
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
}
