/*
 * Puzzle Exchange — base styles on top of Bootstrap 5 (mobile-first, UI-10/UI-11).
 * Brand colours are defined once as CSS variables.
 *
 * Palette (2026-09): night green ink, bright green, mist and meadow greens, petal pink.
 * Bright green is too light for text or for white text on it (2.5:1), so it is used as a
 * FILL with ink text on top (7.2:1); links and small green text use the darker --pe-link.
 */
@font-face {
    font-family: "DM Sans"; font-style: normal; font-weight: 100 1000; font-display: swap;
    src: url("../fonts/dm-sans-latin-wght-normal-MCOKvbW.woff2") format("woff2-variations");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: "DM Sans"; font-style: normal; font-weight: 100 1000; font-display: swap;
    src: url("../fonts/dm-sans-latin-ext-wght-normal-HHWdQmy.woff2") format("woff2-variations");
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: "Barlow Condensed"; font-style: normal; font-weight: 700; font-display: swap;
    src: url("../fonts/barlow-condensed-latin-700-normal-fn5da0S.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: "Barlow Condensed"; font-style: normal; font-weight: 700; font-display: swap;
    src: url("../fonts/barlow-condensed-latin-ext-700-normal-aYB-Djd.woff2") format("woff2");
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
    --pe-ink: #001f00;            /* night green: text, dark surfaces */
    --pe-green: #26bf26;          /* brand fill (buttons, hero) — ink text on top, 7.2:1 */
    --pe-green-hover: #22ab22;    /* ink on it 5.8:1 */
    --pe-link: #177317;           /* green text/links: 6.0:1 on white, 5.4:1 on mist */
    --pe-link-hover: #0f520f;
    --pe-mist: #f1f5e8;           /* soft section background */
    --pe-meadow: #cde7b1;         /* selected / highlight tint */
    --pe-pink: #f4c8ec;           /* secondary accent fill */
    --pe-accent: #b3311a;         /* prices: 6.2:1 on white */
    --pe-muted: #5c705c;          /* secondary text: 5.3:1 on white, 5.1:1 on mist */
    --pe-border: #d7dfcf;
    --pe-font-display: "Barlow Condensed", "Arial Narrow", sans-serif-condensed, system-ui, sans-serif;

    /* aliases kept for older rules */
    --pe-primary: var(--pe-link);
    --pe-primary-hover: var(--pe-link-hover);
    --pe-surface: var(--pe-mist);

    --bs-primary: var(--pe-green);
    --bs-primary-rgb: 38, 191, 38;
    --bs-link-color: var(--pe-link);
    --bs-link-color-rgb: 23, 115, 23;
    --bs-link-hover-color: var(--pe-link-hover);
    --bs-link-hover-color-rgb: 15, 82, 15;
    --bs-body-color: var(--pe-ink);
    --bs-body-color-rgb: 0, 31, 0;
    --bs-emphasis-color: var(--pe-ink);
    --bs-emphasis-color-rgb: 0, 31, 0;
    --bs-heading-color: var(--pe-ink);
    --bs-secondary-color: var(--pe-muted);
    --bs-secondary-color-rgb: 92, 112, 92;
    --bs-tertiary-bg: var(--pe-mist);
    --bs-tertiary-bg-rgb: 241, 245, 232;
    --bs-border-color: var(--pe-border);
    --bs-border-color-translucent: rgba(0, 31, 0, .12);
    --bs-primary-text-emphasis: var(--pe-link-hover);
    --bs-primary-bg-subtle: var(--pe-mist);
    --bs-primary-border-subtle: var(--pe-meadow);
    --bs-focus-ring-color: rgba(38, 191, 38, .45);
    --bs-body-font-family: "DM Sans", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --bs-border-radius: .625rem;
    --bs-border-radius-lg: 1rem;
}

h1, .h1, .display-font { font-family: var(--pe-font-display); font-weight: 700; letter-spacing: .01em; line-height: 1.05; }
.text-primary { color: var(--pe-link) !important; }
.text-bg-primary { background: var(--pe-green) !important; color: var(--pe-ink) !important; }
.text-body-secondary { color: var(--pe-muted) !important; }
.form-control:focus, .form-select:focus { border-color: var(--pe-green); box-shadow: 0 0 0 .25rem rgba(38, 191, 38, .3); }
.form-check-input:checked { background-color: var(--pe-ink); border-color: var(--pe-ink); }
.form-check-input:focus { border-color: var(--pe-green); box-shadow: 0 0 0 .25rem rgba(38, 191, 38, .3); }
.nav-pills { --bs-nav-pills-link-active-bg: var(--pe-green); --bs-nav-pills-link-active-color: var(--pe-ink); }
.nav-pills .nav-link { border-radius: 999px; }
.nav-link { --bs-nav-link-color: var(--pe-ink); --bs-nav-link-hover-color: var(--pe-link); }
.page-link { --bs-pagination-color: var(--pe-ink); --bs-pagination-active-bg: var(--pe-ink); --bs-pagination-active-border-color: var(--pe-ink); --bs-pagination-hover-color: var(--pe-link); }

/* Buttons: pills; bright green with ink text (never white text on it) */
.btn { --bs-btn-border-radius: 999px; --bs-btn-font-weight: 500; padding-left: 1.1rem; padding-right: 1.1rem; }
.btn-sm { --bs-btn-border-radius: 999px; padding-left: .8rem; padding-right: .8rem; }
.btn-link { padding-left: .25rem; padding-right: .25rem; }
.btn-primary, .btn-success {
    --bs-btn-color: var(--pe-ink);
    --bs-btn-bg: var(--pe-green);
    --bs-btn-border-color: var(--pe-green);
    --bs-btn-hover-color: var(--pe-ink);
    --bs-btn-hover-bg: var(--pe-green-hover);
    --bs-btn-hover-border-color: var(--pe-green-hover);
    --bs-btn-active-color: var(--pe-ink);
    --bs-btn-active-bg: var(--pe-green-hover);
    --bs-btn-active-border-color: var(--pe-green-hover);
    --bs-btn-disabled-color: var(--pe-ink);
    --bs-btn-disabled-bg: var(--pe-green);
    --bs-btn-disabled-border-color: var(--pe-green);
    --bs-btn-focus-shadow-rgb: 0, 31, 0;
}
.btn-outline-primary, .btn-outline-success {
    --bs-btn-color: var(--pe-ink);
    --bs-btn-border-color: var(--pe-ink);
    --bs-btn-hover-color: var(--pe-mist);
    --bs-btn-hover-bg: var(--pe-ink);
    --bs-btn-hover-border-color: var(--pe-ink);
    --bs-btn-active-color: var(--pe-mist);
    --bs-btn-active-bg: var(--pe-ink);
    --bs-btn-active-border-color: var(--pe-ink);
    --bs-btn-focus-shadow-rgb: 38, 191, 38;
}
.btn-secondary, .btn-dark {
    --bs-btn-color: var(--pe-mist);
    --bs-btn-bg: var(--pe-ink);
    --bs-btn-border-color: var(--pe-ink);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: #0d3a0d;
    --bs-btn-hover-border-color: #0d3a0d;
    --bs-btn-active-bg: #0d3a0d;
    --bs-btn-active-border-color: #0d3a0d;
}
.btn-outline-secondary {
    --bs-btn-color: var(--pe-ink);
    --bs-btn-border-color: var(--pe-border);
    --bs-btn-hover-color: var(--pe-ink);
    --bs-btn-hover-bg: var(--pe-mist);
    --bs-btn-hover-border-color: #b9c6ad;
    --bs-btn-active-color: var(--pe-ink);
    --bs-btn-active-bg: var(--pe-meadow);
    --bs-btn-active-border-color: var(--pe-meadow);
}
.btn-group > .btn { border-radius: 0; }
.btn-group > .btn:first-child { border-top-left-radius: 999px; border-bottom-left-radius: 999px; }
.btn-group > .btn:last-child { border-top-right-radius: 999px; border-bottom-right-radius: 999px; }

/* UI-11: comfortable touch targets */
.btn, .form-control, .form-select { min-height: 44px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .25rem; }
.btn-sm { min-height: 36px; }
.lang-toggle {
    display: inline-flex; align-items: center; gap: .4rem; min-height: 44px; min-width: 44px; padding: 0 .75rem;
    border: 1px solid var(--pe-border); border-radius: 999px; background: transparent; color: var(--pe-ink); font-weight: 500;
}
.lang-toggle:hover, .lang-toggle[aria-expanded="true"] { border-color: var(--pe-ink); background: var(--pe-mist); color: var(--pe-ink); }
.lang-toggle.dropdown-toggle::after { margin-left: .1rem; }
.lang-switch .dropdown-menu { --bs-dropdown-min-width: 11rem; --bs-dropdown-link-active-bg: var(--pe-meadow); --bs-dropdown-link-active-color: var(--pe-ink); }
.lang-switch .dropdown-item { min-height: 44px; }
@media (max-width: 575.98px) { .lang-toggle { padding: 0 .6rem; } .lang-toggle.dropdown-toggle::after { display: none; } }

.site-header .navbar { flex-wrap: wrap; }
.site-header .navbar-brand { color: var(--pe-ink); }
.brand-name { font-weight: 700; letter-spacing: -.02em; }
.logo-mark { flex-shrink: 0; }
@media (max-width: 420px) {
    .site-header .navbar-brand { font-size: 1.05rem; }
    .site-header .navbar-brand .logo-mark { width: 34px; height: 34px; }
}
@media (min-width: 768px) {
    .site-header .site-search { max-width: 520px; width: auto !important; }
}
.site-search .form-control { border-radius: 999px 0 0 999px; padding-left: 1.1rem; background: var(--pe-mist); border-color: var(--pe-mist); }
.site-search .form-control:focus { background: #fff; }
.site-search .btn { border-radius: 0 999px 999px 0; }

/* Hero: bright green block with ink text and huge condensed type (like the reference) */
.hero {
    /* Decorative puzzle pieces on the right (warm sunset palette); text stays on the plain green on the left. */
    background: var(--pe-green) url("../images/hero-pieces-5b1FyrM.svg") no-repeat right center / auto 100%;
    color: var(--pe-ink);
}
@media (max-width: 991.98px) {
    /* Narrow screens: the pieces end up under the text, so they are washed out. */
    .hero { background-image: linear-gradient(rgba(38, 191, 38, .62), rgba(38, 191, 38, .62)), url("../images/hero-pieces-5b1FyrM.svg"); }
}
.hero h1 { font-size: clamp(2.6rem, 8vw, 5rem); text-transform: uppercase; letter-spacing: 0; line-height: .95; }
.hero .lead { color: rgba(0, 31, 0, .82); max-width: 40rem; }
.hero .btn-primary { --bs-btn-color: var(--pe-mist); --bs-btn-bg: var(--pe-ink); --bs-btn-border-color: var(--pe-ink); --bs-btn-hover-color: #fff; --bs-btn-hover-bg: #0d3a0d; --bs-btn-hover-border-color: #0d3a0d; --bs-btn-active-bg: #0d3a0d; --bs-btn-active-color: #fff; }
.hero .btn-outline-primary { --bs-btn-bg: rgba(255, 255, 255, .25); --bs-btn-border-color: var(--pe-ink); }

.site-footer { background: var(--pe-ink); color: var(--pe-mist); border-top: 0 !important; }
.site-footer a { color: #fff; }
.site-footer .footer-brand { color: #fff; }
.site-footer a:hover { color: var(--pe-meadow); }
.site-footer .text-body-secondary { color: rgba(241, 245, 232, .75) !important; }

.category-strip { flex-wrap: wrap; }
.category-chip {
    display: inline-flex; align-items: center; min-height: 44px; padding: 0 1rem;
    border: 1px solid var(--bs-border-color); border-radius: 999px; white-space: nowrap;
    background: var(--bs-body-bg); color: var(--bs-body-color); text-decoration: none;
}
a.category-chip:hover { border-color: var(--pe-ink); background: var(--pe-meadow); color: var(--pe-ink); }
.category-chip .filter-count { margin-left: .4rem; }

.avatar { object-fit: cover; flex-shrink: 0; }
.avatar-initials {
    --avatar-size: 40px;
    display: inline-flex; align-items: center; justify-content: center;
    width: var(--avatar-size); height: var(--avatar-size);
    font-size: calc(var(--avatar-size) * 0.4); font-weight: 600; color: #fff;
    background: hsl(var(--avatar-hue, 120) 55% 26%);  /* white text keeps 4.5:1 contrast for every hue */
    user-select: none;
}

.maintenance-banner { background: #b91c1c; color: #fff; font-weight: 600; }

.content-page { max-width: 760px; }
.content-body li { margin-bottom: .35rem; }

/* --- Accounts (M2) --- */
.auth-page { max-width: 640px; }
.auth-page-narrow { max-width: 440px; }
.auth-page legend, .account-page legend { font-weight: 600; margin-bottom: .75rem; font-size: 1rem; }
.auth-divider { display: flex; align-items: center; gap: .75rem; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; border-top: 1px solid var(--bs-border-color); }
.oauth-btn { gap: .5rem; }

.verify-banner { background: #fef3c7; color: #78350f; }

.account-nav .nav-link { min-height: 44px; display: flex; align-items: center; }
.account-nav .nav-pills { --bs-nav-pills-link-active-bg: var(--pe-green); --bs-nav-pills-link-active-color: var(--pe-ink); }

.rating { display: inline-flex; align-items: center; gap: .35rem; }
.rating-stars span { color: #d1d5db; }
.rating-stars .full { color: #f59e0b; }
.rating-stars .half { background: linear-gradient(90deg, #f59e0b 50%, #d1d5db 50%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.rating-lg .rating-stars { font-size: 1.5rem; }
.rating-value { font-size: .9em; color: var(--bs-secondary-color); }

/* --- Items (M3) --- */
.offer-price { color: var(--pe-accent); font-weight: 700; }
.offer-tag { font-weight: 600; }

.item-card { overflow: hidden; border-color: var(--pe-border); border-radius: 1rem; transition: box-shadow .15s, transform .15s; }
.item-card:hover { box-shadow: 0 6px 18px rgba(0, 31, 0, .1); }
.item-card-photo { display: block; background: var(--pe-surface); }
.item-card-photo img { width: 100%; height: 100%; object-fit: cover; }
.item-card-title { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.item-card-desc { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.item-card .badge { font-weight: 500; }
.badge-condition { background: var(--pe-mist); color: var(--bs-body-color); border: 1px solid var(--bs-border-color); }

.my-item-photo img { width: 96px; height: 96px; object-fit: cover; border-radius: .5rem; background: var(--pe-surface); }
.my-item-photo { width: 96px; height: 96px; border-radius: .5rem; background: var(--pe-surface); }
.min-w-0 { min-width: 0; }

.item-form-page { max-width: 760px; }
.photo-grid { display: flex; flex-wrap: wrap; gap: .75rem; margin: 0 0 .5rem; }
.photo-tile, .photo-add { position: relative; width: 120px; height: 120px; border-radius: .5rem; overflow: hidden; background: var(--pe-surface); }
.photo-tile { cursor: grab; border: 2px solid transparent; }
.photo-tile.photo-main { border-color: var(--pe-green); }
.photo-tile.dragging { opacity: .4; }
.photo-tile img { width: 100%; height: 100%; object-fit: cover; }
.photo-tile.photo-noprev::after { content: "HEIC"; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--bs-secondary-color); }
.photo-remove { position: absolute; top: 4px; right: 4px; min-height: 32px; width: 32px; padding: 0; border-radius: 50%; line-height: 1; }
.photo-badge { position: absolute; left: 4px; bottom: 4px; }
.photo-add { border: 2px dashed var(--bs-border-color); }
.photo-add-label { width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; cursor: pointer; color: var(--bs-secondary-color); text-align: center; padding: .25rem; }
.photo-add-label:hover { color: var(--pe-primary); }
.visually-hidden-focusable-input .photo-input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.chip.active { background: var(--pe-green); border-color: var(--pe-green); color: var(--pe-ink); }
.category-checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .25rem 1rem; }

.item-gallery-main { background: var(--pe-surface); border-radius: .5rem; overflow: hidden; }
.item-gallery-main img { width: 100%; height: 100%; object-fit: contain; cursor: zoom-in; }
.item-gallery-thumbs button { width: 72px; height: 72px; padding: 0; border: 2px solid transparent; border-radius: .375rem; overflow: hidden; background: var(--pe-surface); }
.item-gallery-thumbs button.active { border-color: var(--pe-green); }
.item-gallery-thumbs img { width: 100%; height: 100%; object-fit: cover; }
.item-lightbox .carousel-item img { max-height: 90vh; width: auto; max-width: 100%; margin: 0 auto; display: block; }
.item-description, .item-wishes { white-space: pre-line; overflow-wrap: anywhere; }
.item-specs dt { font-weight: 500; color: var(--bs-secondary-color); }
.status-banner { border-left: 4px solid var(--bs-warning); }

/* --- Catalog, favourites, profile (M4) --- */
/* UI-10: 2 columns on phones, 3–4 on tablets, 4–5 on desktops. CSS grid, so "show more" frames can use display: contents. */
.item-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; }
@media (min-width: 576px) { .item-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; } }
@media (min-width: 992px) { .item-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 1400px) { .container .item-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); } .catalog-page .item-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.catalog-more-frame { display: contents; }
.catalog-more { grid-column: 1 / -1; }

.item-card { position: relative; }
.item-card-fav { position: absolute; top: .35rem; right: .35rem; z-index: 2; }
.fav-form { margin: 0; }
.fav-btn {
    display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px;
    border: 0; border-radius: 50%; background: rgba(255, 255, 255, .92); color: #374151; padding: 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .2); cursor: pointer;
}
.fav-btn .heart-shape { fill: none; stroke: currentColor; stroke-width: 2; }
.fav-btn[aria-pressed="true"] { color: #be123c; }
.fav-btn[aria-pressed="true"] .heart-shape { fill: currentColor; }
.fav-btn:hover, .fav-btn:focus-visible { color: #be123c; }
.fav-btn-lg { border: 1px solid var(--bs-border-color); box-shadow: none; flex-shrink: 0; }
.item-card-unavailable { opacity: .7; }
.item-card-unavailable img { filter: grayscale(1); }
.header-icon { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; color: var(--bs-body-color); border-radius: 50%; }
.header-icon:hover { color: var(--pe-primary); background: var(--bs-tertiary-bg); }

.catalog-filters .filter-group { border: 0; margin: 0 0 1.25rem; padding: 0; }
.catalog-filters legend { font-size: 1rem; font-weight: 600; margin-bottom: .5rem; }
.catalog-filters .form-check { min-height: 32px; display: flex; align-items: center; gap: .5rem; padding-left: 0; }
.catalog-filters .form-check-input { margin: 0; width: 1.25rem; height: 1.25rem; flex-shrink: 0; }
.catalog-filters .form-check-label { flex-grow: 1; cursor: pointer; padding: .2rem 0; }
.filter-scroll { max-height: 18rem; overflow-y: auto; }
.filter-count { color: var(--bs-secondary-color); font-size: .85em; }
.btn-check:checked + .chip-filter .filter-count { color: rgba(0, 31, 0, .75); }
.btn-check:checked + .chip-filter { background: var(--pe-green); border-color: var(--pe-green); color: var(--pe-ink); }
.filter-more summary { cursor: pointer; color: var(--pe-primary); min-height: 32px; padding: .25rem 0; }
.filter-actions { position: sticky; bottom: 0; background: var(--bs-body-bg); padding: .5rem 0; }
@media (min-width: 992px) { .filter-actions .btn-primary { display: none; } }

.price-range { position: relative; height: 32px; }
.price-range input[type=range] { position: absolute; left: 0; right: 0; top: 8px; width: 100%; margin: 0; pointer-events: none; background: transparent; -webkit-appearance: none; appearance: none; height: 16px; }
.price-range input[type=range]::-webkit-slider-thumb { pointer-events: auto; -webkit-appearance: none; width: 22px; height: 22px; border-radius: 50%; background: var(--pe-ink); border: 2px solid #fff; box-shadow: 0 0 0 1px var(--pe-ink); cursor: pointer; }
.price-range input[type=range]::-moz-range-thumb { pointer-events: auto; width: 20px; height: 20px; border-radius: 50%; background: var(--pe-ink); border: 2px solid #fff; cursor: pointer; }
.price-range::before { content: ""; position: absolute; left: 0; right: 0; top: 14px; height: 4px; border-radius: 2px; background: var(--bs-border-color); }

.filter-chip { display: inline-flex; align-items: center; gap: .35rem; min-height: 36px; padding: 0 .85rem; border-radius: 999px; background: var(--bs-tertiary-bg); color: var(--bs-body-color); text-decoration: none; border: 1px solid var(--bs-border-color); }
.filter-chip:hover { border-color: var(--pe-primary); color: var(--pe-primary); }
.filter-chip-reset { background: transparent; border-style: dashed; }
.catalog-toolbar .form-select { width: auto; max-width: 62vw; }

/* Horizontal carousel (PUB-02, ITEMPAGE-13): scroll-snap, no JavaScript */
.item-carousel { display: grid; grid-auto-flow: column; grid-auto-columns: 46%; gap: .75rem; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: .5rem; }
.item-carousel-cell { scroll-snap-align: start; }
@media (min-width: 576px) { .item-carousel { grid-auto-columns: 31%; } }
@media (min-width: 992px) { .item-carousel { grid-auto-columns: 23.5%; } }
@media (min-width: 1200px) { .item-carousel { grid-auto-columns: 19%; } }

/* --- Messages and contacts (M5) --- */
.unread-badge { position: absolute; top: 2px; right: 0; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: #be123c; color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; }
.messages-shell { min-height: 70vh; background: var(--bs-body-bg); }
.messages-list { max-height: 80vh; overflow-y: auto; }
.messages-thread { display: flex; flex-direction: column; max-height: 80vh; min-height: 70vh; }
.thread-messages { flex: 1 1 auto; overflow-y: auto; background: var(--pe-surface); display: flex; flex-direction: column; gap: .5rem; }
.conv-link { display: flex; gap: .75rem; align-items: flex-start; padding: .75rem 1rem; color: var(--bs-body-color); text-decoration: none; border-bottom: 1px solid var(--bs-border-color-translucent); position: relative; }
.conv-link:hover { background: var(--bs-tertiary-bg); }
.conv-link.active { background: var(--pe-mist); box-shadow: inset 3px 0 0 var(--pe-green); }
.conv-link.unread .conv-title, .conv-link.unread .conv-last { font-weight: 700; }
.conv-photo { width: 48px; height: 48px; flex-shrink: 0; border-radius: .5rem; overflow: hidden; background: var(--pe-surface); display: flex; align-items: center; justify-content: center; }
.conv-photo img { width: 100%; height: 100%; object-fit: cover; }
.conv-text { display: flex; flex-direction: column; min-width: 0; flex-grow: 1; }
.conv-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-item, .conv-last { font-size: .85rem; color: var(--bs-secondary-color); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-time { font-size: .75rem; color: var(--bs-secondary-color); flex-shrink: 0; }
.conv-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--pe-green); position: absolute; right: .75rem; bottom: 1rem; }
.msg { display: flex; }
.msg-mine { justify-content: flex-end; }
.msg-bubble { max-width: min(80%, 560px); padding: .5rem .75rem; border-radius: 1rem; background: var(--bs-body-bg); box-shadow: 0 1px 1px rgba(0, 0, 0, .06); }
.msg-mine .msg-bubble { background: var(--pe-meadow); border-bottom-right-radius: .25rem; }
.msg-theirs .msg-bubble { border-bottom-left-radius: .25rem; }
.msg-admin .msg-bubble { background: #fef3c7; }
.msg-author { font-size: .8rem; font-weight: 700; margin-bottom: .15rem; }
.msg-body { white-space: pre-line; overflow-wrap: anywhere; }
.msg-time { display: block; font-size: .72rem; color: var(--bs-secondary-color); text-align: right; margin-top: .15rem; }
.msg-offer { margin-top: .5rem; display: flex; flex-direction: column; gap: .35rem; }
.mini-card { display: flex; gap: .5rem; align-items: center; padding: .35rem; border: 1px solid var(--bs-border-color); border-radius: .5rem; background: var(--bs-body-bg); color: var(--bs-body-color); text-decoration: none; min-width: 0; }
a.mini-card:hover { border-color: var(--pe-primary); }
.mini-card-photo { width: 56px; height: 56px; flex-shrink: 0; border-radius: .375rem; overflow: hidden; background: var(--pe-surface); }
.mini-card-photo img { width: 100%; height: 100%; object-fit: cover; }
.mini-card-body { display: flex; flex-direction: column; min-width: 0; }
.mini-card-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-card-unavailable { opacity: .65; }
.offer-options { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: .5rem; max-height: 16rem; overflow-y: auto; }
.offer-option { display: flex; align-items: center; gap: .5rem; cursor: pointer; }
.offer-option .form-check-input { flex-shrink: 0; width: 1.25rem; height: 1.25rem; margin: 0; }
.offer-option:has(input:checked) .mini-card { border-color: var(--pe-primary); box-shadow: 0 0 0 2px rgba(38, 191, 38, .35); }
.contact-label { min-width: 4.5rem; }
@media (max-width: 767.98px) {
    .messages-page { padding-left: 0; padding-right: 0; }
    .messages-shell { border-radius: 0 !important; border-left: 0 !important; border-right: 0 !important; }
    .messages-list, .messages-thread { max-height: none; }
    .messages-thread { height: calc(100dvh - 150px); }
}

/* --- Deals and ratings (M6) --- */
.star-input { display: inline-flex; flex-direction: row-reverse; gap: .25rem; }
.star-input input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.star-input label { font-size: 2.25rem; line-height: 1; color: #d1d5db; cursor: pointer; min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; }
.star-input label:hover, .star-input label:hover ~ label, .star-input input:checked ~ label { color: #f59e0b; }
.star-input input:focus-visible + label { outline: 2px solid var(--pe-primary); outline-offset: 2px; border-radius: .25rem; }
.deal-option { min-height: 44px; display: flex; align-items: center; gap: .5rem; }
.msg-system { justify-content: center; }
.msg-system .msg-bubble { background: transparent; box-shadow: none; text-align: center; color: var(--bs-secondary-color); font-size: .9rem; }
