:root {
  --bg: #f6f2ea;
  --surface: #fffdf9;
  --ink: #23302b;
  --muted: #66736c;
  --line: #ddd5c6;
  --accent: #2f6b4f;
  --accent-ink: #ffffff;
  --offer: #2f6b4f;
  --offer-bg: #e1efe6;
  --request: #a8502a;
  --request-bg: #f7e4d8;
  --danger: #a32d2d;
  --radius: 10px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #171c1a;
    --surface: #202725;
    --ink: #e8ece8;
    --muted: #9aa8a0;
    --line: #36403c;
    --accent: #6fbf97;
    --accent-ink: #10201a;
    --offer: #7fcfa6;
    --offer-bg: #1f3a2d;
    --request: #eaa27c;
    --request-bg: #44291b;
    --danger: #e98080;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1; padding-top: 1.5rem; padding-bottom: 3rem; }
.wrap { width: 100%; max-width: 1040px; margin: 0 auto; padding-left: 1.1rem; padding-right: 1.1rem; }
a { color: var(--accent); }
h1 { font-size: 1.8rem; line-height: 1.2; margin: 0 0 .6rem; letter-spacing: -.01em; }
h2 { font-size: 1.2rem; margin: 2rem 0 .8rem; }
h3 { font-size: 1.08rem; margin: .45rem 0 .3rem; line-height: 1.3; }
.muted, .meta, small { color: var(--muted); }
small { display: block; font-size: .85rem; font-weight: 400; margin-top: .2rem; }
.meta { margin: .15rem 0; font-size: .92rem; }

/* header / footer */
header.site { background: var(--surface); border-bottom: 1px solid var(--line); }
.bar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-top: .7rem; padding-bottom: .7rem; flex-wrap: wrap; }
.brand { font-size: 1.2rem; font-weight: 600; color: var(--ink); text-decoration: none; display: flex; align-items: center; gap: .45rem; }
.brand b { color: var(--accent); font-weight: 700; }
.brand .dot { width: .8rem; height: .8rem; border-radius: 50%; background: var(--accent); box-shadow: .45rem 0 0 -.1rem var(--request); margin-right: .3rem; }
nav { display: flex; align-items: center; gap: 1.1rem; flex-wrap: wrap; }
nav a { text-decoration: none; color: var(--ink); font-weight: 500; }
nav a:hover { color: var(--accent); }
footer.site { border-top: 1px solid var(--line); color: var(--muted); font-size: .9rem; }
footer.site .wrap { display: flex; gap: 1.2rem; flex-wrap: wrap; padding-top: 1rem; padding-bottom: 1.4rem; }

/* buttons */
.btn {
  display: inline-block; border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink);
  padding: .55rem 1.05rem; border-radius: 8px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
}
.btn:hover { filter: brightness(1.08); }
.btn.small { padding: .35rem .8rem; font-size: .93rem; }
nav a.btn, nav a.btn:hover { color: var(--accent-ink); }
.btn.ghost { background: transparent; color: var(--accent); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 2px; }

/* forms */
label { display: block; font-weight: 600; font-size: .95rem; }
input, select, textarea {
  display: block; width: 100%; margin-top: .3rem; padding: .55rem .65rem; font: inherit; font-weight: 400;
  color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 8px;
}
input[type=radio] { display: inline; width: auto; margin: .25rem 0 0; }
textarea { resize: vertical; }
.stack > * + * { margin-top: 1rem; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
fieldset.choice { border: 0; padding: 0; margin: 0; }
fieldset.choice legend { font-weight: 600; font-size: .95rem; padding: 0; margin-bottom: .4rem; }
fieldset.choice label {
  display: flex; gap: .6rem; align-items: flex-start; font-weight: 400; padding: .65rem .8rem;
  border: 1px solid var(--line); border-radius: 8px; background: var(--surface); margin-bottom: .45rem; cursor: pointer;
}
fieldset.choice label:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }

.narrow { max-width: 460px; }
.narrow.wide { max-width: 680px; }

