:root {
  color-scheme: light;
  --ink: #111827;
  --muted: #687083;
  --line: #d9dee8;
  --surface: #ffffff;
  --soft: #f3f5f8;
  --accent: #0f766e;
  --accent-dark: #115e59;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #eef1f5;
  color: var(--ink);
}

button, input, select { font: inherit; }

.shell {
  width: min(1180px, calc(100% - 28px));
  min-height: calc(100vh - 28px);
  margin: 14px auto;
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 14px;
}

.search-pane, .results-pane {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 22px;
}

.mark {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--ink);
  color: white;
  font-weight: 800;
  font-size: 24px;
}

h1, h2, p { margin: 0; }
h1 { font-size: 24px; line-height: 1.15; }
h2 { font-size: 20px; }
.brand p, .status, .empty span { color: var(--muted); }

#fileInput { display: none; }

.upload {
  width: 100%;
  min-height: 210px;
  display: grid;
  place-items: center;
  gap: 6px;
  border: 2px dashed #b8c0ce;
  border-radius: 8px;
  background: var(--soft);
  color: var(--ink);
  cursor: pointer;
}

.upload.dragover {
  border-color: var(--accent);
  background: #e6f5f2;
}

.uploadIcon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--accent);
  color: white;
  font-size: 32px;
  line-height: 1;
}

.uploadTitle { font-weight: 700; }
.uploadHint { color: var(--muted); font-size: 14px; }

.preview {
  display: grid;
  gap: 10px;
}

.preview[hidden] { display: none; }

.preview img {
  width: 100%;
  max-height: 260px;
  object-fit: contain;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.preview button {
  border: 1px solid var(--line);
  background: white;
  border-radius: 6px;
  padding: 10px;
  cursor: pointer;
}

.filters {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 18px 0;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

input, select {
  min-width: 0;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 11px;
  color: var(--ink);
  background: white;
}

.primary {
  width: 100%;
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: white;
  padding: 13px 16px;
  font-weight: 800;
  cursor: pointer;
}

.primary:hover { background: var(--accent-dark); }
.primary:disabled { background: #9ca3af; cursor: not-allowed; }
.status { margin-top: 12px; font-size: 14px; min-height: 20px; }

.results-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

#resultsCount { color: var(--muted); font-size: 14px; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 14px;
}

.card {
  display: grid;
  color: inherit;
  text-decoration: none;
  background: #f9fafb;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  min-height: 286px;
}

.card:hover {
  border-color: var(--accent);
  box-shadow: 0 8px 22px rgba(17, 24, 39, 0.10);
}

.card img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  background: #e5e7eb;
}

.info {
  display: grid;
  align-content: start;
  gap: 8px;
  padding: 12px;
}

.name {
  font-weight: 750;
  line-height: 1.25;
  min-height: 40px;
}

.meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}

.price { color: var(--accent-dark); font-weight: 800; }
.score { color: #374151; font-size: 13px; }

.empty, .loading, .error {
  min-height: 360px;
  display: grid;
  place-content: center;
  gap: 8px;
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
}

.empty strong, .error strong { color: var(--ink); }
.error { color: #991b1b; background: #fff5f5; }

@media (max-width: 860px) {
  .shell {
    grid-template-columns: 1fr;
    min-height: auto;
  }
}

@media (max-width: 460px) {
  .shell {
    width: calc(100% - 16px);
    margin: 8px auto;
    gap: 8px;
  }

  .search-pane, .results-pane { padding: 14px; }
  .filters { grid-template-columns: 1fr; }
  h1 { font-size: 21px; }
}
