:root {
    --ink: #1f2522;
    --muted: #687169;
    --paper: #f7f5ef;
    --panel: #ffffff;
    --line: #ddd6c8;
    --green: #2f6b4f;
    --green-dark: #24523d;
    --rust: #b85b34;
    --clay: #d8a45d;
    --blue: #3d6f83;
    --shadow: 0 18px 44px rgba(43, 39, 32, .11);
    --shadow-soft: 0 10px 28px rgba(43, 39, 32, .08);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, .62), rgba(247, 245, 239, 0) 340px),
        radial-gradient(circle at 14% 0%, rgba(216, 164, 93, .18), transparent 30%),
        var(--paper);
    color: var(--ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    line-height: 1.5;
}

a { color: inherit; text-decoration: none; }

button, input, select, textarea { font: inherit; }

button, a, input, select, textarea {
    transition: border-color .18s ease, box-shadow .18s ease, background .18s ease, color .18s ease, transform .18s ease;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 3px solid rgba(61, 111, 131, .28);
    outline-offset: 2px;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 14px max(18px, calc((100vw - 1180px) / 2));
    background: rgba(247, 245, 239, .9);
    border-bottom: 1px solid rgba(221, 214, 200, .78);
    backdrop-filter: blur(16px);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--green), var(--rust));
    color: #fff;
    font-weight: 900;
    letter-spacing: .02em;
    box-shadow: 0 12px 24px rgba(47, 107, 79, .22);
}

.brand strong { display: block; font-size: 18px; line-height: 1.1; }

.brand small {
    display: block;
    color: var(--muted);
    font-size: 12px;
    margin-top: 3px;
    white-space: nowrap;
}

.nav {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.nav a,
.nav button,
.link-button,
.filters button,
.primary,
.secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    border-radius: 8px;
    border: 1px solid rgba(221, 214, 200, .95);
    background: rgba(255, 255, 255, .82);
    color: var(--ink);
    padding: 10px 15px;
    font-weight: 800;
    cursor: pointer;
    white-space: nowrap;
}

.nav a:hover,
.nav button:hover,
.secondary:hover,
.link-button.secondary:hover,
.filters button:hover {
    background: #fff;
    border-color: rgba(61, 111, 131, .32);
    transform: translateY(-1px);
    box-shadow: var(--shadow-soft);
}

.nav-cta,
.primary,
.link-button.primary {
    background: var(--green);
    border-color: var(--green);
    color: #fff;
    box-shadow: 0 12px 26px rgba(47, 107, 79, .2);
}

.nav-cta:hover,
.primary:hover,
.link-button.primary:hover {
    background: var(--green-dark);
    border-color: var(--green-dark);
    transform: translateY(-1px);
}

.secondary,
.link-button.secondary {
    background: #fff;
    color: var(--blue);
}

.inline { margin: 0; }

main {
    max-width: 1180px;
    margin: 0 auto;
    padding: 34px 18px 68px;
}

.flash {
    max-width: 1180px;
    margin: 16px auto 0;
    padding: 13px 16px;
    border-radius: 8px;
    border: 1px solid rgba(47, 107, 79, .18);
    background: #e8f2e8;
    color: #274224;
    box-shadow: var(--shadow-soft);
}

.flash.error {
    border-color: rgba(184, 91, 52, .22);
    background: #f8e2da;
    color: #7b2c1d;
}

.hero {
    min-height: 470px;
    display: grid;
    grid-template-columns: minmax(0, 1.08fr) minmax(330px, .92fr);
    gap: clamp(24px, 5vw, 56px);
    align-items: center;
    padding: 34px 0;
}

.hero-copy { min-width: 0; }

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: var(--rust);
    font-size: 12px;
    font-weight: 900;
    letter-spacing: .08em;
    margin-bottom: 12px;
    text-transform: uppercase;
}

.eyebrow::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: var(--clay);
}

.hero h1 {
    max-width: 780px;
    margin: 0;
    font-size: clamp(42px, 6vw, 74px);
    line-height: .98;
    letter-spacing: 0;
}

.hero p {
    max-width: 680px;
    color: var(--muted);
    font-size: 18px;
    line-height: 1.68;
    margin: 22px 0 0;
}

.hero-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 26px;
}

.hero-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    max-width: 680px;
    margin-top: 28px;
}

.hero-stats span {
    display: grid;
    gap: 2px;
    min-height: 78px;
    padding: 14px;
    border: 1px solid rgba(221, 214, 200, .82);
    border-radius: 8px;
    background: rgba(255, 255, 255, .64);
    color: var(--muted);
    box-shadow: 0 8px 24px rgba(43, 39, 32, .05);
}

.hero-stats b {
    color: var(--ink);
    font-size: 24px;
    line-height: 1;
}

