/* ===== Findmeety – hand-written styles (no framework) ===== */
:root {
    --bg: #faf7f2;
    --surface: #ffffff;
    --text: #1f2a30;
    --muted: #6f685e;
    --line: #e8e2d8;
    --accent: #E4572E;
    --accent-dark: #C0431D;
    --accent-soft: #fdebe4;
    --ink: #1B3A4B;
    --amber: #F2A541;
    --ok: #2f8a4c;
    --ok-soft: #e4f3e8;
    --danger: #c0392b;
    --danger-soft: #fbe5e2;
    --verified: #1d7bf0;
    --radius: 14px;
    --shadow: 0 1px 2px rgba(34, 32, 28, .06), 0 4px 16px rgba(34, 32, 28, .05);
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang TC", "PingFang SC", "Hiragino Sans", "Apple SD Gothic Neo", "Noto Sans CJK TC", "Microsoft JhengHei", "Microsoft YaHei", "Malgun Gothic", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font-family: var(--font); font-size: 16px; line-height: 1.55; min-height: 100vh; display: flex; flex-direction: column; }
a { color: var(--accent-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.7rem; margin: 1.2rem 0 .8rem; letter-spacing: -.01em; line-height: 1.25; }
h2 { font-size: 1.15rem; margin: 0 0 .7rem; }
h1:focus { outline: none; }
img { max-width: 100%; }

.container { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 20px; }
.container.narrow { max-width: 760px; }
.page { flex: 1; padding-bottom: 3rem; }

/* ---------- utilities ---------- */
.muted { color: var(--muted); }
.small { font-size: .86rem; }
.strong { font-weight: 600; color: var(--text); }
.row { display: flex; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.center { align-items: center; }
.gap { gap: .6rem; }
.grow { flex: 1; }
.min0 { min-width: 0; }
.full { width: 100%; }
.push-right { margin-left: auto; }
.pad { padding: 1rem; }
.spacer { margin-top: 2rem; }
.center-text { text-align: center; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40%; }
.prose { white-space: pre-wrap; overflow-wrap: anywhere; }
.error { color: var(--danger); margin: .5rem 0; }
.success { color: var(--ok); }
.alert { background: #fff6e0; border: 1px solid #f1d58a; padding: .7rem 1rem; border-radius: 10px; }

/* ---------- buttons & form ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .35rem; padding: .62rem 1.1rem; border-radius: 999px; border: 1px solid var(--accent); background: var(--accent); color: #fff; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; transition: background .15s; }
.btn:hover { background: var(--accent-dark); text-decoration: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-small { padding: .38rem .85rem; font-size: .88rem; }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--line); }
.btn-ghost:hover { background: #f1ece4; }
.btn-ok { background: var(--ok); border-color: var(--ok); }
.btn-ok:hover { background: #256e3c; }
.btn-danger { background: var(--danger); border-color: var(--danger); }
.btn-danger:hover { background: #9c2d22; }
.link-btn { background: none; border: 0; padding: 0; color: var(--accent-dark); cursor: pointer; font: inherit; }
.link-btn:hover { text-decoration: underline; }

label { display: block; font-size: .9rem; font-weight: 600; margin-bottom: .85rem; }
label.check { display: flex; align-items: center; gap: .5rem; font-weight: 500; }
label.check input { width: auto; margin: 0; }
input, select, textarea { display: block; width: 100%; margin-top: .3rem; padding: .6rem .75rem; border: 1px solid var(--line); border-radius: 10px; background: #fff; font: inherit; font-size: 16px; /* 16px stops iOS zoom-on-focus */ color: var(--text); font-weight: 400; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
textarea { resize: vertical; }
input[type="date"], input[type="time"] { min-height: 2.9rem; -webkit-appearance: none; appearance: none; }
.w-110 { width: 110px; flex-shrink: 0; }
.when-summary { margin: -.2rem 0 .9rem; }
.mobile-cta { display: none; }
fieldset { border: 1px solid var(--line); border-radius: 12px; padding: .8rem 1rem; margin: 0 0 1rem; }
legend { font-weight: 600; font-size: .9rem; padding: 0 .3rem; }
.validation-message { color: var(--danger); font-size: .84rem; font-weight: 400; }
.form { padding: 1.4rem; }

/* ---------- chips / badges ---------- */
.chip { display: inline-block; padding: .18rem .6rem; border-radius: 999px; background: #f1ece4; font-size: .8rem; font-weight: 600; }
.chip-small { font-size: .72rem; padding: .1rem .5rem; }
.chip-ok { background: var(--ok-soft); color: var(--ok); }
.chip-off { background: #eee; color: #777; }
.badge { display: inline-flex; min-width: 1.25rem; height: 1.25rem; padding: 0 .35rem; align-items: center; justify-content: center; border-radius: 999px; background: var(--accent); color: #fff; font-size: .72rem; font-weight: 700; }
.verified { display: inline-flex; align-items: center; gap: .2rem; color: var(--verified); font-size: .8rem; font-weight: 600; vertical-align: middle; }
.verified svg { width: 1.05em; height: 1.05em; }
.verified-lg svg { width: 1.3em; height: 1.3em; }
.avatar { border-radius: 50%; object-fit: cover; background: #e6e1d8; flex-shrink: 0; }

/* ---------- top bar ---------- */
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.topbar-inner { display: flex; align-items: center; height: 60px; gap: 1rem; }
.brand { display: inline-flex; align-items: center; gap: .45rem; font-weight: 800; font-size: 1.35rem; color: var(--ink); letter-spacing: -.03em; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 34px; height: 34px; display: block; }
.brand-text span { color: var(--accent); }
.lang-picker { display: inline-flex; align-items: center; gap: .2rem; margin: 0 0 0 .3rem; font-weight: 400; }
.lang-picker select { width: auto; margin: 0; padding: .3rem 1.6rem .3rem .5rem; font-size: .9rem; border-radius: 999px; background-color: #fff; cursor: pointer; }
.lang-globe { font-size: 1rem; }
.footer-brand { display: inline-flex; align-items: center; gap: .4rem; }
.nav-collapse { display: flex; align-items: center; gap: .2rem; margin-left: auto; }
.nav-link { color: var(--text); padding: .45rem .7rem; border-radius: 999px; font-size: .95rem; display: inline-flex; align-items: center; gap: .3rem; }
.nav-link:hover { background: #f1ece4; text-decoration: none; }
.nav-link.active { background: var(--accent-soft); color: var(--accent-dark); }
.nav-link.btn { color: #fff; background: var(--accent); }
.nav-toggle { display: none; margin-left: auto; background: none; border: 1px solid var(--line); border-radius: 10px; font-size: 1.2rem; padding: .25rem .6rem; cursor: pointer; }

.site-footer { border-top: 1px solid var(--line); background: var(--surface); padding: 1.2rem 0; font-size: .85rem; }
.footer-inner { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }

/* ---------- hero ---------- */
.hero { background: radial-gradient(1200px 300px at 85% -40%, rgba(242,165,65,.25), transparent 60%), linear-gradient(135deg, #fdebe4 0%, #faf7f2 65%); padding: 2.2rem 0 1.6rem; border-bottom: 1px solid var(--line); }
.hero h1 { font-size: 2.1rem; margin: 0 0 .3rem; color: var(--ink); }
.hero-sub { color: var(--muted); margin: 0 0 1.2rem; }
.cat-tiles { display: flex; gap: .5rem; flex-wrap: wrap; }
.cat-tile { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: .5rem 1rem; font: inherit; cursor: pointer; }
.cat-tile:hover { border-color: var(--accent); }
.cat-tile.active { background: var(--ink); color: #fff; border-color: var(--ink); }

/* ---------- browse ---------- */
.browse { display: grid; grid-template-columns: 280px 1fr; gap: 1.5rem; margin-top: 1.5rem; align-items: start; }
.filters { padding: 1.1rem; position: sticky; top: 76px; max-height: calc(100vh - 90px); overflow: auto; }
.filters-title { display: flex; width: 100%; justify-content: space-between; align-items: center; background: none; border: 0; padding: 0; margin: 0 0 .9rem; font: inherit; font-size: 1.15rem; font-weight: 700; color: var(--text); cursor: default; }
.filters-caret { display: none; }
.distance-box .unit-select { width: 90px; }
.results { min-width: 0; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 1.1rem; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.empty { padding: 2rem; text-align: center; }
.listing-card { display: flex; flex-direction: column; color: var(--text); overflow: hidden; transition: transform .15s, box-shadow .15s; }
.listing-card:hover { text-decoration: none; transform: translateY(-2px); box-shadow: 0 8px 24px rgba(34, 32, 28, .1); }
.card-img { aspect-ratio: 16 / 10; background: #eee center / cover no-repeat; position: relative; }
.chip-cat { position: absolute; left: .6rem; top: .6rem; background: rgba(255, 255, 255, .92); }
.card-body { padding: .8rem .9rem 1rem; display: flex; flex-direction: column; gap: .3rem; flex: 1; }
.card-title { font-size: 1rem; margin: 0; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.price { font-weight: 700; color: var(--accent-dark); }
.price.big { font-size: 1.3rem; }
.meta { color: var(--muted); font-size: .85rem; }
.owner-line { display: flex; align-items: center; gap: .4rem; font-size: .85rem; margin-top: auto; padding-top: .5rem; border-top: 1px solid var(--line); }

/* ---------- detail ---------- */
.detail { display: grid; grid-template-columns: 1fr 340px; grid-template-areas: "main side" "comments side"; column-gap: 2rem; margin-top: 1.5rem; align-items: start; }
.detail-main { grid-area: main; min-width: 0; }
.detail-side { grid-area: side; }
.detail-comments { grid-area: comments; min-width: 0; }
.detail-hero { aspect-ratio: 16 / 9; border-radius: var(--radius); background: #eee center / cover no-repeat; margin-bottom: .6rem; }
.thumbs { display: flex; gap: .5rem; overflow-x: auto; margin-bottom: 1rem; }
.thumb { width: 84px; height: 60px; flex-shrink: 0; border-radius: 8px; border: 2px solid transparent; background: #eee center / cover; cursor: pointer; }
.thumb.active { border-color: var(--accent); }
.detail-title { margin-top: .6rem; }
.detail-meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: .6rem; margin-bottom: 1.2rem; }
.detail-side { display: flex; flex-direction: column; gap: 1rem; position: sticky; top: 76px; }
.owner-card, .booking-card, .safety { padding: 1.1rem; }
.owner-head { display: flex; gap: .8rem; align-items: center; color: var(--text); margin-bottom: .8rem; }
.owner-head:hover { text-decoration: none; }
.kv { display: grid; grid-template-columns: 3rem 1fr; gap: .5rem; font-size: .9rem; margin-bottom: .6rem; }
.kv .k { color: var(--muted); }
.owner-card .btn { margin-top: .4rem; }
.estimate { background: var(--accent-soft); padding: .6rem .8rem; border-radius: 10px; }
.busy { margin-top: .8rem; }
.safety ul { padding-left: 1.1rem; margin: .4rem 0 .6rem; }
.report-box textarea { margin-bottom: .5rem; }

.comments { margin-top: 1.6rem; border-top: 1px solid var(--line); padding-top: 1.4rem; }
.comment { display: flex; gap: .7rem; margin-bottom: 1rem; }
.comment-body { flex: 1; min-width: 0; }
.comment-head { display: flex; align-items: center; gap: .45rem; flex-wrap: wrap; }
.comment-form { display: flex; flex-direction: column; align-items: flex-end; gap: .5rem; margin-top: 1rem; }

/* ---------- forms: uploads ---------- */
.upload-row { display: flex; gap: 1rem; align-items: center; margin-bottom: 1rem; }
.cover-preview { width: 160px; aspect-ratio: 16 / 10; border-radius: 10px; background: #eee center / cover; flex-shrink: 0; }
.gallery-edit { display: flex; gap: .6rem; flex-wrap: wrap; margin-bottom: .7rem; }
.gallery-item { width: 110px; height: 80px; border-radius: 8px; background: #eee center / cover; position: relative; }
.gallery-item .remove { position: absolute; top: 4px; right: 4px; border: 0; border-radius: 50%; width: 24px; height: 24px; background: rgba(0, 0, 0, .6); color: #fff; cursor: pointer; }

/* ---------- lists ---------- */
.list { display: flex; flex-direction: column; gap: .8rem; }
.list-row { display: flex; gap: 1rem; align-items: center; padding: .8rem; }
.list-thumb { width: 120px; aspect-ratio: 16 / 10; border-radius: 10px; background: #eee center / cover; flex-shrink: 0; }
.list-row .actions { justify-content: flex-end; }

/* ---------- profile ---------- */
.profile-card { display: flex; gap: 1.5rem; padding: 1.5rem; margin-top: 1.5rem; align-items: flex-start; }
.profile-name { margin: 0 0 .2rem; display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.profile-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin: 1rem 0 2rem; }
.profile-grid .card { padding: 1.2rem; }
.verify-strip { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .9rem 1.2rem; margin-bottom: 1rem; flex-wrap: wrap; }
.success-card { padding: 1.4rem; background: #eef6ff; border-color: #cfe3fb; }
.privacy-note { background: #f4f1ec; padding: .8rem 1rem; border-radius: 10px; margin: .5rem 0 1rem; }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: .3rem; border-bottom: 1px solid var(--line); margin-bottom: 1rem; }
.tab { background: none; border: 0; border-bottom: 3px solid transparent; padding: .6rem 1rem; font: inherit; cursor: pointer; color: var(--muted); display: inline-flex; gap: .4rem; align-items: center; }
.tab.active { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }

/* ---------- bookings ---------- */
.booking-row { padding: 1rem 1.1rem; margin-bottom: .8rem; border-left: 4px solid var(--line); }
.booking-row.status-pending { border-left-color: #e9a93b; }
.booking-row.status-approved { border-left-color: var(--ok); }
.booking-row.status-denied, .booking-row.status-cancelled { border-left-color: #bbb; opacity: .8; }
.booking-who { display: flex; gap: .7rem; align-items: center; }
.status-pill { margin-left: auto; font-size: .8rem; font-weight: 700; padding: .2rem .6rem; border-radius: 999px; background: #f1ece4; white-space: nowrap; }
.status-approved .status-pill { background: var(--ok-soft); color: var(--ok); }
.status-pending .status-pill { background: #fff1d6; color: #9a6a12; }
.booking-when { margin: .6rem 0 .3rem; font-weight: 600; }
blockquote { margin: .6rem 0; padding: .5rem .8rem; background: #f7f4ef; border-radius: 8px; }
.respond { margin-top: .7rem; }
.respond input { margin-bottom: .5rem; }

/* ---------- messages ---------- */
.chat-layout { display: grid; grid-template-columns: 320px 1fr; gap: 1rem; margin-top: 1.5rem; height: calc(100vh - 150px); min-height: 480px; }
.inbox { overflow-y: auto; padding: 0; }
.inbox-title { padding: 1rem 1rem .5rem; margin: 0; }
.inbox-item { display: flex; gap: .7rem; align-items: center; padding: .7rem 1rem; color: var(--text); border-top: 1px solid var(--line); }
.inbox-item:hover { background: #faf6f0; text-decoration: none; }
.inbox-item.active { background: var(--accent-soft); }
.thread-main { flex: 1; min-width: 0; }
.thread-top { display: flex; gap: .3rem; align-items: center; }
.thread-preview { color: var(--muted); font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thread-preview.unread { color: var(--text); font-weight: 600; }
.thread { display: flex; flex-direction: column; overflow: hidden; }
.thread-empty { margin: auto; }
.thread-header { display: flex; align-items: center; gap: .7rem; padding: .7rem 1rem; border-bottom: 1px solid var(--line); }
.thread-header a { color: var(--text); }
.back-link { display: none; font-size: 1.3rem; }
.online-dot { color: var(--ok); font-size: .8rem; }
.messages { flex: 1; overflow-y: auto; padding: 1rem; background: #fcfaf7; }
.day-sep { text-align: center; margin: .8rem 0; font-size: .78rem; color: var(--muted); }
.day-sep span { background: #efe9e0; padding: .15rem .6rem; border-radius: 999px; }
.bubble-row { display: flex; margin-bottom: .4rem; }
.bubble-row.mine { justify-content: flex-end; }
.bubble { max-width: 72%; padding: .5rem .8rem; border-radius: 16px; background: #fff; border: 1px solid var(--line); }
.mine .bubble { background: var(--accent); color: #fff; border-color: var(--accent); border-bottom-right-radius: 4px; }
.theirs .bubble { border-bottom-left-radius: 4px; }
.bubble-meta { font-size: .7rem; opacity: .7; text-align: right; margin-top: .15rem; }
.composer { display: flex; gap: .5rem; padding: .7rem; border-top: 1px solid var(--line); background: #fff; }
.composer input { margin: 0; }

/* ---------- admin ---------- */
.review-card { padding: 1.1rem; margin-bottom: 1rem; }
.doc-images { display: flex; gap: 1rem; flex-wrap: wrap; margin: .8rem 0; }
.doc-images a { display: flex; flex-direction: column; gap: .2rem; align-items: center; }
.doc-images img { width: 240px; height: 160px; object-fit: contain; background: #222; border-radius: 8px; }
.review-card input { margin-bottom: .6rem; }
.table { width: 100%; border-collapse: collapse; background: #fff; border-radius: var(--radius); overflow: hidden; font-size: .9rem; }
.table th, .table td { text-align: left; padding: .6rem .8rem; border-bottom: 1px solid var(--line); }
.table th { background: #f4f1ec; }


/* ---------- calendar ---------- */
.calendar-page .card { padding: 1rem 1.1rem; margin-bottom: 1rem; }
.cal-head { display: flex; align-items: center; gap: .5rem; margin-bottom: .8rem; }
.cal-title { margin: 0 .4rem; font-size: 1.2rem; min-width: 10rem; text-align: center; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal-dow div { text-align: center; font-size: .78rem; font-weight: 700; color: var(--muted); padding: .2rem 0; }
.cal-day { min-height: 92px; display: flex; flex-direction: column; align-items: stretch; gap: 3px; padding: 4px; border: 1px solid var(--line);
    border-radius: 8px; background: #fff; font: inherit; text-align: left; cursor: pointer; overflow: hidden; }
.cal-day:hover { border-color: var(--accent); }
.cal-day.other { background: #faf8f4; color: #b3aca2; }
.cal-day.today .cal-num { background: var(--accent); color: #fff; }
.cal-day.selected { outline: 2px solid var(--ink); outline-offset: -1px; }
.cal-num { font-size: .8rem; font-weight: 700; width: 1.6rem; height: 1.6rem; line-height: 1.6rem; text-align: center; border-radius: 50%; }
.cal-ev { display: block; font-size: .72rem; line-height: 1.25; padding: 2px 5px; border-radius: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-ev.approved { background: var(--ok-soft); color: #1f6b39; }
.cal-ev.pending { background: #fff1d6; color: #8a5d0c; }
.cal-ev.theirs { border-left: 3px solid var(--ink); }
.cal-more { font-size: .7rem; color: var(--muted); padding-left: 4px; }
.cal-legend { display: flex; gap: 1rem; margin-top: .7rem; }
.dot { display: inline-block; width: .7rem; height: .7rem; border-radius: 50%; vertical-align: middle; }
.dot.approved { background: #58b26f; }
.dot.pending { background: #e9a93b; }
.cal-agenda h2 { font-size: 1.05rem; }
.agenda-row { display: flex; gap: .8rem; align-items: center; padding: .7rem .2rem; border-top: 1px solid var(--line); border-left: 4px solid transparent; padding-left: .6rem; }
.agenda-row.approved { border-left-color: #58b26f; }
.agenda-row.pending { border-left-color: #e9a93b; }
.agenda-time { font-weight: 700; min-width: 3.6rem; font-size: .92rem; }
.cal-subscribe input { margin: 0; font-size: .85rem; }


/* ---------- support page ---------- */
.footer-support { color: var(--accent-dark); font-weight: 600; }
.support-hero { text-align: center; }
.support-heart { font-size: 2.6rem; color: var(--accent); line-height: 1; margin-bottom: .4rem; }
.support-page { margin-top: 1.5rem; }
.support-card { padding: 1.2rem 1.4rem; margin-bottom: 1rem; }
.support-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .55rem; }
.support-buttons { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: .6rem; margin-top: .6rem; }
.support-btn { justify-content: flex-start; padding: .8rem 1.1rem; }
.support-icon { font-size: 1.15rem; }
.sp-paypal { background: #0070ba; border-color: #0070ba; }
.sp-paypal:hover { background: #005ea6; }
.sp-bmc { background: #ffdd00; border-color: #ffdd00; color: #1f2a30; }
.sp-bmc:hover { background: #f2d100; }
.sp-kofi { background: #29abe0; border-color: #29abe0; }
.sp-kofi:hover { background: #1f97c7; }
.sp-venmo { background: #008cff; border-color: #008cff; }
.sp-venmo:hover { background: #0077d9; }
.sp-cashapp { background: #00c244; border-color: #00c244; }
.sp-cashapp:hover { background: #00a83b; }

/* ---------- Blazor error UI ---------- */
#blazor-error-ui { background: #fff3cd; bottom: 0; box-shadow: 0 -1px 2px rgba(0, 0, 0, .2); display: none; left: 0; padding: .6rem 1.25rem .7rem; position: fixed; width: 100%; z-index: 1000; }
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: .75rem; top: .5rem; }

/* ================= Tablet ================= */
@media (max-width: 960px) {
    /* Hamburger menu below 960px */
    .nav-toggle { display: block; }
    .nav-collapse { display: none; position: absolute; top: 60px; left: 0; right: 0; background: var(--surface); border-bottom: 1px solid var(--line); flex-direction: column; align-items: stretch; padding: .5rem 16px 1rem; box-shadow: var(--shadow); }
    .nav-collapse.open { display: flex; }
    .nav-link { padding: .7rem .6rem; border-radius: 10px; }
    .lang-picker { margin: .5rem 0 0; padding: 0 .6rem; }
    .lang-picker select { flex: 1; }
    .browse { grid-template-columns: 1fr; }
    .filters { position: static; max-height: none; }
    .detail { grid-template-columns: 1fr; grid-template-areas: "main" "side" "comments"; row-gap: 1.2rem; }
    .detail-side { position: static; }
}

/* ================= Phone ================= */
@media (max-width: 640px) {
    .container { padding: 0 16px; }
    h1 { font-size: 1.4rem; }
    .hero { padding: 1.4rem 0 1.1rem; }
    .hero h1 { font-size: 1.5rem; }
    .cat-tiles { flex-wrap: nowrap; overflow-x: auto; padding-bottom: .3rem; }
    .cat-tile { white-space: nowrap; }


    /* Compact horizontal cards so several results fit on one screen */
    .grid { grid-template-columns: 1fr; gap: .75rem; }
    .listing-card { flex-direction: row; min-height: 118px; }
    .listing-card .card-img { width: 118px; aspect-ratio: auto; flex-shrink: 0; }
    .listing-card .chip-cat { display: none; }
    .listing-card .card-body { padding: .65rem .8rem; gap: .15rem; min-width: 0; }
    .listing-card .card-title { font-size: .98rem; }
    .listing-card .price { font-size: .92rem; }
    .listing-card .meta { font-size: .8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .listing-card .owner-line { padding-top: .35rem; font-size: .8rem; }
    .listing-card .owner-line .push-right { display: none; }

    /* Listing page: sticky action bar at the bottom of the screen */
    .mobile-cta { display: flex; gap: .6rem; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
        padding: .6rem 16px calc(.6rem + env(safe-area-inset-bottom)); background: var(--surface);
        border-top: 1px solid var(--line); box-shadow: 0 -4px 16px rgba(34, 32, 28, .08); }
    .mobile-cta .btn { padding: .7rem .8rem; }
    .detail { padding-bottom: 5.5rem; }
    .detail-side { position: static; }
    .detail-hero { border-radius: 12px; }
    .booking-card { scroll-margin-top: 72px; }

    .table { display: block; overflow-x: auto; white-space: nowrap; }
    .filters { padding: .8rem 1rem; }
    .filters-title { margin: 0; cursor: pointer; }
    .filters-caret { display: inline; color: var(--muted); }
    .filters:not(.open) .filters-body { display: none; }
    .filters.open .filters-title { margin-bottom: .9rem; }
    .list-row { flex-wrap: wrap; }
    .list-thumb { width: 96px; }
    .list-row .actions { width: 100%; justify-content: flex-start; }
    .profile-card { flex-direction: column; align-items: center; text-align: center; }
    .profile-name { justify-content: center; }
    .profile-grid { grid-template-columns: 1fr; }
    .upload-row { flex-direction: column; align-items: flex-start; }

    /* Messages: show either the inbox or the open thread */
    .chat-layout { grid-template-columns: 1fr; height: calc(100vh - 120px); height: calc(100dvh - 76px); margin-top: .8rem; min-height: 0; }
    .chat-layout.has-thread .inbox { display: none; }
    .chat-layout:not(.has-thread) .thread { display: none; }
    .back-link { display: inline; }
    .bubble { max-width: 85%; }
    .ellipsis { display: none; }
    /* Calendar: compact month grid with coloured dots */
    .cal-grid { gap: 2px; }
    .cal-day { min-height: 52px; padding: 3px 2px; align-items: center; flex-direction: row; flex-wrap: wrap; align-content: flex-start; justify-content: center; }
    .cal-num { width: 100%; font-size: .78rem; }
    .cal-day.today .cal-num { width: 1.5rem; }
    .cal-ev { width: 7px; height: 7px; padding: 0; border-radius: 50%; border-left: 0 !important; }
    .cal-ev.approved { background: #58b26f; }
    .cal-ev.pending { background: #e9a93b; }
    .cal-ev-text, .cal-more { display: none; }
    .cal-title { min-width: 0; font-size: 1.05rem; }
    .doc-images img { width: 100%; height: auto; }
}
