.listing-detail-production {
    --ld-bg: #fff;
    --ld-surface: #f7f8fa;
    --ld-ink: #171b26;
    --ld-muted: #667085;
    --ld-accent: #f5b82e;
    --ld-success: #20a464;
    --ld-border: #e8eaef;
    --ld-shadow: 0 7px 24px rgba(23, 27, 38, .06);
    background: var(--ld-bg);
}

.listing-detail-production svg {
    width: 19px;
    height: 19px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
}

.listing-detail-shell {
    max-width: 1440px;
    margin: 0 auto;
    padding: 18px 28px 48px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, Helvetica, sans-serif;
    color: var(--ld-ink);
}

.listing-detail-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
}

.listing-detail-breadcrumb {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin: 0;
    padding: 0;
    color: var(--ld-muted);
    font-size: 13px;
    font-weight: 500;
    list-style: none;
}

.listing-detail-breadcrumb li:not(:last-child)::after {
    content: "›";
    margin-left: 8px;
    color: #a1a8b5;
}

.listing-detail-breadcrumb li:last-child {
    max-width: 360px;
    overflow: hidden;
    color: var(--ld-ink);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.listing-detail-pager {
    display: flex;
    gap: 10px;
}

.listing-detail-pager a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 36px;
    border-radius: 10px;
    padding: 0 10px;
    font-size: 13px;
    font-weight: 500;
}

.listing-detail-pager a:hover {
    background: var(--ld-surface);
}

.listing-detail-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(430px, .78fr) 322px;
    gap: 20px;
    align-items: start;
}

.listing-detail-left,
.listing-detail-center,
.listing-detail-right {
    display: grid;
    gap: 16px;
    min-width: 0;
}

.listing-detail-card {
    min-width: 0;
    border: 1px solid var(--ld-border);
    border-radius: 14px;
    background: #fff;
    box-shadow: var(--ld-shadow);
}

.listing-detail-card h1,
.listing-detail-card h2,
.listing-detail-card h3,
.listing-detail-card strong {
    font-weight: 600;
}

.listing-detail-card h2 {
    margin: 0 0 12px;
    font-size: 18px;
    line-height: 1.3;
}

.listing-gallery {
    overflow: hidden;
}

.gallery-main {
    position: relative;
    overflow: hidden;
    border-radius: 14px 14px 0 0;
    background: #111722;
}

.gallery-image-button {
    display: block;
    width: 100%;
    border: 0;
    padding: 0;
    background: #111722;
    cursor: zoom-in;
}

.gallery-main img,
.gallery-placeholder {
    display: grid;
    place-items: center;
    width: 100%;
    aspect-ratio: 1.64 / 1;
    object-fit: cover;
    background: linear-gradient(135deg, #edf0f5, #fbf6ed);
    color: var(--ld-muted);
    font-weight: 500;
}

.gallery-count {
    position: absolute;
    top: 12px;
    left: 12px;
    border-radius: 999px;
    padding: 6px 12px;
    background: rgba(0, 0, 0, .72);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
}

.gallery-favorite {
    position: absolute;
    top: 12px;
    right: 12px;
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .86);
    color: #fff;
}

.gallery-favorite button {
    display: grid;
    place-items: center;
    width: 100%;
    height: 100%;
    border: 0;
    border-radius: 50%;
    padding: 0;
    background: transparent;
    color: inherit;
}

.gallery-favorite svg {
    filter: drop-shadow(0 1px 3px rgba(0, 0, 0, .35));
}

.gallery-thumbs {
    display: grid;
    grid-template-columns: repeat(6, minmax(84px, 1fr));
    gap: 7px;
    padding: 8px;
    overflow-x: auto;
}

.gallery-thumbs button {
    position: relative;
    min-width: 84px;
    overflow: hidden;
    border: 2px solid transparent;
    border-radius: 10px;
    padding: 0;
    background: #eef1f5;
}

.gallery-thumbs button.is-active {
    border-color: var(--ld-accent);
}

.gallery-thumbs img {
    display: block;
    width: 100%;
    aspect-ratio: 1.58 / 1;
    object-fit: cover;
}

.gallery-thumbs .has-more::after {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(23, 27, 38, .55);
}

.gallery-thumbs .has-more span {
    position: absolute;
    inset: 0;
    z-index: 1;
    display: grid;
    place-items: center;
    color: #fff;
    font-size: 18px;
    font-weight: 600;
}

