:root {
    --bg: #f4f6f8;
    --card: #fff;
    --text: #20242b;
    --muted: #747c89;
    --line: #e3e7ed;
    --blue: #1769ff;
    --blue-soft: #eaf1ff;
    --red: #f24b43;
    --dark: #27292d;
    --shadow: 0 8px 30px rgba(25, 37, 61, .08);
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    color: var(--text);
    background: var(--bg)
}

* {
    box-sizing: border-box
}

body {
    margin: 0;
    background: var(--bg);
    font-size: 15px
}

a {
    color: var(--blue);
    text-decoration: none
}

button, input, select, textarea {
    font: inherit
}

.container {
    width: min(1240px, calc(100% - 32px));
    margin: 0 auto
}

.topbar {
    height: 64px;
    background: #2e3034;
    color: white;
    display: flex;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 50
}

.topbar-inner {
    display: flex;
    align-items: center;
    gap: 36px
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #fff;
    font-size: 20px;
    font-weight: 800
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: linear-gradient(135deg, #4284ff, #1557da);
    font-size: 12px
}

.main-nav {
    display: flex;
    gap: 26px;
    flex: 1
}

.main-nav a, .top-actions > a, .top-actions .link-btn {
    color: #fff;
    opacity: .92
}

.main-nav a:hover, .top-actions > a:hover {
    opacity: 1
}

.top-actions {
    display: flex;
    align-items: center;
    gap: 16px
}

.top-actions form {
    margin: 0
}

.link-btn {
    background: none;
    border: 0;
    cursor: pointer;
    padding: 0
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    border-radius: 8px;
    min-height: 42px;
    padding: 0 18px;
    font-weight: 650;
    cursor: pointer;
    text-decoration: none
}

.btn-sm {
    min-height: 34px;
    padding: 0 12px;
    font-size: 13px
}

.btn-lg {
    min-height: 50px;
    padding: 0 26px
}

.btn-block {
    display: flex;
    width: 100%;
    margin-top: 10px
}

.btn-primary {
    background: var(--blue);
    color: #fff
}

.btn-danger {
    background: var(--red);
    color: #fff
}

.btn-light {
    background: #fff;
    color: #2c5ea9;
    border-color: #d8dee8
}

.flash {
    margin-top: 14px;
    border-radius: 10px;
    padding: 12px 16px
}

.flash-success {
    background: #eaf8ef;
    border: 1px solid #c9ead4;
    color: #23733e
}

.flash-error {
    background: #fff0ef;
    border: 1px solid #ffd2cf;
    color: #a92b25
}

.flash ul {
    margin: 6px 0 0
}

.hero {
    padding: 28px 0 14px;
    background: linear-gradient(#eef2f7, #f4f6f8)
}

.search-panel {
    background: #fff;
    border-radius: 16px;
    padding: 24px;
    box-shadow: var(--shadow)
}

.operation-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 16px
}

.operation-tabs button {
    border: 0;
    background: #f4f6f9;
    border-radius: 9px;
    padding: 13px 34px;
    cursor: pointer
}

.operation-tabs button.active {
    background: #dce8ff;
    color: #095cea;
    font-weight: 700
}

.hero-form {
    display: grid;
    grid-template-columns:1.1fr .7fr 1.4fr auto;
    gap: 10px
}

.field {
    display: flex;
    flex-direction: column;
    gap: 6px
}

.field span {
    font-size: 12px;
    color: var(--muted);
    font-weight: 600
}

.field input, .field select, .toolbar-form input, .toolbar-form select, .extra-filters input, .extra-filters select, .auth-card input, .listing-form input, .listing-form select, .listing-form textarea, .admin-content input, .admin-content select, .admin-content textarea {
    width: 100%;
    border: 1px solid #cfd5df;
    border-radius: 8px;
    min-height: 46px;
    padding: 0 13px;
    background: #fff;
    outline: none
}

.field input:focus, .field select:focus, input:focus, select:focus, textarea:focus {
    border-color: #76a4ff;
    box-shadow: 0 0 0 3px rgba(23, 105, 255, .08)
}

textarea {
    padding: 12px !important;
    resize: vertical
}

.hero-submit {
    align-self: end;
    height: 46px
}

.category-strip {
    display: grid;
    grid-template-columns:repeat(5, 1fr);
    gap: 10px;
    margin-top: 22px
}

.category-tile {
    min-height: 150px;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 16px;
    color: var(--text);
    background: linear-gradient(145deg, #fff, #f7f9fc);
    position: relative;
    overflow: hidden
}

.category-tile:hover {
    border-color: #a8c4ff;
    transform: translateY(-1px)
}

.category-tile-copy {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    width: 58%
}

.category-tile-copy > span {
    font-weight: 750;
    line-height: 1.3
}

.category-tile-image {
    position: absolute;
    z-index: 1;
    right: -4px;
    bottom: -4px;
    width: 62%;
    height: 88%;
    object-fit: contain;
    object-position: right bottom;
    pointer-events: none;
    transition: transform .2s ease
}

.category-tile:hover .category-tile-image {
    transform: translate(-2px, -2px) scale(1.025)
}

.category-tile-copy small {
    color: var(--muted);
    margin-top: 5px
}

.category-admin-image {
    display: flex;
    align-items: center;
    gap: 12px
}

.category-admin-image img {
    width: 120px;
    height: 80px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: #f3f5f8;
    object-fit: contain
}

.category-admin-image .check {
    margin: 0
}

.section {
    padding: 34px 0
}

.section-soft {
    background: #edf1f5
}

.section-head, .page-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 20px
}

.section-head h2, .page-head h1 {
    margin: 0
}

.section-head p, .page-head p {
    margin: 5px 0 0
}

.listing-grid {
    display: grid;
    grid-template-columns:repeat(4, 1fr);
    gap: 16px
}

.listing-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
    overflow: hidden;
    transition: .18s
}

