:root {
    color-scheme: light;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: #17202a;
    background: #f4f7f8;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    line-height: 1.55;
}

a {
    color: #075c74;
}

.site-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 1rem max(1rem, calc((100% - 76rem) / 2));
    background: #fff;
    border-bottom: 1px solid #dbe3e6;
}

.brand {
    font-weight: 700;
    text-decoration: none;
}

nav {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.container {
    width: min(100% - 2rem, 76rem);
    margin: 2rem auto;
}

.card {
    padding: 2rem;
    background: #fff;
    border: 1px solid #dbe3e6;
    border-radius: .6rem;
}

.narrow {
    max-width: 34rem;
    margin-right: auto;
    margin-left: auto;
}

form:not(.inline-form) {
    display: grid;
    gap: .65rem;
}

input {
    width: 100%;
    padding: .7rem;
    border: 1px solid #9baeb5;
    border-radius: .3rem;
    font: inherit;
}

select,
textarea {
    width: 100%;
    padding: .7rem;
    border: 1px solid #9baeb5;
    border-radius: .3rem;
    font: inherit;
}

textarea {
    resize: vertical;
}

button,
.button {
    display: inline-block;
    width: fit-content;
    padding: .7rem 1rem;
    border: 0;
    border-radius: .3rem;
    background: #075c74;
    color: #fff;
    font: inherit;
    text-decoration: none;
    cursor: pointer;
    text-align: center;
    min-height: 2.75rem;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 3px solid #e7a629;
    outline-offset: 2px;
}

button:disabled {
    cursor: not-allowed;
    opacity: .6;
}

.button-secondary,
.view-toggle-button {
    background: #e8f0f2;
    color: #123944;
}

.button-danger {
    background: #9e2c24;
    color: #fff;
}

.marketplace-page {
    min-width: 0;
}

.page-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.page-heading h1 {
    margin-bottom: .25rem;
}

.eyebrow {
    margin: 0 0 .35rem;
    color: #516168;
    font-size: .88rem;
}

.search-filters {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    padding: 1.25rem;
    background: #fff;
    border: 1px solid #dbe3e6;
    border-radius: .6rem;
}

.search-filters label,
.listing-editor form > label,
.listing-editor fieldset label {
    display: grid;
    gap: .35rem;
    font-weight: 600;
}

.filter-actions {
    display: flex;
    align-items: end;
    flex-wrap: wrap;
    gap: .6rem;
}

.location-disclosure,
.map-attribution {
    color: #516168;
    font-size: .88rem;
}

.results-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: .75rem;
    margin: 1.25rem 0;
}

.view-toggle {
    display: none;
    gap: .35rem;
}

.view-toggle-button.is-selected {
    background: #075c74;
    color: #fff;
}

.results-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(20rem, .9fr);
    align-items: start;
    gap: 1.25rem;
}

.listing-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.listing-card {
    overflow: hidden;
    min-width: 0;
    background: #fff;
    border: 1px solid #dbe3e6;
    border-radius: .6rem;
}

.listing-card-image {
    display: grid;
    place-items: center;
    height: 12rem;
    overflow: hidden;
    background: #e8f0f2;
    color: #516168;
    text-decoration: none;
}

.listing-card-image img,
.owner-listing > img,
.listing-placeholder {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.listing-card-body {
    padding: 1rem;
}

.listing-card-body h2 {
    margin: .25rem 0 .65rem;
    font-size: 1.15rem;
}

.listing-card-body h2 a {
    text-decoration: none;
}

.listing-price {
    margin: .3rem 0;
    color: #123944;
    font-size: 1.2rem;
    font-weight: 700;
}

.listing-price span {
    font-size: .95rem;
    font-weight: 400;
}

.map-panel {
    position: sticky;
    top: 1rem;
    min-width: 0;
}

.map-toolbar,
.status-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
}

.map-status {
    min-height: 1.5rem;
    margin: .5rem 0;
    color: #516168;
    font-size: .9rem;
}

.market-map,
.location-map,
.detail-map {
    min-height: 25rem;
    width: 100%;
    background: #e8f0f2;
    border: 1px solid #dbe3e6;
    border-radius: .5rem;
    z-index: 0;
}

.location-map {
    min-height: 20rem;
}

.detail-map {
    min-height: 18rem;
}

.listing-map-popup {
    display: grid;
    gap: .25rem;
    color: #17202a;
}

.listing-map-popup a {
    font-weight: 700;
}

.empty-state {
    padding: 2rem;
    background: #fff;
    border: 1px solid #dbe3e6;
    border-radius: .6rem;
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.25rem;
    margin: 1.5rem 0;
}

.listing-editor {
    max-width: 52rem;
    margin: 0 auto;
}

.listing-editor form {
    gap: .7rem;
}

.listing-editor fieldset {
    display: grid;
    gap: .6rem;
    min-width: 0;
    margin: .5rem 0;
    padding: 1rem;
    border: 1px solid #dbe3e6;
    border-radius: .5rem;
}

.listing-editor legend {
    padding: 0 .4rem;
    font-weight: 700;
}

.listing-images-editor,
.listing-status-editor {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid #dbe3e6;
}

.image-editor-grid,
.detail-image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
    gap: .75rem;
}

.image-editor-item {
    min-width: 0;
}

