/* Cariboo styles — warm, clean, mobile-first. */

/* Reset + base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px; line-height: 1.6; color: var(--ink); background: var(--page-bg);
}
img, picture, video, canvas, svg { display: block; max-width: 100%; }
input, button, textarea, select { font: inherit; color: inherit; }
a { color: var(--teal); text-decoration: none; }
a:hover { text-decoration: underline; }
ul, ol { margin: 0; padding: 0; list-style: none; }
h1, h2, h3, h4, p { margin: 0; }

/* Variables */
:root {
  --coral: #E63946; --coral-dark: #C1121F;
  --teal: #1D7A8C; --teal-dark: #155F6D;
  --gold: #F4A261;
  --cream: #FBF8F3; --warm-white: #FAFAF7; --card: #FFFFFF;
  --border: #E8E6E1; --ink: #1F2937; --muted: #6B7280;
  --success: #059669; --danger: #DC2626;
  --radius-sm: 6px; --radius-md: 10px; --radius-lg: 16px; --radius-xl: 24px;
  --shadow-sm: 0 1px 2px rgba(31,41,55,0.05);
  --shadow-md: 0 4px 12px rgba(31,41,55,0.08);
  --shadow-lg: 0 12px 32px rgba(31,41,55,0.12);
  --page-bg: var(--cream); --container: 1440px;
}

/* Layout primitives */
.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 1rem; }
.narrow { max-width: 720px; }
.row { display: flex; flex-direction: column; gap: 1rem; }
.grid { display: grid; gap: 1rem; }
.stack > * + * { margin-top: 1rem; }

