/* E4.002 v3: Hero + Busca — somente a Home.
   O menu preserva seus links e logo; backend aceita apenas finalidade/tipo/estado/cidade.
   Imagem de fundo própria; o HTML continua acessível e editável. */

.e4-hero {
    position: relative;
    /* Mantem as listas dos filtros acima dos cards e suas imagens (z-index: 1/2),
       mas abaixo do Main Menu fixo (z-index: 50). O hero e um contexto isolado. */
    z-index: 10;
    /* O seletor pesquisavel pode ultrapassar a borda inferior da Home.
       O backdrop ja ocupa somente 100% e nao cria overflow horizontal. */
    overflow: visible;
    padding: 0 !important;
    isolation: isolate;
    background: #fff;
}
/* E4.002 v3: a imagem ocupa um wrapper de largura 100% do documento,
   não um pseudo-elemento 100vw que inclui a largura da scrollbar vertical. */
.e4-hero::before { display: none; }
.e4-hero .e4-hero-backdrop {
    position: relative;
    width: 100%;
    background: linear-gradient(90deg, rgba(2,22,43,.82) 0%, rgba(2,22,43,.67) 33%, rgba(6,29,53,.31) 59%, rgba(8,26,42,.05) 100%),
                url('../img/hero-imobee-e4-002.webp') center 53% / cover no-repeat;
}
.e4-hero .e4-hero-stage::before { content: none; }
.e4-hero .e4-hero-stage {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 38px;
    min-height: 348px;
    width: min(calc(100% - clamp(40px, 10vw, 110px)), 1320px);
    padding: 81px 0 92px;
    isolation: isolate;
}
.e4-hero .e4-hero-copy {
    width: min(100%, 620px);
    color: #fff;
    text-shadow: 0 1px 10px rgba(0,0,0,.12);
}
.e4-hero .e4-hero-eyebrow {
    color: #eef5ff;
    font-size: 10px;
    letter-spacing: .18em;
    font-weight: 850;
}
.e4-hero .e4-hero-eyebrow::after { width: 26px; height: 2px; color: #eab858; }
.e4-hero h1 {
    max-width: 570px;
    margin: 10px 0 7px;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(30px, 3.35vw, 46px);
    line-height: 1.055;
    letter-spacing: -.027em;
    font-weight: 750;
    color: #fff;
}
.e4-hero h1 span { display: block; }
.e4-hero .hero-lead {
    max-width: 455px;
    margin: 0;
    color: #f1f6fc;
    line-height: 1.38;
    font-size: clamp(11.5px, 1.13vw, 14px);
    font-weight: 480;
}
.e4-hero .e4-hero-actions {
    margin-top: 13px;
    gap: 9px;
}
.e4-hero .e4-hero-btn {
    min-height: 31px;
    padding: 0 13px;
    gap: 7px;
    border-radius: 6px;
    font-size: clamp(10px, .96vw, 12px);
    font-weight: 780;
    line-height: 1.2;
    white-space: nowrap;
    transition: background .18s ease;
}
.e4-hero .e4-hero-btn:hover { transform: none; }
.e4-hero .e4-hero-btn svg { width: 15px; height: 15px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.e4-hero .e4-hero-btn-favorites { color: #0b2d52; background: #fff; border-color: #fff; }
.e4-hero .e4-hero-btn-favorites:hover { background: #eef4fa; }
.e4-hero .e4-hero-btn-list { color: #fff; background: rgba(1,15,29,.55); border-color: rgba(255,255,255,.80); }
.e4-hero .e4-hero-btn-list:hover { background: rgba(3,29,52,.92); }
.e4-hero .e4-hero-message {
    display: flex;
    flex-direction: column;
    flex: 0 0 238px;
    margin-top: 70px;
    padding: 15px 17px;
    background: rgba(10,31,53,.48);
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 3px;
    color: #fff;
    -webkit-backdrop-filter: blur(5px);
    backdrop-filter: blur(5px);
}
.e4-hero .e4-hero-message strong { font: 18px/1.2 Georgia, "Times New Roman", serif; font-weight: 500; }
.e4-hero .e4-hero-message span { margin-top: 5px; font-size: 11px; line-height: 1.35; color: #f8fbff; }
.e4-hero .e4-hero-message i { display: block; width: 28px; height: 2px; margin-top: 11px; background: #eac16b; }

/* A busca fica na borda inferior da fotografia, como na referência. */
.e4-hero .e4-search {
    position: relative;
    width: min(calc(100% - clamp(32px, 9vw, 110px)), 1320px);
    z-index: 5;
    margin-top: -52px;
    padding: 8px 13px 9px;
    transform: none;
    border-radius: 11px;
    border: 1px solid rgba(221,232,244,.92);
    background: #fff;
    box-shadow: 0 14px 32px rgba(16,51,81,.12);
}
.e4-hero .e4-search-form { margin: 0; }
.e4-hero .e4-search-top { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 7px; }
.e4-hero .e4-search-tabs { display: flex; align-items: center; gap: 3px; }
.e4-hero .e4-search-tab {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 87px;
    min-height: 30px;
    padding: 6px 12px;
    border: 1px solid #d8e2ed;
    border-radius: 5px;
    background: #eef2f7;
    color: #18304f;
    font-size: 10.5px;
    font-weight: 750;
    line-height: 1.1;
    cursor: pointer;
    transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}
.e4-hero .e4-search-tab input { position: absolute; width: 100%; height: 100%; inset: 0; opacity: 0; cursor: pointer; }
.e4-hero .e4-search-tab-label { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.e4-hero .e4-search-tab-label svg { display: none; flex: 0 0 14px; width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
/* Estado visual explicito: JS sincroniza .is-active com o radio selecionado.
   Nao depende de :has() nem de atualização dos resultados. */
.e4-hero .e4-search-tab.is-active { background: #09539e; color: #fff; border-color: #09539e; box-shadow: none; }
.e4-hero .e4-search-tab.is-active .e4-search-tab-label svg { display: block; }
/* Foco de teclado sem contorno colorido: indicacao discreta por sublinhado. */
.e4-hero .e4-search-tab input:focus-visible + .e4-search-tab-label { text-decoration: underline; text-underline-offset: 3px; }
@media (prefers-reduced-motion: reduce) { .e4-hero .e4-search-tab { transition: none; } }
.e4-hero .e4-search-advanced-link { display: inline-flex; align-items: center; gap: 6px; color: #142d50; font-size: 10px; font-weight: 700; }
.e4-hero .e4-search-advanced-link svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; }
.e4-hero .e4-search-fields { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)) minmax(137px,1.07fr); gap: 7px; align-items: stretch; }
.e4-hero .e4-search-field {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
    height: 52px;
    padding: 7px 9px;
    border: 1px solid #e1e8f0;
    border-radius: 7px;
    background: #fff;
}
.e4-hero .e4-search-field > span:first-child,
.e4-hero .e4-search-field > label,
.e4-hero .e4-search-field .e4-search-field-title { display: block; margin-bottom: 5px; color: #465b75; font-size: 9.5px; line-height: 1.1; font-weight: 750; white-space: nowrap; }
/* Identidade visual: icones discretos nas labels do filtro convencional. */
.e4-hero .e4-search-field > .e4-conventional-caption:first-child {
    display: inline-flex;
    align-items: center;
    align-self: flex-start;
    gap: 4px;
}
.e4-hero .e4-search-field .e4-conventional-caption svg {
    flex: 0 0 13px;
    width: 13px;
    height: 13px;
    fill: none;
    stroke: #29618c;
    stroke-width: 1.85;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.e4-hero .e4-search-field input, .e4-hero .e4-search-field select {
    width: 100%; min-width: 0; height: 23px;
    padding: 0; border: 0; border-radius: 0;
    background: transparent;
    color: #153254;
    font-family: inherit;
    font-size: 11.5px;
    line-height: 1.3;
    font-weight: 630;
    outline-offset: -1px;
}
.e4-hero .e4-search-code input { font-variant-numeric: tabular-nums; }
.e4-hero .e4-search-field input::placeholder { color: #718399; opacity: 1; font-weight: 500; }
.e4-hero .e4-search-location-group { display: flex; gap: 5px; align-items: center; width: 100%; }
.e4-hero .e4-search-location-group #e4-city { flex: 1 1 auto; width: 1px; text-overflow: ellipsis; }
.e4-hero .e4-search-location-group #e4-state { width: 47px; flex: 0 0 47px; font-size: 10.5px; border-left: 1px solid #dbe4ef; padding-left: 5px; }
.e4-hero .e4-search-field select:disabled { color: #718399; cursor: not-allowed; }
/* E3.1 refinamento: seletores pesquisáveis; select nativo funciona sem JS. */
.e4-hero .e4-filter-combobox { position: relative; width: 100%; min-width: 0; }
.e4-hero .e4-filter-toggle[hidden],
.e4-hero .e4-filter-dropdown[hidden] { display: none !important; }
.e4-hero .e4-filter-combobox.is-ready > .e4-filter-native { display: none !important; }
.e4-hero .e4-filter-toggle {
    display: flex; justify-content: space-between; align-items: center; gap: 4px;
    width: 100%; min-width: 0; height: 23px; margin: 0; padding: 0;
    background: transparent; border: 0; border-radius: 2px;
    color: #153254; font-family: inherit; font-size: 11.5px; font-weight: 630; line-height: 1.3; text-align: left; cursor: pointer;
}
.e4-hero .e4-filter-toggle > [data-filter-label] {
    display: block; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
.e4-hero .e4-filter-chevron {
    display: block; flex: 0 0 6px; width: 6px; height: 6px;
    border-right: 1.6px solid #5b718a; border-bottom: 1.6px solid #5b718a;
    transform: rotate(45deg) translateY(-2px);
}
.e4-hero .e4-filter-combobox.is-open .e4-filter-chevron { transform: rotate(225deg) translate(-2px, -1px); }
.e4-hero .e4-filter-toggle:focus-visible { outline: 2px solid #0b63b6; outline-offset: 3px; }
.e4-hero .e4-filter-toggle:disabled { color: #718399; cursor: not-allowed; }
.e4-hero .e4-search-field:has(.e4-filter-combobox.is-open) { position: relative; z-index: 30; }
.e4-hero .e4-filter-dropdown {
    position: absolute; top: calc(100% + 10px); left: 0; z-index: 40;
    width: 280px; max-width: min(280px, calc(100vw - 30px));
    padding: 9px; border: 1px solid #d9e4f0; border-radius: 10px;
    background: #fff; box-shadow: 0 16px 36px rgba(18, 45, 75, .2);
}
.e4-hero .e4-search-field .e4-filter-search {
    display: block; width: 100%; height: 36px; min-height: 36px; margin: 0 0 7px;
    padding: 0 10px; border: 1px solid #dbe5ef; border-radius: 7px;
    background: #f8fafc; color: #153254; font-size: 12px; font-weight: 550;
}
.e4-hero .e4-search-field .e4-filter-search:focus { outline: 2px solid #0b63b6; outline-offset: 1px; background: #fff; }
.e4-hero .e4-filter-options { display: grid; gap: 2px; max-height: 210px; overflow-y: auto; overscroll-behavior: contain; }
.e4-hero .e4-filter-option {
    display: flex; align-items: center; gap: 9px; width: 100%; min-height: 34px;
    padding: 7px 9px; border: 0; border-radius: 6px; background: transparent;
    color: #243e5d; font-size: 12px; font-weight: 600; line-height: 1.3;
    text-align: left; white-space: normal; cursor: pointer;
}
.e4-hero .e4-filter-option::before {
    content: ''; flex: 0 0 13px; width: 13px; height: 13px;
    border: 1px solid #9bb0c7; border-radius: 50%;
}
.e4-hero .e4-filter-option[aria-selected="true"] { background: #eaf3fc; color: #09539e; font-weight: 750; }
.e4-hero .e4-filter-option[aria-selected="true"]::before {
    content: '✓'; border-color: #09539e; background: #09539e; color: #fff;
    font-size: 10px; line-height: 12px; text-align: center;
}
.e4-hero .e4-filter-option:hover, .e4-hero .e4-filter-option:focus-visible { background: #edf4fc; color: #064c8d; outline: 2px solid transparent; }
.e4-hero .e4-filter-empty { padding: 9px; color: #63758b; font-size: 12px; }
.e4-hero .e4-search-location-group .e4-filter-combobox--city { flex: 1 1 0; width: 1px; }
.e4-hero .e4-search-location-group .e4-filter-combobox--state {
    flex: 0 0 47px; width: 47px; border-left: 1px solid #dbe4ef; padding-left: 5px;
}
.e4-hero .e4-search-location-group .e4-filter-combobox--state .e4-filter-toggle { font-size: 10.5px; }
/* Posiciona as listas de localizacao para dentro do painel mesmo em telas estreitas. */
.e4-hero .e4-search-location .e4-filter-dropdown { left: auto; right: 0; }
.e4-hero .e4-search-location .e4-filter-combobox--city .e4-filter-dropdown { right: -52px; }

/* E3.2: faixa de preco pesquisavel, acessivel e sem deslocar a grade do Hero. */
.e4-hero .e4-search-price-field:has(.e4-price-details[open]) { position: relative; z-index: 30; }
.e4-hero .e4-price-details { position: relative; min-width: 0; }
.e4-hero .e4-price-summary {
    display: flex; align-items: center; justify-content: space-between; gap: 5px;
    width: 100%; min-width: 0; min-height: 23px; margin: 0; padding: 0;
    color: #153254; font-size: 11.5px; font-weight: 630; line-height: 1.3;
    cursor: pointer; list-style: none;
}
.e4-hero .e4-price-summary::-webkit-details-marker { display: none; }
.e4-hero .e4-price-summary > [data-price-display] {
    display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.e4-hero .e4-price-summary:focus-visible { outline: 2px solid #0b63b6; outline-offset: 3px; }
.e4-hero .e4-price-details[open] .e4-price-summary .e4-filter-chevron { transform: rotate(225deg) translate(-2px, -1px); }
.e4-hero .e4-price-dropdown {
    position: absolute; top: calc(100% + 14px); left: 0; z-index: 40;
    display: flex; flex-direction: column; gap: 5px;
    width: 260px; max-width: min(260px, calc(100vw - 30px));
    padding: 12px; border: 1px solid #d9e4f0; border-radius: 10px;
    background: #fff; box-shadow: 0 16px 36px rgba(18, 45, 75, .2);
}
.e4-hero .e4-price-dropdown strong { font-size: 12px; color: #16375a; margin-bottom: 4px; }
.e4-hero .e4-price-dropdown label { font-size: 11px; font-weight: 700; color: #3b526f; }
.e4-hero .e4-search-field .e4-price-dropdown input {
    width: 100%; height: 35px; min-height: 35px; padding: 6px 9px;
    border: 1px solid #dbe5ef; border-radius: 6px; background: #f8fafc;
    font-size: 14px; font-weight: 650; color: #153254;
}
.e4-hero .e4-search-field .e4-price-dropdown input:focus { outline: 2px solid #0b63b6; outline-offset: 0; background: #fff; }
.e4-hero .e4-price-dropdown p { margin: 3px 0 4px; color: #60738a; font-size: 10.5px; line-height: 1.4; }
.e4-hero .e4-price-done {
    align-self: stretch; min-height: 34px; border: 0; border-radius: 6px;
    color: #fff; background: #09539e; font-size: 11.5px; font-weight: 750; cursor: pointer;
}
.e4-hero .e4-price-done:hover { background: #063f7d; }
.e4-price-save-notice { margin: 12px 0; font-size: 12px; line-height: 1.5; color: #53657b; }

.e4-hero .e4-code-search-note { display: none; margin: 8px 2px 0; color: #52677d; font-size: 11px; line-height: 1.4; }
.e4-hero .e4-search-form:has(.e4-search-code input:not(:placeholder-shown)) .e4-code-search-note { display: block; }
.e4-hero .e4-search-filter-status { margin: 8px 2px 0; color: #5f6f81; font-size: 11px; line-height: 1.4; }
.e4-hero .e4-search-field-coming { background: #f7f9fc; border-color: #e9eef4; }
.e4-hero .e4-search-field-coming > span:first-child { color: #7d8b9b; }
.e4-hero .e4-search-field .e4-coming-value { color: #8491a1; font-size: 11px; font-weight: 600; }
.e4-hero .e4-search-submit {
    min-width: 0;
    min-height: 52px;
    padding: 0 9px;
    border: 0;
    border-radius: 7px;
    background: #09539e;
    color: #fff;
    font-size: 11.5px;
    font-weight: 780;
    white-space: nowrap;
    cursor: pointer;
    box-shadow: none;
}
.e4-hero .e4-search-submit:hover { background: #063f7d; transform: none; }
.e4-hero .e4-search-submit svg { flex: 0 0 auto; width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.e4-hero .e4-search-details { display: none; align-items: center; justify-content: space-between; gap: 20px; margin-top: 9px; padding-top: 8px; border-top: 1px solid #e6ecf2; color: #53657b; font-size: 11px; }
.e4-hero .e4-search-details:target { display: flex; }
.e4-hero .e4-search-details a { flex: 0 0 auto; color: #0b58a6; font-weight: 750; }
.e4-hero .e4-sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.e4-hero .search-notice { margin: 10px 0 0; }
/* Reduz apenas o espaço após o painel flutuante; não altera os cards. */
body:has(.e4-hero) .section-properties { padding-top: 38px; }

@media (min-width: 1440px) {
    .e4-hero .e4-hero-stage { min-height: 430px; padding-top: 88px; }
    .e4-hero .e4-hero-copy { width: 620px; }
    .e4-hero h1 { font-size: 48px; }
    .e4-hero .e4-hero-message { margin-top: 65px; }
}
@media (max-width: 1080px) {
    .e4-hero .e4-hero-stage { padding-top: 54px; }
    .e4-hero .e4-hero-copy { max-width: 456px; }
    .e4-hero .e4-hero-message { flex-basis: 205px; padding: 13px; }
    .e4-hero .e4-search-fields { grid-template-columns: repeat(4, minmax(0,1fr)) minmax(135px,1.04fr); }
}
/* Em telas intermediarias, preserva espaco para nomes de cidades e tipos. */
@media (min-width: 921px) and (max-width: 1200px) {
    .e4-hero .e4-search-fields { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
/* Cinco itens: nas grades de tres colunas, o botao ocupa as duas colunas
   restantes da segunda linha, sem lacunas desnecessarias. */
@media (min-width: 621px) and (max-width: 1200px) {
    .e4-hero .e4-search-submit { grid-column: span 2; }
}
@media (min-width: 621px) and (max-width: 920px) {
    .e4-hero .e4-search-price-field .e4-price-dropdown { left: auto; right: 0; }
}
@media (max-width: 920px) {
    /* Header v4 fica fixo e transparente mesmo em telas menores. */
    .e4-hero .e4-hero-stage { min-height: 390px; padding: 110px 0 80px; }
    .e4-hero .e4-hero-copy { width: min(100%, 560px); }
    .e4-hero h1 { font-size: clamp(31px, 4.4vw, 40px); }
    .e4-hero .e4-hero-message { display: none; }
    .e4-hero .e4-search { width: min(calc(100% - 36px), 750px); margin-top: -45px; }
    .e4-hero .e4-search-fields { grid-template-columns: repeat(3, minmax(0,1fr)); }
    .e4-hero .e4-search-submit { min-height: 56px; }
}
@media (max-width: 620px) {
    .e4-hero .e4-hero-backdrop { background-position: 63% center; }
    .e4-hero .e4-hero-stage { min-height: 385px; padding: 105px 0 65px; }
    .e4-hero .e4-hero-copy { width: 100%; }
    .e4-hero .e4-hero-eyebrow { font-size: 8.5px; letter-spacing: .13em; }
    .e4-hero h1 { max-width: 430px; margin-top: 13px; font-size: clamp(29px, 8.6vw, 39px); line-height: 1.08; }
    .e4-hero .hero-lead { max-width: 380px; font-size: 12px; }
    .e4-hero .e4-hero-actions { gap: 8px; margin-top: 16px; }
    .e4-hero .e4-hero-btn { min-height: 35px; padding-inline: 10px; font-size: 10px; }
    .e4-hero .e4-hero-btn svg { width: 13px; height: 13px; }
    .e4-hero .e4-search { padding: 11px 12px 13px; margin-top: -34px; }
    .e4-hero .e4-search-top { gap: 6px; align-items: flex-start; }
    .e4-hero .e4-search-tabs { gap: 3px; }
    .e4-hero .e4-search-tab { min-width: 0; padding: 7px 8px; font-size: 10px; }
    .e4-hero .e4-search-advanced-link { font-size: 0; padding: 5px; }
    .e4-hero .e4-search-advanced-link svg { width: 19px; height: 19px; }
    .e4-hero .e4-search-fields { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px; }
    .e4-hero .e4-search-price-field { display: flex; }
    .e4-hero .e4-search-field { height: 60px; }
    .e4-hero .e4-search-submit { min-height: 59px; }
    .e4-hero .e4-search-details:target { flex-direction: column; align-items: flex-start; gap: 7px; }
    body:has(.e4-hero) .section-properties { padding-top: 48px; }
}
@media (max-width: 390px) {
    .e4-hero .e4-hero-stage { min-height: 420px; }
    .e4-hero .e4-hero-actions { align-items: stretch; flex-direction: column; }
    .e4-hero .e4-hero-btn { align-self: flex-start; }
    .e4-hero .e4-search-fields { grid-template-columns: 1fr; }
    .e4-hero .e4-search-submit { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
    .e4-hero .e4-hero-btn { transition: none; }
}

/* Etapa 3.4.1: painel avancado de ambientes, integrado ao formulario existente. */
.e4-hero .e4-search-advanced-link { border: 0; padding: 5px 3px; background: transparent; cursor: pointer; font-family: inherit; }
.e4-hero .e4-search-advanced-link[hidden],
.e4-hero .e4-advanced-counter[hidden],
.e4-hero .e4-advanced-panel[hidden] { display: none !important; }
.e4-hero .e4-search-advanced-link:focus-visible { outline: 2px solid #09539e; outline-offset: 3px; border-radius: 3px; }
.e4-hero .e4-search-advanced-link[aria-expanded="true"] { color: #09539e; }
.e4-hero .e4-advanced-counter { display: inline-flex; align-items: center; justify-content: center; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 12px; color: #fff; background: #09539e; font-size: 10px; }
.e4-hero .e4-advanced-panel { margin: 13px 1px 2px; padding: 16px; border: 1px solid #dbe6f2; border-radius: 10px; background: #f7faff; }
.e4-hero .e4-advanced-heading strong { display: block; color: #173757; font-size: 13px; }
.e4-hero .e4-advanced-heading p { margin: 3px 0 13px; color: #657991; font-size: 11px; line-height: 1.45; }
.e4-hero .e4-advanced-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 10px; }
.e4-hero .e4-advanced-field { display: flex; flex-direction: column; min-width: 0; gap: 6px; color: #405775; font-size: 11px; font-weight: 750; }
.e4-hero .e4-advanced-field-label { display: inline-flex; align-items: center; gap: 7px; min-height: 18px; }
.e4-hero .e4-advanced-field-label svg { flex: 0 0 17px; width: 17px; height: 17px; fill: none; stroke: #29618c; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.e4-hero .e4-advanced-divider { height: 0; border-top: 1px solid #dbe6f2; margin: 22px 0 17px; }

.e4-hero .e4-advanced-field input[data-advanced-input] { display: block; box-sizing: border-box; width: 100%; min-width: 0; height: 41px; padding: 0 10px; border: 1px solid #d4e0ed; border-radius: 7px; background: #fff; color: #173757; font-family: inherit; font-size: 12px; font-weight: 600; line-height: 1.3; }
.e4-hero .e4-advanced-field input[data-advanced-input]::placeholder { color: #71849b; opacity: 1; }
.e4-hero .e4-advanced-field input[data-advanced-input]:focus-visible { outline: 2px solid #09539e; outline-offset: 2px; }
.e4-hero .e4-advanced-field input[data-advanced-input]:invalid:not(:placeholder-shown) { border-color: #b63b3b; }
.e4-hero .e4-advanced-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 9px; margin-top: 14px; }
.e4-hero .e4-advanced-clear, .e4-hero .e4-advanced-done { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 36px; padding: 0 14px; border-radius: 6px; font-family: inherit; font-size: 11.5px; font-weight: 750; cursor: pointer; }
.e4-hero .e4-advanced-action-icon { display: block; flex: 0 0 15px; width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.e4-hero .e4-advanced-clear { border: 1px solid #ccdae8; background: #fff; color: #244969; }
.e4-hero .e4-advanced-done { border: 1px solid #09539e; background: #09539e; color: #fff; }
.e4-hero .e4-advanced-clear:hover { background: #edf4fc; }
.e4-hero .e4-advanced-done:hover { background: #063f7d; }
.e4-hero .e4-advanced-footnote { margin: 12px 0 0; color: #64758b; font-size: 10.5px; line-height: 1.5; }
@media (max-width: 920px) { .e4-hero .e4-advanced-grid { grid-template-columns: repeat(2,minmax(0,1fr)); } }
@media (max-width: 390px) { .e4-hero .e4-advanced-grid { grid-template-columns: 1fr; } }

/* Etapa 3.4.2: caracteristicas (SIM), no mesmo painel de ambientes. */
.e4-hero .e4-advanced-features { min-width: 0; margin: 0; padding: 0; border: 0; }
.e4-hero .e4-advanced-features legend { padding: 0; color: #173757; font-size: 13px; font-weight: 750; }
.e4-hero .e4-advanced-section-title { display: inline-flex; align-items: center; gap: 7px; }
.e4-hero .e4-advanced-section-title svg { display: block; flex: 0 0 17px; width: 17px; height: 17px; fill: none; stroke: #29618c; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.e4-hero .e4-advanced-features > p { margin: 2px 0 12px; color: #657991; font-size: 11px; line-height: 1.5; }
/* Uma linha no desktop: 5 controles em Comprar e 4 em Alugar, conforme a visibilidade do financiamento. */
.e4-hero .e4-advanced-features-grid { display: flex; gap: 9px; }
.e4-hero .e4-advanced-feature { box-sizing: border-box; position: relative; display: flex; flex: 1 1 0; min-width: 0; align-items: center; gap: 9px; min-height: 47px; padding: 8px 11px; background: #fff; border: 1px solid #d4e0ed; border-radius: 7px; cursor: pointer; color: #274768; font-size: 11.5px; font-weight: 650; line-height: 1.4; }
.e4-hero .e4-advanced-feature[hidden] { display: none !important; }
.e4-hero .e4-advanced-feature.is-checked { border-color: #b5cde5; background: #f1f7ff; }
/* Checkbox nativo acessivel: o trilho e o polegar formam o chaveador visual. */
.e4-hero .e4-advanced-feature-input { position: absolute; width: 1px; height: 1px; opacity: 0; margin: 0; }
.e4-hero .e4-advanced-feature-icon { display: block; flex: 0 0 17px; width: 17px; height: 17px; fill: none; stroke: #29618c; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.e4-hero .e4-advanced-feature-text { flex: 1 1 auto; min-width: 0; }
.e4-hero .e4-advanced-switch { flex: 0 0 42px; width: 42px; height: 24px; border-radius: 999px; background: #cbd5e1; padding: 3px; box-sizing: border-box; transition: background-color .16s ease; }
.e4-hero .e4-advanced-switch-thumb { display: block; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(5,31,59,.2); transition: transform .16s ease; }
.e4-hero .e4-advanced-feature-input:checked ~ .e4-advanced-switch { background: #09539e; }
.e4-hero .e4-advanced-feature-input:checked ~ .e4-advanced-switch .e4-advanced-switch-thumb { transform: translateX(18px); }
.e4-hero .e4-advanced-feature-input:focus-visible ~ .e4-advanced-switch { outline: 2px solid #09539e; outline-offset: 3px; }
@media (prefers-reduced-motion: reduce) {
    .e4-hero .e4-advanced-switch, .e4-hero .e4-advanced-switch-thumb { transition: none; }
}
@media (max-width: 920px) {
    .e4-hero .e4-advanced-features-grid { flex-wrap: wrap; }
    .e4-hero .e4-advanced-feature { flex: 1 1 calc(50% - 9px); }
}
@media (max-width: 390px) { .e4-hero .e4-advanced-feature { flex-basis: 100%; } }

/* Etapa 3.4.3: bairro pesquisavel, somente quando publicamente autorizado. */
.e4-hero .e4-advanced-neighborhood { min-width: 0; margin: 0; padding: 0; border: 0; }
.e4-hero .e4-advanced-neighborhood legend { padding: 0; color: #173757; font-size: 13px; font-weight: 750; }
.e4-hero .e4-advanced-neighborhood p { margin: 3px 0 11px; color: #657991; font-size: 11px; line-height: 1.45; }
.e4-hero .e4-advanced-neighborhood > label { display: block; margin-bottom: 6px; color: #405775; font-size: 11px; font-weight: 750; }
.e4-hero .e4-advanced-neighborhood .e4-filter-combobox { width: min(100%, 440px); }
.e4-hero .e4-advanced-neighborhood .e4-filter-native,
.e4-hero .e4-advanced-neighborhood .e4-filter-toggle { box-sizing: border-box; display: flex; align-items: center; width: 100%; min-width: 0; min-height: 41px; padding: 0 10px; border: 1px solid #d4e0ed; border-radius: 7px; background: #fff; color: #173757; font-family: inherit; font-size: 12px; font-weight: 600; }
.e4-hero .e4-advanced-neighborhood .e4-filter-toggle { justify-content: space-between; }
.e4-hero .e4-advanced-neighborhood .e4-filter-toggle:disabled { background: #eaf0f7; color: #718399; }
.e4-hero .e4-advanced-neighborhood .e4-filter-dropdown { z-index: 100; width: min(330px, calc(100vw - 48px)); max-width: 100%; left: 0; right: auto; }


/* Etapa 3.4.4 — filtro adaptado para toque: preserva o layout desktop.
   Listas pesquisaveis e preco usam um painel de selecao fixo no mobile,
   independente da largura dos campos do formulario. */
.e4-hero .e4-mobile-location-label, .e4-hero .e4-mobile-sheet-header { display: none; }
.e4-hero .e4-mobile-picker-backdrop[hidden] { display: none !important; }
@media (max-width: 620px) {
    .e4-hero .e4-search { box-sizing: border-box; width: calc(100% - 24px); max-width: 540px; padding: 13px; }
    .e4-hero .e4-search-top { align-items: center; gap: 10px; }
    .e4-hero .e4-search-tabs { flex: 1 1 auto; min-width: 0; gap: 7px; }
    .e4-hero .e4-search-tab { flex: 1 1 0; min-height: 42px; font-size: 12px; padding: 10px 7px; }
    .e4-hero .e4-search-advanced-link { min-width: 40px; min-height: 42px; justify-content: center; }

    /* Evita os campos estreitos de duas colunas nos celulares maiores. */
    .e4-hero .e4-search-fields { grid-template-columns: minmax(0, 1fr); gap: 10px; }
    .e4-hero .e4-search-field { box-sizing: border-box; width: 100%; min-width: 0; height: auto; min-height: 76px; padding: 10px 12px; }
    .e4-hero .e4-search-field > .e4-conventional-caption:first-child,
    .e4-hero .e4-search-field > .e4-search-field-title { font-size: 12px; margin-bottom: 6px; gap: 7px; }
    .e4-hero .e4-search-field .e4-conventional-caption svg { width: 16px; height: 16px; flex-basis: 16px; }
    .e4-hero .e4-search-field input, .e4-hero .e4-search-field select,
    .e4-hero .e4-filter-toggle, .e4-hero .e4-price-summary { min-height: 40px; height: 40px; font-size: 15px; line-height: 1.35; }
    .e4-hero .e4-search-field .e4-filter-toggle,
    .e4-hero .e4-search-field .e4-price-summary { padding: 0 3px; }
    .e4-hero .e4-search-submit { grid-column: auto; min-height: 49px; width: 100%; font-size: 14px; }

    /* Estado e Cidade ficam independentes, com UF antes da cidade.
       A ordem do DOM e os nomes de campos GET permanecem iguais. */
    .e4-hero .e4-search-location { min-height: 0; }
    .e4-hero .e4-search-location-group { display: flex; flex-direction: column; align-items: stretch; gap: 9px; }
    .e4-hero .e4-search-location-group .e4-filter-combobox--state,
    .e4-hero .e4-search-location-group .e4-filter-combobox--city { box-sizing: border-box; flex: 0 0 auto; width: 100%; padding: 0; border: 0; }
    .e4-hero .e4-search-location-group .e4-filter-combobox--state { order: -1; }
    .e4-hero .e4-mobile-location-label { display: block; color: #566c83; font-size: 11px; font-weight: 700; margin-bottom: 2px; }
    .e4-hero .e4-search-location-group .e4-filter-combobox--state .e4-filter-toggle { font-size: 15px; }
    .e4-hero .e4-search-location-group .e4-filter-combobox .e4-filter-toggle,
    .e4-hero .e4-search-location-group .e4-filter-native { box-sizing: border-box; width: 100%; min-height: 40px; padding: 0 8px; background: #f7faff; border: 1px solid #e1e8f0; border-radius: 6px; }
    .e4-hero .e4-search-field:has(.e4-filter-combobox.is-open),
    .e4-hero .e4-search-price-field:has(.e4-price-details[open]),
    .e4-hero .e4-advanced-neighborhood:has(.e4-filter-combobox.is-open) { position: relative; z-index: 75; }

    /* Fundo e folhas modais: nenhuma pode ser cortada pelo bloco do Hero. */
    .e4-hero .e4-mobile-picker-backdrop { position: fixed; inset: 0; z-index: 50; background: rgba(8,25,46,.55); }
    .e4-hero .e4-mobile-picker-ready .e4-filter-dropdown,
    .e4-hero .e4-mobile-picker-ready .e4-search-location .e4-filter-dropdown,
    .e4-hero .e4-mobile-picker-ready .e4-search-location .e4-filter-combobox--city .e4-filter-dropdown,
    .e4-hero .e4-mobile-picker-ready .e4-advanced-neighborhood .e4-filter-dropdown,
    .e4-hero .e4-mobile-picker-ready .e4-price-dropdown {
        box-sizing: border-box;
        position: fixed;
        top: auto;
        left: 12px;
        right: 12px;
        bottom: var(--e4-mobile-picker-bottom, 8px);
        z-index: 85;
        display: flex;
        flex-direction: column;
        gap: 8px;
        width: auto;
        max-width: none;
        max-height: min(600px, calc(var(--e4-mobile-picker-height, 100dvh) - 16px));
        min-height: 0;
        padding: 14px;
        overflow: hidden;
        border-radius: 15px;
        background: #fff;
        box-shadow: 0 18px 48px rgba(8,26,46,.27);
    }
    .e4-hero .e4-mobile-sheet-header { display: flex; flex: 0 0 auto; align-items: center; justify-content: space-between; gap: 10px; min-height: 38px; color: #173757; font-size: 15px; font-weight: 750; }
    .e4-hero .e4-mobile-sheet-close { box-sizing: border-box; flex: 0 0 38px; width: 38px; height: 38px; border: 1px solid #d4e0ed; border-radius: 8px; background: #f7faff; color: #173757; font-size: 23px; line-height: 1; cursor: pointer; }
    .e4-hero .e4-filter-dropdown .e4-filter-search,
    .e4-hero .e4-search-field .e4-filter-search { box-sizing: border-box; flex: 0 0 auto; width: 100%; min-height: 45px; height: 45px; margin: 0; padding: 0 12px; font-size: 16px; }
    .e4-hero .e4-filter-options { display: block; flex: 1 1 auto; max-height: none; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
    .e4-hero .e4-filter-option { min-height: 47px; padding: 12px; font-size: 14px; }
    .e4-hero .e4-mobile-picker-ready .e4-price-dropdown > strong { display: none; }
    .e4-hero .e4-price-dropdown input { flex: 0 0 auto; }
    .e4-hero .e4-price-done { flex: 0 0 46px; min-height: 46px; font-size: 13px; }

    .e4-hero .e4-advanced-panel { box-sizing: border-box; width: 100%; padding: 13px; }
    .e4-hero .e4-advanced-features-grid { flex-wrap: wrap; }
    .e4-hero .e4-advanced-feature { min-width: 0; min-height: 52px; padding: 9px; }
    .e4-hero .e4-advanced-feature-text { overflow-wrap: anywhere; }
    .e4-hero .e4-advanced-actions { display: grid; grid-template-columns: 1fr; }
    .e4-hero .e4-advanced-clear, .e4-hero .e4-advanced-done { min-height: 44px; }
    .e4-hero .e4-advanced-neighborhood .e4-filter-combobox { width: 100%; }
    body:has(.e4-hero) .section-properties { padding-top: 48px; }
}
@media (max-width: 390px) {
    .e4-hero .e4-search-fields { grid-template-columns: minmax(0, 1fr); }
    .e4-hero .e4-search-top { flex-wrap: wrap; }
    .e4-hero .e4-search-tabs { flex: 1 1 100%; }
    .e4-hero .e4-search-advanced-link { margin-left: auto; }
}
body.e4-mobile-picker-open { overflow: hidden; }

/* Etapa 3.4.4-C: Busca Avancada vem antes dos campos convencionais,
   mas a finalidade permanece no topo e o envio no final do formulario. */
.e4-hero .e4-conventional-heading[hidden] { display: none !important; }
.e4-hero .e4-conventional-heading {
    display: flex; align-items: center; gap: 9px;
    margin: 15px 2px 9px; color: #173757; font-size: 12px; font-weight: 750;
}
.e4-hero .e4-conventional-heading::after {
    content: ''; flex: 1 1 auto; height: 1px; background: #dbe6f2;
}
.e4-hero .e4-search-fields { scroll-margin-top: 78px; }
.e4-hero .e4-advanced-panel { scroll-margin-top: 78px; }
.e4-hero .e4-advanced-panel:not([hidden]) { margin-bottom: 0; }
@media (max-width: 620px) {
    .e4-hero .e4-conventional-heading { margin: 16px 1px 11px; font-size: 13px; }
    .e4-hero .e4-search-fields, .e4-hero .e4-advanced-panel { scroll-margin-top: 72px; }
}

/* Catálogo de imóveis: a Home mantém o Hero fotográfico; nas buscas, o
   título compacto aproxima os filtros dos resultados sem alterar o formulário. */
.e4-hero.e4-hero--catalog {
    background: #fff;
    /* O menu e fixo; sem fotografia, o titulo deve comecar abaixo dele. */
    padding-top: 58px !important;
}
.e4-hero--catalog .e4-catalog-intro {
    width: min(calc(100% - clamp(32px, 9vw, 110px)), 1320px);
    padding: clamp(23px, 3.5vw, 42px) 0 15px;
}
.e4-hero--catalog .e4-catalog-intro .eyebrow {
    color: #0b63b6;
    font-size: 10px;
    letter-spacing: .14em;
}
.e4-hero--catalog .e4-catalog-intro h1 {
    max-width: none;
    margin: 7px 0 5px;
    color: #0b2340;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(26px, 3.1vw, 39px);
    font-weight: 750;
    line-height: 1.13;
    letter-spacing: -.025em;
}
.e4-hero--catalog .e4-catalog-intro p {
    margin: 0;
    color: #566c85;
    font-size: clamp(12px, 1.15vw, 14px);
    line-height: 1.45;
}
.e4-hero.e4-hero--catalog .e4-search {
    margin-top: 0;
    transform: none;
    /* Na listagem, o filtro mantém apenas o contorno, sem sombra. */
    box-shadow: none;
}
.e4-hero.e4-hero--catalog + .section-properties {
    padding-top: 30px;
}
@media (max-width: 1030px) {
    .e4-hero.e4-hero--catalog { padding-top: 64px !important; }
}
@media (max-width: 920px) {
    .e4-hero.e4-hero--catalog { padding-top: 70px !important; }
}
@media (max-width: 620px) {
    .e4-hero--catalog .e4-catalog-intro { padding: 21px 0 12px; }
    .e4-hero--catalog .e4-catalog-intro h1 { font-size: clamp(25px, 6vw, 32px); }
    .e4-hero.e4-hero--catalog + .section-properties { padding-top: 26px; }
}

/* Busca exclusiva por codigo: bloqueio visual sem alterar o campo codigo
   nem o botao Buscar imoveis. O JavaScript aplica disabled/inert aos controles. */
.e4-hero .e4-search-form.is-code-only .e4-search-tabs,
.e4-hero .e4-search-form.is-code-only .e4-search-advanced-link,
.e4-hero .e4-search-form.is-code-only .e4-search-fields > .e4-search-field:not(.e4-search-code),
.e4-hero .e4-search-form.is-code-only .e4-advanced-panel {
    opacity: .48;
    pointer-events: none;
}
.e4-hero .e4-search-form.is-code-only .e4-search-tab,
.e4-hero .e4-search-form.is-code-only .e4-search-tab.is-active {
    color: #63758a;
    background: #f3f6fa;
    border-color: #dbe4ef;
    box-shadow: none;
    cursor: not-allowed;
}
.e4-hero .e4-search-form.is-code-only .e4-search-field:not(.e4-search-code) {
    background: #f6f8fb;
}
.e4-hero .e4-search-form.is-code-only .e4-search-field:not(.e4-search-code) .e4-price-summary {
    cursor: not-allowed;
}
