:root {
  --ink: #172a29;
  --muted: #576b66;
  --light-muted: #839792;
  --accent: #08665c;
  --accent-dark: #054841;
  --accent-light: #eaf4f0;
  --accent-tint: #f1f8f5;
  --line: #dbe5e0;
  --surface: #ffffff;
  --bg: #f8faf9;
  --card-p1: #f3f7f4;
  --card-p2: #edf4f5;
  --diff-bg: #edf8ee;
  --diff-ink: #10422d;
  --danger: #b33f36;
  --danger-bg: #faeceb;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
}

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

body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
  font-size: 14px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

button, input, a {
  font: inherit;
}

button {
  cursor: pointer;
}

/* Header */
.app-header {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.03);
}

.header-container {
  max-width: 1240px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

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

.brand-mark {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, #0a7368 0%, #064d45 100%);
  color: white;
  border-radius: 12px;
  display: grid;
  place-content: center;
  font-size: 26px;
  font-weight: 800;
  box-shadow: 0 4px 14px rgba(8, 102, 92, 0.25);
}

.brand-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.brand-title-wrap h1 {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.6px;
  color: var(--ink);
}

.domain-badge {
  font-size: 11px;
  font-weight: 700;
  background: var(--accent-light);
  color: var(--accent);
  padding: 2px 8px;
  border-radius: 20px;
  border: 1px solid #b8d2c2;
  letter-spacing: 0.3px;
}

.tagline {
  font-size: 12px;
  color: var(--muted);
}

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

.nav-btn {
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 650;
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
  transition: all 0.15s ease;
}

.nav-btn:hover {
  background: #f1f4f2;
}

.nav-btn.secondary {
  border-color: #b8d2c2;
  color: var(--accent);
  background: var(--accent-light);
}

.nav-btn.secondary:hover {
  background: #d8eae1;
}

.nav-btn.danger-outline {
  border-color: #eccbc7;
  color: var(--danger);
  background: var(--danger-bg);
}

.nav-btn.danger-outline:hover {
  background: #f5dad7;
}

/* Main Container */
.main-container {
  max-width: 1240px;
  width: 100%;
  margin: 0 auto;
  padding: 28px 24px 60px;
  flex: 1;
}

/* Welcome Card */
.welcome-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 48px 36px;
  text-align: center;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.02);
  margin-top: 20px;
}

.welcome-hero {
  max-width: 640px;
  margin: 0 auto 36px;
}

.welcome-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 18px;
  background: var(--accent-light);
  color: var(--accent);
  border-radius: 18px;
  display: grid;
  place-content: center;
  font-size: 34px;
  font-weight: 800;
}

.welcome-hero h2 {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.8px;
  margin-bottom: 10px;
}

.welcome-subtitle {
  font-size: 15px;
  color: var(--muted);
  line-height: 1.6;
}

.guide-steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
  max-width: 980px;
  margin: 0 auto 40px;
  text-align: left;
}

.step-card {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 24px;
}

.step-num {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  display: grid;
  place-content: center;
  font-weight: 750;
  margin-bottom: 14px;
  font-size: 13px;
}

.step-card h3 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 8px;
}

.step-card p {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
}

.welcome-cta {
  margin-top: 10px;
}

.cta-button {
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 10px;
  padding: 13px 26px;
  font-size: 15px;
  font-weight: 700;
  box-shadow: 0 4px 16px rgba(8, 102, 92, 0.3);
  transition: all 0.15s ease;
}

.cta-button:hover {
  background: var(--accent-dark);
  transform: translateY(-1px);
}

.cta-hint {
  font-size: 12px;
  color: var(--light-muted);
  margin-top: 12px;
}

/* Products Grid */
.products-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 24px;
}

.product-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 24px;
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 22px;
  align-items: start;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.02);
  position: relative;
  transition: border-color 0.15s ease;
}

.product-card:hover {
  border-color: #b8d2c2;
}

#card-p1 {
  background: linear-gradient(180deg, #ffffff 0%, var(--card-p1) 100%);
}

#card-p2 {
  background: linear-gradient(180deg, #ffffff 0%, var(--card-p2) 100%);
}

.card-header {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: -6px;
}

.product-pill {
  font-size: 11px;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--accent);
}

.product-pill.secondary {
  color: #1a6270;
}

.retailer-pill {
  font-size: 10.5px;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 3px 9px;
  border-radius: 6px;
  background: #e3ede8;
  color: #124d3e;
}

