/* Barterra theme. Warm, light, phone first. Dark mode follows the device.
   Class names are kept from the old stylesheet so every template keeps working. */

:root {
  color-scheme: light;
  --ground: #FBF7F1;
  --surface: #FFFFFF;
  --surface-2: #F3EBDF;
  --line: #E6DCCB;
  --line-strong: #D5C8B3;
  --ink: #1F2A22;
  --muted: #6B7568;
  --moss: #3E7C4F;      --moss-soft: #E3F0E4;  --moss-ink: #245A35;  --on-moss: #FFFFFF;
  --clay: #D9743F;      --clay-soft: #FBE7DA;  --clay-ink: #9E4A1E;  --on-clay: #1F2A22;
  --honey: #E9B44C;     --honey-soft: #FBF0D3; --honey-ink: #7A5410;
  --sky: #5C93B8;       --sky-soft: #E1EEF7;   --sky-ink: #2E5F80;
  --berry: #B8474F;     --berry-soft: #F8E1E3; --berry-ink: #8F2F37; --on-berry: #FFFFFF;
  --shadow: 0 8px 24px rgba(60, 40, 20, .10);
  --shadow-sm: 0 2px 8px rgba(60, 40, 20, .08);
  --radius: 16px;
  --radius-sm: 10px;
  --pill: 999px;
  --display: "Fredoka", "Nunito Sans", "Segoe UI", system-ui, sans-serif;
  --body: "Nunito Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  --tabbar-h: 64px;

  /* Old token names. A few templates use these in inline styles. */
  --primary: var(--moss);
  --primary-dim: var(--moss-ink);
  --primary-bg: var(--moss-soft);
  --primary-glow: none;
  --bg: var(--ground);
  --border: var(--line);
  --border-strong: var(--line-strong);
  --text: var(--ink);
  --text-muted: var(--muted);
  --text-bright: var(--ink);
  --accent: var(--clay);
  --danger: var(--berry);
  --success: var(--moss);
  --font: var(--body);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --ground: #171C18;
    --surface: #222A24;
    --surface-2: #2B342D;
    --line: #38433A;
    --line-strong: #4A5749;
    --ink: #EEF2EC;
    --muted: #9AA69B;
    --moss: #6FB57F;    --moss-soft: #25392B;  --moss-ink: #BFE5C7;  --on-moss: #0F1A12;
    --clay: #E98B58;    --clay-soft: #43291C;  --clay-ink: #F8C7A9;  --on-clay: #1A0F08;
    --honey: #F0C466;   --honey-soft: #403418; --honey-ink: #F6E2A8;
    --sky: #7FB0D0;     --sky-soft: #1F3040;   --sky-ink: #BFD9EA;
    --berry: #E07A82;   --berry-soft: #452428; --berry-ink: #F3B4B9; --on-berry: #1A0C0D;
    --shadow: 0 8px 24px rgba(0, 0, 0, .40);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, .35);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --ground: #171C18;
  --surface: #222A24;
  --surface-2: #2B342D;
  --line: #38433A;
  --line-strong: #4A5749;
  --ink: #EEF2EC;
  --muted: #9AA69B;
  --moss: #6FB57F;    --moss-soft: #25392B;  --moss-ink: #BFE5C7;  --on-moss: #0F1A12;
  --clay: #E98B58;    --clay-soft: #43291C;  --clay-ink: #F8C7A9;  --on-clay: #1A0F08;
  --honey: #F0C466;   --honey-soft: #403418; --honey-ink: #F6E2A8;
  --sky: #7FB0D0;     --sky-soft: #1F3040;   --sky-ink: #BFD9EA;
  --berry: #E07A82;   --berry-soft: #452428; --berry-ink: #F3B4B9; --on-berry: #1A0C0D;
  --shadow: 0 8px 24px rgba(0, 0, 0, .40);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, .35);
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--body);
  background: var(--ground);
  color: var(--ink);
  line-height: 1.55;
  min-height: 100vh;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
}
h1, h2, h3, h4 { font-family: var(--display); font-weight: 600; line-height: 1.15; text-wrap: balance; color: var(--ink); }
h1 { font-size: 1.9rem; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.1rem; }
p { margin: 0; }
a { color: var(--moss-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--honey); outline-offset: 2px; border-radius: 6px; }
.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; }
.skip-link { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; border-radius: 8px; z-index: 1000; }
.skip-link:focus { left: 8px; }
.container { max-width: 1200px; margin: 0 auto; padding: 0 16px; }
main.container { padding-top: 16px; }
@media (min-width: 768px) {
  body { padding-bottom: 0; }
  .container { padding: 0 24px; }
  main.container { padding-top: 24px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 100;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner { display: flex; align-items: center; gap: 12px; height: 60px; }
.brand { display: flex; align-items: center; gap: 8px; font-family: var(--display); font-weight: 700; font-size: 1.25rem; color: var(--moss-ink); white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand svg { width: 26px; height: 26px; }
.topbar-search { display: none; flex: 0 1 380px; align-items: center; gap: 8px; background: var(--ground); border: 1px solid var(--line); border-radius: var(--pill); padding: 0 14px; height: 42px; }
.topbar-search svg { width: 18px; height: 18px; color: var(--muted); flex: none; }
.topbar-search input { flex: 1; min-width: 0; background: none; border: 0; height: 100%; outline: none; }
.topbar-search input::placeholder { color: var(--muted); }
.topbar-links { display: none; align-items: center; gap: 20px; margin-left: 8px; }
.topbar-links a { font-weight: 700; color: var(--ink); position: relative; }
.topbar-links a.on { color: var(--moss-ink); }
.topbar-links a:hover { text-decoration: none; color: var(--moss-ink); }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.topbar-actions .btn-clay { display: none; }
.avatar-link {
  width: 38px; height: 38px; border-radius: 50%; background: var(--moss); color: var(--on-moss);
  display: grid; place-items: center; font-family: var(--display); font-weight: 700; font-size: 1rem;
}
.avatar-link:hover { text-decoration: none; }
.badge {
  display: inline-block; background: var(--berry); color: var(--on-berry); font-size: .65rem; font-weight: 700;
  padding: 1px 6px; border-radius: var(--pill); margin-left: 5px; vertical-align: 2px; line-height: 1.5;
}
@media (min-width: 768px) {
  .topbar-inner { height: 68px; gap: 20px; }
  .topbar-search { display: flex; }
  .topbar-links { display: flex; }
  .topbar-actions .btn-clay { display: inline-flex; }
}
@media (min-width: 1024px) {
  .topbar-links { gap: 26px; }
}

/* ---------- bottom tab bar (phones) ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 100;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--surface); border-top: 1px solid var(--line);
  display: grid; grid-template-columns: repeat(5, 1fr); align-items: end;
}
.tab {
  display: grid; justify-items: center; gap: 3px; padding: 8px 4px 10px;
  font-size: .68rem; font-weight: 700; color: var(--muted); text-decoration: none; min-height: 44px;
}
.tab:hover { text-decoration: none; }
.tab svg { width: 24px; height: 24px; }
.tab.on { color: var(--moss-ink); }
.tab-icon { position: relative; display: inline-block; }
.tab-icon .badge { position: absolute; top: -6px; right: -12px; margin: 0; }
.tab-post .plus {
  width: 54px; height: 54px; border-radius: 50%; background: var(--clay); color: var(--on-clay);
  display: grid; place-items: center; margin-top: -30px; box-shadow: 0 6px 16px rgba(217, 116, 63, .45);
}
.tab-post .plus svg { width: 26px; height: 26px; }
.tab-post { color: var(--clay-ink); }
@media (min-width: 768px) { .tabbar { display: none; } }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 18px; border-radius: 14px; border: 1px solid transparent;
  cursor: pointer; font-family: var(--display); font-weight: 600; font-size: 1rem;
  text-decoration: none; text-align: center; transition: transform .12s ease, background .15s ease, box-shadow .15s ease;
  background: var(--surface); color: var(--ink);
}
.btn:hover { text-decoration: none; }
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--moss); color: var(--on-moss); border-color: var(--moss); box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--moss-ink); border-color: var(--moss-ink); color: var(--on-moss); }
.btn-clay { background: var(--clay); color: var(--on-clay); border-color: var(--clay); box-shadow: var(--shadow-sm); }
.btn-clay:hover { filter: brightness(.95); color: var(--on-clay); }
.btn-outline { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.btn-outline:hover { border-color: var(--moss); color: var(--moss-ink); }
.btn-danger { background: var(--berry); color: var(--on-berry); border-color: var(--berry); }
.btn-danger:hover { filter: brightness(.95); color: var(--on-berry); }
.btn-sm { min-height: 36px; padding: 6px 12px; font-size: .9rem; border-radius: 10px; }
.btn-lg { min-height: 52px; padding: 12px 24px; font-size: 1.1rem; }
.full-width { width: 100%; }

/* ---------- hero (home) ---------- */
.hero { padding: 24px 0 8px; text-align: left; }
.hero h1 { font-size: 1.6rem; margin-bottom: 6px; }
.hero p { color: var(--muted); font-size: 1.05rem; margin-bottom: 18px; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.hero-search { display: flex; gap: 8px; max-width: 560px; }
.search-input {
  flex: 1; min-width: 0; min-height: 48px; padding: 10px 16px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--pill); font-size: 1rem; box-shadow: var(--shadow-sm);
}
.search-input:focus { outline: none; border-color: var(--moss); box-shadow: 0 0 0 3px var(--moss-soft); }
.search-input::placeholder { color: var(--muted); }
@media (min-width: 768px) {
  .hero { padding: 40px 0 16px; }
  .hero h1 { font-size: 2.3rem; }
}

/* ---------- sections: big headings, a clay accent bar, and room to breathe ---------- */
.section { margin: 48px 0; }
.section-title, .page-heading,
.detail-body h2, .detail-map-section h2, .profile-edit h2, .profile-listings h2 {
  font-family: var(--display); font-size: 1.4rem; font-weight: 600; margin: 0 0 18px;
  color: var(--ink); display: flex; align-items: baseline; gap: 10px; line-height: 1.2;
  padding-left: 14px; border-left: 5px solid var(--clay);
}
.urgent-title { color: var(--berry); border-left-color: var(--berry); }
.center-action { text-align: center; margin-top: 22px; }
@media (min-width: 768px) {
  .section { margin: 72px 0; }
  .section-title, .page-heading,
  .detail-body h2, .detail-map-section h2, .profile-edit h2, .profile-listings h2 { font-size: 1.7rem; margin-bottom: 22px; }
}

/* ---------- category grid ---------- */
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.cat-card {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; color: var(--ink);
  font-size: .78rem; font-weight: 700; text-align: center; line-height: 1.25; transition: transform .12s ease, box-shadow .15s ease;
}
.cat-card:hover { text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow-sm); border-color: var(--moss); }
.cat-icon { font-size: 1.5rem; line-height: 1; }
@media (min-width: 768px) { .cat-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); } }