.listing-card:hover {
    box-shadow: var(--shadow);
    transform: translateY(-2px)
}

.listing-photo-wrap {
    display: block;
    position: relative;
    height: 190px;
    background: #e6ebf1
}

.listing-photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block
}

.photo-count, .operation-badge {
    position: absolute;
    top: 10px;
    background: rgba(28, 32, 38, .75);
    color: #fff;
    border-radius: 6px;
    padding: 5px 8px;
    font-size: 12px
}

.photo-count {
    right: 10px
}

.operation-badge {
    left: 10px;
    background: #2f7af4
}

.listing-body {
    padding: 14px
}

.listing-price {
    font-size: 21px;
    font-weight: 800;
    margin-bottom: 8px
}

.listing-price small, .detail-price small {
    font-size: 13px;
    color: var(--muted);
    font-weight: 500
}

.listing-title {
    display: block;
    color: var(--text);
    font-weight: 700;
    line-height: 1.35;
    margin-bottom: 8px
}

.listing-meta {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 13px
}

.listing-meta span {
    background: #f1f4f7;
    border-radius: 6px;
    padding: 5px 7px
}

.listing-address {
    font-size: 13px;
    color: var(--muted);
    margin-top: 10px
}

.info-grid {
    display: grid;
    grid-template-columns:repeat(3, 1fr);
    gap: 16px
}

.info-card {
    background: #fff;
    border-radius: 13px;
    padding: 22px;
    border: 1px solid var(--line)
}

.info-card b {
    font-size: 19px
}

.info-card p {
    color: var(--muted);
    line-height: 1.55
}

.footer {
    background: #22252a;
    color: #fff;
    padding: 30px 0;
    margin-top: 40px
}

.footer-row {
    display: flex;
    justify-content: space-between
}

.muted {
    color: var(--muted)
}

.footer .muted {
    color: #9ca4b0
}

.catalog-toolbar {
    background: #fff;
    border-bottom: 1px solid var(--line);
    padding: 12px 0;
    position: sticky;
    top: 64px;
    z-index: 40
}

.toolbar-form {
    display: grid;
    grid-template-columns:170px 240px 120px 120px 1fr auto;
    gap: 8px
}

.toolbar-form input, .toolbar-form select {
    min-height: 40px
}

.catalog-layout {
    display: grid;
    grid-template-columns:minmax(720px, 56%) 1fr;
    min-height: calc(100vh - 118px)
}

.catalog-results {
    padding: 24px 18px 50px 28px;
    min-width: 0
}

.catalog-map {
    position: sticky;
    top: 117px;
    height: calc(100vh - 117px);
    background: #dce7d5
}

.catalog-map #map {
    height: 100%;
    width: 100%
}

.catalog-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 18px
}

.catalog-heading h1 {
    font-size: 25px;
    margin: 9px 0
}

.catalog-heading select {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 9px
}

.breadcrumbs {
    color: #9097a1;
    font-size: 12px;
    margin-bottom: 8px
}

.breadcrumbs a {
    color: #667283
}

.extra-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: 8px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 16px
}

.extra-filters label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 12px;
    color: var(--muted);
    min-width: 100px
}

.extra-filters input, .extra-filters select {
    min-height: 38px
}

.filter-reset {
    padding: 10px
}

.catalog-grid {
    display: grid;
    grid-template-columns:repeat(3, 1fr);
    gap: 14px
}

.catalog-grid .listing-photo-wrap {
    height: 185px
}

.empty-state {
    background: #fff;
    border: 1px dashed #cfd6df;
    border-radius: 14px;
    padding: 48px;
    text-align: center
}

.empty-inline {
    padding: 16px;
    border: 1px dashed #cfd6df;
    border-radius: 9px;
    color: var(--muted)
}

.detail-page {
    padding-top: 22px
}

.detail-layout {
    display: grid;
    grid-template-columns:minmax(0, 1fr) 340px;
    gap: 24px
}

.gallery {
    height: 520px;
    display: grid;
    grid-template-columns:2fr 1fr;
    grid-template-rows:1fr 1fr;
    gap: 6px;
    border-radius: 14px;
    overflow: hidden;
    background: #e5e9ee
}

.gallery img {
    width: 100%;
    height: 100%;
    object-fit: cover
}

