:root {
  --bg-page: #f6f5f1;
  --bg-card: #ffffff;
  --bg-subtle: #faf9f6;
  --border-color: #e6e3dc;
  --border-strong: #d4cfc4;
  --text-main: #18181b;
  --text-secondary: #52525b;
  --text-muted: #71717a;
  --gold-primary: #c59b27;
  --gold-hover: #b0891e;
  --gold-soft: #fbf6e8;
  --gold-border: #ead49b;
  --green-text: #15803d;
  --green-bg: #dcfce7;
  --red-text: #b91c1c;
  --red-bg: #fee2e2;
  --amber-text: #b45309;
  --amber-bg: #fef3c7;
  --blue-text: #1d4ed8;
  --blue-bg: #dbeafe;
  --shadow-sm: 0 1px 3px rgba(24, 24, 27, 0.05);
  --shadow-md: 0 4px 12px rgba(24, 24, 27, 0.06);
  --radius-lg: 14px;
  --radius-md: 10px;
  --radius-sm: 6px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  background-color: var(--bg-page);
  color: var(--text-main);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.app-container {
  max-width: 1440px;
  margin: 0 auto;
  padding: 28px 32px 64px;
}

/* Header */
.top-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold-primary);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.eyebrow::before {
  content: "";
  display: inline-block;
  width: 18px;
  height: 2px;
  background: var(--gold-primary);
}

.brand-title {
  font-family: 'Playfair Display', Georgia, 'Times New Roman', serif;
  font-size: 40px;
  font-weight: 500;
  letter-spacing: -0.02em;
  margin: 0 0 6px 0;
  color: #111113;
  line-height: 1.1;
}

.brand-subtitle {
  margin: 0;
  font-size: 14.5px;
  color: var(--text-muted);
}

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

/* Navigation Tabs */
.nav-tabs {
  display: flex;
  gap: 6px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 22px;
  padding-bottom: 10px;
  overflow-x: auto;
}

.nav-tab {
  background: transparent;
  border: 1px solid transparent;
  padding: 8px 15px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.nav-tab:hover {
  background: #eceae3;
  color: var(--text-main);
}

.nav-tab.active {
  background: #18181b;
  color: #ffffff;
  font-weight: 600;
}

.nav-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  font-size: 11px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.2);
}

.nav-tab:not(.active) .nav-badge {
  background: #e4e2db;
  color: var(--text-secondary);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 15px;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-main);
  box-shadow: var(--shadow-sm);
  transition: all 0.15s ease;
}

.btn:hover {
  background: var(--bg-subtle);
  border-color: var(--border-strong);
}

.btn-gold {
  background: var(--gold-primary);
  border-color: var(--gold-primary);
  color: #ffffff;
}

.btn-gold:hover {
  background: var(--gold-hover);
  border-color: var(--gold-hover);
}

.btn-dark {
  background: #18181b;
  border-color: #18181b;
  color: #ffffff;
}

.btn-dark:hover {
  background: #27272a;
}

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
  border-radius: 7px;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-secondary);
  cursor: pointer;
}

.icon-btn:hover {
  background: var(--bg-subtle);
  color: var(--text-main);
}

/* Top 3-Column Strip (Product | Spot Price | Data Quality) */
.top-control-strip {
  display: grid;
  grid-template-columns: 2.1fr 1.1fr 1.1fr;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  margin-bottom: 18px;
  overflow: hidden;
}

.strip-cell {
  padding: 20px 24px;
  border-right: 1px solid var(--border-color);
}

.strip-cell:last-child {
  border-right: none;
}

.cell-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.product-selector-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.product-select {
  flex: 1;
  padding: 9px 12px;
  font-size: 14.5px;
  font-weight: 600;
  border: 1px solid var(--border-color);
  border-radius: 9px;
  background: var(--bg-card);
  color: var(--text-main);
}

.product-meta-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  font-size: 12px;
  color: var(--text-muted);
}