/* ---------- listing cards ---------- */
.listing-grid { display: grid; grid-template-columns: 1fr; gap: 18px; }
@media (min-width: 560px) { .listing-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 900px) { .listing-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1200px) { .listing-grid { grid-template-columns: repeat(4, 1fr); } }
.listing-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  color: var(--ink); overflow: hidden; position: relative; display: flex; flex-direction: column;
  transition: transform .12s ease, box-shadow .15s ease, border-color .15s ease;
}
.listing-card:hover { text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--line-strong); }
.card-type {
  display: inline-block; padding: 3px 10px; font-size: .72rem; font-weight: 700; border-radius: 8px;
  margin: 12px 12px 0; align-self: flex-start;
}
.type-offer { background: var(--moss-soft); color: var(--moss-ink); }
.type-request { background: var(--clay-soft); color: var(--clay-ink); }
.type-skill { background: var(--honey-soft); color: var(--honey-ink); }
.type-mutual_aid { background: var(--berry-soft); color: var(--berry-ink); }
.type-free { background: var(--sky-soft); color: var(--sky-ink); }
.card-img { height: 170px; background-size: cover; background-position: center; background-color: var(--surface-2); margin-top: 10px; }
.card-img-pending { display: flex; align-items: center; justify-content: center; }
.card-img-pending::after { content: 'Photo is being checked'; color: var(--muted); font-size: .8rem; }
.card-body { padding: 12px; flex: 1; display: flex; flex-direction: column; gap: 4px; }
.card-title { font-family: var(--display); font-size: 1.05rem; font-weight: 600; color: var(--ink); }
.card-meta { font-size: .82rem; color: var(--muted); }
.card-desc { font-size: .92rem; color: var(--ink); flex: 1; }
.card-terms { font-size: .85rem; color: var(--clay-ink); font-weight: 600; }
.card-footer { display: flex; justify-content: space-between; margin-top: 6px; font-size: .78rem; color: var(--muted); padding-top: 8px; border-top: 1px solid var(--line); }
.urgent-badge {
  position: absolute; top: 10px; right: 10px; background: var(--berry); color: var(--on-berry);
  font-size: .68rem; padding: 3px 8px; font-weight: 700; border-radius: var(--pill);
}
.distance-badge {
  display: inline-block; background: var(--surface-2); color: var(--muted); padding: 1px 8px;
  border-radius: var(--pill); font-size: .75rem; font-weight: 700; margin-left: 4px;
}
.distance-badge-lg { font-size: .85rem; padding: 3px 10px; }