.gallery img:first-child {
    grid-row: 1/3
}

.gallery-single {
    display: block
}

.detail-title-row {
    display: flex;
    justify-content: space-between;
    gap: 24px;
    margin: 26px 0 18px
}

.detail-title-row h1 {
    margin: 8px 0 9px;
    font-size: 29px
}

.operation-pill {
    display: inline-block;
    background: var(--blue-soft);
    color: var(--blue);
    border-radius: 7px;
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 700
}

.detail-address {
    color: var(--muted)
}

.detail-price {
    font-size: 28px;
    font-weight: 850;
    white-space: nowrap
}

.facts-row {
    display: flex;
    gap: 10px;
    margin-bottom: 18px
}

.facts-row > div {
    min-width: 140px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 14px
}

.facts-row b, .facts-row span {
    display: block
}

.facts-row span {
    font-size: 12px;
    color: var(--muted);
    margin-top: 4px
}

.detail-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 22px;
    margin-bottom: 16px
}

.detail-card h2 {
    margin-top: 0
}

.description-text {
    line-height: 1.7;
    color: #39404a
}

.spec-grid {
    display: grid;
    grid-template-columns:repeat(2, 1fr);
    gap: 0 28px
}

.spec-grid > div {
    display: flex;
    justify-content: space-between;
    border-bottom: 1px solid #edf0f4;
    padding: 11px 0
}

.spec-grid span {
    color: var(--muted)
}

.contact-card {
    position: sticky;
    top: 90px;
    align-self: start;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 20px;
    box-shadow: var(--shadow)
}

.contact-price {
    font-size: 28px;
    font-weight: 850
}

.seller {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 0
}

.seller span {
    display: block;
    color: var(--muted);
    font-size: 12px;
    margin-top: 4px
}

.avatar {
    width: 46px;
    height: 46px;
    background: #dfe9ff;
    color: #1858ca;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-weight: 800;
    font-size: 20px
}

.safety-note {
    background: #f5f7fa;
    border-radius: 10px;
    padding: 14px;
    margin-top: 16px
}

.safety-note p {
    margin: 5px 0 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.5
}

.auth-wrap {
    min-height: 70vh;
    display: grid;
    place-items: center;
    padding: 50px 16px
}

.auth-card {
    width: min(430px, 100%);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 15px;
    padding: 28px;
    box-shadow: var(--shadow)
}

.auth-card h1 {
    margin-top: 0
}

.auth-card label, .listing-form label, .admin-content label {
    display: flex;
    flex-direction: column;
    gap: 7px;
    margin-bottom: 14px;
    font-weight: 600
}

.auth-card .check, .listing-form .check, .admin-content .check {
    flex-direction: row;
    align-items: center
}

.check input, .mini-check input, .switch-line input {
    width: auto !important;
    min-height: auto !important
}

.auth-bottom {
    text-align: center;
    margin-bottom: 0
}

.dashboard-page, .form-page {
    padding-top: 30px
}

.dashboard-list {
    display: grid;
    gap: 10px
}

.dashboard-item {
    display: grid;
    grid-template-columns:140px 1fr auto;
    gap: 16px;
    align-items: center;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 10px
}

.dashboard-item img {
    width: 140px;
    height: 92px;
    object-fit: cover;
    border-radius: 8px
}

.dashboard-info {
    display: flex;
    flex-direction: column;
    gap: 5px
}

.dashboard-info > b {
    font-size: 17px
}

.dashboard-info > span {
    color: var(--muted)
}

.dashboard-actions {
    display: flex;
    align-items: center;
    gap: 10px
}

.link-danger {
    background: none;
    border: 0;
    color: #d13d36;
    cursor: pointer
}

.status {
    display: inline-flex;
    width: max-content;
    border-radius: 6px;
    padding: 4px 7px;
    font-size: 11px;
    font-weight: 700
}

.status-pending {
    background: #fff3d5;
    color: #8b6400
}

.status-published {
    background: #ddf5e5;
    color: #24713b
}

.status-rejected {
    background: #ffe4e1;
    color: #a4352f
}

.status-draft {
    background: #edf0f4;
    color: #5e6671
}

.reject-box {
    background: #fff0ef;
    color: #a4352f;
    border-radius: 7px;
    padding: 8px;
    font-size: 12px
}

.listing-form {
    display: grid;
    gap: 14px
}

.form-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 13px;
    padding: 22px
}

.form-card h2 {
    font-size: 19px;
    margin-top: 0
}

.form-grid {
    display: grid;
    grid-template-columns:repeat(3, 1fr);
    gap: 14px
}

.span-2 {
    grid-column: span 2
}

.dynamic-fields {
    display: none
}

.field-hint {
    font-size: 12px;
    color: var(--muted);
    margin: 0
}

.switch-line {
    min-height: 46px;
    display: flex;
    align-items: center;
    gap: 8px
}

.photo-manage {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 12px
}

.photo-manage > div {
    position: relative
}

.photo-manage img {
    width: 130px;
    height: 90px;
    object-fit: cover;
    border-radius: 8px
}