/* Retailer colors */
.retailer-amazon { background: #ffeccf; color: #704706; }
.retailer-temu { background: #fee8de; color: #8e370a; }
.retailer-bestbuy { background: #dceaf7; color: #0b457a; }
.retailer-walmart { background: #d6e8fa; color: #08437d; }
.retailer-ebay { background: #fbe6e8; color: #7e1724; }

.product-visual {
  width: 140px;
}

.image-box {
  width: 140px;
  height: 150px;
  background: white;
  border-radius: 12px;
  border: 1px solid var(--line);
  display: grid;
  place-content: center;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.image-box img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 6px;
}

.img-placeholder {
  font-size: 11px;
  color: var(--light-muted);
  padding: 10px;
  text-align: center;
}

.product-info {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.product-title {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.4;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.price-row {
  margin-top: 4px;
}

.price-val {
  font-size: 26px;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -0.5px;
}

.meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--muted);
  flex-wrap: wrap;
}

.meta-row.subtle {
  font-size: 11.5px;
  color: var(--light-muted);
}

.rating-text {
  color: #b26800;
  font-weight: 700;
}

.capture-time {
  font-size: 11px;
  color: var(--light-muted);
  margin-top: 4px;
}

.store-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 8px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--accent);
  text-decoration: none;
  width: fit-content;
}

.store-link:hover {
  text-decoration: underline;
  color: var(--accent-dark);
}

/* Summary Banner */
.summary-banner {
  background: var(--accent-light);
  border: 1px solid #b8d2c2;
  border-radius: 14px;
  padding: 18px 22px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 24px;
}

.summary-icon {
  font-size: 20px;
  color: var(--accent);
  font-weight: 800;
  line-height: 1.2;
}

.summary-body strong {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--accent);
  margin-bottom: 4px;
}

.summary-body p {
  font-size: 14px;
  color: var(--ink);
  line-height: 1.6;
}

/* Toolbar */
.comparison-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.toolbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.table-title {
  font-size: 18px;
  font-weight: 750;
  letter-spacing: -0.4px;
}

.row-count-badge {
  font-size: 12px;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 3px 10px;
  border-radius: 20px;
}

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

.search-box input {
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  font-size: 12.5px;
  width: 220px;
  outline: none;
  transition: border-color 0.15s ease;
  background: white;
}

.search-box input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(8, 102, 92, 0.12);
}

.filter-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
}

.filter-toggle input {
  accent-color: var(--accent);
  width: 18px;
  height: 18px;
  cursor: pointer;
}

/* Specs Table */
.table-container {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.02);
}

.specs-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 13px;
}

.specs-table th,
.specs-table td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  overflow-wrap: anywhere;
}

.specs-table thead th {
  background: #f3f6f4;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-weight: 750;
  color: var(--muted);
}

.specs-table tbody th {
  font-weight: 650;
  color: #31443f;
  background: #fbfdfc;
}

.specs-table tbody tr:last-child > * {
  border-bottom: 0;
}

.specs-table tr.different td {
  background: var(--diff-bg);
  color: var(--diff-ink);
  font-weight: 600;
}

.specs-table tr.different th {
  background: #f4faf6;
}

.specs-table .missing {
  color: var(--light-muted) !important;
  font-style: italic;
  font-weight: 400 !important;
}

.specs-table .group-row th {
  background: #f4efe6;
  color: #63502c;
  font-size: 11.5px;
  font-weight: 750;
  letter-spacing: 0.5px;
  padding: 10px 18px;
}

.specs-table .empty-cell {
  text-align: center;
  padding: 36px 20px;
  color: var(--muted);
  font-size: 14px;
}

/* Data notes */
.data-notes {
  margin-top: 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px 20px;
  font-size: 12px;
  color: var(--muted);
}

.data-notes summary {
  cursor: pointer;
  font-weight: 650;
  color: var(--ink);
}

.data-notes ul {
  padding-left: 20px;
  margin-top: 10px;
}

.data-notes li {
  margin-bottom: 4px;
}

/* Footer */
.app-footer {
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding: 24px;
  margin-top: auto;
}

.footer-container {
  max-width: 1240px;
  margin: 0 auto;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}

.footer-stores {
  margin-top: 6px;
  font-size: 11px;
  color: var(--light-muted);
}

/* Responsive */
@media (max-width: 820px) {
  .products-grid {
    grid-template-columns: 1fr;
  }
  .product-card {
    grid-template-columns: 110px 1fr;
    gap: 16px;
    padding: 18px;
  }
  .image-box {
    width: 110px;
    height: 120px;
  }
  .price-val {
    font-size: 22px;
  }
  .comparison-toolbar {
    flex-direction: column;
    align-items: flex-start;
  }
  .toolbar-right {
    width: 100%;
    flex-wrap: wrap;
  }
  .search-box input {
    width: 100%;
  }
}

/* Print styles */
@media print {
  body {
    background: white;
    color: black;
  }
  .app-header .header-actions,
  .toolbar-right,
  .app-footer {
    display: none !important;
  }
  .app-header {
    position: static;
    box-shadow: none;
    border-bottom: 2px solid #ccc;
  }
  .main-container {
    padding: 0;
    max-width: 100%;
  }
  .product-card {
    box-shadow: none;
    border: 1px solid #ccc;
  }
  .table-container {
    box-shadow: none;
    border: 1px solid #ccc;
  }
  .specs-table th, .specs-table td {
    padding: 8px 10px;
  }
}