/* ---------- listing detail ---------- */
.listing-detail { max-width: 820px; margin: 0 auto 32px; }
.listing-detail h1 { font-size: 1.6rem; margin: 6px 0 8px; }
.detail-header { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.detail-type { padding: 4px 12px; font-weight: 700; font-size: .8rem; border-radius: 8px; }
.detail-status { font-size: .8rem; color: var(--muted); font-weight: 700; }
.status-completed { color: var(--moss-ink); }
.detail-meta { color: var(--muted); font-size: .9rem; margin-bottom: 16px; }
.detail-images { display: flex; gap: 10px; overflow-x: auto; margin-bottom: 16px; padding-bottom: 6px; scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; }
.detail-img { max-height: 420px; border-radius: var(--radius); object-fit: contain; border: 1px solid var(--line); scroll-snap-align: start; background: var(--surface-2); }
.scan-notice { color: var(--clay-ink); font-size: .9rem; margin-bottom: 12px; }
.detail-body { margin-bottom: 18px; line-height: 1.7; font-size: 1.02rem; max-width: 65ch; }
.detail-terms { background: var(--clay-soft); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 18px; }
.detail-terms h3 { font-size: .78rem; color: var(--clay-ink); margin-bottom: 4px; letter-spacing: .06em; text-transform: uppercase; font-family: var(--body); font-weight: 700; }
.detail-terms p { font-size: 1.02rem; }
.detail-condition { color: var(--muted); margin-bottom: 18px; font-size: .95rem; }
.detail-actions { display: flex; gap: 10px; margin-bottom: 24px; flex-wrap: wrap; }
.detail-map-section { margin-bottom: 18px; }
.detail-map-section h3 { margin-bottom: 8px; }
.detail-map { height: 260px; border-radius: var(--radius); border: 1px solid var(--line); overflow: hidden; }
.map-disclaimer { font-size: .82rem; color: var(--muted); margin-top: 6px; }
.safety-notice { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin: 20px 0; font-size: .92rem; line-height: 1.6; }
.safety-notice h3 { font-size: 1rem; margin-bottom: 6px; color: var(--ink); }
.safety-notice ul { margin: 0; padding-left: 20px; }
.safety-notice li { margin: 3px 0; }
.disclaimer-banner { background: var(--honey-soft); color: var(--honey-ink); border-radius: var(--radius); padding: 12px 16px; margin: 0 0 20px; font-size: .92rem; line-height: 1.55; }

/* ---------- share panel ---------- */
.share-panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-top: 16px; }
.share-panel h3 { font-size: 1rem; margin-bottom: 10px; }
.share-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.share-btn {
  display: inline-flex; align-items: center; min-height: 36px; padding: 6px 12px; background: var(--surface-2);
  border: 1px solid transparent; border-radius: var(--pill); color: var(--ink); font-size: .85rem; font-weight: 700; cursor: pointer;
}
.share-btn:hover { border-color: var(--moss); color: var(--moss-ink); text-decoration: none; }

/* ---------- forms ---------- */
.form-page { max-width: 720px; margin: 0 auto 32px; }
.form-page h1 { margin-bottom: 18px; }
.form-section { margin-bottom: 18px; }
.form-label { display: block; font-weight: 700; margin-bottom: 6px; font-size: .92rem; color: var(--ink); }
.form-input, .listing-form select, .listing-form textarea, .listing-form input[type=text],
.auth-form input[type=text], .auth-form input[type=password], .auth-form input[type=email], .auth-form textarea {
  width: 100%; min-height: 46px; padding: 10px 14px; background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: 12px; font-size: 1rem; color: var(--ink);
}
.listing-form textarea, .auth-form textarea { resize: vertical; min-height: 100px; }
.form-input:focus, .listing-form select:focus, .listing-form textarea:focus, .listing-form input:focus, .auth-form input:focus, .auth-form textarea:focus {
  outline: none; border-color: var(--moss); box-shadow: 0 0 0 3px var(--moss-soft);
}
.form-row { display: flex; gap: 12px; }
.form-row .half { flex: 1; }
.form-help { font-size: .85rem; color: var(--muted); margin-top: 5px; }
.form-error { font-size: .88rem; color: var(--berry); margin-top: 5px; font-weight: 700; }
.form-actions { display: flex; gap: 12px; margin-top: 20px; flex-wrap: wrap; }
.type-selector { display: flex; flex-wrap: wrap; gap: 8px; }
.type-btn {
  display: inline-flex; align-items: center; min-height: 44px; padding: 8px 16px; background: var(--surface);
  border: 2px solid var(--line); border-radius: 12px; cursor: pointer; font-weight: 700; font-size: .95rem; color: var(--ink);
  transition: border-color .12s ease, background .12s ease;
}
.type-btn:hover { border-color: var(--moss); }
.type-btn.active, .type-btn:has(input:checked) { border-color: var(--moss); background: var(--moss-soft); color: var(--moss-ink); }
.type-btn input { position: absolute; opacity: 0; width: 0; height: 0; }
.form-map { height: 280px; border-radius: var(--radius); border: 1px solid var(--line); margin-top: 8px; overflow: hidden; }
.upload-zone {
  border: 2px dashed var(--line-strong); border-radius: var(--radius); padding: 28px 16px; text-align: center;
  cursor: pointer; position: relative; background: var(--surface);
}
.upload-zone:hover { border-color: var(--moss); background: var(--moss-soft); }
.upload-zone p { color: var(--muted); font-size: .95rem; }
.upload-input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.image-preview-grid { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.image-preview-grid img { width: 88px; height: 88px; object-fit: cover; border-radius: 12px; border: 1px solid var(--line); }
.existing-image { display: inline-flex; align-items: center; gap: 8px; margin: 4px; }
.existing-image img { width: 64px; height: 64px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); }
.img-pending { width: 64px; height: 64px; background: var(--surface-2); display: grid; place-items: center; border-radius: 10px; font-size: .7rem; color: var(--muted); text-align: center; }