.photo-delete {
    position: absolute;
    right: 5px;
    top: 5px;
    border: 0;
    background: rgba(0, 0, 0, .65);
    color: #fff;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    cursor: pointer
}

.form-submit {
    display: flex;
    justify-content: flex-end
}

.admin-layout {
    display: grid;
    grid-template-columns:220px 1fr;
    gap: 24px;
    padding-top: 28px
}

.admin-sidebar {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 10px;
    height: max-content;
    position: sticky;
    top: 90px
}

.admin-title {
    padding: 10px;
    font-weight: 800
}

.admin-sidebar a {
    display: block;
    padding: 10px;
    border-radius: 8px;
    color: #424a55
}

.admin-sidebar a.active {
    background: var(--blue-soft);
    color: var(--blue);
    font-weight: 700
}

.admin-content {
    min-width: 0
}

.stats-grid {
    display: grid;
    grid-template-columns:repeat(5, 1fr);
    gap: 10px;
    margin-bottom: 18px
}

.stats-grid > div {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 16px
}

.stats-grid span, .stats-grid b {
    display: block
}

.stats-grid span {
    color: var(--muted);
    font-size: 12px
}

.stats-grid b {
    font-size: 28px;
    margin-top: 8px
}

.admin-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 18px;
    margin-bottom: 16px
}

.admin-card-head {
    display: flex;
    justify-content: space-between;
    align-items: center
}

.admin-card-head h2 {
    margin: 0
}

.moderation-row {
    display: grid;
    grid-template-columns:70px 1fr auto auto;
    gap: 12px;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #edf0f4
}

.moderation-row:last-child {
    border-bottom: 0
}

.moderation-row img {
    width: 70px;
    height: 54px;
    object-fit: cover;
    border-radius: 7px
}

.moderation-row > div {
    display: flex;
    flex-direction: column;
    gap: 4px
}

.moderation-row span {
    color: var(--muted);
    font-size: 12px
}

.moderation-row-full {
    grid-template-columns:70px 1fr auto auto minmax(230px, auto)
}

.reject-form {
    display: flex;
    gap: 6px
}

.reject-form input {
    min-height: 34px !important
}

.reject-text {
    color: #b23a34
}

.table-wrap {
    overflow: auto
}

table {
    width: 100%;
    border-collapse: collapse
}

th, td {
    text-align: left;
    padding: 12px;
    border-bottom: 1px solid #edf0f4
}

th {
    font-size: 12px;
    color: var(--muted)
}

td small {
    display: block;
    color: var(--muted);
    margin-top: 3px
}

.field-list {
    display: grid;
    gap: 8px
}

.field-row {
    display: grid;
    grid-template-columns:1.1fr 1fr 110px 80px 1.3fr 70px 75px 75px auto auto;
    gap: 6px;
    align-items: center;
    padding: 8px;
    background: #f7f9fb;
    border-radius: 8px
}

.field-row input, .field-row select {
    min-height: 36px !important;
    padding: 0 8px !important
}

.mini-check {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 4px !important;
    font-size: 11px !important;
    margin: 0 !important
}

.field-row .btn, .field-row .link-danger {
    white-space: nowrap
}

.pagination {
    margin-top: 20px
}

.pagination .relative.inline-flex {
    display: inline-flex;
    gap: 8px
}

.pagination a, .pagination span {
    display: inline-flex;
    padding: 8px 12px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 7px;
    color: var(--text)
}

@media (max-width: 1100px) {
    .main-nav {
        display: none
    }

    .category-strip {
        grid-template-columns:repeat(3, 1fr)
    }

    .listing-grid {
        grid-template-columns:repeat(3, 1fr)
    }

    .catalog-layout {
        grid-template-columns:1fr
    }

    .catalog-map {
        display: none
    }

    .catalog-grid {
        grid-template-columns:repeat(3, 1fr)
    }

    .toolbar-form {
        grid-template-columns:repeat(3, 1fr)
    }

    .toolbar-search {
        grid-column: span 2
    }

    .detail-layout {
        grid-template-columns:1fr
    }

    .contact-card {
        position: static
    }

    .stats-grid {
        grid-template-columns:repeat(3, 1fr)
    }

    .field-row {
        grid-template-columns:repeat(4, 1fr)
    }
}