.listing-description,
.listing-location,
.listing-summary,
.listing-exchange-preferences,
.listing-owner-card,
.safety-card,
.listing-related {
    padding: 16px;
}

.listing-description p,
.listing-location p,
.listing-exchange-preferences p,
.safety-card p {
    margin: 0 0 8px;
    color: #2d3440;
    font-size: 14px;
    line-height: 1.65;
}

.description-specs,
.listing-dynamic-fields {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 14px 0 0;
}

.description-specs div,
.listing-dynamic-fields div {
    display: flex;
    align-items: baseline;
    gap: 6px;
    min-width: 0;
}

.description-specs dt,
.listing-dynamic-fields dt {
    flex: 0 0 auto;
    margin: 0;
    color: var(--ld-muted);
    font-size: 13px;
    font-weight: 500;
    line-height: 1.5;
    white-space: nowrap;
}

.description-specs dt::after,
.listing-dynamic-fields dt span::after {
    content: ":";
}

.description-specs dd,
.listing-dynamic-fields dd {
    flex: 1 1 auto;
    min-width: 0;
    margin: 0;
    color: var(--ld-ink);
    font-size: 14px;
    font-weight: 600;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.map-preview {
    position: relative;
    min-height: 118px;
    overflow: hidden;
    border-radius: 12px;
    background:
        linear-gradient(90deg, rgba(255,255,255,.55) 1px, transparent 1px),
        linear-gradient(rgba(255,255,255,.55) 1px, transparent 1px),
        linear-gradient(135deg, #edf2ec 0%, #f5f7f3 42%, #e7f0e4 100%);
    background-size: 42px 42px, 42px 42px, 100% 100%;
}

.map-preview::before,
.map-preview::after {
    content: "";
    position: absolute;
    height: 18px;
    border-radius: 999px;
    background: rgba(199, 211, 202, .65);
}

.map-preview::before {
    top: 48px;
    left: -24px;
    width: 82%;
    transform: rotate(-9deg);
}

.map-preview::after {
    right: -30px;
    bottom: 38px;
    width: 72%;
    transform: rotate(7deg);
}

.map-preview span {
    position: absolute;
    left: 56%;
    top: 43%;
    z-index: 1;
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--ld-accent);
    color: #fff;
    box-shadow: 0 13px 28px rgba(245, 184, 46, .32);
}

.listing-summary h1 {
    margin: 0 0 12px;
    font-size: 26px;
    line-height: 1.23;
}

.summary-price-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 9px;
    margin-bottom: 12px;
}

.summary-price-row strong {
    font-size: 28px;
    line-height: 1.2;
}

.summary-price-row span {
    border-radius: 999px;
    padding: 6px 10px;
    background: #f0f6ff;
    color: #175cd3;
    font-size: 13px;
    font-weight: 600;
}

.summary-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 7px 12px;
    border-bottom: 1px solid var(--ld-border);
    padding-bottom: 14px;
    color: #4e5866;
    font-size: 13px;
}

.summary-meta span,
.listing-dynamic-fields dt {
    display: inline-flex;
    align-items: flex-start;
    gap: 6px;
}

.summary-meta svg,
.listing-dynamic-fields svg {
    width: 16px;
    height: 16px;
    flex: 0 0 auto;
    color: #5d6673;
}

.listing-dynamic-fields dt {
    align-items: center;
}

.exchange-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 12px 0 14px;
}

.exchange-chips span {
    border: 1px solid var(--ld-border);
    border-radius: 999px;
    padding: 7px 12px;
    background: #fff;
    color: #252b36;
    font-size: 14px;
    font-weight: 500;
}

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

.listing-offer-form fieldset {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    margin: 0;
    border: 0;
    padding: 0;
}

.listing-offer-form legend,
.listing-offer-form label {
    color: #252b36;
    font-size: 13px;
    font-weight: 600;
}

.listing-offer-form fieldset label {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 36px;
    border: 1px solid var(--ld-border);
    border-radius: 999px;
    padding: 0 12px;
    font-weight: 500;
}

.listing-offer-form textarea {
    width: 100%;
    resize: vertical;
    border: 1px solid var(--ld-border);
    border-radius: 12px;
    padding: 12px;
    color: #171b26;
    font-size: 14px;
    line-height: 1.55;
}

.listing-offer-form button,
.owner-actions a,
.owner-actions button,
.owner-tools a,
.guest-action-panel a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 44px;
    border: 1px solid var(--ld-border);
    border-radius: 12px;
    padding: 0 14px;
    background: #fff;
    color: #252b36;
    font-size: 14px;
    font-weight: 600;
}