.product-meta-line strong {
  color: var(--text-main);
  font-weight: 600;
}

.spot-value-large {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 30px;
  font-weight: 600;
  color: var(--text-main);
  margin: 4px 0;
}

.spot-unit {
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.quality-box {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 6px;
}

.quality-ring {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 4px solid #e4e4e7;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

.quality-ring.good {
  border-color: #22c55e;
}

.quality-ring.warn {
  border-color: var(--gold-primary);
}

/* 4 KPI Summary Cards */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 18px 22px;
  box-shadow: var(--shadow-sm);
  position: relative;
}

.kpi-card.accent-gold {
  border-right: 4px solid var(--gold-primary);
}

.kpi-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.kpi-price {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 29px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 6px;
}

.kpi-sub {
  font-size: 12.5px;
  color: var(--text-secondary);
}

.kpi-sub.leader {
  color: var(--green-text);
  font-weight: 600;
}

.kpi-sub.behind {
  color: var(--red-text);
  font-weight: 600;
}

/* Main Card & Seller Table */
.section-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  margin-bottom: 24px;
}

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

.section-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 23px;
  font-weight: 500;
  margin: 0 0 4px 0;
}

.section-subtitle {
  font-size: 12.5px;
  color: var(--text-muted);
  margin: 0;
}

.info-banner {
  margin: 14px 24px;
  padding: 12px 16px;
  background: #f0f6ff;
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  font-size: 13px;
  color: #1e3a8a;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  text-align: left;
  padding: 12px 20px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
  background: #faf9f6;
}

.data-table td {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  font-size: 13.5px;
  vertical-align: middle;
}

.data-table tr:last-child td {
  border-bottom: none;
}

.data-table tr.row-egr {
  background: #f4fbf6;
}

.data-table tr.row-excluded {
  background: #fcfbfa;
  opacity: 0.92;
}

.seller-cell {
  display: flex;
  align-items: center;
  gap: 12px;
}

.monogram {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: #f1efe9;
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12.5px;
  color: var(--text-main);
  flex-shrink: 0;
}

.row-egr .monogram {
  background: #dcfce7;
  border-color: #86efac;
  color: #166534;
}

.seller-name-line {
  font-weight: 600;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 6px;
}

.seller-domain-link {
  font-size: 12px;
  color: var(--text-muted);
  text-decoration: none;
}

.seller-domain-link:hover {
  color: var(--gold-primary);
  text-decoration: underline;
}

.price-serif {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 18px;
  font-weight: 600;
}

/* Badges / Pills */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 99px;
  font-size: 11.5px;
  font-weight: 600;
}

.pill-green {
  background: var(--green-bg);
  color: var(--green-text);
}

.pill-amber {
  background: var(--amber-bg);
  color: var(--amber-text);
}

.pill-red {
  background: var(--red-bg);
  color: var(--red-text);
}

.pill-blue {
  background: var(--blue-bg);
  color: var(--blue-text);
}

.pill-grey {
  background: #f1f0ec;
  color: var(--text-secondary);
}

.pill-you {
  background: var(--gold-soft);
  color: var(--amber-text);
  border: 1px solid var(--gold-border);
  font-size: 10px;
  padding: 1px 6px;
}

.exclusion-note {
  font-size: 11.5px;
  color: var(--red-text);
  margin-top: 4px;
  max-width: 280px;
  line-height: 1.35;
}

/* Modals / Drawers */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(24, 24, 27, 0.48);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  max-width: 640px;
  width: 100%;
  max-height: 88vh;
  overflow-y: auto;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.18);
  padding: 24px;
}

.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 5px;
  color: var(--text-secondary);
}

.form-input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 13.5px;
}

.quick-sku-pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

@media (max-width: 1024px) {
  .top-control-strip {
    grid-template-columns: 1fr;
  }
  .strip-cell {
    border-right: none;
    border-bottom: 1px solid var(--border-color);
  }
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