@media (max-width: 760px) {
    .container {
        width: min(100% - 20px, 1240px)
    }

    .topbar {
        height: auto;
        min-height: 60px
    }

    .topbar-inner {
        gap: 10px
    }

    .top-actions > a:not(.btn), .top-actions form, .top-actions .icon-link {
        display: none
    }

    .brand {
        margin-right: auto
    }

    .hero {
        padding-top: 12px
    }

    .search-panel {
        padding: 14px
    }

    .hero-form {
        grid-template-columns:1fr
    }

    .field-wide {
        grid-column: auto
    }

    .category-strip {
        grid-template-columns:repeat(2, 1fr)
    }

    .category-tile {
        min-height: 125px
    }

    .listing-grid, .catalog-grid {
        grid-template-columns:1fr
    }

    .info-grid {
        grid-template-columns:1fr
    }

    .toolbar-form {
        grid-template-columns:1fr 1fr
    }

    .toolbar-search {
        grid-column: 1/3
    }

    .catalog-toolbar {
        top: 60px
    }

    .catalog-results {
        padding: 18px 10px
    }

    .catalog-heading {
        align-items: flex-start;
        flex-direction: column
    }

    .gallery {
        height: 340px
    }

    .detail-title-row {
        flex-direction: column
    }

    .facts-row {
        overflow: auto
    }

    .spec-grid {
        grid-template-columns:1fr
    }

    .dashboard-item {
        grid-template-columns:90px 1fr
    }

    .dashboard-item img {
        width: 90px;
        height: 80px
    }

    .dashboard-actions {
        grid-column: 1/3;
        justify-content: flex-end;
        flex-wrap: wrap
    }

    .form-grid {
        grid-template-columns:1fr
    }

    .span-2 {
        grid-column: auto
    }

    .admin-layout {
        grid-template-columns:1fr
    }

    .admin-sidebar {
        position: static;
        display: flex;
        overflow: auto
    }

    .admin-sidebar .admin-title {
        display: none
    }

    .stats-grid {
        grid-template-columns:1fr 1fr
    }

    .moderation-row, .moderation-row-full {
        grid-template-columns:60px 1fr
    }

    .moderation-row > *:nth-child(n+3) {
        grid-column: 2
    }

    .field-row {
        grid-template-columns:1fr 1fr
    }

    .field-row > * {
        min-width: 0
    }

    .page-head {
        align-items: flex-start;
        flex-direction: column
    }

    .section {
        padding: 24px 0
    }
}

.listing-price-per-meter {
    color: var(--muted);
    font-size: 13px;
    margin: -4px 0 9px
}

.listing-price-per-meter span {
    font-size: 12px
}

.detail-price-wrap {
    text-align: right
}

.detail-price-per-meter, .contact-price-per-meter {
    color: var(--muted);
    font-size: 13px;
    margin-top: 4px
}

.contact-price-per-meter {
    margin: 2px 0 6px
}

.price-history-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px
}

.price-history-head h2 {
    margin-bottom: 0
}

.price-history-head > span {
    color: var(--muted);
    font-size: 13px
}

.price-history-list {
    margin-top: 18px
}

.price-history-row {
    display: grid;
    grid-template-columns:14px 90px minmax(140px, auto) minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    min-height: 42px;
    position: relative
}

.price-history-row:not(:last-child)::before {
    content: "";
    position: absolute;
    left: 6px;
    top: 28px;
    bottom: -14px;
    width: 2px;
    background: #e4e9f0
}

.price-history-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #fff;
    border: 4px solid var(--blue);
    z-index: 1
}

.price-history-row time {
    color: var(--muted);
    font-size: 13px
}

.price-history-row b {
    font-size: 16px
}

.price-change {
    font-size: 12px;
    font-weight: 700
}

.price-down {
    color: #198754
}

.price-up {
    color: #d24a43
}

.price-current {
    background: var(--blue-soft);
    color: var(--blue);
    border-radius: 6px;
    padding: 4px 7px;
    font-size: 11px;
    font-weight: 700
}

.price-history-row:last-child .price-history-dot {
    border-color: #aab2bd
}

@media (max-width: 760px) {
    .detail-price-wrap {
        text-align: left
    }

    .price-history-row {
        grid-template-columns:14px 76px 1fr auto;
        gap: 8px
    }

    .price-history-row .price-change {
        grid-column: 3
    }

    .price-current {
        grid-column: 4;
        grid-row: 1
    }

    .price-history-head {
        align-items: flex-start
    }
}

.chat-nav-link {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 4px
}

.nav-count {
    display: inline-grid;
    place-items: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: var(--red);
    color: #fff;
    font-size: 10px
}

.chats-page {
    padding-top: 28px
}

.chat-page-head {
    margin-bottom: 16px
}

.chat-layout {
    display: grid;
    grid-template-columns:340px minmax(0, 1fr);
    height: min(700px, calc(100vh - 170px));
    min-height: 520px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: var(--shadow)
}

.conversation-panel {
    min-width: 0;
    border-right: 1px solid var(--line);
    display: flex;
    flex-direction: column
}

.conversation-panel-title {
    padding: 17px 18px;
    font-weight: 800;
    border-bottom: 1px solid var(--line)
}

.conversation-list {
    overflow-y: auto
}

.conversation-item {
    display: grid;
    grid-template-columns:56px minmax(0, 1fr);
    gap: 11px;
    padding: 13px;
    border-bottom: 1px solid #edf0f4;
    color: var(--text)
}

.conversation-item:hover, .conversation-item.active {
    background: #f1f6ff
}

.conversation-item.active {
    box-shadow: inset 3px 0 var(--blue)
}

.conversation-item > img {
    width: 56px;
    height: 56px;
    border-radius: 9px;
    object-fit: cover;
    background: #e6ebf1
}

.conversation-summary {
    min-width: 0
}

.conversation-name, .conversation-preview {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px
}

