:root {
  color-scheme: light;
  --ink: #162235;
  --muted: #66758a;
  --paper: #f4f7fa;
  --surface: #ffffff;
  --line: #d9e2ec;
  --primary: #1f497d;
  --primary-dark: #17365d;
  --accent: #dceaf7;
  --danger: #a33a3a;
  --shadow: 0 20px 55px rgba(31, 73, 125, 0.1);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background:
    radial-gradient(circle at 85% 5%, rgba(126, 169, 210, 0.22), transparent 26rem),
    var(--paper);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.site-header-inner,
main,
footer {
  width: min(1180px, calc(100% - 40px));
  margin-inline: auto;
}

.site-header {
  position: sticky;
  z-index: 10;
  top: 0;
  width: 100%;
  border-bottom: 1px solid rgba(31, 73, 125, 0.12);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(14px);
}

.site-header-inner {
  min-height: 112px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding-block: 8px;
}

.brand {
  display: inline-flex;
  align-items: center;
  color: var(--ink);
  text-decoration: none;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.brand-logo {
  display: block;
  width: 150px;
  height: auto;
}

.mode-pill {
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 254, 250, 0.7);
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.mode-pill.live {
  color: var(--primary);
  border-color: rgba(31, 73, 125, 0.3);
}

.step {
  margin: 0 0 14px;
  color: var(--primary);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h2,
p {
  margin-top: 0;
}

main {
  padding-top: clamp(28px, 5vw, 56px);
}

.search-panel {
  padding: clamp(24px, 5vw, 52px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
}

.panel-heading,
.results-heading,
.form-footer {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(30px, 4vw, 46px);
  font-weight: 720;
  letter-spacing: -0.035em;
}

.text-button {
  padding: 0;
  color: var(--primary);
  background: transparent;
  border: 0;
  border-bottom: 1px solid currentColor;
  font-weight: 700;
}

form {
  margin-top: 42px;
}

.form-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 26px 20px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.field-wide {
  grid-column: span 3;
}

.field span {
  font-size: 14px;
  font-weight: 750;
}

.field strong {
  color: var(--primary);
}

.field input {
  width: 100%;
  padding: 15px 0;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  outline: none;
  font-size: 16px;
}

.field input:focus {
  border-color: var(--primary);
  box-shadow: 0 1px 0 var(--primary);
}

.field small,
.form-footer p,
.muted {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.form-footer {
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.form-footer p {
  margin-bottom: 0;
}

.primary-button {
  display: inline-flex;
  min-width: 230px;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 17px 20px;
  color: white;
  background: var(--primary-dark);
  border: 1px solid var(--primary-dark);
  border-radius: 10px;
  font-weight: 750;
  transition: transform 160ms ease, background 160ms ease;
}

.primary-button:hover {
  background: var(--primary);
  transform: translateY(-2px);
}

.primary-button:disabled {
  cursor: wait;
  opacity: 0.65;
  transform: none;
}

.message,
.data-warning {
  margin-top: 22px;
  padding: 16px 18px;
  border: 1px solid rgba(141, 47, 40, 0.25);
  border-left: 4px solid var(--danger);
  background: #fff4f0;
  color: #64231e;
  line-height: 1.55;
  border-radius: 10px;
}

.message.info,
.data-warning {
  border-color: rgba(31, 73, 125, 0.24);
  border-left-color: var(--primary);
  background: #f2f7fc;
  color: var(--primary-dark);
}

.products,
.results {
  padding: 86px 0 40px;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 28px;
}

.product-card {
  display: flex;
  min-height: 330px;
  flex-direction: column;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  transition: border-color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.product-card:hover {
  border-color: rgba(31, 73, 125, 0.45);
  box-shadow: 0 14px 40px rgba(31, 73, 125, 0.1);
  transform: translateY(-3px);
}

.product-meta {
  min-height: 16px;
  margin-bottom: 16px;
  color: var(--primary);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.product-card h3 {
  margin: 0 0 10px;
  font-size: 24px;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.025em;
}

.product-seller {
  margin-bottom: 24px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.product-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: auto;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.product-metrics span,
.product-metrics strong {
  display: block;
}

.product-metrics span {
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.product-metrics strong {
  font-size: 16px;
  font-variant-numeric: tabular-nums;
}

.product-actions {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  margin-top: 22px;
}

.product-actions a {
  color: var(--primary);
  font-size: 14px;
  font-weight: 700;
}

.empty-products {
  grid-column: 1 / -1;
  padding: 50px;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  text-align: center;
}

.results-heading {
  align-items: flex-start;
}

.results {
  margin-top: 80px;
  padding: clamp(24px, 4vw, 42px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
}

.results-heading .muted {
  margin: 10px 0 0;
}

.stats {
  display: flex;
  gap: 10px;
}

.results-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  width: min(100%, 430px);
  gap: 12px;
}

.download-button {
  width: 100%;
  padding: 13px 18px;
  color: white;
  background: var(--primary-dark);
  border: 1px solid var(--primary-dark);
  border-radius: 10px;
  font-size: 15px;
  font-weight: 750;
}

.download-button:hover {
  background: var(--primary);
}

.download-button:disabled {
  cursor: not-allowed;
  color: var(--muted);
  background: #edf2ef;
  border-color: var(--line);
  opacity: 1;
}

.download-help {
  width: 100%;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  text-align: right;
}

.stat {
  min-width: 160px;
  padding: 18px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 12px;
}

.stat.accent {
  background: var(--accent);
  border-color: #c6dbef;
}

.stat span,
.stat strong {
  display: block;
}

.stat span {
  margin-bottom: 9px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.stat strong {
  font-size: 25px;
  font-weight: 720;
}

.table-wrap {
  margin-top: 28px;
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
}

table {
  width: max(100%, 1420px);
  border-collapse: collapse;
  white-space: nowrap;
}

th,
td {
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

th {
  color: var(--muted);
  background: #edf3f8;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

td {
  font-size: 14px;
}

td:nth-child(4),
td:nth-child(5) {
  font-variant-numeric: tabular-nums;
}

td.satker {
  max-width: 360px;
  overflow: hidden;
  text-overflow: ellipsis;
}

tbody tr:last-child td {
  border-bottom: 0;
}

tbody tr:hover td {
  background: #f6f9fc;
}

.empty-cell {
  padding: 50px;
  color: var(--muted);
  text-align: center;
}

footer {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  margin-top: 60px;
  padding: 30px 0 44px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

footer p {
  margin-bottom: 0;
}

footer a {
  color: var(--primary);
  font-weight: 700;
}

@media (max-width: 760px) {
  .site-header-inner,
  main,
  footer {
    width: min(100% - 24px, 1180px);
  }

  .site-header-inner {
    min-height: 90px;
  }

  .brand-logo {
    width: 122px;
  }

  .panel-heading,
  .results-heading,
  .form-footer,
  footer {
    align-items: stretch;
    flex-direction: column;
  }

  .form-grid {
    grid-template-columns: 1fr 1fr;
  }

  .field-wide {
    grid-column: span 2;
  }

  .primary-button {
    width: 100%;
  }

  .stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .results-actions {
    align-items: stretch;
  }

  .download-help {
    text-align: left;
  }

  .product-grid {
    grid-template-columns: 1fr;
  }

  .stat {
    min-width: 0;
  }
}

@media (min-width: 761px) and (max-width: 1020px) {
  .product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 460px) {
  .site-header-inner {
    gap: 12px;
  }

  .mode-pill {
    max-width: 152px;
    padding: 7px 9px;
    font-size: 11px;
    line-height: 1.25;
    text-align: center;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .field-wide {
    grid-column: span 1;
  }

  .stats {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