.listing-offer-form button,
.owner-actions .primary,
.guest-action-panel a {
    border-color: transparent;
    background: var(--ld-accent);
    color: var(--ld-ink);
}

.owner-tools {
    display: grid;
    gap: 8px;
}

.guest-action-panel {
    display: grid;
    gap: 10px;
    border: 1px solid #fde68a;
    border-radius: 12px;
    padding: 12px;
    background: #fffbeb;
}

.owner-profile {
    display: grid;
    grid-template-columns: 60px minmax(0, 1fr);
    gap: 12px;
    align-items: center;
}

.owner-avatar {
    display: grid;
    place-items: center;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #202735;
    color: #fff;
    font-size: 18px;
    font-weight: 600;
}

.owner-profile h3 {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0 0 5px;
    font-size: 16px;
    line-height: 1.3;
}

.owner-profile h3 svg {
    width: 17px;
    height: 17px;
    color: var(--ld-success);
}

.owner-profile p,
.owner-profile small {
    display: block;
    margin: 0 0 5px;
    color: var(--ld-muted);
    font-size: 13px;
}

.owner-stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1px;
    overflow: hidden;
    margin: 14px 0;
    border-radius: 12px;
    background: var(--ld-border);
}

.owner-stats div {
    display: grid;
    gap: 6px;
    padding: 11px;
    background: #fbfbfd;
}

.owner-stats span {
    color: var(--ld-muted);
    font-size: 12px;
    line-height: 1.35;
}

.owner-stats strong {
    font-size: 16px;
}

.owner-actions {
    display: grid;
    gap: 8px;
}

.owner-actions form {
    margin: 0;
}

