:root {
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
  --page: #f3f5f0;
  --panel: #fff;
  --field: #f6f7f4;
  --text: #18251f;
  --muted: #52635a;
  --line: #dce5dc;
  --accent: #205a43;
  --on-accent: #fff;
  --tint: #e8f3eb;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { color-scheme: dark; }
}
:root[data-theme="dark"] { color-scheme: dark; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --page: #111916; --panel: #19231e; --field: #222f28; --text: #eef5ef;
    --muted: #b6c8bd; --line: #37473e; --accent: #a4d8b8; --on-accent: #14251b;
    --tint: #243d30;
  }
}
:root[data-theme="dark"] {
  --page: #111916; --panel: #19231e; --field: #222f28; --text: #eef5ef;
  --muted: #b6c8bd; --line: #37473e; --accent: #a4d8b8; --on-accent: #14251b;
  --tint: #243d30;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--page); color: var(--text); }
main {
  max-width: 1032px;
  margin: auto;
  padding: clamp(18px, 5vw, 48px) clamp(14px, 4vw, 32px)
    max(36px, env(safe-area-inset-bottom));
}
h1, h2, p { margin: 0; }
h1 { font-size: clamp(28px, 5vw, 46px); font-weight: 720; letter-spacing: -.05em; }
h2 { font-size: 19px; font-weight: 690; letter-spacing: -.025em; }
p { color: var(--muted); line-height: 1.45; }
.masthead { display: flex; justify-content: space-between; align-items: end; gap: 12px; margin-bottom: 22px; }
.masthead p { margin-top: 6px; font-size: 14px; }
.monitor-status {
  background: var(--tint);
  color: var(--accent);
  border-radius: 99px;
  padding: 6px 11px;
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
}
.workspace { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); gap: 18px; align-items: start; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 19px; padding: 21px; min-width: 0; }
.filters h2 { margin-bottom: 17px; }
fieldset { min-width: 0; border: 0; padding: 0; margin: 0; }
label { display: block; font-size: 13px; font-weight: 650; margin-bottom: 6px; }
.grid { display: grid; gap: 10px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.model-choice, .traits { margin-top: 14px; }
.price-row { display: flex; justify-content: space-between; align-items: baseline; margin-top: 14px; }
.price-row span { color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .06em; }
select, input, button { font: inherit; color: inherit; }
select, input {
  width: 100%; min-width: 0; min-height: 44px; padding: 8px 11px;
  background: var(--field); border: 1px solid var(--line); border-radius: 9px;
  font-size: 16px;
}
select { padding-right: 23px; text-overflow: ellipsis; }
input::placeholder { color: var(--muted); opacity: 1; }
button, .lot-link { cursor: pointer; }
button:disabled, fieldset:disabled :is(button, input, select), select:disabled { opacity: .63; cursor: default; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.primary, .secondary { min-height: 44px; padding: 8px 12px; border: 1px solid transparent; border-radius: 9px; font-size: 14px; font-weight: 680; }
.primary { display: block; width: 100%; background: var(--accent); color: var(--on-accent); margin-top: 17px; }
.secondary { background: var(--field); border-color: var(--line); }
.quiet { display: block; width: 100%; color: var(--muted); background: transparent; border-color: transparent; margin-top: 5px; }
.feedback { font-size: 13px; margin-top: 10px; }
.feedback:empty { display: none; }
.feedback[data-error] { color: #a0392a; }
:root[data-theme="dark"] .feedback[data-error] { color: #ffaf9e; }
.results-heading { display: flex; justify-content: space-between; align-items: start; gap: 8px; }
.results-heading p { font-size: 13px; margin-top: 4px; }
.icon { width: 44px; font-size: 21px; line-height: 1; }
.sorting { margin-top: 15px; }
.sorting select { font-size: 14px; }
.lots { list-style: none; padding: 0; margin: 9px 0 0; }
.lot { display: flex; align-items: center; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.lot:last-child { border-bottom: 0; padding-bottom: 0; }
.lot-image { display: block; flex-shrink: 0; border-radius: 10px; background: var(--tint); object-fit: cover; }
.lot-info { min-width: 0; flex: 1; overflow-wrap: anywhere; }
.lot-title { font-size: 14px; }
.lot-traits { font-size: 12px; margin-top: 3px; }
.lot-source { display: inline-block; font-size: 11px; font-weight: 650; color: var(--accent); margin-top: 4px; }
.lot-link { color: var(--accent); text-decoration: none; font-size: 12px; display: grid; gap: 3px; text-align: right; min-height: 44px; align-content: center; }
.lot-price { font-size: 14px; font-variant-numeric: tabular-nums; }
.lot-link:hover span { text-decoration: underline; }
.empty { text-align: center; padding: 23px 10px; font-size: 14px; }

@media (max-width: 650px) {
  .workspace { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .masthead { align-items: start; margin-bottom: 16px; }
  .monitor-status { margin-top: 5px; }
  .panel { padding: 16px; border-radius: 15px; }
}
@media (max-width: 340px) {
  .masthead { flex-wrap: wrap; }
  .lot-image { width: 43px; height: 43px; }
}

.image-choice {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  width: 100%;
  min-width: 0;
  padding: 5px 10px;
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: 9px;
  text-align: left;
}
.image-choice::after {
  content: "";
  width: 6px;
  height: 6px;
  border: solid var(--muted);
  border-width: 0 1.5px 1.5px 0;
  transform: translateY(-2px) rotate(45deg);
  flex-shrink: 0;
}
.image-choice span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
:is(.image-choice, .picker-option) img {
  flex-shrink: 0;
  border-radius: 8px;
  background: var(--tint);
  object-fit: contain;
}
#picker {
  width: min(440px, calc(100% - 24px));
  max-height: 84vh;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  color: var(--text);
  overflow: hidden;
}
#picker[open] { display: flex; flex-direction: column; gap: 10px; }
#picker::backdrop { background: rgb(10 20 15 / .52); }
.picker-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.picker-options { list-style: none; margin: 0; padding: 2px; overflow-y: auto; }
.picker-option {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 46px;
  border: 0;
  border-radius: 9px;
  padding: 5px 8px;
  background: transparent;
  text-align: left;
  overflow-wrap: anywhere;
}
.picker-option:is(:hover, [aria-pressed="true"]) { background: var(--tint); }