.conversation-name time {
    color: var(--muted);
    font-size: 11px
}

.conversation-listing, .conversation-preview span {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap
}

.conversation-listing {
    font-size: 12px;
    color: #617083;
    margin: 4px 0 6px
}

.conversation-preview {
    font-size: 12px;
    color: var(--muted)
}

.conversation-preview b {
    flex: none;
    display: grid;
    place-items: center;
    min-width: 19px;
    height: 19px;
    padding: 0 5px;
    border-radius: 10px;
    background: var(--blue);
    color: #fff;
    font-size: 10px
}

.conversation-empty {
    padding: 30px 20px;
    color: var(--muted);
    line-height: 1.55;
    text-align: center
}

.chat-panel {
    min-width: 0;
    display: flex;
    flex-direction: column;
    background: #f5f7fa
}

.chat-header {
    display: flex;
    align-items: center;
    gap: 11px;
    min-height: 72px;
    padding: 10px 18px;
    background: #fff;
    border-bottom: 1px solid var(--line)
}

.chat-header b, .chat-header a, .chat-listing-deleted {
    display: block
}

.chat-header a, .chat-listing-deleted {
    max-width: min(580px, 60vw);
    margin-top: 3px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 12px
}

.chat-listing-deleted {
    color: var(--muted)
}

.chat-avatar {
    width: 43px;
    height: 43px;
    font-size: 17px;
    flex: none
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 22px;
    scroll-behavior: smooth
}

.chat-message {
    display: flex;
    margin-bottom: 10px
}

.chat-message-own {
    justify-content: flex-end
}

.chat-bubble {
    max-width: min(72%, 620px);
    padding: 10px 12px 7px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 5px 14px 14px 14px;
    box-shadow: 0 2px 8px rgba(25, 37, 61, .04)
}

.chat-message-own .chat-bubble {
    background: #dce9ff;
    border-color: #c9dcff;
    border-radius: 14px 5px 14px 14px
}

.chat-message-text {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    line-height: 1.45
}

.chat-message-meta {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 5px;
    color: #7d8794;
    font-size: 10px
}

.chat-start-hint {
    margin: auto;
    width: max-content;
    max-width: 100%;
    padding: 9px 13px;
    border-radius: 15px;
    background: #e8ebef;
    color: var(--muted);
    font-size: 12px
}

.chat-composer {
    display: flex;
    align-items: end;
    gap: 10px;
    padding: 13px;
    background: #fff;
    border-top: 1px solid var(--line)
}

.chat-composer textarea {
    flex: 1;
    min-height: 48px;
    max-height: 130px;
    border: 1px solid #cfd5df;
    border-radius: 10px;
    outline: none
}

.chat-placeholder {
    margin: auto;
    text-align: center;
    color: var(--muted)
}

.chat-placeholder > span {
    font-size: 54px
}

.chat-placeholder h2 {
    margin: 12px 0 5px;
    color: var(--text)
}

.chat-placeholder p {
    margin: 0
}

.chat-panel:has(.chat-start-hint) .chat-messages {
    display: flex;
    flex-direction: column
}

@media (max-width: 760px) {
    .top-actions > a.chat-nav-link {
        display: inline-flex
    }

    .chat-nav-link > span {
        display: none
    }

    .chats-page {
        width: 100%;
        padding: 0
    }

    .chat-page-head {
        display: none
    }

    .chat-layout {
        display: block;
        height: calc(100vh - 60px);
        min-height: 480px;
        border: 0;
        border-radius: 0
    }

    .conversation-panel {
        height: 100%;
        border: 0
    }

    .chat-panel {
        height: 100%
    }

    .chat-layout:has(.chat-panel .chat-header) .conversation-panel {
        display: none
    }

    .chat-layout:not(:has(.chat-panel .chat-header)) .chat-panel {
        display: none
    }

    .chat-header {
        min-height: 64px;
        padding: 8px 12px
    }

    .chat-header a {
        max-width: 70vw
    }

    .chat-messages {
        padding: 14px 10px
    }

    .chat-bubble {
        max-width: 88%
    }

    .chat-composer {
        padding: 9px
    }

    .chat-composer .btn {
        padding: 0 12px
    }

    .conversation-panel-title {
        padding: 15px
    }
}

.chat-back {
    display: none !important
}

@media (max-width: 760px) {
    .chat-back {
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        width: 34px;
        height: 40px;
        color: var(--text);
        font-size: 32px;
        line-height: 1;
        flex: none
    }
}

.status-approved {
    background: #ddf5e5;
    color: #24713b
}

.dashboard-head-actions, .admin-head-actions {
    display: flex;
    align-items: center;
    gap: 10px
}

.agency-page {
    padding-top: 30px
}

.agency-empty, .agency-review-card {
    max-width: 720px;
    margin: 40px auto;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 48px;
    text-align: center;
    box-shadow: var(--shadow)
}

.agency-empty > span, .agency-review-icon {
    font-size: 54px
}

.agency-empty p, .agency-review-card p {
    color: var(--muted);
    line-height: 1.6
}