/* Typography */
h1, .h1 { font-size: clamp(2rem,5vw,3rem); line-height: 1.15; font-weight: 800; letter-spacing: -0.02em; }
h2, .h2 { font-size: clamp(1.5rem,3vw,2rem); line-height: 1.2; font-weight: 700; }
h3, .h3 { font-size: 1.25rem; line-height: 1.3; font-weight: 700; }
.muted { color: var(--muted); }
.lead { font-size: 1.125rem; color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* Header & navigation */
.site-header { position: sticky; top: 0; z-index: 100; background: var(--card); border-bottom: 1px solid var(--border); box-shadow: var(--shadow-sm); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 64px; }
.logo { display: inline-flex; align-items: center; }
.logo:hover { text-decoration: none; }
.logo-img { height: 32px; width: auto; display: block; }
.logo-img-lg { height: 64px; }
.logo-wordmark-img { height: 28px; width: auto; display: block; }
.nav-toggle { display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; padding: 0; background: none; border: 1px solid var(--border); border-radius: var(--radius-md); cursor: pointer; }
.hamburger, .hamburger::before, .hamburger::after { display: block; width: 22px; height: 2px; background: var(--ink); border-radius: 2px; }
.hamburger { position: relative; }
.hamburger::before, .hamburger::after { content: ''; position: absolute; left: 0; }
.hamburger::before { top: -7px; } .hamburger::after { top: 7px; }
.main-nav { position: fixed; inset: 64px 0 auto 0; background: var(--card); border-bottom: 1px solid var(--border); padding: 1rem; display: none; flex-direction: column; gap: 1rem; box-shadow: var(--shadow-md); }
.main-nav.open { display: flex; }
.nav-list { display: flex; flex-direction: column; gap: 0.5rem; }
.nav-list a { display: block; padding: 0.5rem 0; color: var(--ink); font-weight: 500; }
.nav-cta { color: var(--coral) !important; font-weight: 700 !important; }
.has-dropdown { position: relative; }
.nav-dropdown-trigger { width: 100%; text-align: left; background: none; border: none; padding: 0.5rem 0; font-weight: 500; cursor: pointer; }
.dropdown { display: none; flex-direction: column; gap: 0.25rem; padding-left: 1rem; }
.dropdown.open { display: flex; }
.header-tools { display: flex; flex-direction: column; gap: 1rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.country-picker select, .user-menu select { width: 100%; padding: 0.5rem; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--warm-white); }
.user-menu { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }

/* Locale switch */
.locale-switch { display: inline-flex; align-items: center; border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; background: var(--warm-white); }
.locale-btn { display: inline-flex; align-items: center; justify-content: center; min-width: 36px; padding: 0.35rem 0.6rem; font-size: 0.8rem; font-weight: 700; color: var(--muted); background: transparent; transition: background .15s ease, color .15s ease; }
.locale-btn:hover { text-decoration: none; background: var(--border); color: var(--ink); }
.locale-btn.active { background: var(--teal); color: #fff; }

/* Currency conversion inline note */
.price-usd-conversion { font-size: 0.85em; font-weight: 500; margin-left: 0.35rem; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; padding: 0.65rem 1.25rem; border-radius: var(--radius-md); border: 1px solid transparent; font-weight: 600; cursor: pointer; transition: transform .1s ease, box-shadow .2s ease, background .2s ease; }
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--coral); color: #fff; border-color: var(--coral); }
.btn-primary:hover { background: var(--coral-dark); border-color: var(--coral-dark); }
.btn-secondary { background: var(--teal); color: #fff; border-color: var(--teal); }
.btn-secondary:hover { background: var(--teal-dark); }
.btn-ghost { background: transparent; color: var(--teal); border-color: var(--border); }
.btn-ghost:hover { background: var(--warm-white); }
.btn-danger { background: #fff; color: var(--danger); border-color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-lg { padding: 0.85rem 1.5rem; font-size: 1.05rem; }
.btn-sm { padding: 0.4rem 0.75rem; font-size: 0.875rem; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.inline-form { display: inline; }

/* Hero */
.hero { padding: 3rem 0; background: linear-gradient(135deg, var(--warm-white) 0%, var(--cream) 100%); text-align: center; }
.hero-title { color: var(--teal); margin-bottom: 0.75rem; }
.hero-subtitle { color: var(--muted); max-width: 560px; margin: 0 auto 1.5rem; }
.hero-search { display: flex; flex-direction: column; gap: 0.75rem; max-width: 680px; margin: 0 auto; background: var(--card); padding: 0.75rem; border-radius: var(--radius-xl); box-shadow: var(--shadow-lg); }
.search-input, .search-select { padding: 0.85rem 1rem; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--warm-white); width: 100%; }
.search-input:focus, .search-select:focus, input:focus, select:focus, textarea:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px rgba(29,122,140,0.15); }

/* Features */
.features { padding: 2.5rem 0; }
.feature-grid { display: grid; gap: 1.25rem; }
.feature-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1.5rem; text-align: center; box-shadow: var(--shadow-sm); }
.feature-icon { display: inline-block; font-size: 2rem; margin-bottom: 0.75rem; }
.feature-card h2 { font-size: 1.15rem; margin-bottom: 0.5rem; }
.feature-card p { color: var(--muted); font-size: 0.95rem; }

/* Sections */
.categories-section, .recent-listings { padding: 2rem 0; }
.section-header { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; }
.link-arrow { font-weight: 600; }

/* Category tiles */
.category-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 0.75rem; }
.category-tile { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.5rem; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1.25rem 0.75rem; text-align: center; color: var(--ink); transition: transform .15s ease, box-shadow .15s ease; position: relative; }
.category-tile:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); text-decoration: none; }
.category-icon { font-size: 1.75rem; }
.category-name { font-weight: 600; font-size: 0.9rem; }

