/* The approved visual system lives in styles.css. This file only lays out the new search interaction. */
.masthead-v2 {
  min-height: 76px;
  justify-content: space-between;
}

.masthead-v2__actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: clamp(14px, 2vw, 28px);
  margin-left: auto;
}

.snapshot-date {
  color: #c7c2b8;
  font-size: 13px;
  white-space: nowrap;
}

.account-button,
.sort-toggle,
.professional-panel button,
.account-dialog button {
  min-height: 44px;
}

.account-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 16px;
  border: 1px solid #817a70;
  border-radius: var(--radius);
  background: transparent;
  color: #fff;
  font-weight: 650;
  text-decoration: none;
}

.search-stage-v2 {
  min-height: 600px;
  padding: clamp(44px, 5vw, 72px) clamp(20px, 6vw, 100px) 82px;
  align-items: center;
}

.search-stage-v2__content {
  width: min(860px, 100%);
}

.search-stage-v2 h1 {
  max-width: 13ch;
  margin: 0 0 clamp(24px, 3vw, 40px);
  font-family: "Prata", Georgia, serif;
  font-size: clamp(48px, 5vw, 76px);
  line-height: 1.04;
  letter-spacing: -.035em;
}

.search-form-v2 {
  position: relative;
  display: block;
  width: min(820px, 100%);
  padding: clamp(14px, 2vw, 20px);
  border: 1px solid rgb(255 255 255 / 36%);
  border-radius: 10px;
  background: rgb(21 25 28 / 90%);
  box-shadow: 0 24px 60px rgb(0 0 0 / 22%);
  backdrop-filter: blur(8px);
}

.search-form-v2 .search-form__label {
  display: block;
  margin: 0 0 7px;
  color: #e8e2d8;
  font-size: 13px;
  font-weight: 620;
}

.search-v2__query-row input {
  width: 100%;
  height: 56px;
  padding: 0 18px;
  border: 1px solid #d1c9bb;
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  font-size: 17px;
  cursor: text;
}