/* ---------- auth ---------- */
.auth-page { max-width: 440px; margin: 16px auto 32px; }
.auth-page h1 { text-align: center; margin-bottom: 6px; font-size: 1.6rem; }
.auth-subtitle { text-align: center; color: var(--muted); margin-bottom: 18px; }
.auth-form { background: var(--surface); padding: 22px; border-radius: var(--radius); border: 1px solid var(--line); box-shadow: var(--shadow-sm); }
.auth-alt { text-align: center; margin-top: 14px; font-size: .95rem; color: var(--muted); }
.auth-alt a { font-weight: 700; }
.sso-section { border-top: 1px solid var(--line); margin-top: 18px; padding-top: 18px; text-align: center; }
.sso-section p { font-size: .85rem; color: var(--muted); margin-bottom: 10px; font-weight: 700; }
.sso-divider { display: flex; align-items: center; gap: 12px; margin: 16px 0; color: var(--muted); font-size: .85rem; }
.sso-divider::before, .sso-divider::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.btn-sso {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 10px 22px;
  background: var(--surface); border: 2px solid var(--moss); color: var(--moss-ink); border-radius: 14px;
  font-family: var(--display); font-weight: 600; font-size: 1rem; cursor: pointer;
}
.btn-sso:hover { background: var(--moss); color: var(--on-moss); text-decoration: none; }