.material-visual {
    position: relative;
    min-height: 390px;
    overflow: hidden;
    border-radius: 8px;
    background:
        linear-gradient(145deg, rgba(255, 255, 255, .54), rgba(255, 255, 255, .08)),
        linear-gradient(135deg, rgba(47, 107, 79, .16), rgba(184, 91, 52, .14)),
        #ded4c4;
    border: 1px solid rgba(221, 214, 200, .9);
    box-shadow: var(--shadow);
}

.material-visual::before {
    content: "";
    position: absolute;
    inset: 22px;
    border: 1px solid rgba(255, 255, 255, .54);
    border-radius: 8px;
}

.material-visual span {
    position: absolute;
    display: block;
    border-radius: 7px;
    box-shadow: 0 18px 28px rgba(37, 33, 29, .14);
}

.material-visual span:nth-of-type(1) { width: 190px; height: 96px; left: 24px; bottom: 44px; background: var(--rust); transform: rotate(-8deg); }
.material-visual span:nth-of-type(2) { width: 150px; height: 130px; right: 38px; bottom: 58px; background: var(--clay); transform: rotate(11deg); }
.material-visual span:nth-of-type(3) { width: 230px; height: 46px; left: 88px; top: 70px; background: var(--blue); transform: rotate(5deg); }
.material-visual span:nth-of-type(4) { width: 82px; height: 82px; left: 46%; bottom: 108px; background: var(--green); transform: rotate(18deg); }
.material-visual span:nth-of-type(5) { width: 120px; height: 52px; right: 72px; top: 96px; background: #8d8172; transform: rotate(-14deg); }

.visual-card {
    position: absolute;
    z-index: 2;
    display: grid;
    gap: 5px;
    width: min(78%, 300px);
    padding: 15px;
    border: 1px solid rgba(255, 255, 255, .72);
    border-radius: 8px;
    background: rgba(255, 255, 255, .9);
    box-shadow: 0 18px 36px rgba(43, 39, 32, .16);
}

.visual-card strong { font-size: 15px; }
.visual-card small { color: var(--muted); }
.primary-card { top: 34px; left: 32px; }
.secondary-card { right: 26px; bottom: 34px; }

.toolbar {
    position: sticky;
    top: 73px;
    z-index: 5;
    margin: 8px 0 24px;
}

.filters {
    display: grid;
    grid-template-columns: 1fr 220px auto;
    gap: 10px;
    padding: 12px;
    border: 1px solid rgba(221, 214, 200, .9);
    border-radius: 8px;
    background: rgba(255, 255, 255, .84);
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(14px);
}

input,
select,
textarea {
    width: 100%;
    min-height: 44px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 11px 12px;
    background: #fff;
    color: var(--ink);
}

textarea {
    resize: vertical;
    line-height: 1.55;
}

input:hover,
select:hover,
textarea:hover,
input:focus,
select:focus,
textarea:focus {
    border-color: rgba(61, 111, 131, .45);
    box-shadow: 0 0 0 4px rgba(61, 111, 131, .08);
}

.listings-heading,
.page-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 18px;
    margin: 26px 0 16px;
}

.page-heading {
    display: block;
    max-width: 680px;
}

.listings-heading h2,
.page-heading h1 {
    margin: 0;
    font-size: clamp(30px, 4vw, 44px);
    line-height: 1.05;
}

.listings-heading p,
.page-heading p {
    color: var(--muted);
    margin: 8px 0 0;
}