/* Listing cards */
.listing-grid { display: grid; grid-template-columns: 1fr; gap: 1rem; }
.listing-card { position: relative; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-sm); transition: transform .15s ease, box-shadow .15s ease; }
.listing-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }
.card-link { display: block; color: inherit; }
.card-link:hover { text-decoration: none; }
.card-image { position: relative; aspect-ratio: 4/3; background: var(--warm-white); overflow: hidden; }
.card-image img { width: 100%; height: 100%; object-fit: cover; }
.card-body { padding: 1rem; }
.card-title { font-size: 1rem; font-weight: 600; line-height: 1.35; margin-bottom: 0.35rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-price { font-size: 1.1rem; font-weight: 700; color: var(--teal); margin-bottom: 0.35rem; }
.price-contact { color: var(--muted); font-weight: 500; }
.card-location, .card-meta { font-size: 0.85rem; color: var(--muted); }
.card-meta { margin-top: 0.25rem; }
.favorite-btn { position: absolute; top: 0.5rem; right: 0.5rem; width: 36px; height: 36px; border-radius: 50%; border: none; background: rgba(255,255,255,0.95); color: var(--coral); font-size: 1.25rem; display: flex; align-items: center; justify-content: center; cursor: pointer; box-shadow: var(--shadow-sm); }
.favorite-btn[aria-pressed="true"] { color: var(--coral); }

/* Badges */
.badge { display: inline-flex; align-items: center; gap: 0.25rem; padding: 0.2rem 0.5rem; border-radius: 999px; font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.02em; }
.badge-cash { position: absolute; bottom: 0.5rem; left: 0.5rem; background: var(--gold); color: #3d2612; }
.badge-reach { position: absolute; top: 0.5rem; left: 0.5rem; background: var(--teal); color: #fff; }
.badge-island { background: #e6f4f1; color: var(--teal-dark); }
.badge-premium { background: #fde8e9; color: var(--coral-dark); }
.badge-success { background: #d1fae5; color: var(--success); }
.badge-pending { background: #fef3c7; color: #92400e; }
.badge-danger { background: #fee2e2; color: var(--danger); }

/* Listing detail */
.breadcrumbs { padding: 1rem 0; font-size: 0.875rem; color: var(--muted); }
.breadcrumbs a { color: var(--muted); }
.breadcrumbs span[aria-hidden="true"] { margin: 0 0.35rem; }
.listing-detail { padding-bottom: 3rem; }
.listing-detail-grid { display: grid; gap: 1.5rem; }
.gallery-main { margin: 0; background: var(--warm-white); border-radius: var(--radius-lg); overflow: hidden; aspect-ratio: 4/3; }
.gallery-main img { width: 100%; height: 100%; object-fit: cover; }
.gallery-thumbs { display: flex; gap: 0.5rem; margin-top: 0.75rem; overflow-x: auto; }
.thumb { flex: 0 0 72px; height: 72px; border: 2px solid transparent; border-radius: var(--radius-md); overflow: hidden; padding: 0; background: var(--warm-white); cursor: pointer; }
.thumb.active { border-color: var(--teal); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.listing-header { margin-bottom: 1rem; }
.listing-price { font-size: 1.75rem; font-weight: 800; color: var(--teal); margin: 0.5rem 0; }
.listing-location { color: var(--muted); margin-bottom: 0.5rem; }
.listing-meta { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; color: var(--muted); font-size: 0.875rem; }
.attributes-card, .description-card, .seller-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1.25rem; margin-top: 1rem; }
.attributes-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 0.75rem 1rem; }
.attribute dt { font-size: 0.8rem; color: var(--muted); text-transform: capitalize; }
.attribute dd { font-weight: 600; margin: 0; }
.seller-badge { display: flex; align-items: center; gap: 0.75rem; }
.seller-avatar { width: 48px; height: 48px; border-radius: 50%; background: var(--teal); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 1.1rem; }
.seller-name { font-weight: 700; display: flex; align-items: center; gap: 0.35rem; }
.seller-meta { font-size: 0.875rem; color: var(--muted); }
.verified-chips { display: flex; gap: 0.35rem; margin-top: 0.35rem; }
.chip { font-size: 0.75rem; background: #e6f4f1; color: var(--teal-dark); padding: 0.15rem 0.4rem; border-radius: 999px; }
.action-buttons { display: flex; flex-direction: column; gap: 0.75rem; margin-top: 1.5rem; }
.report-link { margin-top: 1rem; font-size: 0.85rem; }

/* Forms */
.form { display: flex; flex-direction: column; gap: 1.25rem; }
.field { display: flex; flex-direction: column; gap: 0.35rem; }
.field label { font-weight: 600; font-size: 0.95rem; }
.field input, .field select, .field textarea { padding: 0.7rem 0.85rem; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--card); }
.field-hint { font-size: 0.8rem; color: var(--muted); }
.radio-group { display: flex; flex-direction: column; gap: 0.5rem; }
.radio-label { display: flex; align-items: center; gap: 0.5rem; font-weight: 500; cursor: pointer; }
.field-checkbox label { display: flex; align-items: flex-start; gap: 0.5rem; font-weight: 500; cursor: pointer; }
.form-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 1rem; }
.price-inputs { display: flex; align-items: center; gap: 0.5rem; }
.price-inputs input { flex: 1; }

.dynamic-fieldset { border: 1px solid var(--border); border-radius: var(--radius-md); padding: 1rem; margin: 0; }
.dynamic-fieldset legend { font-weight: 700; padding: 0 0.5rem; }

/* Auth */
.auth-page { display: flex; align-items: center; justify-content: center; padding: 2rem 1rem; min-height: 70vh; }
.auth-card { width: 100%; max-width: 420px; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 2rem; box-shadow: var(--shadow-md); }
.auth-header { text-align: center; margin-bottom: 1.5rem; }
.auth-header .logo-img-lg { margin-bottom: 0.5rem; }
.auth-header .logo-wordmark-img { margin: 0 auto 0.75rem; }
.auth-header h1 { font-size: 1.5rem; margin-top: 0.5rem; }
.auth-footer { text-align: center; margin-top: 1.5rem; font-size: 0.95rem; color: var(--muted); }

/* Dashboard */
.dashboard { padding: 1.5rem 0 3rem; }
.dashboard-header { display: flex; flex-direction: column; gap: 1rem; margin-bottom: 1.5rem; }
.tabs { display: flex; gap: 0.25rem; overflow-x: auto; border-bottom: 1px solid var(--border); margin-bottom: 1.25rem; }
.tab { padding: 0.75rem 1rem; background: none; border: none; border-bottom: 2px solid transparent; font-weight: 600; color: var(--muted); cursor: pointer; white-space: nowrap; }
.tab.active { color: var(--teal); border-bottom-color: var(--teal); }
.tab-panel[hidden] { display: none; }
.thread-list { display: flex; flex-direction: column; gap: 0.75rem; }
.thread-item { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-md); }
.thread-item a { display: block; padding: 1rem; color: inherit; }
.thread-title { font-weight: 600; }
.thread-meta { font-size: 0.875rem; color: var(--muted); }
.subscription-status-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1.25rem; margin-bottom: 1.5rem; }
.tier-grid { display: grid; gap: 1rem; margin-bottom: 1.5rem; }
.tier-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1.25rem; text-align: center; }
.tier-price { font-size: 1.75rem; font-weight: 800; color: var(--teal); }
.tier-price .period { font-size: 1rem; font-weight: 500; color: var(--muted); }
.tier-limit { margin-bottom: 1rem; }
.data-table { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.data-table th, .data-table td { padding: 0.75rem; text-align: left; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
.data-table th { background: var(--warm-white); font-weight: 700; }

/* Browse */
.browse-layout { display: grid; gap: 1.5rem; padding: 1.5rem 0 3rem; }
.browse-sidebar { order: 2; }
.browse-results { order: 1; }
.filters { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1.25rem; display: flex; flex-direction: column; gap: 1.25rem; }
.filter-group h3 { font-size: 0.95rem; margin-bottom: 0.5rem; }
.filter-group select, .filter-group input[type="number"] { width: 100%; padding: 0.6rem; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--card); }
.results-header { margin-bottom: 1.25rem; }
.results-header h1 { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; font-size: 1.5rem; }
.heading-country { font-weight: 500; color: var(--muted); font-size: 1rem; }
.results-count, .search-term { color: var(--muted); margin-top: 0.25rem; }
.pagination { display: flex; justify-content: center; align-items: center; gap: 0.5rem; margin-top: 1.5rem; flex-wrap: wrap; }
.page-numbers { display: flex; gap: 0.25rem; }
.page-link { display: inline-flex; align-items: center; justify-content: center; min-width: 36px; height: 36px; padding: 0 0.6rem; border-radius: var(--radius-md); border: 1px solid var(--border); background: var(--card); color: var(--ink); font-weight: 600; }
.page-link.current { background: var(--teal); color: #fff; border-color: var(--teal); }
.page-link.disabled { opacity: 0.5; cursor: not-allowed; }

/* Callouts & alerts */
.callout { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1rem 1.25rem; margin-bottom: 1.25rem; }
.callout-cash { background: #fffbeb; border-color: var(--gold); }
.callout-info { background: #eff6ff; border-color: #93c5fd; }
.callout.hidden { display: none; }
.flash-container { position: fixed; top: 76px; right: 1rem; left: 1rem; z-index: 200; display: flex; flex-direction: column; gap: 0.5rem; pointer-events: none; }
.alert { pointer-events: auto; padding: 0.85rem 1rem; border-radius: var(--radius-md); display: flex; align-items: center; justify-content: space-between; gap: 1rem; box-shadow: var(--shadow-md); }
.alert-info { background: #eff6ff; color: #1e3a8a; }
.alert-success { background: #d1fae5; color: #065f46; }
.alert-error { background: #fee2e2; color: #991b1b; }
.alert-close { background: none; border: none; font-size: 1.25rem; cursor: pointer; color: inherit; }

/* Modals */
.modal { position: fixed; inset: 0; z-index: 300; width: 100%; height: 100%; border: none; padding: 1rem; background: transparent; }
.modal[open] { display: flex; align-items: center; justify-content: center; background: rgba(31,41,55,0.5); }
.modal::backdrop { background: rgba(31,41,55,0.5); }
.modal-content { background: var(--card); border-radius: var(--radius-lg); padding: 1.5rem; width: 100%; max-width: 460px; box-shadow: var(--shadow-lg); }
.modal-content h2 { margin-bottom: 0.5rem; }
.modal-content .field { margin-top: 1rem; }
.modal-actions { display: flex; justify-content: flex-end; gap: 0.75rem; margin-top: 1.25rem; }

/* Empty states */
.empty-state { text-align: center; padding: 2.5rem 1rem; color: var(--muted); }
.empty-icon { font-size: 3rem; }
.empty-state h2 { color: var(--ink); margin: 0.75rem 0 0.5rem; }
.empty-state .btn { margin-top: 1rem; }

/* Sell banner */
.sell-banner { background: var(--teal); color: #fff; padding: 2rem 0; margin-top: 1rem; }
.sell-banner-inner { display: flex; flex-direction: column; gap: 1rem; align-items: flex-start; }
.sell-banner h2 { color: #fff; }
.sell-banner p { opacity: 0.9; }
.sell-banner .btn-secondary { background: #fff; color: var(--teal); }

/* Footer */
.site-footer { background: var(--warm-white); border-top: 1px solid var(--border); padding: 2.5rem 0 1.5rem; }
.footer-grid { display: grid; grid-template-columns: 1fr; gap: 1.75rem; margin-bottom: 2rem; }
.footer-brand .tagline { color: var(--muted); margin-top: 0.25rem; }
.footer-links h3 { font-size: 1rem; margin-bottom: 0.5rem; }
.footer-links a { display: block; padding: 0.2rem 0; color: var(--muted); font-size: 0.95rem; }
.footer-small { border-top: 1px solid var(--border); padding-top: 1.25rem; font-size: 0.85rem; color: var(--muted); }
.footer-small p + p { margin-top: 0.25rem; }

/* Content pages */
.content-page { padding: 1.5rem 0 3rem; }
.content-page h2 { margin-top: 1.5rem; margin-bottom: 0.75rem; }
.content-page ol, .content-page ul { padding-left: 1.25rem; margin-bottom: 1rem; }
.content-page ol { list-style: decimal; }
.content-page ul { list-style: disc; }
.content-page li { margin-bottom: 0.35rem; }

/* Utilities */
.flex { display: flex; } .gap-1 { gap: 0.5rem; } .gap-2 { gap: 1rem; }
.mt-1 { margin-top: 0.5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 1.5rem; }
.hidden { display: none !important; }

/* Chat / messaging thread */
.conversation-page {
  position: relative;
  padding-bottom: 0;
}

.thread-header {
  position: sticky;
  top: 64px;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0;
  margin-bottom: 0.5rem;
  background: var(--page-bg);
  border-bottom: 1px solid var(--border);
}

.thread-back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--ink);
  font-size: 1.1rem;
  flex-shrink: 0;
}

.thread-back:hover { background: var(--warm-white); text-decoration: none; }

.thread-contact {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
  flex: 1;
}

.thread-avatar { width: 40px; height: 40px; font-size: 1rem; flex-shrink: 0; }

.thread-info { min-width: 0; }

.thread-name {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.3;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.thread-country {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--muted);
  background: var(--card);
  border: 1px solid var(--border);
  padding: 0.15rem 0.4rem;
  border-radius: 999px;
}

.thread-header .verified-chips { margin-top: 0.2rem; }

/* Listing context pill above thread */
.listing-context-pill {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0.6rem 0.85rem;
  margin-bottom: 0.75rem;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .2s ease, transform .15s ease;
}

.listing-context-pill:hover {
  text-decoration: none;
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.listing-context-pill img {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  object-fit: cover;
  background: var(--warm-white);
  flex-shrink: 0;
}

.pill-body {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.pill-title {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pill-price {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--teal);
}

/* Conversation thread */
.conversation-thread {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.5rem 0 160px;
}

.message-row {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  max-width: 100%;
}

.message-row--mine { justify-content: flex-end; }
.message-row--theirs { justify-content: flex-start; }

.message-row:last-child,
.chat-empty { scroll-margin-bottom: 150px; }

.message-avatar,
.message-avatar-spacer {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  flex-shrink: 0;
  align-self: flex-start;
  margin-top: 0.25rem;
}

.message-avatar {
  background: var(--teal);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
}

.message-avatar-spacer { background: transparent; }

.message-content {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  max-width: calc(100% - 40px);
  min-width: 0;
}

.message-row--mine .message-content { align-items: flex-end; }
.message-row--theirs .message-content { align-items: flex-start; }

.message-name {
  font-size: 0.75rem;
  color: var(--muted);
  margin-left: 0.25rem;
}

.message-bubble {
  position: relative;
  padding: 0.65rem 0.85rem;
  font-size: 0.95rem;
  line-height: 1.45;
  word-wrap: break-word;
  max-width: 100%;
}

.bubble--mine {
  background: linear-gradient(135deg, var(--teal) 0%, var(--teal-dark) 100%);
  color: #fff;
  border-radius: 18px 18px 18px 4px;
}

.bubble--theirs {
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--border);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.7), 0 1px 2px rgba(31,41,55,0.04);
  border-radius: 18px 18px 4px 18px;
}

.message-body {
  margin: 0;
  white-space: pre-wrap;
}

.message-time {
  display: block;
  font-size: 0.7rem;
  margin-top: 0.35rem;
  opacity: 0.85;
}

.bubble--mine .message-time {
  text-align: right;
  color: rgba(255,255,255,0.9);
}

.bubble--theirs .message-time {
  text-align: left;
  color: var(--muted);
}

.message-read {
  font-size: 0.7rem;
  color: var(--muted);
  margin-right: 0.25rem;
}

.message-row--theirs .message-read { display: none; }

.day-separator {
  position: relative;
  text-align: center;
  font-size: 0.75rem;
  color: var(--muted);
  margin: 0.75rem 0 0.25rem;
}

.day-separator span {
  position: relative;
  z-index: 1;
  background: var(--page-bg);
  padding: 0 0.6rem;
}

.day-separator::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 1px;
  background: var(--border);
  z-index: 0;
}

/* Empty state inside chat */
.chat-empty {
  margin: auto 0;
  padding: 2rem 1rem;
}

/* Composer */
.conversation-composer {
  position: sticky;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 60;
  padding: 0.75rem 0 calc(0.75rem + env(safe-area-inset-bottom));
  background: var(--page-bg);
  border-top: 1px solid var(--border);
}

.composer-field {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0.5rem;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .2s ease, border-color .2s ease;
}

.composer-field:focus-within {
  box-shadow: var(--shadow-md);
  border-color: var(--teal);
}

.conversation-composer textarea {
  flex: 1 1 auto;
  resize: none;
  border: 0;
  background: transparent;
  padding: 0.45rem 0.5rem;
  max-height: 120px;
  line-height: 1.4;
}

.conversation-composer textarea:focus {
  outline: none;
  box-shadow: none;
}

.composer-send {
  flex: 0 0 auto;
  padding: 0.55rem 1rem;
  border-radius: var(--radius-md);
}

.composer-hint {
  font-size: 0.75rem;
  color: var(--muted);
  text-align: center;
  margin-top: 0.4rem;
}

/* Responsive chat */
@media (min-width: 640px) {
  .message-content { max-width: 420px; }
  .bubble--mine { border-radius: 20px 20px 20px 6px; }
  .bubble--theirs { border-radius: 20px 20px 6px 20px; }
}

@media (min-width: 1024px) {
  .thread-header { top: 72px; }
  .message-content { max-width: 520px; }
}

/* Responsive */
@media (min-width: 640px) {
  .hero-search { flex-direction: row; }
  .hero-search .search-input { flex: 1; }
  .feature-grid { grid-template-columns: repeat(3,1fr); }
  .category-grid { grid-template-columns: repeat(3,1fr); }
  .listing-grid { grid-template-columns: repeat(2,1fr); }
  .row-2 { flex-direction: row; }
  .row-2 > * { flex: 1; }
  .action-buttons { flex-direction: row; flex-wrap: wrap; }
  .sell-banner-inner { flex-direction: row; align-items: center; justify-content: space-between; }
  .tier-grid { grid-template-columns: repeat(3,1fr); }
}

@media (min-width: 1024px) {
  .nav-toggle { display: none; }
  .main-nav { position: static; display: flex !important; flex-direction: row; align-items: center; justify-content: space-between; flex: 1; padding: 0; border: none; box-shadow: none; margin-left: 2rem; }
  .nav-list { flex-direction: row; align-items: center; gap: 1.25rem; }
  .dropdown { position: absolute; top: 100%; left: 0; min-width: 220px; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 0.5rem; box-shadow: var(--shadow-md); padding-left: 0.5rem; }
  .header-tools { flex-direction: row; padding-top: 0; border-top: none; }
  .category-grid { grid-template-columns: repeat(4,1fr); }
  .listing-grid { grid-template-columns: repeat(3,1fr); }
  .listing-grid.compact { grid-template-columns: repeat(2,1fr); }
  .listing-detail-grid { grid-template-columns: 1.2fr 0.8fr; align-items: start; }
  .browse-layout { grid-template-columns: 260px 1fr; }
  .browse-sidebar { order: 1; }
  .browse-results { order: 2; }
  .footer-grid { grid-template-columns: 2fr 1fr 1fr 1fr; }
}

@media (min-width: 1280px) {
  .listing-grid { grid-template-columns: repeat(4,1fr); }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