/* ---------- messages ---------- */
.messages-page { max-width: 760px; margin: 0 auto 32px; }
.messages-page h1 { margin-bottom: 24px; }
.convo-list { display: flex; flex-direction: column; gap: 8px; }
.convo-card {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 14px; color: var(--ink); min-height: 64px;
}
.convo-card:hover { text-decoration: none; border-color: var(--moss); }
.convo-unread { border-left: 4px solid var(--moss); }
.convo-info { flex: 0 1 auto; min-width: 0; }
.convo-info strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; font-family: var(--display); font-weight: 600; }
.convo-with { font-size: .82rem; color: var(--muted); }
.convo-preview { flex: 1; min-width: 0; font-size: .92rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.convo-meta { flex: 0 0 auto; font-size: .78rem; color: var(--muted); text-align: right; white-space: nowrap; }
.thread-page { max-width: 760px; margin: 0 auto 32px; }
.thread-header { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.thread-header div { flex: 1; min-width: 160px; }
.thread-header h2 { font-size: 1.1rem; }
.thread-with { font-size: .9rem; color: var(--muted); }
.thread-messages { max-height: 60vh; overflow-y: auto; margin-bottom: 12px; padding: 4px; display: flex; flex-direction: column; gap: 10px; }
.message { max-width: 82%; }
.msg-mine { align-self: flex-end; }
.msg-theirs { align-self: flex-start; }
.msg-meta { font-size: .72rem; color: var(--muted); margin-bottom: 3px; display: flex; gap: 8px; }
.msg-mine .msg-meta { justify-content: flex-end; }
.msg-body { padding: 10px 14px; border-radius: 18px; line-height: 1.45; font-size: .98rem; }
.msg-mine .msg-body { background: var(--moss); color: var(--on-moss); border-bottom-right-radius: 6px; }
.msg-theirs .msg-body { background: var(--surface); border: 1px solid var(--line); border-bottom-left-radius: 6px; }
.thread-form { display: flex; gap: 8px; align-items: flex-end; }
.thread-form textarea {
  flex: 1; min-height: 46px; padding: 10px 14px; background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: 22px; font-size: 1rem; resize: none;
}
.thread-form textarea:focus { outline: none; border-color: var(--moss); box-shadow: 0 0 0 3px var(--moss-soft); }

/* ---------- profile ---------- */
.profile-page { max-width: 900px; margin: 0 auto 32px; }
.profile-header { margin-bottom: 22px; }
.profile-header h1 { font-size: 1.6rem; }
.profile-name { font-size: 1rem; color: var(--muted); }
.profile-bio { margin-top: 8px; max-width: 65ch; }
.profile-since { font-size: .85rem; color: var(--muted); margin-top: 4px; }
.profile-sections { display: grid; gap: 28px; }
.profile-edit { background: var(--surface); padding: 20px; border-radius: var(--radius); border: 1px solid var(--line); }
.profile-sections { gap: 40px; }
@media (min-width: 900px) { .profile-sections { grid-template-columns: 340px 1fr; align-items: start; } }

/* ---------- filters (browse) ---------- */
.browse-page h1 { margin-bottom: 14px; }
.filters {
  display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; padding: 12px;
  background: var(--surface); border-radius: var(--radius); border: 1px solid var(--line);
}
.filters .form-input, .filters select {
  flex: 1 1 140px; min-height: 42px; padding: 8px 12px; background: var(--ground); border: 1px solid var(--line);
  border-radius: var(--pill); font-size: .95rem; width: auto;
}
.filters .btn { flex: 1 1 120px; }

/* ---------- pagination ---------- */
.pagination { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 24px; flex-wrap: wrap; }
.page-info { color: var(--muted); font-size: .9rem; }

/* ---------- alerts ---------- */
.alert { padding: 12px 16px; border-radius: 14px; margin: 12px 0; font-size: .95rem; font-weight: 600; }
.alert-success { background: var(--moss-soft); color: var(--moss-ink); }
.alert-error { background: var(--berry-soft); color: var(--berry-ink); }
.alert-info { background: var(--sky-soft); color: var(--sky-ink); }
.alert-warning { background: var(--honey-soft); color: var(--honey-ink); }

/* ---------- empty state ---------- */
.empty-state { text-align: center; padding: 40px 16px; color: var(--muted); font-size: 1rem; display: grid; gap: 12px; justify-items: center; }

/* ---------- footer ---------- */
.footer { margin-top: 48px; padding: 24px 0; border-top: 1px solid var(--line); background: var(--surface); }
.footer-inner { display: flex; flex-direction: column; gap: 8px; align-items: center; text-align: center; }
.footer-text { color: var(--muted); font-size: .9rem; }
.footer-links { color: var(--muted); font-size: .85rem; }
.footer-links a { font-weight: 700; }
@media (min-width: 768px) { .footer-inner { flex-direction: row; justify-content: space-between; text-align: left; } }

/* ---------- responsive tweaks ---------- */
@media (max-width: 600px) {
  .form-row { flex-direction: column; gap: 10px; }
  .detail-actions .btn { flex: 1 1 100%; }
  .thread-header { flex-direction: column; align-items: flex-start; }
}

/* ---------- leaflet in the theme ---------- */
.leaflet-container { background: var(--surface-2); font-family: var(--body); }
.leaflet-control-zoom a { background: var(--surface) !important; color: var(--ink) !important; border-color: var(--line) !important; }
.leaflet-popup-content-wrapper { background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 12px; }
.leaflet-popup-tip { background: var(--surface); }

/* ---------- home page ---------- */
.home-hero { padding: 28px 0 8px; display: grid; gap: 14px; }
.home-hero h1 { font-size: 1.65rem; max-width: 22ch; }
.home-hero .lead { color: var(--muted); font-size: 1.05rem; max-width: 50ch; }
.home-hero .hero-search { margin-top: 4px; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; display: inline-flex; align-items: center; min-height: 38px; padding: 6px 14px; border-radius: var(--pill);
  background: var(--surface); border: 1px solid var(--line); color: var(--ink); font-size: .9rem; font-weight: 700; cursor: pointer;
}
.chip:hover { text-decoration: none; border-color: var(--moss); color: var(--moss-ink); }
.chip.on { background: var(--moss); border-color: var(--moss); color: var(--on-moss); }
.section-link { margin-left: auto; font-family: var(--body); font-size: .9rem; font-weight: 700; }
.near-map-wrap { position: relative; margin-bottom: 14px; }
.near-map { height: 150px; border-radius: var(--radius); border: 1px solid var(--line); overflow: hidden; cursor: pointer; background: var(--surface-2); }
.near-map-open { position: absolute; right: 10px; bottom: 10px; z-index: 500; }
.soft-ask {
  display: grid; gap: 12px; padding: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.soft-ask strong { font-family: var(--display); font-size: 1.1rem; font-weight: 600; display: block; margin-bottom: 4px; }
.soft-ask p { color: var(--muted); font-size: .95rem; }
.soft-ask .btn { justify-self: start; }
.soft-ask-note { font-size: .9rem; color: var(--clay-ink); }
.doors { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.door {
  display: grid; justify-items: center; gap: 6px; padding: 14px 6px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 14px; color: var(--ink); font-size: .8rem; font-weight: 700; text-align: center; line-height: 1.2;
  transition: transform .12s ease, box-shadow .15s ease, border-color .15s ease;
}
.door:hover { text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow-sm); border-color: var(--moss); }
.door-icon { font-size: 1.7rem; line-height: 1; }
.all-cats { margin-top: 12px; }
.all-cats summary { cursor: pointer; font-weight: 700; color: var(--moss-ink); padding: 8px 0; list-style: none; display: inline-flex; align-items: center; gap: 6px; }
.all-cats summary::-webkit-details-marker { display: none; }
.all-cats summary::before { content: ''; width: 8px; height: 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg); transition: transform .15s ease; }
.all-cats[open] summary::before { transform: rotate(45deg); }
.all-cats .cat-grid { margin-top: 10px; }
.how { display: grid; gap: 14px; }
.how-step { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px 14px 56px; display: grid; gap: 2px; }
.how-step strong { font-family: var(--display); font-size: 1.05rem; font-weight: 600; }
.how-step p { color: var(--muted); font-size: .95rem; }
.how-num {
  position: absolute; left: 14px; top: 14px; width: 30px; height: 30px; border-radius: 50%; background: var(--clay);
  color: var(--on-clay); display: grid; place-items: center; font-family: var(--display); font-weight: 700;
}
.first-post { background: var(--surface); border: 1px dashed var(--line-strong); border-radius: var(--radius); }
.first-post p { color: var(--ink); max-width: 40ch; }
.safety-tips { margin: 48px 0 8px; background: var(--honey-soft); border-radius: var(--radius); padding: 12px 16px; color: var(--ink); }
.safety-tips summary { cursor: pointer; font-weight: 700; color: var(--honey-ink); min-height: 32px; display: flex; align-items: center; }
.safety-tips ul { margin: 8px 0; padding-left: 20px; line-height: 1.6; }
.safety-fine { font-size: .88rem; color: var(--honey-ink); }
@media (min-width: 768px) {
  .home-hero { padding: 36px 0 12px; }
  .home-hero h1 { font-size: 2.3rem; }
  .near-map { height: 220px; }
  .doors { grid-template-columns: repeat(8, 1fr); }
  .door { font-size: .85rem; padding: 16px 8px; }
  .how { grid-template-columns: repeat(3, 1fr); }
}

/* ---------- browse page ---------- */
.browse-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.browse-head h1 { margin: 0; font-size: 1.5rem; }
.result-count { color: var(--muted); font-weight: 700; }
.view-toggle { margin-left: auto; display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: var(--pill); padding: 3px; }
.view-toggle button { border: 0; background: none; padding: 6px 14px; border-radius: var(--pill); font-weight: 700; color: var(--muted); cursor: pointer; min-height: 36px; }
.view-toggle button.on { background: var(--moss); color: var(--on-moss); }
.browse-controls { display: grid; gap: 10px; margin-bottom: 16px; }
.browse-controls .search-row { display: flex; }
.browse-controls .chip { position: relative; }
.browse-controls .chip input { position: absolute; opacity: 0; width: 0; height: 0; }
.browse-controls .chip:has(input:checked) { background: var(--moss); border-color: var(--moss); color: var(--on-moss); }
.browse-controls .chip:has(input:focus-visible) { outline: 3px solid var(--honey); outline-offset: 2px; }
.select-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.select-row .form-input { min-height: 42px; padding: 8px 12px; border-radius: var(--pill); background: var(--surface); border: 1px solid var(--line); font-size: .95rem; width: 100%; }
.select-row input.form-input { grid-column: 1 / -1; }
.browse-split { display: grid; gap: 16px; }
.browse-map { display: none; }
.browse.show-map .browse-list { display: none; }
.browse.show-map .browse-map { display: block; }
#browse-map { height: calc(100vh - 300px); min-height: 360px; border-radius: var(--radius); border: 1px solid var(--line); overflow: hidden; background: var(--surface-2); }
.pin-icon span { display: block; width: 22px; height: 22px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .3); }
.marker-cluster-small, .marker-cluster-medium, .marker-cluster-large { background: rgba(62, 124, 79, .35); }
.marker-cluster-small div, .marker-cluster-medium div, .marker-cluster-large div { background: var(--moss); color: #fff; font-family: var(--display); font-weight: 700; }
.skeleton-row { display: none; grid-template-columns: 1fr; gap: 14px; margin-top: 14px; }
.skeleton-row.htmx-request { display: grid; opacity: 1; }
.skeleton-card { display: block; height: 200px; border-radius: var(--radius); background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface) 50%, var(--surface-2) 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
#results.htmx-request { opacity: .5; }
.load-more { grid-column: 1 / -1; }
.load-more .skeleton-card { height: 56px; }
.empty-state.wide { grid-column: 1 / -1; }
@media (min-width: 560px) {
  .skeleton-row { grid-template-columns: repeat(2, 1fr); }
  .select-row { grid-template-columns: 1fr 1fr 1fr; }
  .select-row input.form-input { grid-column: auto; }
}
@media (min-width: 1024px) {
  .view-toggle { display: none; }
  .browse-split { grid-template-columns: 1fr 380px; align-items: start; }
  .browse-map { display: block; position: sticky; top: 84px; }
  .browse.show-map .browse-list { display: block; }
  #browse-map { height: calc(100vh - 140px); }
  .browse-list .listing-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1280px) {
  .browse-list .listing-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ---------- listing cards, photo version ---------- */
img.card-img { width: 100%; height: 170px; object-fit: cover; display: block; margin-top: 0; }
.card-img-empty { display: grid; place-items: center; height: 110px; font-size: 2.4rem; margin-top: 0; }
.card-tags { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.card-tags .card-type { margin: 0; }
.card-tags .urgent-badge { position: static; }

/* ---------- listing page ---------- */
.detail-layout { display: grid; gap: 32px; max-width: 1100px; margin: 0 auto 24px; }
.detail-photos { position: relative; }
.carousel { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; border-radius: var(--radius); background: var(--surface-2); scrollbar-width: none; }
.carousel::-webkit-scrollbar { display: none; }
.carousel-slide { flex: 0 0 100%; scroll-snap-align: start; display: grid; place-items: center; aspect-ratio: 4 / 3; max-height: 70vh; }
.carousel-slide img { width: 100%; height: 100%; object-fit: contain; display: block; }
.carousel-dots { position: absolute; left: 0; right: 0; bottom: 10px; display: flex; justify-content: center; gap: 6px; pointer-events: none; }
.carousel-dots i { width: 8px; height: 8px; border-radius: 4px; background: rgba(255, 255, 255, .6); transition: width .15s ease; box-shadow: 0 0 2px rgba(0, 0, 0, .4); }
.carousel-dots i.on { background: #fff; width: 20px; }
.carousel-btn { position: absolute; top: 50%; transform: translateY(-50%); width: 42px; height: 42px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .92); color: #1F2A22; font-size: 1.8rem; line-height: 1; display: none; place-items: center; cursor: pointer; box-shadow: var(--shadow-sm); }
.carousel-btn.prev { left: 10px; }
.carousel-btn.next { right: 10px; }
@media (hover: hover) { .carousel-btn { display: grid; } }
.detail-nophoto { aspect-ratio: 16 / 7; border-radius: var(--radius); background: var(--surface-2); display: grid; place-items: center; align-content: center; gap: 4px; color: var(--muted); }
.detail-nophoto span { font-size: 3rem; line-height: 1; }
.detail-side { display: grid; gap: 14px; }
.detail-tags { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.detail-tags .card-type { margin: 0; }
.detail-tags .urgent-badge { position: static; }
.detail-when { font-size: .82rem; color: var(--muted); }
.status-pill { display: inline-block; padding: 3px 10px; border-radius: var(--pill); background: var(--moss-soft); color: var(--moss-ink); font-size: .78rem; font-weight: 700; }
.detail-title { font-size: 1.6rem; margin: 0; }
.wantbox { background: var(--clay-soft); border-radius: var(--radius); padding: 12px 14px; display: grid; gap: 4px; }
.wantbox small { font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--clay-ink); }
.wantbox p { font-size: 1.02rem; color: var(--ink); }
.wantbox.free { background: var(--sky-soft); }
.wantbox.free small { color: var(--sky-ink); }
.person { display: flex; align-items: center; gap: 10px; color: var(--ink); }
.person:hover { text-decoration: none; }
.person .avatar { width: 42px; height: 42px; border-radius: 50%; background: var(--moss); color: var(--on-moss); display: grid; place-items: center; font-family: var(--display); font-weight: 700; font-size: 1.1rem; flex: none; }
.person b { display: block; font-size: .98rem; }
.person small { display: block; color: var(--muted); font-size: .8rem; }
.detail-actions { display: grid; gap: 10px; }
.detail-actions .yours { color: var(--muted); font-weight: 700; }
.detail-body > p { line-height: 1.7; font-size: 1.02rem; max-width: 65ch; }
.detail-condition { margin-top: 10px; color: var(--muted); font-size: .95rem; }
.share-panel summary { cursor: pointer; font-weight: 700; color: var(--moss-ink); min-height: 32px; display: flex; align-items: center; }
.share-panel .share-buttons { margin-top: 10px; }
.detail-safety { margin: 0; }
.detail-bar { position: fixed; left: 0; right: 0; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px)); z-index: 99; background: var(--surface); border-top: 1px solid var(--line); padding: 10px 16px; display: flex; gap: 10px; }
.detail-bar .btn-primary { flex: 1; }
.detail-bar .share-trigger { width: 48px; padding: 0; flex: none; }
body.has-detail-bar { padding-bottom: calc(var(--tabbar-h) + 74px + env(safe-area-inset-bottom, 0px)); }
@media (max-width: 767px) {
  .detail-actions .btn-lg, .detail-actions .share-trigger { display: none; }
}
@media (min-width: 768px) {
  .detail-bar { display: none; }
  body.has-detail-bar { padding-bottom: 0; }
}
@media (min-width: 1024px) {
  .detail-layout { grid-template-columns: 1fr 380px; grid-template-areas: "photos side" "body side" "map side" "safety side" "share side"; align-items: start; column-gap: 28px; }
  .detail-photos { grid-area: photos; }
  .detail-side { grid-area: side; position: sticky; top: 84px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
  .detail-body { grid-area: body; }
  .detail-map-section { grid-area: map; }
  .detail-safety { grid-area: safety; }
  .share-panel { grid-area: share; }
  .detail-title { font-size: 1.5rem; }
}

/* ---------- post a listing: the wizard ---------- */
.wizard { max-width: 720px; margin: 0 auto 32px; }
.wizard-head { display: grid; gap: 12px; margin-bottom: 24px; }
.wizard-head .page-heading { margin-bottom: 0; }
.wizard-step-label { color: var(--muted); font-weight: 700; display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.draft-note { font-weight: 600; color: var(--moss-ink); font-size: .9rem; }
.linkish { background: none; border: 0; color: var(--clay-ink); font-weight: 700; cursor: pointer; text-decoration: underline; padding: 0; font: inherit; }
.progress { display: flex; gap: 6px; }
.progress i { flex: 1; height: 8px; border-radius: 4px; background: var(--line); }
.progress i.on { background: var(--moss); }
.step { display: none; }
.step.on { display: grid; gap: 18px; }
.q { font-size: 1.4rem; margin: 0; }
.hint { color: var(--muted); font-size: .92rem; }
.opts { display: grid; gap: 10px; }
.opt { position: relative; display: flex; align-items: center; gap: 14px; background: var(--surface); border: 2px solid var(--line); border-radius: 16px; padding: 12px 14px; cursor: pointer; min-height: 64px; }
.opt.on { border-color: var(--moss); background: var(--moss-soft); }
.opt:has(input:focus-visible) { outline: 3px solid var(--honey); outline-offset: 2px; }
.opt input { position: absolute; opacity: 0; width: 0; height: 0; }
.opt .em { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font-size: 1.4rem; flex: none; }
.opt b { display: block; font-size: 1rem; }
.opt small { color: var(--muted); font-size: .85rem; }
.photo-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.photo-actions .btn { cursor: pointer; }
.photo-grid { list-style: none; display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding: 0; margin: 0; }
.photo-item { position: relative; aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: var(--surface-2); border: 1px solid var(--line); }
.photo-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-item.dragging { opacity: .5; }
.cover-badge { position: absolute; left: 6px; top: 6px; background: var(--moss); color: var(--on-moss); font-size: .68rem; font-weight: 700; padding: 2px 8px; border-radius: var(--pill); }
.photo-remove { position: absolute; right: 6px; top: 6px; width: 30px; height: 30px; border-radius: 50%; border: 0; background: rgba(0, 0, 0, .55); color: #fff; font-size: 1.2rem; line-height: 1; cursor: pointer; }
.photo-move { position: absolute; left: 6px; right: 6px; bottom: 6px; display: flex; justify-content: space-between; }
.photo-move button { width: 30px; height: 30px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .92); color: #1F2A22; font-size: 1.2rem; line-height: 1; cursor: pointer; }
.existing-photos { display: flex; flex-wrap: wrap; gap: 10px; }
.toggle-row { display: flex; align-items: center; gap: 10px; font-weight: 700; min-height: 44px; cursor: pointer; }
.toggle-row input { width: 22px; height: 22px; accent-color: var(--clay); }
.cat-picker { display: grid; gap: 10px; }
.cat-selected { display: flex; align-items: center; gap: 10px; background: var(--moss-soft); border-radius: 12px; padding: 10px 12px; font-weight: 700; color: var(--moss-ink); flex-wrap: wrap; }
.cat-list { display: grid; gap: 8px; max-height: 320px; overflow: auto; padding: 4px; }
.cat-group { font-size: .78rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-top: 6px; }
.chips.wrap { flex-wrap: wrap; overflow: visible; white-space: normal; }
.chips.wrap .chip { min-height: 36px; font-size: .85rem; padding: 5px 12px; }
.wizard-nav { display: flex; gap: 10px; margin-top: 24px; }
.wizard-nav .btn-primary, .wizard-nav .btn-clay { margin-left: auto; }
.loc-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.toast-live { position: sticky; top: 70px; z-index: 90; background: var(--moss-soft); color: var(--moss-ink); border: 1px solid var(--moss); border-radius: var(--radius); padding: 12px 16px; font-weight: 700; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; transition: opacity .4s ease; }
.toast-live.hide { opacity: 0; pointer-events: none; }
@media (min-width: 768px) {
  .photo-grid { grid-template-columns: repeat(5, 1fr); }
  .toast-live { top: 78px; }
}

/* ---------- messages ---------- */
.convo-avatar { width: 44px; height: 44px; border-radius: 50%; background: var(--moss); color: var(--on-moss); display: grid; place-items: center; font-family: var(--display); font-weight: 700; font-size: 1.1rem; flex: none; }
.convo-card { align-items: center; }
.convo-info { display: grid; gap: 1px; flex: 1; min-width: 0; }
.convo-info strong { max-width: none; font-size: 1rem; }
.convo-preview { flex: none; display: block; }
.thread-page { max-width: 760px; margin: 0 auto; }
.about { display: flex; gap: 10px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 8px 10px; color: var(--ink); margin-bottom: 12px; }
.about:hover { text-decoration: none; border-color: var(--moss); }
.about-img { width: 48px; height: 48px; border-radius: 10px; object-fit: cover; flex: none; background: var(--surface-2); display: grid; place-items: center; font-size: 1.4rem; }
.about b { display: block; font-size: .95rem; }
.about small { display: block; color: var(--muted); font-size: .8rem; }
.thread-messages { max-height: none; height: calc(100vh - 400px); min-height: 240px; }
.thread-empty { padding: 24px 12px; }
.thread-compose { position: sticky; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px)); background: var(--ground); padding: 8px 0 6px; display: grid; gap: 8px; }
.quick { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.quick::-webkit-scrollbar { display: none; }
.quick .chip { min-height: 34px; font-size: .82rem; padding: 5px 12px; background: var(--moss-soft); border-color: transparent; color: var(--moss-ink); flex: none; }
.thread-form { align-items: flex-end; }
.thread-form textarea { border-radius: 22px; min-height: 46px; max-height: 160px; line-height: 1.4; }
.thread-form .send { width: 46px; min-height: 46px; padding: 0; border-radius: 50%; flex: none; }
.msg-meta { margin-top: 3px; margin-bottom: 0; }
@media (min-width: 768px) {
  .thread-compose { bottom: 0; }
  .thread-messages { height: calc(100vh - 360px); }
}

/* ---------- avatars everywhere ---------- */
.avatar { width: 42px; height: 42px; border-radius: 50%; background: var(--moss); color: var(--on-moss); display: grid; place-items: center; font-family: var(--display); font-weight: 700; font-size: 1.1rem; flex: none; }
.avatar-img { object-fit: cover; display: block; background: var(--surface-2); }
.avatar.big { width: 96px; height: 96px; font-size: 2.2rem; }
.avatar-link { overflow: hidden; }
.avatar-link img { width: 100%; height: 100%; object-fit: cover; display: block; }
.convo-card .avatar { width: 44px; height: 44px; }

/* ---------- profile pages ---------- */
.profile-card { display: flex; gap: 18px; align-items: flex-start; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 40px; box-shadow: var(--shadow-sm); }
.profile-who { display: grid; gap: 6px; min-width: 0; }
.profile-who h1 { font-size: 1.6rem; margin: 0; }
.profile-handle { color: var(--muted); font-size: .9rem; }
.profile-facts { color: var(--muted); font-size: .95rem; }
.profile-facts strong { color: var(--moss-ink); }
.profile-bio { margin-top: 4px; max-width: 60ch; }
.profile-links { font-size: .95rem; font-weight: 700; }
.profile-sections { display: grid; gap: 40px; }
.profile-edit { background: var(--surface); padding: 20px; border-radius: var(--radius); border: 1px solid var(--line); }
.profile-edit .auth-form { padding: 0; border: 0; box-shadow: none; background: none; }
.profile-main { display: grid; gap: 40px; }
.avatar-edit { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.avatar-edit-actions { display: grid; gap: 8px; }
.avatar-edit-actions .btn { cursor: pointer; justify-self: start; }
.welcome h1 { font-size: 1.7rem; }
@media (min-width: 900px) {
  .profile-sections { grid-template-columns: 360px 1fr; align-items: start; }
  .profile-edit { position: sticky; top: 84px; }
}

/* ---------- install banner + offline ---------- */
.install-banner { position: fixed; left: 12px; right: 12px; bottom: calc(var(--tabbar-h) + 12px + env(safe-area-inset-bottom, 0px)); z-index: 98; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px 40px 12px 14px; display: flex; align-items: center; gap: 12px; }
.install-text { display: grid; gap: 2px; font-size: .92rem; flex: 1; min-width: 0; }
.install-text span { color: var(--muted); display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.install-close { position: absolute; right: 6px; top: 6px; width: 30px; height: 30px; border: 0; background: none; color: var(--muted); font-size: 1.3rem; cursor: pointer; border-radius: 50%; }
.offline-page .first-post { padding: 32px 20px; }
.offline-big { font-size: 3rem; line-height: 1; }
.offline-page h1 { font-size: 1.6rem; }
@media (min-width: 768px) { .install-banner { bottom: 16px; left: auto; right: 16px; max-width: 420px; } }

/* ---------- alerts ---------- */
.alerts-card { display: grid; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.alerts-card .btn { justify-self: start; }
.alerts-nudge { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; background: var(--moss-soft); color: var(--moss-ink); border-radius: 14px; padding: 10px 14px; margin: -8px 0 20px; font-weight: 700; }
.alerts-nudge .hint { flex-basis: 100%; font-weight: 600; }
.alerts-nudge .hint:empty { display: none; }

/* ---------- trades + thank-you notes ---------- */
.trade-page .lead-small { color: var(--muted); margin-bottom: 20px; max-width: 60ch; }
.trade-page .opts { margin-bottom: 8px; }
.kudos { display: flex; gap: 12px; align-items: flex-start; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.kudos.mine { background: var(--moss-soft); border-color: transparent; }
.kudos b { font-size: .95rem; }
.kudos small { color: var(--muted); }
.kudos p { margin-top: 4px; font-size: 1.02rem; line-height: 1.5; }
.kudos-list { display: grid; gap: 12px; }
.msg-mine .msg-body a { color: var(--on-moss); text-decoration: underline; }

/* ---------- report, block, safety ---------- */
.report-link { display: inline-block; color: var(--muted); font-size: .88rem; font-weight: 700; text-decoration: underline; padding: 6px 0; }
.report-link:hover { color: var(--berry); }
.profile-tools { display: flex; align-items: center; gap: 14px; margin-top: 6px; flex-wrap: wrap; }
.thread-block { margin-left: auto; }
.thread-block .linkish { color: var(--muted); font-size: .85rem; }
.safety-page .tips { padding-left: 22px; line-height: 1.7; display: grid; gap: 6px; max-width: 65ch; }
.safety-page .safety-fine { margin-top: 24px; color: var(--muted); }
.form-page .lead-small { color: var(--muted); margin-bottom: 20px; max-width: 60ch; }

/* ---------- account pages ---------- */
.btn-sso.full-width { width: 100%; }
.email-list { list-style: none; padding: 0; margin: 0 0 8px; display: grid; gap: 8px; }
.email-list li { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 0; border-bottom: 1px solid var(--line); }
.email-addr { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 8px; font-size: .72rem; font-weight: 700; }
.tag.have { background: var(--moss-soft); color: var(--moss-ink); }
.tag.free { background: var(--sky-soft); color: var(--sky-ink); }
.tag.skill { background: var(--honey-soft); color: var(--honey-ink); }

/* ---------- legal pages + small fixes ---------- */
.legal-page .tips { padding-left: 22px; line-height: 1.7; display: grid; gap: 6px; max-width: 65ch; }
.legal-page p { max-width: 65ch; line-height: 1.7; }
.form-help ul { list-style: none; padding: 0; margin: 0; }
/* links inside running text are underlined, so color is never the only clue */
p a, li a, .form-help a, .hint a, .safety-fine a, .auth-subtitle a { text-decoration: underline; text-underline-offset: 2px; }

/* ---------- saved listings, saved searches, nearby alerts ---------- */
.card-wrap { position: relative; display: flex; flex-direction: column; }
.card-wrap .listing-card { flex: 1; }
.fav { position: absolute; top: 10px; left: 10px; width: 38px; height: 38px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .92); color: var(--berry); display: grid; place-items: center; cursor: pointer; box-shadow: var(--shadow-sm); z-index: 2; }
.fav.on { background: var(--berry); color: #fff; }
.fav:hover { text-decoration: none; transform: scale(1.06); }
.fav-row { display: flex; align-items: center; gap: 10px; }
.fav-row .fav { position: static; }
.save-search { display: flex; justify-content: flex-end; margin: -8px 0 12px; }
.save-search .chip { cursor: pointer; }
.saved-searches { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.saved-searches li { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.saved-searches .linkish { color: var(--muted); font-size: .85rem; }
.follow-form { display: grid; gap: 12px; }
.doors-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; }
.doors-pick .toggle-row { min-height: 38px; font-weight: 600; }
@media (max-width: 420px) { .doors-pick { grid-template-columns: 1fr; } }

/* ---------- trust: "Verified - paid member" / "Unverified" (WOPR-057) ----------
   Gold star like LoveJoos's paid-member star. Unverified stays calm: muted, dashed, no red. */
.trust { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: var(--pill); font-size: .72rem; font-weight: 700; line-height: 1.3; white-space: nowrap; vertical-align: middle; }
.trust-icon { width: 12px; height: 12px; flex: none; }
.trust-verified { background: var(--honey-soft); color: var(--honey-ink); }
.trust-verified .trust-icon { color: var(--honey); }
.trust-unverified { background: transparent; color: var(--muted); border: 1px dashed var(--line-strong); padding: 1px 7px; }
.card-footer { flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.card-who { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 4px 6px; min-width: 0; }
.person-trust { display: block; margin: 2px 0; }
.profile-trust { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; font-size: .9rem; }
.profile-trust .trust { font-size: .8rem; padding: 3px 10px; }
.profile-trust .trust-unverified { padding: 2px 9px; }
.trust-why { color: var(--muted); }
.trust-note { background: var(--surface-2); color: var(--ink); border-radius: var(--radius-sm); padding: 8px 12px; font-size: .88rem; line-height: 1.45; max-width: 65ch; }
.thread-page > .trust-note { margin: -4px 0 12px; }
.convo-name { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; min-width: 0; }
.convo-name strong { max-width: 100%; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- selection ---------- */
::selection { background: var(--honey-soft); color: var(--ink); }

/* WOPR-059: the in-thread notice (a warn after a send, or why a send was refused). */
.thread-notice { margin: 4px 0 10px; }
.thread-notice.is-error { background: var(--berry-soft); color: var(--berry-ink); }
