/* ── Imóveis: listagem em cards horizontais ── */

body.mq-app .mq-imoveis-list {
    display: flex;
    flex-direction: column;
    gap: .65rem;
}

body.mq-app .mq-imovel-card {
    display: grid;
    grid-template-columns: 168px minmax(0, 1fr) auto auto;
    align-items: stretch;
    gap: 1rem 1.15rem;
    padding: .7rem .85rem;
    background: var(--mq-surface, #fff);
    border: 1px solid var(--mq-line, #e2e8f0);
    border-radius: 14px;
    transition: border-color .15s ease, box-shadow .15s ease;
}

body.mq-app .mq-imovel-card:hover {
    border-color: color-mix(in srgb, var(--mq-o, #e85d04) 35%, var(--mq-line, #e2e8f0));
    box-shadow: 0 4px 18px rgba(15, 23, 42, .05);
}

body.mq-app .mq-imovel-cover {
    position: relative;
    width: 168px;
    min-width: 168px;
    height: 118px;
    border-radius: 10px;
    overflow: hidden;
    flex-shrink: 0;
    background: var(--mq-surface-2, #f1f5f9);
    border: 1px solid var(--mq-line, #e2e8f0);
    display: flex;
    align-items: center;
    justify-content: center;
}

body.mq-app .mq-imovel-cover img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    object-fit: cover;
    object-position: center center;
    display: block;
    z-index: 1;
}

body.mq-app .mq-imovel-cover img.mq-imovel-cover-img,
body.mq-app .mq-imovel-cover-preview img.mq-imovel-cover-img {
    opacity: 0;
    transition: opacity .18s ease;
}

body.mq-app .mq-imovel-cover img.mq-imovel-cover-img.is-loaded,
body.mq-app .mq-imovel-cover-preview img.mq-imovel-cover-img.is-loaded {
    opacity: 1;
}

body.mq-app .mq-imovel-cover--empty {
    color: var(--mq-muted, #94a3b8);
}

body.mq-app .mq-imovel-cover:not(.mq-imovel-cover--empty) > i,
body.mq-app .mq-imovel-cover-preview:not(.mq-imovel-cover--empty) > i {
    visibility: hidden;
}

body.mq-app .mq-imovel-cover--empty img {
    opacity: 0;
}

body.mq-app .mq-imovel-cover--empty i {
    width: 28px;
    height: 28px;
    opacity: .7;
}

body.mq-app .mq-imovel-main {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: .28rem;
}

body.mq-app .mq-imovel-code {
    font-size: .95rem;
    font-weight: 800;
    letter-spacing: -.02em;
    color: var(--mq-text, #0f172a);
    line-height: 1.2;
}

body.mq-app .mq-imovel-addr {
    font-size: .84rem;
    color: var(--mq-text, #0f172a);
    line-height: 1.35;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

body.mq-app .mq-imovel-meta {
    display: flex;
    flex-wrap: wrap;
    gap: .2rem .85rem;
    font-size: .75rem;
    color: var(--mq-muted, #64748b);
}

body.mq-app .mq-imovel-meta b {
    font-weight: 600;
    color: var(--mq-text, #334155);
}

body.mq-app .mq-imovel-side {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: .35rem;
    flex-shrink: 0;
}

body.mq-app .mq-imovel-status {
    display: inline-flex;
    align-items: center;
    padding: .22rem .6rem;
    border-radius: 999px;
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .03em;
    text-transform: uppercase;
    line-height: 1.2;
    white-space: nowrap;
}

body.mq-app .mq-imovel-status--ocupado {
    background: #fff7ed;
    color: #c2410c;
}

body.mq-app .mq-imovel-status--disponivel {
    background: #f0fdf4;
    color: #166534;
}

body.mq-app .mq-imovel-status--manutencao {
    background: #fef9c3;
    color: #854d0e;
}

body.mq-app .mq-imovel-contracts {
    font-size: .7rem;
    color: var(--mq-muted, #64748b);
    white-space: nowrap;
}

body.mq-app .mq-imovel-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: .35rem;
    flex-shrink: 0;
}

body.mq-app .mq-imovel-actions .btn {
    padding: .35rem .55rem;
    font-size: .72rem;
    min-height: 34px;
}

body.mq-app .mq-imovel-actions .btn i {
    width: 14px;
    height: 14px;
}

body.mq-app .mq-imovel-actions .mq-imovel-btn-danger {
    color: #ef4444;
    border-color: #fee2e2;
    background: #fff1f2;
}

/* Campo foto de capa no formulário */
body.mq-app .mq-imovel-cover-field {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: .85rem;
}

body.mq-app .mq-imovel-cover-preview {
    position: relative;
    width: 160px;
    height: 116px;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--mq-line);
    background: var(--mq-surface-2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--mq-muted);
    flex-shrink: 0;
}

body.mq-app .mq-imovel-cover-preview img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    object-fit: cover;
    object-position: center center;
    display: block;
}

body.mq-app .mq-imovel-cover-preview i {
    width: 28px;
    height: 28px;
}

body.mq-app .mq-imovel-cover-controls {
    display: flex;
    flex-direction: column;
    gap: .45rem;
    min-width: 0;
    flex: 1;
}

body.mq-app .mq-imovel-cover-controls .mq-imovel-cover-hint {
    font-size: .75rem;
    color: var(--mq-muted);
    margin: 0;
}

body.mq-app .mq-imovel-cover-btns .visually-hidden-file {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

body.mq-app .mq-imovel-cover-btns label.btn {
    position: relative;
}

/* Modal de consulta */
body.mq-app .mq-imovel-view-overlay {
    position: fixed;
    inset: 0;
    z-index: 12000;
    background: rgba(15, 23, 42, .45);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
}

body.mq-app .mq-imovel-view-box {
    width: min(720px, 100%);
    max-height: min(90vh, 880px);
    overflow: auto;
    background: var(--mq-surface, #fff);
    border-radius: 16px;
    border: 1px solid var(--mq-line);
    box-shadow: 0 24px 64px rgba(15, 23, 42, .18);
}

body.mq-app .mq-imovel-view-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: .75rem;
    padding: 1rem 1.15rem;
    border-bottom: 1px solid var(--mq-line);
    position: sticky;
    top: 0;
    background: var(--mq-surface, #fff);
    z-index: 1;
}

body.mq-app .mq-imovel-view-head h2 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 800;
}

body.mq-app .mq-imovel-view-head p {
    margin: .2rem 0 0;
    font-size: .8rem;
    color: var(--mq-muted);
}

body.mq-app .mq-imovel-view-body {
    padding: 1rem 1.15rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

body.mq-app .mq-imovel-view-hero {
    display: grid;
    grid-template-columns: 200px minmax(0, 1fr);
    gap: 1rem;
    align-items: start;
}

body.mq-app .mq-imovel-view-hero .mq-imovel-cover {
    width: 200px;
    height: 145px;
}

body.mq-app .mq-imovel-view-section {
    padding-top: .15rem;
}

body.mq-app .mq-imovel-view-section h3 {
    margin: 0 0 .55rem;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--mq-muted);
}

body.mq-app .mq-imovel-view-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .55rem .85rem;
}

body.mq-app .mq-imovel-view-item {
    display: flex;
    flex-direction: column;
    gap: .12rem;
    min-width: 0;
}

body.mq-app .mq-imovel-view-item span {
    font-size: .68rem;
    font-weight: 600;
    color: var(--mq-muted);
    text-transform: uppercase;
    letter-spacing: .03em;
}

body.mq-app .mq-imovel-view-item strong {
    font-size: .88rem;
    font-weight: 600;
    color: var(--mq-text);
    word-break: break-word;
}

body.mq-app .mq-imovel-view-item--wide {
    grid-column: 1 / -1;
}

body.mq-app .mq-imovel-view-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
    gap: .5rem;
}

body.mq-app .mq-imovel-view-gallery a {
    display: block;
    height: 80px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--mq-line);
}

body.mq-app .mq-imovel-view-gallery img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

body.mq-app .mq-imovel-view-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .45rem;
    justify-content: flex-end;
    padding-top: .35rem;
    border-top: 1px solid var(--mq-line);
}

@media (max-width: 860px) {
    body.mq-app .mq-imovel-card {
        grid-template-columns: 120px minmax(0, 1fr);
        grid-template-areas:
            "cover main"
            "side side"
            "actions actions";
    }

    body.mq-app .mq-imovel-cover { grid-area: cover; width: 120px; min-width: 120px; height: 90px; }
    body.mq-app .mq-imovel-main { grid-area: main; }
    body.mq-app .mq-imovel-side {
        grid-area: side;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
    body.mq-app .mq-imovel-actions {
        grid-area: actions;
        justify-content: flex-start;
    }

    body.mq-app .mq-imovel-view-hero {
        grid-template-columns: 1fr;
    }

    body.mq-app .mq-imovel-view-hero .mq-imovel-cover {
        width: 100%;
        height: 160px;
    }

    body.mq-app .mq-imovel-view-grid {
        grid-template-columns: 1fr;
    }
}