.notice { background: var(--offer-bg); border: 1px solid var(--line); border-radius: 8px; padding: .7rem .9rem; margin: 1rem 0; }
.notice.error { background: var(--request-bg); }
.notice ul { margin: 0; padding-left: 1.2rem; }

/* home */
.hero { padding: 1rem 0 1.3rem; max-width: 720px; }
.hero h1 { font-size: clamp(1.6rem, 4.2vw, 2.35rem); }
.hero p { font-size: 1.08rem; color: var(--muted); margin: 0; }
.search {
  display: grid; grid-template-columns: 2fr 1.3fr 1.5fr .9fr 1fr auto; gap: .7rem; align-items: end;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem;
}
.search label { font-size: .82rem; color: var(--muted); }
.results-head { font-size: 1rem; color: var(--muted); font-weight: 500; margin: 1.5rem 0 .8rem; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: .9rem; }
.card {
  display: block; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: .9rem 1rem; text-decoration: none; color: inherit; border-top: 3px solid var(--offer);
}
.card.request { border-top-color: var(--request); }
a.card:hover { border-color: var(--accent); border-top-color: var(--offer); }
a.card.request:hover { border-top-color: var(--request); }
.card-top { display: flex; align-items: center; gap: .55rem; flex-wrap: wrap; font-size: .88rem; margin: 0; }
.badge { font-size: .76rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: .12rem .5rem; border-radius: 99px; }
.badge.offer { background: var(--offer-bg); color: var(--offer); }
.badge.request { background: var(--request-bg); color: var(--request); }
.badge.closed { background: var(--line); color: var(--muted); }
.pill { background: var(--request); color: #fff; font-size: .75rem; font-weight: 700; border-radius: 99px; padding: .05rem .45rem; }
.empty { text-align: center; background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); padding: 2.2rem 1rem; }
.empty p { margin: 0 auto .7rem; max-width: 460px; }

/* listing page */
.listing { max-width: 720px; }
.listing h1 { margin-top: .5rem; }
.listing .body { white-space: pre-wrap; overflow-wrap: anywhere; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; margin: 1rem 0 1.5rem; }
.manage { display: flex; gap: .6rem; align-items: flex-start; flex-wrap: wrap; margin-top: 1.5rem; }
details summary { cursor: pointer; color: var(--muted); padding: .55rem 0; }
details.report { margin-top: 1.5rem; font-size: .93rem; }

/* messages */
.threads { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.thread { display: grid; grid-template-columns: 1fr auto; gap: .1rem .8rem; padding: .8rem 1rem; text-decoration: none; color: inherit; border-top: 1px solid var(--line); }
.thread:first-child { border-top: 0; }
.thread:hover { background: color-mix(in srgb, var(--accent) 7%, var(--surface)); }
.thread .who { font-weight: 600; }
.thread.unread .snippet { color: var(--ink); font-weight: 600; }
.thread .about, .thread .snippet { grid-column: 1; color: var(--muted); font-size: .92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thread .when { grid-column: 2; grid-row: 1; color: var(--muted); font-size: .85rem; }
.thread-title { font-size: 1.35rem; }
.chat { display: flex; flex-direction: column; gap: .7rem; margin: 1.2rem 0 1.6rem; }
.msg { max-width: 85%; }
.msg.me { align-self: flex-end; }
.msg-meta { font-size: .8rem; color: var(--muted); margin-bottom: .15rem; }
.msg.me .msg-meta { text-align: right; }
.msg-body { white-space: pre-wrap; overflow-wrap: anywhere; padding: .6rem .85rem; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); }
.msg.me .msg-body { background: var(--offer-bg); border-color: transparent; }

.prose { max-width: 680px; }
.prose li { margin-bottom: .45rem; }
.report-row { margin-bottom: .8rem; }

@media (max-width: 820px) {
  .search { grid-template-columns: 1fr 1fr; }
  .search label:first-child { grid-column: 1 / -1; }
  .search .btn { grid-column: 1 / -1; }
}
@media (max-width: 520px) {
  .row { grid-template-columns: 1fr; }
  h1 { font-size: 1.5rem; }
}