.safety-card {
    background: linear-gradient(135deg, #f6fbff, #f7f8ff);
}

.safety-card div {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    margin-bottom: 10px;
    border-radius: 50%;
    background: #e8f0ff;
    color: #2f69d8;
}

.safety-card span,
.empty-note {
    color: var(--ld-muted);
    font-size: 13px;
}

.listing-related {
    display: grid;
    gap: 12px;
}

.related-item {
    display: grid;
    grid-template-columns: 86px minmax(0, 1fr);
    gap: 10px;
    align-items: center;
    border-top: 1px solid var(--ld-border);
    padding-top: 12px;
}

.related-item:first-of-type {
    border-top: 0;
    padding-top: 0;
}

.related-item span.related-item-media {
    position: relative;
    display: block;
    width: 86px;
    height: 66px;
    border-radius: 10px;
    overflow: hidden;
    background: #eef1f5;
}

.related-item img,
.related-placeholder {
    display: grid;
    place-items: center;
    width: 86px;
    height: 66px;
    object-fit: cover;
    color: var(--ld-muted);
    font-size: 12px;
}

.related-item-media .eb-listing-featured-badge {
    position: absolute;
    top: 4px;
    left: 4px;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    gap: 2px;
    height: 15px;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--eb-accent, #f5b82e);
    color: #171b26;
    font-size: 7px;
    font-weight: 800;
    white-space: nowrap;
}

.related-item-media .eb-listing-featured-badge svg {
    width: 7px;
    height: 7px;
}

.related-item span {
    display: grid;
    gap: 4px;
    min-width: 0;
}

/* Barter-type pill -- restored to the card's text area (not an image
   overlay), same soft-color treatment as the main listing-card pill,
   scaled to this compact sidebar widget's type size. */
.related-item .eb-barter-pill {
    display: inline-block;
    justify-self: start;
    border-radius: 999px;
    padding: 2px 7px;
    font-size: 10px;
    font-weight: 500;
    white-space: nowrap;
    border: 1px solid transparent;
}

.related-item .eb-barter-pill-full {
    border-color: #d8f2e3;
    background: #eefaf3;
    color: var(--eb-success, #20a464);
}

.related-item .eb-barter-pill-partial {
    border-color: #d3e3fb;
    background: #eef4fe;
    color: #3467c9;
}

.related-item strong,
.related-item em {
    overflow: hidden;
    font-style: normal;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.related-item small {
    color: var(--ld-muted);
    font-size: 12px;
}

.lightbox {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(17, 23, 34, .82);
}

.lightbox[hidden] {
    display: none;
}

.lightbox img {
    max-width: min(980px, 86vw);
    max-height: 82vh;
    border-radius: 16px;
    object-fit: contain;
    box-shadow: 0 24px 70px rgba(0, 0, 0, .38);
}

.lightbox-close,
.lightbox-nav {
    position: absolute;
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 50%;
    background: #fff;
    color: #171b26;
}

.lightbox-close {
    top: 24px;
    right: 24px;
    font-size: 26px;
}

.lightbox-nav.prev {
    left: 28px;
}

.lightbox-nav.next {
    right: 28px;
}

.listing-toast {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 90;
    border: 1px solid var(--ld-border);
    border-radius: 12px;
    padding: 12px 14px;
    background: #fff;
    box-shadow: 0 18px 44px rgba(16, 24, 40, .16);
    font-size: 14px;
    font-weight: 500;
}

@media (max-width: 1260px) {
    .listing-detail-grid {
        grid-template-columns: minmax(0, 1.05fr) minmax(410px, .95fr);
    }

    .listing-detail-right {
        grid-column: 1 / -1;
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 1024px) {
    .listing-detail-grid {
        grid-template-columns: minmax(0, 1fr) minmax(360px, .88fr);
    }

    .listing-detail-right {
        grid-column: 1 / -1;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .listing-related {
        grid-column: 1 / -1;
    }
}

@media (max-width: 800px) {
    .listing-detail-shell {
        padding: 18px 16px 36px;
    }

    .listing-detail-topbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .listing-detail-grid,
    .listing-detail-right {
        grid-template-columns: 1fr;
    }

    .listing-detail-left,
    .listing-detail-center,
    .listing-detail-right {
        display: contents;
    }

    .listing-gallery {
        order: 1;
    }

    .listing-summary {
        order: 2;
    }

    .listing-exchange-preferences {
        order: 3;
    }

    .listing-owner-card {
        order: 4;
    }

    .safety-card {
        order: 5;
    }

    .listing-description {
        order: 6;
    }

    .listing-location {
        order: 7;
    }

    .listing-related {
        order: 8;
    }

    .listing-summary h1 {
        font-size: 24px;
    }

    .summary-price-row strong {
        font-size: 26px;
    }

    .gallery-thumbs {
        grid-template-columns: repeat(6, 86px);
    }
}

@media (max-width: 430px) {
    .listing-detail-card h2 {
        font-size: 18px;
    }

    .listing-summary h1 {
        font-size: 23px;
    }

    .summary-price-row strong {
        font-size: 24px;
    }

    .listing-description,
    .listing-location,
    .listing-summary,
    .listing-exchange-preferences,
    .listing-owner-card,
    .safety-card,
    .listing-related {
        padding: 16px;
    }

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

/* Зарын статус/онцлох badge — ebarter-ui.css-ийн .ui-status визуал хэлтэй
   ижил боловч энэ хуудас тэр файлыг ачаалдаггүй тул өөрөө бие даасан. */
.listing-status-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 10px;
}

.listing-status-row .ui-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 28px;
    padding: 5px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
    border: 1px solid transparent;
    white-space: nowrap;
}

.listing-status-row .ui-status-icon {
    display: inline-grid;
    place-items: center;
    width: 16px;
    height: 16px;
    border-radius: 999px;
    border: 1px solid currentColor;
    color: inherit;
    font-size: 10px;
    font-weight: 900;
    line-height: 1;
}

.listing-status-row .ui-status-success { color: #15803d; background: #ecfdf3; border-color: #bbf7d0; }
.listing-status-row .ui-status-warning { color: #b45309; background: #fffbeb; border-color: #fde68a; }
.listing-status-row .ui-status-danger { color: #b91c1c; background: #fef2f2; border-color: #fecaca; }
.listing-status-row .ui-status-info { color: #0369a1; background: #eff6ff; border-color: #bfdbfe; }
.listing-status-row .ui-status-muted { color: #64748b; background: #f8fafc; border-color: #e2e8f0; }

.listing-status-row .ui-status-featured {
    color: #8a5b00;
    background: #fff7e3;
    border-color: #ffe2b2;
}

.listing-status-row .ui-status-featured svg {
    width: 13px;
    height: 13px;
}

.listing-status-row .ui-status-verified {
    color: #0369a1;
    background: #eff6ff;
    border-color: #bfdbfe;
}

.listing-status-row .ui-status-verified svg {
    width: 13px;
    height: 13px;
    flex-shrink: 0;
}

.listing-location-detail {
    margin: 6px 0 0;
    color: var(--muted, #667085);
    font-size: 13px;
}

.listing-map-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 10px;
    font-size: 13px;
    font-weight: 700;
    color: inherit;
    text-decoration: underline;
}
