:root {
  color-scheme: dark;
  --canvas: #000;
  --surface: #1c1d21;
  --field: #121316;
  --hover: #25272d;
  --ink: #f6f7fa;
  --muted: #a7abb5;
  --line: #34363f;
  --action: #79baff;
  --accent: #a6d4ff;
  --error: #ff9396;
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  color: var(--ink);
  background: var(--canvas);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body, h1, h2, h3, p { margin: 0; }
button, input, select { font: inherit; }
button, summary, select { cursor: pointer; }
button:disabled, fieldset:disabled button { cursor: default; opacity: .58; }
button, input, select, summary { min-height: 44px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
button { color: inherit; }
input, select {
  width: 100%;
  min-width: 0;
  padding: .58rem .75rem;
  color: var(--ink);
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: .85rem;
}
input::placeholder { color: var(--muted); opacity: 1; }

.topbar { color: var(--ink); }
.topbar-inner {
  max-width: 36rem;
  min-height: 72px;
  padding: .7rem clamp(1rem, 4vw, 2rem);
  margin: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: .32rem;
  font-size: 1.6rem;
  font-weight: 780;
  letter-spacing: -.05em;
  line-height: 1;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 1.47rem;
  height: 1.47rem;
  border-radius: .38rem;
  font-size: 1.15rem;
  color: #0c2644;
  background: var(--accent);
}
main { max-width: 36rem; margin: auto; padding: .95rem clamp(1rem, 4vw, 2rem) 2.8rem; }
.intro { margin-bottom: 1.35rem; }
h1 { font-size: clamp(2rem, 6vw, 2.65rem); line-height: 1.03; font-weight: 760; letter-spacing: -.061em; }
.intro p { margin-top: .55rem; color: var(--muted); }
h2 { font-size: 1.35rem; letter-spacing: -.025em; }
h3 { font-size: 1rem; line-height: 1.32; overflow-wrap: anywhere; }
fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
.filter-panel { border: 1px solid var(--line); background: var(--surface); border-radius: 1.35rem; overflow: clip; }
.keyword-row { display: grid; gap: .38rem; padding: .95rem 1rem; }
label, .field-label { font-weight: 620; }
.keyword-row label, .field-label { font-size: .94rem; }
.pickers { display: grid; border-block: 1px solid var(--line); }
.picker {
  display: flex;
  width: 100%;
  min-width: 0;
  min-height: 74px;
  text-align: left;
  align-items: center;
  gap: .875rem;
  justify-content: space-between;
  border: 0;
  background: var(--surface);
  padding: .7rem 1rem;
}
.picker + .picker { border-top: 1px solid var(--line); }
.picker:hover, summary:hover { background: var(--hover); }
.picker:focus-visible, summary:focus-visible { outline-offset: -4px; }
.picker-value { display: block; font-size: .91rem; font-weight: 400; color: var(--muted); overflow-wrap: anywhere; }
.chevron { width: .52rem; height: .52rem; flex: none; border: solid var(--action); border-width: 0 2px 2px 0; transform: rotate(-45deg); }
.condition-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .7rem 1rem;
  padding: .8rem 1rem;
  border-bottom: 1px solid var(--line);
}
.condition-row label { font-size: .94rem; }
.condition-row select { width: auto; }
summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .75rem 1rem;
  font-weight: 640;
}
summary::-webkit-details-marker { display: none; }
details { overflow: clip; }
summary .chevron {
  transform: rotate(45deg);
  margin: -.25rem .1rem 0 0;
  transition: transform 280ms ease, margin-top 280ms ease;
}
details[open]:not([data-collapsing]) > summary .chevron { transform: rotate(225deg); margin-top: .25rem; }
@media (prefers-reduced-motion: reduce) { summary .chevron { transition: none; } }
.advanced { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .9rem 1rem; padding: .4rem 1rem .95rem; }
.advanced label, .advanced .field-label { font-size: .9rem; }
.advanced label:not(.check) { display: grid; align-content: start; gap: .35rem; }
.range { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .4rem; margin-top: .35rem; }
.check { display: flex; align-items: center; gap: .62rem; min-height: 44px; cursor: pointer; }
.check input { width: 1.12rem; height: 1.12rem; margin: 0; min-height: 0; flex: none; accent-color: var(--action); }
.actions { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: .85rem; }
.primary, .outline, .text-button {
  border-radius: .9rem;
  padding: .56rem .9rem;
  font-size: .94rem;
  font-weight: 680;
}
.primary { border: 1px solid var(--action); background: var(--action); color: #102139; }
.primary:hover { background: #99cafa; }
.outline { border: 1px solid var(--line); background: var(--surface); }
.outline:hover { background: var(--hover); }
.topbar .outline { border-radius: 999px; }
.topbar .outline:hover { background: var(--hover); }
.text-button { border: 1px solid transparent; background: transparent; color: var(--action); }
.text-button:hover { text-decoration: underline; }
.feedback { color: var(--muted); font-size: .9rem; }
.feedback:not(:empty) { margin-top: .45rem; }
.feedback[data-error] { color: var(--error); }
.results { margin-top: 1.8rem; }
.results-heading { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; column-gap: .75rem; }
.results-title-group { display: flex; align-items: center; gap: .55rem; }
.results-heading-spinner { display: inline-flex; }
#results-count { color: var(--muted); font-size: .9rem; font-variant-numeric: tabular-nums; }
.results-context { color: var(--muted); font-size: .92rem; margin: .25rem 0 .7rem; }
.results-context[data-loading] { display: flex; align-items: center; gap: .55rem; }
.results-heading-spinner::before, .results-context[data-loading]::before, .lot-photo-loading::before {
  content: "";
  width: 1.05rem;
  height: 1.05rem;
  flex: none;
  border: 2px solid var(--line);
  border-top-color: var(--action);
  border-radius: 50%;
  animation: rad-wait .8s linear infinite;
}
@keyframes rad-wait { to { transform: rotate(1turn); } }
@media (prefers-reduced-motion: reduce) {
  .results-heading-spinner::before, .results-context[data-loading]::before, .lot-photo-loading::before { animation: none; }
}
.result-pagination { display: grid; gap: .75rem; margin-top: 1rem; }
#page-status { justify-content: center; text-align: center; margin: .85rem 0 0; }
.page-directions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .65rem; }
.page-directions button { display: flex; align-items: center; justify-content: center; gap: .5rem; }
#page-previous::before, #page-next::after {
  content: "";
  width: .43rem;
  height: .43rem;
  border: solid currentColor;
  border-width: 0 0 2px 2px;
  transform: rotate(45deg);
}
#page-next::after { transform: rotate(225deg); }
.page-numbers { display: flex; justify-content: center; flex-wrap: wrap; gap: .35rem; }
.page-numbers button { min-width: 44px; padding-inline: .5rem; font-variant-numeric: tabular-nums; }
.page-numbers [aria-current="page"] { color: #102139; background: var(--action); opacity: 1; }
.lot-details a {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  color: inherit;
  text-decoration: none;
}
.lot-details a:hover { color: var(--action); text-decoration: underline; }
.lot-list { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--line); }
.lot {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  gap: .3rem .75rem;
  padding: .75rem 0;
  border-bottom: 1px solid var(--line);
}
.lot[data-photo] { grid-template-columns: auto minmax(0, 1fr); }
.lot-thumbnail {
  display: block;
  position: relative;
  width: clamp(4.5rem, 19vw, 5.75rem);
  aspect-ratio: 1;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: .5rem;
  background: var(--surface);
}
.lot-thumbnail[hidden] { display: none; }
.lot-thumbnail img { display: block; width: 100%; height: 100%; object-fit: cover; }
.lot-photo-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  justify-content: center;
  gap: .35rem;
  font-size: .75rem;
  color: var(--muted);
}
.lot-thumbnail img:not([data-ready]), .gallery-photos img:not([data-ready]) { opacity: 0; }
.lot-thumbnail img[data-ready], .gallery-photos img[data-ready] {
  animation: photo-arrival .24s ease-out both;
}
@keyframes photo-arrival {
  from { opacity: 0; transform: scale(1.02); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .lot-thumbnail img[data-ready], .gallery-photos img[data-ready] { animation: none; }
}
.lot-location, .lot-price span { color: var(--muted); font-size: .8rem; }
.lot-location { margin-top: .12rem; overflow-wrap: anywhere; }
.lot-prices {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: .75rem;
}
.lot-prices:has(.lot-indicators:not([hidden])) {
  grid-template-columns: minmax(0, 1fr) auto;
  align-self: end;
}
.lot-price-values { display: flex; width: max-content; gap: inherit; }
.lot-price {
  display: grid;
  grid-template-rows: 1fr auto;
  justify-items: start;
  gap: .08rem;
  line-height: 1.25;
  text-align: start;
  white-space: nowrap;
}
.lot-price[hidden] { display: none; }
.lot-price strong {
  color: var(--muted);
  font-size: var(--lot-amount-size, 1em);
  font-weight: 400;
  font-variant-numeric: tabular-nums;
}
.lot-price[data-price="current"] strong { color: var(--ink); font-weight: 700; }
.lot-indicators {
  --indicator-size: 1rem;
  display: flex;
  align-self: end;
  gap: .25rem;
  color: var(--muted);
}
.lot-indicators[data-direction="up"] { color: #71e49a; }
.lot-indicators[data-direction="down"] { color: #ff7979; }
.lot-bankruptcy, .lot-direction {
  display: grid;
  place-items: center;
  inline-size: var(--indicator-size);
  block-size: var(--indicator-size);
  line-height: 1;
}
.lot-bankruptcy {
  border: 1px solid currentColor;
  border-radius: .25rem;
  font-size: .75rem;
  font-weight: 400;
}
.lot-direction {
  font-size: 1.35rem;
  font-weight: 720;
  line-height: var(--indicator-size);
}
.empty { padding: .9rem 0; color: var(--muted); }

dialog {
  width: min(32rem, calc(100% - 1.5rem));
  max-height: min(44rem, calc(100% - 1.5rem));
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 1.45rem;
  color: var(--ink);
  background: rgb(38 40 47 / .96);
  box-shadow: 0 24px 80px #000b, inset 0 1px rgb(255 255 255 / .07);
}
dialog[open] { display: flex; flex-direction: column; overflow: hidden; }
dialog::backdrop {
  background: rgb(0 0 0 / .64);
  backdrop-filter: blur(5px);
  animation: dialog-dim 420ms ease-out both;
}
dialog[data-closing]::backdrop { animation: dialog-undim 200ms ease-in both; }
dialog:is([data-opening], [data-closing]) { pointer-events: none; }
@keyframes dialog-dim { from { opacity: 0; } to { opacity: 1; } }
@keyframes dialog-undim { from { opacity: 1; } to { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { dialog::backdrop { animation: none; } }
.dialog-header, .dialog-footer { display: flex; align-items: center; padding: .6rem 1rem; gap: .8rem; }
.dialog-header {
  display: grid;
  grid-template-columns: minmax(4.5rem, 1fr) minmax(0, 3fr) minmax(4.5rem, 1fr);
  gap: .375rem;
  padding-block: .4rem;
  border-bottom: 1px solid var(--line);
}
.dialog-header h2 {
  grid-column: 2;
  min-width: 0;
  font-size: clamp(1.05rem, 3.8vw, 1.35rem);
  line-height: 1.2;
  overflow-wrap: anywhere;
  text-align: center;
}
.dialog-back {
  display: inline-flex;
  align-items: center;
  justify-self: start;
  gap: .3rem;
  padding-inline: .25rem;
  white-space: nowrap;
}
.dialog-back::before {
  content: "";
  flex: none;
  width: .43rem;
  height: .43rem;
  border: solid currentColor;
  border-width: 0 0 2px 2px;
  transform: rotate(45deg);
}
.dialog-tools { padding: .75rem 1rem .15rem; }
.picker-tools { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: .9rem; }
.dialog-body { overflow: auto; padding: .05rem 1rem .75rem; }
.gallery-body { padding-top: .8rem; }
.gallery-caption { margin-bottom: .75rem; }
.gallery-photos {
  display: flex;
  list-style: none;
  padding: 0;
  margin: 0;
  border-radius: .65rem;
  overflow: auto hidden;
  overscroll-behavior-inline: contain;
  scroll-snap-type: inline mandatory;
  scrollbar-width: none;
  background: rgb(0 0 0 / .2);
}
.gallery-photos li {
  display: grid;
  position: relative;
  place-items: center;
  flex: 0 0 100%;
  min-width: 0;
  height: min(52dvh, 30rem);
  scroll-snap-align: center;
  scroll-snap-stop: always;
}
.gallery-photos img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.gallery-photos img[hidden] { display: none; }
.gallery-controls { display: flex; justify-content: space-between; align-items: center; color: var(--muted); }
.gallery-controls button { min-width: 2.75rem; font-size: 1.65rem; line-height: 1; }
#save-form .dialog-body { padding-top: .8rem; display: grid; gap: .45rem; }
.dialog-footer { border-top: 1px solid var(--line); }
.dialog-footer .primary { width: 100%; }
#picker-dialog[data-picker-mode="regions"] { height: clamp(20rem, calc(100dvh - 7rem), 38.5rem); }
#picker-dialog[data-picker-mode="regions"] > :not(.dialog-body) { flex-shrink: 0; }
#picker-dialog[data-picker-mode="regions"] .dialog-body { flex: 1; min-height: 0; }
.saved-item {
  display: grid;
  width: 100%;
  gap: .22rem;
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: .75rem .25rem;
  text-align: left;
  background: var(--surface);
  overflow-wrap: anywhere;
}
.saved-item:hover { background: var(--hover); }
.saved-item span { font-size: .85rem; color: var(--muted); }

@media (max-width: 490px) {
  main { padding-top: 1.55rem; }
  .picker { min-height: 65px; }
  .condition-row { align-items: start; flex-direction: column; }
  .condition-row select { width: 100%; }
  .advanced { grid-template-columns: 1fr; }
  .actions .primary { flex-basis: 100%; }
}

.section-row {
  display: grid;
  width: 100%;
  grid-template-columns: minmax(0, 1fr) auto .65rem;
  align-items: center;
  min-height: 48px;
  gap: .75rem;
  padding: .6rem .5rem;
  border: 1px solid var(--line);
  border-radius: .84rem;
  background: var(--surface);
  text-align: left;
  font-weight: 620;
}
.section-row + .section-row { margin-top: .35rem; }
.section-row:hover, #picker-options > .check:hover { background: var(--hover); }
.section-count {
  min-width: 1.65rem;
  padding: .12rem .35rem;
  border-radius: .45rem;
  background: var(--hover);
  text-align: center;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.section-count[data-selected] { background: var(--accent); color: #102139; }
#picker-options > .check { padding: .4rem .5rem; border-bottom: 1px solid var(--line); }
#picker-options > .check:has(input[data-choice]:checked) { background: rgb(121 186 255 / .10); }
#picker-options > [data-moving] { position: relative; z-index: 1; }
#picker-options > .check[data-moving] { background: #26282f; }
#picker-options > .check[data-moving]:has(input[data-choice]:checked) { background: #2e3743; }
#picker-options .select-group { color: var(--action); font-weight: 680; }