.cards {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.card,
.listing-detail,
.chat,
.form-card,
.auth-panel,
.private-thread,
.conversation-list {
    background: rgba(255, 255, 255, .9);
    border: 1px solid rgba(221, 214, 200, .86);
    border-radius: 8px;
    box-shadow: 0 12px 32px rgba(43, 39, 32, .07);
}

.card {
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 248px;
    padding: 18px;
    overflow: hidden;
}

.card::after {
    content: "";
    position: absolute;
    inset: auto 18px 0 18px;
    height: 4px;
    border-radius: 999px 999px 0 0;
    background: linear-gradient(90deg, var(--green), var(--clay), var(--rust));
    opacity: 0;
    transition: opacity .18s ease;
}

.card:hover {
    border-color: rgba(47, 107, 79, .34);
    transform: translateY(-3px);
    box-shadow: var(--shadow);
}

.card:hover::after { opacity: 1; }

.card h2 {
    margin: 16px 0 9px;
    font-size: 21px;
    line-height: 1.18;
}

.card p,
.meta,
.empty {
    color: var(--muted);
}

.location {
    margin-top: auto;
    color: var(--ink);
    font-weight: 800;
}

.card footer {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 13px;
}

.mode-pill {
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 900;
    background: #e8f3ec;
    color: var(--green);
}

.mode-pill.receive {
    background: #e8f0f3;
    color: var(--blue);
}

.narrow { max-width: 780px; }

.auth-shell {
    min-height: 72vh;
    display: grid;
    place-items: center;
}

.auth-panel {
    width: min(100%, 450px);
    padding: 26px;
}

.auth-panel h1 {
    margin: 0 0 8px;
    font-size: 34px;
}

.auth-panel p {
    color: var(--muted);
    margin-top: 0;
}

.form-stack,
.form-card,
.message-form {
    display: grid;
    gap: 14px;
}

.form-card { padding: 22px; }

label {
    display: grid;
    gap: 7px;
    color: var(--muted);
    font-weight: 800;
}

.grid.two {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.muted-link,
.back {
    display: inline-block;
    margin-top: 14px;
    color: var(--muted);
    text-decoration: underline;
    text-underline-offset: 4px;
}

.back { margin: 0 0 14px; }

.sso-box {
    display: grid;
    gap: 10px;
    margin: 18px 0;
}

.sso {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 46px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: #fff;
    font-weight: 800;
}

.sso:hover {
    border-color: rgba(61, 111, 131, .35);
    box-shadow: var(--shadow-soft);
}

.sso-icon {
    display: inline-grid;
    place-items: center;
    width: 22px;
    height: 22px;
    flex: 0 0 22px;
}

.sso-icon svg {
    display: block;
    width: 22px !important;
    height: 22px !important;
    max-width: 22px;
    max-height: 22px;
}

.sso.google { color: #2f5fbd; }
.sso.facebook { color: #1877f2; }
.sso.disabled {
    color: var(--muted);
    background: var(--paper);
    opacity: .68;
}

.divider {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--muted);
    font-size: 13px;
    margin: 4px 0 16px;
}

.divider::before,
.divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--line);
}

.listing-detail { padding: 24px; }

.listing-head {
    padding-bottom: 18px;
    margin-bottom: 18px;
    border-bottom: 1px solid var(--line);
}

.listing-detail h1 {
    margin: 16px 0 10px;
    font-size: clamp(31px, 5vw, 44px);
    line-height: 1.06;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin: 20px 0;
}

.detail-grid span {
    display: grid;
    gap: 4px;
    min-height: 76px;
    padding: 13px;
    border-radius: 8px;
    background: var(--paper);
}

.detail-grid b {
    font-size: 12px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .06em;
}

.chat {
    margin-top: 18px;
    padding: 18px;
}

.chat h2 { margin-top: 0; }

.thread {
    display: grid;
    gap: 10px;
    max-height: 520px;
    overflow: auto;
    padding: 8px 2px;
}

.bubble {
    max-width: 78%;
    padding: 12px 13px;
    border-radius: 8px;
    background: var(--paper);
}

.bubble.mine {
    justify-self: end;
    background: #e5f1e8;
}

.bubble p { margin: 6px 0; }

.bubble time {
    color: var(--muted);
    font-size: 12px;
}

.messages-layout {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 16px;
}

.conversation-list { padding: 16px; }

.conversation-list h1 {
    margin-top: 0;
    font-size: 28px;
}

.conversation-list a {
    display: grid;
    gap: 4px;
    padding: 12px;
    border-radius: 8px;
}

.conversation-list a:hover,
.conversation-list a.active {
    background: var(--paper);
}

.conversation-list span {
    color: var(--muted);
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.private-thread {
    min-height: 560px;
    padding: 18px;
    display: grid;
    grid-template-rows: 1fr auto;
}

@media (max-width: 900px) {
    .topbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .nav {
        width: 100%;
        justify-content: flex-start;
    }

    .hero,
    .messages-layout {
        grid-template-columns: 1fr;
    }

    .material-visual { min-height: 300px; }

    .toolbar { position: static; }

    .filters,
    .cards,
    .grid.two {
        grid-template-columns: 1fr;
    }

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

@media (max-width: 560px) {
    main { padding: 24px 12px 54px; }

    .topbar { padding-inline: 12px; }

    .brand small { display: none; }

    .nav a,
    .nav button {
        min-height: 38px;
        padding: 8px 11px;
        font-size: 14px;
    }

    .hero {
        min-height: 0;
        padding-top: 18px;
    }

    .hero h1 { font-size: 40px; }

    .hero p { font-size: 16px; }

    .hero-actions .link-button,
    .filters button,
    .primary,
    .secondary {
        width: 100%;
    }

    .material-visual { min-height: 260px; }

    .visual-card { width: calc(100% - 42px); }

    .secondary-card { right: 21px; }

    .listings-heading { display: block; }

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

    .listing-detail,
    .chat,
    .form-card,
    .auth-panel,
    .private-thread,
    .conversation-list {
        padding: 16px;
    }

    .bubble { max-width: 94%; }
}