.image-editor-item img {
    width: 100%;
    height: 9rem;
    object-fit: cover;
    border-radius: .35rem;
}

.listing-detail {
    max-width: 70rem;
    margin: 0 auto;
}

.detail-image-grid {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr));
    margin: 1.5rem 0;
}

.detail-image-grid img {
    width: 100%;
    max-height: 30rem;
    object-fit: cover;
    border-radius: .5rem;
}

.detail-description,
.detail-booking,
.detail-location {
    margin-top: 1.5rem;
    padding: 1.25rem;
    background: #fff;
    border: 1px solid #dbe3e6;
    border-radius: .6rem;
}

.detail-booking form {
    max-width: 34rem;
}

.detail-booking [data-booking-quote] {
    min-height: 1.6em;
    margin: .25rem 0;
}

.booking-chat {
    max-width: 48rem;
    margin: 0 auto;
}

.chat-messages {
    display: grid;
    gap: .75rem;
    max-height: 60vh;
    min-height: 12rem;
    overflow-y: auto;
    padding: 1rem;
    background: #fff;
    border: 1px solid #dbe3e6;
    border-radius: .6rem;
}

.chat-message {
    width: fit-content;
    max-width: min(90%, 38rem);
    padding: .25rem .85rem;
    background: #edf2f4;
    border-radius: .6rem;
    overflow-wrap: anywhere;
}

.chat-message-own {
    justify-self: end;
    background: #dff1e5;
}

.chat-message p {
    margin: .3rem 0;
    white-space: pre-wrap;
}

.chat-message-meta {
    color: #516168;
    font-size: .82rem;
}

.booking-chat form {
    margin-top: 1rem;
}

.table-scroll {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}

.data-table th,
.data-table td {
    padding: .75rem;
    border-bottom: 1px solid #dbe3e6;
    text-align: left;
    vertical-align: top;
}

.data-table td form {
    margin-bottom: .4rem;
}

.owner-listing-list {
    display: grid;
    gap: .75rem;
}

.owner-listing {
    display: grid;
    grid-template-columns: 6rem minmax(0, 1fr) auto;
    align-items: center;
    gap: 1rem;
    padding: .75rem;
    background: #fff;
    border: 1px solid #dbe3e6;
    border-radius: .6rem;
}

.owner-listing > img,
.listing-placeholder {
    height: 5rem;
    border-radius: .35rem;
    background: #e8f0f2;
}

.listing-placeholder {
    display: grid;
    place-items: center;
    color: #516168;
    font-size: .8rem;
}

.owner-listing h2 {
    margin: .1rem 0;
    font-size: 1.1rem;
}

.owner-listing-info p:last-child {
    margin: .2rem 0;
}

.inline-form {
    display: inline;
}

.inline-form button {
    padding: .25rem .5rem;
    min-height: 2.5rem;
}

.message {
    padding: .8rem 1rem;
    border-radius: .3rem;
}

.message.success {
    background: #e2f4e8;
    color: #164b27;
}

.message.error {
    background: #fde8e7;
    color: #74211d;
}

footer {
    color: #516168;
    font-size: .9rem;
}

@media (max-width: 36rem) {
    .site-header {
        align-items: center;
        padding: .75rem 1rem;
    }

    nav {
        width: 100%;
        justify-content: space-between;
        gap: .35rem;
        font-size: .9rem;
    }

    nav a,
    .inline-form button {
        min-height: 2.75rem;
        display: inline-flex;
        align-items: center;
    }

    .container {
        width: min(100% - 1rem, 76rem);
        margin: 1rem auto;
    }

    .card {
        padding: 1rem;
    }

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

    .page-heading .button {
        width: 100%;
    }

    .search-filters {
        grid-template-columns: minmax(0, 1fr);
        padding: 1rem;
    }

    .filter-actions > * {
        flex: 1 1 auto;
    }

    .filter-actions button,
    .filter-actions .button {
        width: 100%;
    }

    .view-toggle {
        display: flex;
    }

    .results-layout {
        display: block;
    }

    .results-layout[data-active-view="list"] [data-results-panel="map"],
    .results-layout[data-active-view="map"] [data-results-panel="list"] {
        display: none;
    }

    .listing-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .listing-card-image {
        height: 14rem;
    }

    .map-panel {
        position: static;
    }

    .market-map {
        min-height: min(65vh, 34rem);
    }

    .location-map {
        min-height: 17rem;
    }

    .map-toolbar > button {
        flex: 1 1 100%;
        width: 100%;
    }

    .owner-listing {
        grid-template-columns: 4.5rem minmax(0, 1fr);
        gap: .65rem;
    }

    .owner-listing > img,
    .owner-listing .listing-placeholder {
        height: 4.5rem;
    }

    .owner-listing > .button,
    .owner-listing > a:last-child {
        grid-column: 1 / -1;
        width: 100%;
    }

    .status-actions > form,
    .status-actions button {
        width: 100%;
    }

    .pagination {
        justify-content: space-between;
    }

    input,
    select,
    textarea,
    button,
    .button {
        font-size: 16px;
    }
}

@media (min-width: 36.01rem) and (max-width: 62rem) {
    .search-filters {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .results-layout {
        grid-template-columns: minmax(0, 1fr);
    }

    .map-panel {
        position: static;
    }

    .market-map {
        min-height: 22rem;
    }
}