.agency-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 26px 30px;
    border-radius: 16px;
    background: linear-gradient(135deg, #253f72, #1769ff);
    color: #fff
}

.agency-hero h1 {
    margin: 5px 0
}

.agency-hero p {
    margin: 0;
    color: #dce8ff
}

.agency-eyebrow {
    text-transform: uppercase;
    letter-spacing: .09em;
    font-size: 11px;
    color: #bcd1ff
}

.agency-stats {
    display: grid;
    grid-template-columns:repeat(4, 1fr);
    gap: 12px;
    margin: 16px 0
}

.agency-stats > div, .agency-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px
}

.agency-stats > div {
    padding: 17px
}

.agency-stats span, .agency-stats b {
    display: block
}

.agency-stats span {
    font-size: 12px;
    color: var(--muted)
}

.agency-stats b {
    font-size: 26px;
    margin-top: 6px
}

.agency-stats .agency-role-text {
    font-size: 18px
}

.agency-columns {
    display: grid;
    grid-template-columns:1fr 1.2fr;
    gap: 16px
}

.agency-card {
    padding: 20px
}

.agency-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 16px
}

.agency-card-head h2, .agency-card-head p {
    margin: 0
}

.agency-card-head p {
    margin-top: 4px
}

.agency-info-grid {
    display: grid;
    grid-template-columns:1fr 1fr;
    gap: 14px
}

.agency-info-grid span, .agency-info-grid b {
    display: block
}

.agency-info-grid span {
    font-size: 11px;
    color: var(--muted);
    margin-bottom: 3px
}

.agency-description {
    padding-top: 15px;
    border-top: 1px solid var(--line);
    line-height: 1.6;
    color: #46505d
}

.agency-member-form {
    display: grid;
    grid-template-columns:1fr 120px auto;
    gap: 7px;
    margin-bottom: 14px
}

.agency-member-form input, .agency-member-form select {
    min-height: 38px;
    border: 1px solid #cfd5df;
    border-radius: 8px;
    padding: 0 10px;
    min-width: 0
}

.agency-member-list {
    display: grid;
    gap: 7px
}

.agency-member-row {
    display: grid;
    grid-template-columns:42px minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 10px;
    padding: 8px;
    background: #f7f9fb;
    border-radius: 9px
}

.agency-member-row .avatar {
    width: 42px;
    height: 42px;
    font-size: 16px
}

.agency-member-row span {
    display: block;
    color: var(--muted);
    font-size: 11px;
    margin-top: 3px
}

.agency-role {
    border-radius: 6px;
    padding: 5px 7px !important;
    font-weight: 700
}

.agency-role-owner {
    background: #ede5ff;
    color: #6840a9 !important
}

.agency-role-manager {
    background: #e5efff;
    color: #235fac !important
}

.agency-role-agent {
    background: #edf0f4;
    color: #5e6671 !important
}

.agency-listings-card {
    margin-top: 16px
}

.agency-listing-banner {
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 15px 18px;
    border: 1px solid #bcd1ff;
    border-radius: 11px;
    background: var(--blue-soft)
}

.agency-listing-banner > span {
    font-size: 30px
}

.agency-listing-banner p {
    margin: 4px 0 0;
    color: var(--muted)
}

.agency-contact-details {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 12px;
    margin: -8px 0 14px;
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
    color: var(--muted);
    font-size: 12px
}

.agency-admin-list {
    padding-top: 8px
}

.agency-admin-item {
    display: grid;
    grid-template-columns:minmax(280px, 1fr) 220px minmax(260px, auto);
    gap: 18px;
    align-items: center;
    padding: 16px 0;
    border-bottom: 1px solid var(--line)
}

.agency-admin-item:last-child {
    border-bottom: 0
}

.agency-admin-item h3 {
    margin: 7px 0 3px
}

.agency-admin-item p {
    margin: 0 0 5px;
    color: var(--muted)
}

.agency-admin-details {
    display: flex;
    flex-direction: column;
    gap: 5px;
    color: var(--muted);
    font-size: 12px
}

.agency-admin-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px
}

.agency-admin-actions .reject-form {
    min-width: 260px
}

@media (max-width: 900px) {
    .agency-columns {
        grid-template-columns:1fr
    }

    .agency-admin-item {
        grid-template-columns:1fr
    }

    .agency-admin-actions {
        justify-content: flex-start
    }
}

@media (max-width: 760px) {
    .dashboard-head-actions, .admin-head-actions {
        width: 100%;
        flex-wrap: wrap
    }

    .agency-page {
        padding-top: 14px
    }

    .agency-empty, .agency-review-card {
        margin: 15px auto;
        padding: 28px 18px
    }

    .agency-hero {
        align-items: flex-start;
        flex-direction: column;
        padding: 22px
    }

    .agency-stats {
        grid-template-columns:1fr 1fr
    }

    .agency-columns {
        grid-template-columns:1fr
    }

    .agency-card {
        padding: 14px
    }

    .agency-info-grid {
        grid-template-columns:1fr
    }

    .agency-member-form {
        grid-template-columns:1fr 105px
    }

    .agency-member-form .btn {
        grid-column: 1/3
    }

    .agency-member-row {
        grid-template-columns:38px 1fr auto
    }

    .agency-member-row form {
        grid-column: 2/4
    }

    .agency-admin-actions .reject-form {
        min-width: 0;
        flex-wrap: wrap
    }
}