.search-v2__query-row input::placeholder { color: #697174; opacity: 1; }

.primary-filters {
  position: relative;
  display: grid;
  grid-template-columns: minmax(180px, .8fr) minmax(220px, 1fr) minmax(250px, 1.2fr);
  gap: 8px;
  margin-top: 9px;
}

.quick-filter {
  display: block;
  min-width: 0;
  min-height: 48px;
  padding: 0;
  border: 1px solid rgb(255 255 255 / 32%);
  border-radius: var(--radius);
  background: rgb(255 255 255 / 8%);
  color: #fff;
}

.quick-filter summary,
.quick-filter--professional {
  min-height: 48px;
  width: 100%;
  padding: 0 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: #fff;
  font-weight: 610;
  list-style: none;
}

.quick-filter summary::-webkit-details-marker { display: none; }
.quick-filter summary::after { content: "⌄"; font-size: 18px; line-height: 1; }
.quick-filter[open] summary::after { content: "⌃"; }
.quick-filter summary b,
.quick-filter--professional b { color: #d8d1c5; font-size: 12px; font-weight: 520; }
.quick-filter--professional { border: 1px solid rgb(255 255 255 / 32%); cursor: pointer; }

.price-popover {
  position: absolute;
  z-index: 12;
  top: calc(100% + 8px);
  left: 0;
  width: min(420px, 100%);
  padding: 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 18px 45px rgb(0 0 0 / 28%);
}

.range-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.range-fields label,
.professional-section > label,
.account-dialog label { display: grid; gap: 6px; min-width: 0; font-size: 13px; font-weight: 620; }
.range-fields input,
.professional-section input,
.professional-section select,
.account-dialog input {
  width: 100%;
  min-height: 44px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
}

.check-row { display: flex; align-items: center; gap: 9px; min-height: 44px; margin-top: 8px; font-weight: 520; }
.check-row input,
.risk-switch input { width: 20px; height: 20px; flex: 0 0 auto; }
.price-popover__apply { width: 100%; min-height: 44px; margin-top: 10px; border: 1px solid var(--accent); border-radius: var(--radius); background: var(--accent); color: #fff; font-weight: 700; }
.price-popover__apply:hover { background: var(--accent-dark); }

.quick-filter--city .city-combobox { height: 100%; }
.quick-filter--city input {
  width: 100%;
  height: 46px;
  padding: 0 42px 0 13px;
  border: 0;
  background: transparent;
  color: #fff;
  cursor: text;
}
.quick-filter--city input::placeholder { color: #fff; opacity: 1; font-weight: 610; }
.quick-filter--city .city-combobox__toggle { width: 44px; height: 44px; min-height: 44px; filter: invert(1); }
.quick-filter--city .city-options { top: calc(100% + 8px); width: max(100%, 320px); color: var(--ink); }
.quick-filter--city .city-options__group {
  position: sticky;
  z-index: 1;
  top: 0;
  padding: 7px 10px 6px;
  border-bottom: 1px solid var(--line);
  background: #e8e4dc;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 760;
  letter-spacing: .07em;
  text-transform: uppercase;
}
.quick-filter--city .city-option {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
}
.quick-filter--city .city-option span { overflow-wrap: anywhere; }
.quick-filter--city .city-option small { color: var(--ink-soft); font-size: 11px; }
.quick-filter--city .city-option.is-active small { color: currentColor; }
.quick-filter--city .city-option.is-selected::after { content: "Выбрано"; color: var(--accent); font-size: 11px; font-weight: 760; }
.quick-filter--city .city-option.is-selected small { display: none; }

.search-v2__submit {
  width: 100%;
  min-height: 52px;
  margin-top: 10px;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  font-weight: 720;
  letter-spacing: .01em;
}
.search-v2__submit:hover { background: var(--accent-dark); }

.search-form-v2 .active-filters { margin: 10px 0 0; }
.search-form-v2 .active-filter-chip { background: #f3efe6; color: var(--ink); }
.search-form-v2 .active-filters__clear,
.search-form-v2 .search-hint a { color: #fff; }
.search-form-v2 .search-hint { margin: 10px 0 0; color: #d0cbc1; font-size: 12px; }

.professional-panel {
  width: min(980px, calc(100vw - 32px));
  max-width: none;
  max-height: min(760px, calc(100dvh - 32px));
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--paper);
  color: var(--ink);
  overflow: hidden;
}
.professional-panel::backdrop,
.account-dialog::backdrop { background: rgb(14 18 20 / 70%); backdrop-filter: blur(2px); }
.professional-panel__shell { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; max-height: inherit; }
.professional-panel__header,
.professional-panel__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  background: var(--paper);
}
.professional-panel__header { border-bottom: 1px solid var(--line); }
.professional-panel__header p { margin: 0; color: var(--accent); font-size: 11px; font-weight: 720; letter-spacing: .12em; text-transform: uppercase; }
.professional-panel__header h2 { margin: 2px 0 0; font-family: "Prata", Georgia, serif; font-size: clamp(23px, 3vw, 34px); font-weight: 400; }
.professional-panel__header button,
.professional-panel__footer button:first-child { padding: 8px 14px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: transparent; color: var(--ink); }
.professional-panel__body { min-height: 0; overflow-y: auto; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; background: var(--line); }
.professional-section { display: grid; align-content: start; gap: 16px; padding: 22px 20px; background: var(--paper); }
.professional-section h3 { margin: 0 0 2px; font-size: 16px; }
.professional-panel__footer { border-top: 1px solid var(--line); }
.professional-panel__footer button:last-child { min-width: 190px; padding: 8px 22px; border: 1px solid var(--accent); border-radius: var(--radius); background: var(--accent); color: #fff; font-weight: 700; }
.risk-switch { display: flex !important; grid-template-columns: none !important; align-items: flex-start; gap: 10px; padding: 13px; border: 1px solid var(--line); border-radius: var(--radius); }
.risk-switch span { display: grid; gap: 5px; }
.risk-switch small { color: var(--ink-soft); font-weight: 430; line-height: 1.4; }

.entry-links {
  width: min(100%, var(--content));
  margin: 18px auto 0;
  padding: 0 clamp(18px, 4vw, 64px);
  display: flex;
  gap: 8px 20px;
  flex-wrap: wrap;
}
.entry-links a { color: var(--ink); text-underline-offset: 4px; }
body.search-context #entry-deck { display: none; }

.results-v2 { padding-top: clamp(34px, 5vw, 70px); }
.results-v2__topline { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.results-v2__topline h2 { margin: 0; }
.results-v2__topline p { margin: 5px 0 0; color: var(--ink-soft); }
.sort-toggle { flex: 0 0 auto; padding: 8px 13px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--paper); color: var(--ink); }
.sort-menu { inset: auto; position: absolute; width: min(330px, calc(100vw - 24px)); margin: 8px 0 0 auto; padding: 14px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--paper); color: var(--ink); box-shadow: 0 18px 45px rgb(0 0 0 / 20%); }
.sort-menu label { display: block; margin-bottom: 7px; font-size: 13px; font-weight: 650; }
.sort-menu select { width: 100%; min-height: 44px; padding: 7px; border: 1px solid var(--line); background: #fff; color: var(--ink); }
.risk-note { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin: 18px 0 8px; padding: 11px 13px; border: 1px solid var(--line); background: var(--paper-muted); }
.risk-note p { margin: 0; font-size: 13px; }
.risk-note button { min-height: 44px; flex: 0 0 auto; border: 0; background: transparent; color: var(--accent); font-weight: 700; text-decoration: underline; text-underline-offset: 4px; }
.results-v2__method { display: flex; align-items: center; gap: 12px 20px; flex-wrap: wrap; }
.results-v2__method .estimate-legend { margin: 0; }
.results-v2__method .market-range { margin-left: auto; }
.results-v2 .results-table-wrap { max-width: 100%; }
.mobile-card-cell { display: none; }

.account-dialog {
  width: min(440px, calc(100vw - 24px));
  max-width: none;
  padding: 22px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--paper);
  color: var(--ink);
}
.account-dialog__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.account-dialog__head p { margin: 0; color: var(--accent); font-size: 11px; font-weight: 720; letter-spacing: .12em; text-transform: uppercase; }
.account-dialog h2 { margin: 3px 0 0; font-family: "Prata", Georgia, serif; font-weight: 400; }
.account-dialog__head button { padding: 7px 10px; border: 1px solid var(--line); background: transparent; color: var(--ink); }
.account-dialog form { display: grid; gap: 13px; margin-top: 18px; }
.account-dialog form button { border: 1px solid var(--accent); border-radius: var(--radius); background: var(--accent); color: #fff; font-weight: 700; }
.account-dialog__links { display: flex; justify-content: space-between; gap: 14px; margin-top: 18px; }
.account-dialog__links a { color: var(--accent); text-underline-offset: 3px; }
#account-login-status { margin: 0; color: var(--danger); font-size: 13px; }

@media (max-width: 900px) {
  .professional-panel__body { grid-template-columns: 1fr 1fr; }
  .professional-section:last-child { grid-column: 1 / -1; }
}

@media (max-width: 720px) {
  .masthead-v2 { min-height: 72px; padding: 9px 14px; flex-wrap: nowrap; }
  .masthead-v2 .wordmark { min-width: 0; flex: 0 1 155px; }
  .masthead-v2__actions { gap: 8px; min-width: 0; }
  .snapshot-date { position: absolute; top: 51px; left: 14px; max-width: calc(100% - 28px); overflow: hidden; text-overflow: ellipsis; font-size: 10px; }
  .account-button { min-height: 44px; padding: 7px 10px; font-size: 12px; white-space: nowrap; }

  .search-stage-v2 {
    min-height: 704px;
    padding: 28px 14px 34px;
    align-items: flex-start;
  }
  .search-stage-v2 .search-stage__image { object-position: 70% center; opacity: .58; }
  .search-stage-v2 .search-stage__shade { background: linear-gradient(180deg, rgb(21 25 28 / 98%) 0 45%, rgb(21 25 28 / 82%) 70%, rgb(21 25 28 / 52%) 100%); }
  .search-stage-v2 h1 { max-width: 10.5ch; margin-bottom: 20px; font-size: clamp(38px, 10.8vw, 46px); line-height: 1.06; }
  body.search-context .search-stage-v2 { min-height: 0; padding-top: 18px; padding-bottom: 20px; }
  body.search-context .search-stage-v2 .search-stage__image { opacity: .36; }
  body.search-context .search-stage-v2 h1 { max-width: none; margin-bottom: 12px; font-size: 28px; line-height: 1.12; }
  .search-form-v2 { padding: 11px; border-radius: 8px; }
  .search-v2__query-row input { height: 54px; padding-inline: 13px; font-size: 16px; }
  .primary-filters { grid-template-columns: 1fr 1fr; margin-top: 8px; }
  .quick-filter--professional { grid-column: 1 / -1; }
  .price-popover { position: fixed; z-index: 100; top: auto; right: 12px; bottom: 12px; left: 12px; width: auto; }
  .search-v2__submit { min-height: 52px; margin-top: 8px; }
  .search-form-v2 .search-hint { margin-top: 7px; }
  .search-shortcut { display: none; }
  .search-form-v2 .active-filters { margin-top: 7px; }
  .search-form-v2 .active-filter-chips { flex-wrap: wrap; overflow: visible; }
  .search-form-v2 .active-filter-chip { max-width: min(100%, 210px); }
  .quick-filter--city .city-options {
    position: fixed;
    z-index: 120;
    top: auto;
    right: 12px;
    bottom: 12px;
    left: 12px;
    width: auto;
    max-height: min(55dvh, 420px);
    border-color: #6f716f;
    box-shadow: 0 18px 50px rgb(0 0 0 / 28%);
  }

  .professional-panel { width: calc(100vw - 16px); max-height: calc(100dvh - 16px); }
  .professional-panel__header,
  .professional-panel__footer { padding: 12px; }
  .professional-panel__header h2 { font-size: 23px; }
  .professional-panel__body { grid-template-columns: 1fr; }
  .professional-section,
  .professional-section:last-child { grid-column: auto; padding: 17px 14px; }
  .professional-panel__footer button:last-child { min-width: 150px; }

  .entry-links { margin-top: 12px; padding-inline: 14px; font-size: 13px; }
  .results-v2 { padding-top: 28px; }
  body.search-context .results-v2 { padding-top: 16px; }
  .results-v2__topline { align-items: center; gap: 10px; }
  .results-v2__topline h2 { font-size: 24px; }
  .results-v2__topline p { font-size: 12px; }
  .sort-toggle { max-width: 150px; padding-inline: 9px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
  .risk-note { align-items: flex-start; margin-top: 12px; }
  .risk-note p { font-size: 12px; line-height: 1.4; }
  .risk-note button { min-width: 86px; padding: 0; font-size: 12px; }
  .results-v2__method { margin-top: 10px; }
  .account-dialog { padding: 18px; }
}

@media (min-width: 961px) {
  body.search-context .search-stage-v2 {
    min-height: 0;
    padding-top: 24px;
    padding-bottom: 26px;
  }
  body.search-context .search-stage-v2 .search-stage__image { width: 58%; opacity: .56; }
  body.search-context .search-stage-v2 .search-stage__shade {
    background: linear-gradient(90deg, #15191c 0 44%, rgb(21 25 28 / 94%) 57%, rgb(21 25 28 / 42%) 100%);
  }
  body.search-context .search-stage-v2__content { width: min(1060px, 100%); }
  body.search-context .search-stage-v2 h1 {
    max-width: none;
    margin-bottom: 14px;
    font-size: clamp(28px, 3vw, 40px);
    line-height: 1.1;
  }
  body.search-context .search-form-v2 { width: min(980px, 100%); padding: 12px; }
  body.search-context .search-v2__query-row input { height: 50px; }
  body.search-context .search-v2__submit { min-height: 46px; }
  body.search-context .entry-links { margin-top: 12px; }
  body.search-context .results-v2 { padding-top: 18px; }
}

@media (max-width: 960px) {
  .results-v2 .results-table-wrap {
    max-height: none;
    overflow: visible;
    border-top: 0;
  }
  .results-table,
  .results-table tbody { display: block; min-width: 0; width: 100%; }
  .results-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
  .results-table tr {
    display: block;
    padding: 0;
    border-bottom: 0;
    background: transparent;
  }
  .results-table td:not(.mobile-card-cell) { display: none; }
  .results-table td.mobile-card-cell {
    display: block;
    width: 100%;
    padding: 0;
    border: 0;
    text-align: left;
  }
  .results-v2__method .estimate-legend { display: none; }
  .results-v2__method { min-height: 44px; margin-top: 4px; }
  .risk-note { display: grid; justify-content: stretch; gap: 4px; padding: 9px 12px 5px; }
  .risk-note button { justify-self: start; max-width: 100%; text-align: left; }
  .mobile-result-card {
    display: grid;
    grid-template-columns: 92px minmax(0, 1fr);
    gap: 12px 14px;
    margin-bottom: 12px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--paper);
    box-shadow: 0 6px 20px rgb(21 25 28 / 6%);
  }
  .listing-row--review .mobile-result-card { border-color: color-mix(in srgb, var(--danger) 28%, var(--line)); }
  .mobile-result-card__photo {
    width: 92px;
    height: 92px;
    display: grid;
    place-items: center;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--paper-muted);
    color: var(--ink-soft);
    font-size: 11px;
  }
  .mobile-result-card__photo button { width: 100%; height: 100%; padding: 0; border: 0; background: transparent; }
  .mobile-result-card__photo img { width: 100%; height: 100%; object-fit: contain; }
  .mobile-result-card__main { min-width: 0; }
  .mobile-result-card__main h3 { margin: 0; font-size: 16px; line-height: 1.28; overflow-wrap: anywhere; }
  .mobile-result-card__reference,
  .mobile-result-card__place,
  .mobile-result-card__source,
  .mobile-result-card__id { margin: 3px 0 0; color: var(--ink-soft); font-size: 12px; line-height: 1.35; }
  .mobile-result-card__price { margin: 7px 0 0; font-size: 18px; font-weight: 760; font-variant-numeric: tabular-nums; }
  .mobile-result-card__comparison { margin: 8px 0 0; color: var(--accent-dark); font-size: 12px; font-weight: 680; }
  .mobile-result-card__link { display: inline-flex; align-items: center; min-height: 44px; margin-top: 4px; }
  .mobile-result-card__details { grid-column: 1 / -1; border-top: 1px solid var(--line); }
  .mobile-result-card__details summary {
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--ink);
    font-weight: 680;
    cursor: pointer;
    list-style: none;
  }
  .mobile-result-card__details summary::-webkit-details-marker { display: none; }
  .mobile-result-card__details summary::after { content: "+"; color: var(--accent); font-size: 20px; }
  .mobile-result-card__details[open] summary::after { content: "−"; }
  .mobile-result-card__details dl { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 7px 14px; margin: 0 0 10px; font-size: 12px; }
  .mobile-result-card__details dt { color: var(--ink-soft); }
  .mobile-result-card__details dd { margin: 0; text-align: right; font-weight: 650; }
  .mobile-result-card__details p { margin: 0 0 4px; color: var(--ink-soft); font-size: 11px; line-height: 1.45; }
  .skeleton-mobile-card { min-height: 190px; margin-bottom: 12px; border: 1px solid var(--line); background: var(--paper-muted); }
  .skeleton-mobile-card > span { display: block; width: 58%; height: 18px; margin: 22px; background: var(--line); }
}

@media (max-width: 480px) {
  .mobile-result-card { grid-template-columns: 80px minmax(0, 1fr); padding: 12px; gap: 10px 12px; }
  .mobile-result-card__photo { width: 80px; height: 80px; }
  .mobile-result-card__main h3 { font-size: 15px; }
  .mobile-result-card__price { font-size: 17px; }
}

@media (max-width: 380px) {
  .range-fields { grid-template-columns: 1fr; }
  .search-stage-v2 h1 { font-size: 37px; }
}

@media (prefers-reduced-motion: reduce) {
  .professional-panel,
  .account-dialog { scroll-behavior: auto; }
}
