:root {
  --brand: #1a56db;
  --brand-dark: #1542a8;
  --brand-soft: #eaf1ff;
  --accent: #ffc01e;
  --accent-dark: #e8a900;
  --green: #16a34a;
  --wa: #25d366;
  --danger: #dc2626;
  --text: #16202e;
  --muted: #64748b;
  --line: #e3e8ef;
  --bg: #f5f7fa;
  --card: #fff;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .16);
  --header-h: 64px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; color: var(--text); background: var(--bg); font-size: 15px; line-height: 1.5; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.2rem; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
code { background: #eef2f7; padding: 1px 6px; border-radius: 4px; }
.container { width: 100%; max-width: 1240px; margin: 0 auto; padding: 0 16px; }
.page { padding-top: 20px; padding-bottom: 48px; min-height: 60vh; }
.narrow { max-width: 760px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.danger-text { color: var(--danger) !important; }
.link { background: none; border: 0; color: var(--brand); padding: 0; font-weight: 500; }
.show-md { display: none !important; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid transparent; border-radius: 10px; padding: 10px 18px; font-weight: 600; font-size: .95rem; line-height: 1.2; transition: background .15s, border-color .15s, transform .05s; text-decoration: none !important; white-space: nowrap; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .6; cursor: not-allowed; }
.btn-sm { padding: 7px 12px; font-size: .85rem; border-radius: 8px; }
.btn-lg { padding: 14px 24px; font-size: 1.05rem; }
.btn-block { width: 100%; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-accent { background: var(--accent); color: #1b1b1b; }
.btn-accent:hover { background: var(--accent-dark); }
.btn-outline { background: #fff; border-color: var(--line); color: var(--text); }
.btn-outline:hover { border-color: var(--brand); color: var(--brand); }
.btn-ghost { background: transparent; color: var(--text); }
.btn-ghost:hover { background: #eef2f7; }
.btn-ghost.on { color: var(--danger); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-whatsapp { background: var(--wa); color: #fff; }
.btn-whatsapp:hover { background: #1fb957; }

/* Header */
.demo-bar { background: #fff7db; color: #6b5200; text-align: center; font-size: .85rem; padding: 6px 12px; border-bottom: 1px solid #f3e2a4; }
.header { background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 50; }
.header-inner { display: flex; align-items: center; gap: 16px; height: var(--header-h); }
.logo { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 1.45rem; color: var(--text); letter-spacing: -.5px; text-decoration: none !important; flex-shrink: 0; }
.logo b { color: var(--brand); font-weight: 800; }
.logo-light { color: #fff; }
.logo-light b { color: var(--accent); }
.header-search { flex: 1; display: flex; max-width: 520px; border: 1.5px solid var(--line); border-radius: 10px; overflow: hidden; background: #f8fafc; }
.header-search:focus-within { border-color: var(--brand); background: #fff; }
.header-search input { flex: 1; border: 0; background: transparent; padding: 9px 12px; outline: none; min-width: 0; }
.header-search button { border: 0; background: transparent; padding: 0 12px; }
.header-nav { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.nav-icon { position: relative; font-size: 1.3rem; padding: 6px 8px; border-radius: 8px; color: var(--text); text-decoration: none !important; }
.nav-icon:hover, .nav-icon.active { background: var(--brand-soft); }
.unread-badge { position: absolute; top: 0; right: -2px; background: var(--danger); color: #fff; font-size: .65rem; font-weight: 700; min-width: 17px; height: 17px; border-radius: 9px; display: grid; place-items: center; padding: 0 4px; font-style: normal; line-height: 1; }
.unread-badge[hidden] { display: none; }
.header-user { display: flex; gap: 6px; align-items: center; }
.user-menu { position: relative; }
.user-btn { display: flex; align-items: center; gap: 8px; background: none; border: 0; padding: 4px 6px; border-radius: 10px; font-weight: 600; }
.user-btn:hover { background: #eef2f7; }
.dropdown { position: absolute; right: 0; top: calc(100% + 6px); background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); min-width: 240px; padding: 6px; display: none; z-index: 60; }
.dropdown.open { display: block; }
.dropdown a, .dropdown button { display: block; width: 100%; text-align: left; padding: 9px 12px; border-radius: 8px; color: var(--text); background: none; border: 0; text-decoration: none; }
.dropdown a:hover, .dropdown button:hover { background: #f1f5f9; }
.dd-head { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.dd-head small { display: block; color: var(--muted); }
.avatar { display: inline-grid; place-items: center; border-radius: 50%; color: #fff; font-weight: 700; flex-shrink: 0; }

/* Hero */
.hero { background: linear-gradient(135deg, #1a56db 0%, #0f3fa8 60%, #0b2d6b 100%); color: #fff; padding: 48px 0 40px; position: relative; overflow: hidden; }
.hero::after { content: ""; position: absolute; right: -80px; top: -80px; width: 320px; height: 320px; border-radius: 50%; background: rgba(255, 192, 30, .18); }
.hero h1 { font-size: 2.4rem; letter-spacing: -1px; margin-bottom: 6px; }
.hero p { opacity: .9; margin: 0 0 22px; font-size: 1.1rem; }
.hero-search { display: flex; background: #fff; border-radius: 14px; padding: 6px; gap: 6px; box-shadow: var(--shadow-lg); max-width: 900px; position: relative; z-index: 1; }
.hero-search input, .hero-search select { border: 0; padding: 12px 14px; color: var(--text); outline: none; background: #fff; border-radius: 10px; }
.hero-search input { flex: 2; min-width: 0; }
.hero-search select { flex: 1; border-left: 1px solid var(--line); border-radius: 0; min-width: 0; }
.hero-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; position: relative; z-index: 1; }
.hero-links a { color: #fff; background: rgba(255, 255, 255, .14); padding: 5px 12px; border-radius: 20px; font-size: .88rem; }

/* Sections */
.section { margin: 32px 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 14px; }
.section-head h2 { margin: 0; font-size: 1.35rem; }
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.cat-tile { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 12px; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; color: var(--text); text-decoration: none !important; transition: box-shadow .15s, transform .15s; }
.cat-tile:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.cat-icon { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; font-size: 1.8rem; }
.cat-name { font-weight: 600; font-size: .92rem; line-height: 1.25; }
.cat-count { font-size: .78rem; color: var(--muted); }
.promo { display: flex; align-items: center; justify-content: space-between; gap: 20px; background: linear-gradient(90deg, #fff6d9, #fff); border: 1px solid #f6e3a3; border-radius: 16px; padding: 24px 28px; }
.promo h2 { margin: 0 0 4px; }
.promo p { margin: 0; color: var(--muted); }
.trust { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.trust > div { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.trust span { font-size: 1.8rem; }
.trust h3 { margin: 8px 0 4px; }
.trust p { margin: 0 0 6px; color: var(--muted); font-size: .92rem; }

/* Listing cards */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.card { background: var(--card); border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); color: var(--text); text-decoration: none !important; display: flex; flex-direction: column; transition: box-shadow .15s, transform .15s; position: relative; }
.card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.card-img { position: relative; aspect-ratio: 4 / 3; background: #eef2f7; }
.card-img img { width: 100%; height: 100%; object-fit: cover; }
.badge { position: absolute; font-size: .72rem; font-weight: 700; padding: 3px 8px; border-radius: 6px; }
.badge-featured { top: 10px; left: 10px; background: var(--accent); color: #1b1b1b; }
.badge-purpose { bottom: 10px; left: 10px; background: rgba(17, 24, 39, .75); color: #fff; }
.badge-purpose.rent { background: rgba(22, 163, 74, .92); }
.badge-count { bottom: 10px; right: 10px; background: rgba(17, 24, 39, .7); color: #fff; }
.fav-btn { position: absolute; top: 8px; right: 8px; width: 34px; height: 34px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .95); font-size: 1.1rem; display: grid; place-items: center; box-shadow: var(--shadow); color: #334155; }
.fav-btn.on { color: var(--danger); }
.card-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.card-price { font-weight: 800; font-size: 1.08rem; color: var(--brand); }
.card-price small, .ad-price small { font-weight: 500; color: var(--muted); font-size: .8em; }
.card-title { font-weight: 500; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.35; }
.card-attrs { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: .8rem; color: #475569; }
.card-attrs span:not(:last-child)::after { content: "·"; margin-left: 10px; color: #cbd5e1; }
.card-meta { display: flex; justify-content: space-between; gap: 8px; font-size: .78rem; color: var(--muted); margin-top: auto; padding-top: 6px; }
.card-meta span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status-pill { display: inline-block; font-size: .72rem; font-weight: 700; text-transform: capitalize; padding: 2px 8px; border-radius: 20px; background: #e2e8f0; color: #334155; }
.status-pill.sold, .status-pill.resolved { background: #dcfce7; color: #166534; }
.status-pill.paused, .status-pill.dismissed { background: #f1f5f9; color: #64748b; }
.status-pill.removed, .status-pill.open { background: #fee2e2; color: #991b1b; }
.status-pill.active { background: #dbeafe; color: #1e40af; }

/* Search */
.crumbs { font-size: .85rem; color: var(--muted); margin-bottom: 14px; }
.search-layout { display: grid; grid-template-columns: 280px 1fr; gap: 24px; align-items: start; }
.sidebar { position: sticky; top: calc(var(--header-h) + 16px); max-height: calc(100vh - var(--header-h) - 32px); overflow: auto; }
.filters { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.filters-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.filters-head h3 { margin: 0; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field > span { font-size: .85rem; font-weight: 600; color: #334155; }
.field input, .field select, .field textarea { width: 100%; border: 1.5px solid var(--line); border-radius: 10px; padding: 10px 12px; background: #fff; outline: none; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.range { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.seg { display: flex; background: #f1f5f9; border-radius: 10px; padding: 3px; gap: 3px; }
.seg label { flex: 1; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; text-align: center; padding: 7px 8px; border-radius: 8px; font-size: .88rem; font-weight: 600; cursor: pointer; color: #475569; }
.seg input:checked + span { background: #fff; color: var(--brand); box-shadow: var(--shadow); }
.seg input:focus-visible + span { outline: 2px solid var(--brand); }
.results-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.results-head h1 { font-size: 1.4rem; margin: 0; }
.results-head p { margin: 2px 0 0; }
.results-tools { display: flex; gap: 8px; align-items: center; }
.results-tools select { border: 1.5px solid var(--line); border-radius: 8px; padding: 7px 10px; background: #fff; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 14px; scrollbar-width: thin; }
.chip { flex-shrink: 0; background: #fff; border: 1px solid var(--line); border-radius: 20px; padding: 6px 14px; font-size: .88rem; color: var(--text); text-decoration: none !important; }
.chip:hover, .chip.active { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }
.pagination { display: flex; justify-content: center; gap: 6px; margin-top: 28px; flex-wrap: wrap; }
.page-btn { min-width: 40px; height: 40px; border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 0 12px; }
.page-btn.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.page-btn:disabled { opacity: .4; cursor: default; }

/* Ad page */
.ad-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 24px; align-items: start; }
.card-plain { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; }
.card-plain h2 { font-size: 1.1rem; }
.gallery { background: #0f172a; border-radius: var(--radius); overflow: hidden; margin-bottom: 16px; }
.gallery-main { position: relative; aspect-ratio: 4 / 3; max-height: 560px; width: 100%; display: grid; place-items: center; }
.gallery-main img { width: 100%; height: 100%; object-fit: contain; cursor: zoom-in; }
.g-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .9); font-size: 1.6rem; line-height: 1; display: grid; place-items: center; }
.g-nav.prev { left: 12px; }
.g-nav.next { right: 12px; }
.g-count { position: absolute; bottom: 12px; right: 12px; background: rgba(0, 0, 0, .6); color: #fff; font-size: .8rem; padding: 3px 10px; border-radius: 20px; }
.thumbs { display: flex; gap: 6px; padding: 8px; overflow-x: auto; background: #0f172a; }
.thumb { flex-shrink: 0; width: 76px; height: 58px; border: 2px solid transparent; border-radius: 6px; overflow: hidden; padding: 0; background: none; opacity: .65; }
.thumb.active { border-color: var(--accent); opacity: 1; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.ad-price { font-size: 1.7rem; font-weight: 800; color: var(--brand); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.tag { font-size: .75rem; font-weight: 600; background: #fef3c7; color: #92400e; padding: 3px 8px; border-radius: 6px; }
.ad-title { font-size: 1.45rem; margin: 6px 0 10px; }
.ad-meta { display: flex; flex-wrap: wrap; gap: 6px 18px; color: var(--muted); font-size: .9rem; }
.ad-actions { display: flex; gap: 6px; margin-top: 12px; border-top: 1px solid var(--line); padding-top: 10px; flex-wrap: wrap; }
.details { display: grid; grid-template-columns: 1fr 1fr; gap: 0 24px; margin: 0; }
.details > div { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid #f1f5f9; }
.details dt { color: var(--muted); }
.details dd { margin: 0; font-weight: 600; text-align: right; }
.description { white-space: pre-line; margin: 0; }
.sticky { position: sticky; top: calc(var(--header-h) + 16px); }
.contact-box, .owner-box { display: flex; flex-direction: column; gap: 8px; margin: 14px 0; }
.owner-box p { margin: 0; }
.seller { display: flex; gap: 12px; align-items: center; padding: 14px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); color: var(--text); text-decoration: none !important; }
.seller small { display: block; color: var(--muted); }
.seller small.link { color: var(--brand); }
.safety { font-size: .85rem; margin-top: 14px; background: #f8fafc; border-radius: 10px; padding: 12px 14px; }
.safety ul { padding-left: 18px; margin: 6px 0; color: #475569; }
.notice { background: #ecfdf5; border: 1px solid #a7f3d0; color: #065f46; padding: 10px 14px; border-radius: 10px; margin-bottom: 14px; font-weight: 600; }
.notice.danger { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.mobile-contact { display: none; }
.lightbox img { max-height: 80vh; margin: 0 auto; object-fit: contain; }

/* Post ad */
.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; margin-top: 16px; }
.pick { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 20px 10px; background: #fff; border: 1.5px solid var(--line); border-radius: var(--radius); font-weight: 600; }
.pick:hover { border-color: var(--brand); background: var(--brand-soft); }
.pick-list { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-top: 16px; }
.pick-row { display: flex; justify-content: space-between; width: 100%; padding: 15px 18px; background: #fff; border: 0; border-bottom: 1px solid var(--line); text-align: left; font-weight: 500; }
.pick-row:last-child { border-bottom: 0; }
.pick-row:hover { background: var(--brand-soft); }
.crumb-pill { display: inline-block; background: var(--brand-soft); color: var(--brand); border-radius: 20px; padding: 4px 12px; font-size: .85rem; font-weight: 600; }
.post-form { display: flex; flex-direction: column; gap: 0; margin-top: 12px; }
.post-form .card-plain { display: flex; flex-direction: column; gap: 14px; }
.post-form .card-plain h2 { margin: 0; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.row2.wrap > * { min-width: 0; }
.check, .radio { display: flex; gap: 8px; align-items: center; font-size: .92rem; }
.check input, .radio input { width: 18px; height: 18px; accent-color: var(--brand); }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; }
.photo { position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: #f1f5f9; }
.photo img { width: 100%; height: 100%; object-fit: cover; }
.photo.add { border: 2px dashed #cbd5e1; display: flex; flex-direction: column; align-items: center; justify-content: center; cursor: pointer; color: var(--muted); background: #f8fafc; }
.photo.add:hover { border-color: var(--brand); color: var(--brand); }
.photo.add span { font-size: 2rem; line-height: 1; }
.cover { position: absolute; left: 6px; bottom: 6px; background: var(--brand); color: #fff; font-size: .7rem; font-weight: 700; padding: 2px 8px; border-radius: 6px; }
.ph-btn { position: absolute; top: 6px; width: 28px; height: 28px; border-radius: 50%; border: 0; background: rgba(15, 23, 42, .7); color: #fff; font-size: 1rem; line-height: 1; }
.ph-btn.right { right: 6px; }
.ph-btn.left { left: 6px; }
.form-error { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; padding: 10px 14px; border-radius: 10px; margin-bottom: 12px; font-weight: 500; }

/* Auth & account */
.auth-page { display: flex; justify-content: center; }
.auth-card { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 32px; width: 100%; max-width: 440px; box-shadow: var(--shadow); }
.stack { display: flex; flex-direction: column; gap: 14px; }
.btn-google { gap: 10px; margin: 16px 0 4px; }
.or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .82rem; margin: 12px 0 16px; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.demo-hint { background: #fff7db; border-radius: 8px; padding: 8px 12px; font-size: .85rem; text-align: center; }
.profile-head { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; }
.profile-head h1 { margin: 0; }
.profile-head p { margin: 2px 0; }
.quick-links { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.quick-links a { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 8px 14px; color: var(--text); }
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; }
.page-head h1 { margin: 0; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tab { padding: 10px 16px; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; text-decoration: none !important; }
.tab span { background: #eef2f7; border-radius: 10px; padding: 1px 8px; font-size: .78rem; margin-left: 4px; }
.tab.active { color: var(--brand); border-color: var(--brand); }
.my-list { display: flex; flex-direction: column; gap: 10px; }
.my-row { display: flex; gap: 14px; align-items: center; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.my-thumb { width: 120px; aspect-ratio: 4 / 3; border-radius: 8px; overflow: hidden; flex-shrink: 0; background: #eef2f7; }
.my-thumb img { width: 100%; height: 100%; object-fit: cover; }
.my-info { flex: 1; min-width: 0; }
.my-title { font-weight: 600; color: var(--text); }
.my-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

/* Chat */
.chat-layout { display: grid; grid-template-columns: 340px 1fr; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; height: calc(100vh - var(--header-h) - 80px); min-height: 480px; }
.conv-list { border-right: 1px solid var(--line); overflow-y: auto; }
.conv-list h1 { font-size: 1.25rem; padding: 16px 16px 8px; margin: 0; }
.conv { display: flex; gap: 10px; padding: 12px 16px; border-bottom: 1px solid #f1f5f9; color: var(--text); text-decoration: none !important; align-items: center; position: relative; }
.conv:hover { background: #f8fafc; }
.conv.active { background: var(--brand-soft); }
.conv-thumb { width: 52px; height: 52px; border-radius: 10px; object-fit: cover; flex-shrink: 0; background: #eef2f7; }
.conv-body { flex: 1; min-width: 0; }
.conv-top { display: flex; justify-content: space-between; gap: 6px; }
.conv-top small { color: var(--muted); white-space: nowrap; }
.conv-listing { font-size: .8rem; color: var(--brand); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-last { font-size: .85rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv.unread .conv-last { color: var(--text); font-weight: 600; }
.dot { background: var(--brand); color: #fff; font-size: .7rem; font-weight: 700; border-radius: 10px; min-width: 20px; height: 20px; display: grid; place-items: center; }
.chat-pane { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.empty-pane { justify-content: center; }
.chat-head { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.chat-user { display: flex; align-items: center; gap: 10px; flex: 1; color: var(--text); text-decoration: none !important; }
.chat-user small { display: block; color: var(--muted); }
.icon-btn { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: #f1f5f9; text-decoration: none !important; }
.back { font-size: 2rem; line-height: 1; padding: 0 8px 0 0; color: var(--text); text-decoration: none !important; }
.chat-listing { display: flex; gap: 10px; align-items: center; padding: 8px 14px; border-bottom: 1px solid var(--line); background: #f8fafc; color: var(--text); text-decoration: none !important; }
.chat-listing img { width: 48px; height: 40px; object-fit: cover; border-radius: 6px; }
.chat-listing div { flex: 1; min-width: 0; }
.chat-listing .small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-listing strong { color: var(--brand); font-size: .9rem; }
.messages { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 6px; background: #f5f7fb; }
.msg { display: flex; }
.msg.me { justify-content: flex-end; }
.bubble { max-width: 75%; padding: 8px 12px 6px; border-radius: 14px; background: #fff; box-shadow: var(--shadow); white-space: pre-wrap; word-wrap: break-word; }
.msg.me .bubble { background: var(--brand); color: #fff; border-bottom-right-radius: 4px; }
.msg.them .bubble { border-bottom-left-radius: 4px; }
.bubble small { display: block; text-align: right; font-size: .68rem; opacity: .7; margin-top: 2px; }
.day-sep { text-align: center; margin: 8px 0; }
.day-sep span { background: #e2e8f0; color: #475569; font-size: .72rem; padding: 2px 10px; border-radius: 10px; }
.chat-hint { margin: auto; color: var(--muted); text-align: center; }
.quick { display: flex; gap: 6px; padding: 8px 12px 0; overflow-x: auto; }
.quick .chip { cursor: pointer; }
.composer { display: flex; gap: 8px; padding: 10px 12px; align-items: flex-end; }
.composer textarea { flex: 1; resize: none; border: 1.5px solid var(--line); border-radius: 20px; padding: 10px 16px; outline: none; max-height: 140px; }
.composer textarea:focus { border-color: var(--brand); }
.composer .btn { border-radius: 50%; width: 44px; height: 44px; padding: 0; }
.chat-safety { font-size: .75rem; color: var(--muted); text-align: center; margin: 0 0 8px; }

/* Admin */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 20px; }
.stats > div { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.stats strong { display: block; font-size: 1.6rem; }
.stats span { color: var(--muted); font-size: .88rem; }
.table-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th, .table td { padding: 10px 12px; border-bottom: 1px solid #f1f5f9; text-align: left; vertical-align: middle; }
.table th { background: #f8fafc; font-weight: 600; color: #475569; }
.tbl-thumb { width: 56px; height: 42px; object-fit: cover; border-radius: 6px; }

/* Help */
.help-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.prose p, .prose li { color: #334155; }
.prose li { margin-bottom: 6px; }
.tips { padding-left: 20px; }

/* Misc */
.empty { text-align: center; padding: 48px 16px; color: var(--muted); }
.empty-icon { font-size: 3rem; margin-bottom: 8px; }
.empty h3 { color: var(--text); }
.loading { display: grid; place-items: center; padding: 80px 0; }
.spinner { width: 36px; height: 36px; border: 4px solid #dbe4f3; border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.toast { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%) translateY(20px); background: #0f172a; color: #fff; padding: 12px 20px; border-radius: 10px; font-weight: 500; box-shadow: var(--shadow-lg); opacity: 0; pointer-events: none; transition: all .25s; z-index: 200; max-width: calc(100% - 32px); text-align: center; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.success { background: var(--green); }
.toast.error { background: var(--danger); }
.modal-wrap { position: fixed; inset: 0; background: rgba(15, 23, 42, .55); display: grid; place-items: center; z-index: 150; padding: 16px; animation: fade .15s; }
.modal { background: #fff; border-radius: 16px; padding: 24px; width: 100%; max-width: 480px; max-height: 90vh; overflow: auto; position: relative; }
.modal:has(.lightbox) { max-width: 1000px; background: #0f172a; }
.modal-x { position: absolute; top: 10px; right: 12px; border: 0; background: #f1f5f9; width: 32px; height: 32px; border-radius: 50%; font-size: 1.3rem; line-height: 1; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.confirm-msg { font-size: 1.05rem; margin: 8px 0; padding-right: 30px; }
@keyframes fade { from { opacity: 0; } }

/* Footer */
.footer { background: #0b1f45; color: #cbd5e1; padding: 40px 0 16px; margin-top: 40px; }
.footer-inner { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 24px; }
.footer h4 { color: #fff; margin: 0 0 10px; }
.footer a { display: block; color: #cbd5e1; padding: 3px 0; font-size: .9rem; }
.footer .logo { display: inline-flex; }
.footer p { font-size: .9rem; max-width: 320px; }
.footer-bottom { border-top: 1px solid rgba(255, 255, 255, .1); margin-top: 24px; padding-top: 14px; font-size: .85rem; }
.tabbar { display: none; }

/* Responsive */
@media (max-width: 1024px) {
  .ad-layout { grid-template-columns: minmax(0, 1fr) 300px; }
  .footer-inner { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 900px) {
  .show-md { display: inline-flex !important; }
  .hide-md { display: none !important; }
  .search-layout { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0; z-index: 120; background: rgba(15, 23, 42, .5); max-height: none; padding: 0; display: none; top: 0; }
  .sidebar.open { display: block; }
  .sidebar .filters { position: absolute; right: 0; top: 0; bottom: 0; width: min(360px, 90vw); border-radius: 0; overflow-y: auto; }
  .ad-layout { grid-template-columns: 1fr; }
  .sticky { position: static; }
  .chat-layout { grid-template-columns: 1fr; }
  .chat-layout.no-conv .chat-pane { display: none; }
  .chat-layout.no-conv .conv-list { border-right: 0; }
  .stats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 700px) {
  :root { --header-h: 56px; }
  body { font-size: 14.5px; padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
  .hide-sm { display: none !important; }
  .header-inner { gap: 10px; }
  .logo span { display: none; }
  .header-search { max-width: none; }
  .hero { padding: 28px 0; }
  .hero h1 { font-size: 1.7rem; }
  .hero p { font-size: .98rem; }
  .hero-search { flex-direction: column; }
  .hero-search select { border-left: 0; border-top: 1px solid var(--line); }
  .cat-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .cat-tile { padding: 12px 6px; }
  .cat-icon { width: 46px; height: 46px; font-size: 1.5rem; border-radius: 12px; }
  .cat-name { font-size: .78rem; }
  .cat-count { display: none; }
  .promo { flex-direction: column; align-items: stretch; text-align: center; padding: 20px; }
  .trust { grid-template-columns: 1fr; }
  .grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .card-body { padding: 10px; }
  .card-price { font-size: .98rem; }
  .card-title { font-size: .88rem; }
  .card-attrs { font-size: .74rem; }
  .card-meta { flex-direction: column; gap: 0; }
  .results-head { flex-direction: column; }
  .results-head h1 { font-size: 1.15rem; }
  .results-tools { width: 100%; }
  .results-tools select { flex: 1; }
  .details { grid-template-columns: 1fr; }
  .hide-sm-block { display: none; }
  .ad-page .contact-box { display: none; }
  .mobile-contact { display: flex; gap: 8px; position: fixed; left: 0; right: 0; bottom: calc(60px + env(safe-area-inset-bottom)); background: #fff; padding: 10px 12px; border-top: 1px solid var(--line); z-index: 40; box-shadow: 0 -4px 12px rgba(0, 0, 0, .06); }
  .mobile-contact .btn { flex: 1; padding: 11px 6px; }
  .ad-page { padding-bottom: 90px; }
  .row2 { grid-template-columns: 1fr; }
  .my-row { flex-wrap: wrap; }
  .my-thumb { width: 90px; }
  .my-actions { width: 100%; justify-content: flex-start; }
  .auth-card { padding: 22px; border: 0; box-shadow: none; background: transparent; }
  .chat-page { padding: 0; }
  .chat-page.container { padding: 0; }
  .chat-layout { border-radius: 0; border: 0; height: calc(100vh - var(--header-h) - 64px - env(safe-area-inset-bottom)); height: calc(100dvh - var(--header-h) - 64px - env(safe-area-inset-bottom)); min-height: 0; }
  body[data-route="chat"] .footer, body[data-route="chats"] .footer { display: none; }
  .footer-inner { grid-template-columns: 1fr; }
  .tabbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; background: #fff; border-top: 1px solid var(--line); z-index: 60; padding-bottom: env(safe-area-inset-bottom); }
  .tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; font-size: .68rem; color: var(--muted); padding: 7px 0; text-decoration: none !important; height: 60px; }
  .tabbar a span { font-size: 1.25rem; position: relative; line-height: 1.2; }
  .tabbar a.active { color: var(--brand); font-weight: 700; }
  .tabbar .tab-post span { background: var(--accent); color: #1b1b1b; width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; margin-top: -18px; box-shadow: 0 4px 10px rgba(0, 0, 0, .15); border: 3px solid #fff; }
  .tabbar .unread-badge { top: -4px; right: -10px; }
  .toast { bottom: 140px; }
}