@media (min-width: 1101px) {
    .stats-grid {
        grid-template-columns:repeat(6, 1fr)
    }
}

.listing-gallery-item {
    display: block;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    cursor: zoom-in
}

.gallery > .listing-gallery-item:first-child {
    grid-row: 1/3
}

.gallery-single .listing-gallery-item {
    width: 100%;
    height: 100%
}

.listing-gallery-hidden {
    display: none !important
}

.chat-lightbox {
    position: fixed;
    z-index: 1000;
    inset: 0;
    display: grid;
    grid-template-columns:72px minmax(0, 1fr) 72px;
    align-items: center;
    background: rgba(10, 14, 20, .92);
    padding: 28px
}

.chat-lightbox[hidden] {
    display: none
}

.chat-lightbox-stage {
    min-width: 0;
    height: calc(100vh - 56px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px
}

.chat-lightbox-image {
    display: block;
    max-width: 100%;
    max-height: calc(100% - 30px);
    object-fit: contain;
    border-radius: 6px
}

.chat-lightbox-caption {
    color: #fff;
    font-size: 13px
}

.chat-lightbox-button {
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    border: 1px solid rgba(255, 255, 255, .35);
    border-radius: 50%;
    background: rgba(0, 0, 0, .25);
    color: #fff;
    cursor: pointer
}

.chat-lightbox-button:hover {
    background: rgba(255, 255, 255, .16)
}

.chat-lightbox-close {
    position: absolute;
    right: 22px;
    top: 18px
}

.chat-lightbox-next {
    justify-self: end
}

.chat-lightbox-single .chat-lightbox-prev, .chat-lightbox-single .chat-lightbox-next {
    visibility: hidden
}

body.chat-lightbox-open {
    overflow: hidden
}

@media (max-width: 760px) {
    .chat-lightbox {
        grid-template-columns:44px minmax(0, 1fr) 44px;
        padding: 14px 6px
    }

    .chat-lightbox-stage {
        height: calc(100vh - 28px)
    }

    .chat-lightbox-button {
        width: 38px;
        height: 38px
    }

    .chat-lightbox-close {
        right: 10px;
        top: 10px
    }
}

.detail-price-line {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px
}

.price-history-tooltip {
    position: relative;
    display: inline-flex
}

.price-history-tooltip::after {
    content: "";
    position: absolute;
    top: 100%;
    right: 0;
    width: 100%;
    height: 10px
}

.price-history-icon {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 1px solid #cbd4e1;
    border-radius: 50%;
    background: #fff;
    color: var(--blue);
    font-size: 17px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer
}

.price-history-icon:hover, .price-history-icon:focus-visible {
    border-color: var(--blue);
    background: var(--blue-soft);
    outline: none
}

.price-history-popup {
    position: absolute;
    z-index: 30;
    top: calc(100% + 9px);
    right: 0;
    width: 350px;
    padding: 15px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: 0 14px 38px rgba(25, 37, 61, .18);
    text-align: left;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: .15s;
    pointer-events: none
}

.price-history-popup::before {
    content: "";
    position: absolute;
    right: 8px;
    bottom: 100%;
    border: 7px solid transparent;
    border-bottom-color: #fff;
    filter: drop-shadow(0 -1px 0 #dfe4eb)
}

.price-history-tooltip:hover .price-history-popup, .price-history-tooltip:focus-within .price-history-popup {
    opacity: 1;
    visibility: visible;
    transform: none;
    pointer-events: auto
}

.price-history-popup-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--line)
}

.price-history-popup-head > b {
    font-size: 15px
}

.price-history-popup-head > span {
    color: var(--muted);
    font-size: 11px
}

.price-history-popup-list {
    display: grid
}

.price-history-popup-row {
    display: grid;
    grid-template-columns:105px minmax(100px, 1fr) auto;
    align-items: center;
    gap: 8px;
    padding: 9px 0;
    border-bottom: 1px solid #edf0f4
}

.price-history-popup-row:last-child {
    border-bottom: 0;
    padding-bottom: 0
}

.price-history-popup-row time {
    color: var(--muted);
    font-size: 11px
}

.price-history-popup-row > b {
    font-size: 13px;
    white-space: nowrap
}

.price-history-popup-row > span {
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap
}

.price-history-start {
    color: var(--muted)
}

.price-history-unchanged {
    padding: 14px 0 2px;
    color: var(--muted);
    font-size: 13px
}

@media (max-width: 760px) {
    .detail-price-line {
        justify-content: flex-start
    }

    .price-history-popup {
        left: 0;
        right: auto;
        width: min(350px, calc(100vw - 20px))
    }

    .price-history-popup::before {
        left: 8px;
        right: auto
    }
}

#listingMap, .catalog-map #map {
    position: relative;
    z-index: 0;
    isolation: isolate
}
