@font-face {
  font-family: "Be Vietnam Pro";
  src: url("../fonts/BeVietnamPro-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Be Vietnam Pro";
  src: url("../fonts/BeVietnamPro-Medium.ttf") format("truetype");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Be Vietnam Pro";
  src: url("../fonts/BeVietnamPro-SemiBold.ttf") format("truetype");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Be Vietnam Pro";
  src: url("../fonts/BeVietnamPro-Bold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #f3eee4;
  --bg-deep: #e8e0d2;
  --surface: #fffdf8;
  --ink: #1a2420;
  --ink-2: #4a5550;
  --ink-3: #6e7973;
  --line: #e7e0d3;
  --line-2: #d9d1c3;
  --primary: #1b6b54;
  --primary-2: #145544;
  --primary-soft: #e3f2eb;
  --primary-soft-2: #cfe6db;
  --clay: #b85a32;
  --gold: #e8c36a;
  --gift: #1b7a4a;
  --gift-bg: #e8f6ee;
  --heart: #c44536;
  --heart-soft: #fdecea;
  --zalo: #0068ff;
  --zalo-soft: #e8f1ff;
  --danger: #b42318;
  --shadow: 0 10px 28px rgba(26, 36, 32, 0.1);
  --shadow-sm: 0 2px 8px rgba(26, 36, 32, 0.06);
  --radius: 16px;
  --tab-h: 72px;
  --fab: 62px;
  --font: "Be Vietnam Pro", "Noto Sans", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}


html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #161815;
  --bg-deep: #101210;
  --surface: #222521;
  --ink: #f3eee4;
  --ink-2: #c5c0b4;
  --ink-3: #9a958a;
  --line: #33382f;
  --line-2: #3f453c;
  --primary: #3aa37c;
  --primary-2: #8fd4b4;
  --primary-soft: #1b332b;
  --primary-soft-2: #23483c;
  --clay: #d9845c;
  --gold: #e8c36a;
  --gift: #4cbf84;
  --gift-bg: #1a3328;
  --heart: #e06a5c;
  --heart-soft: #3a2422;
  --zalo: #3d8aff;
  --zalo-soft: #1a2a44;
  --danger: #f0a0a0;
  --shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.25);
  --warn-bg: #3a2c14;
  --warn-ink: #f3d9a0;
  --warn-line: #6a5420;
}
html[data-theme="dark"] body {
  background: #0e0f0d;
}
@media (min-width: 540px) {
  html[data-theme="dark"] body {
    background: radial-gradient(ellipse at top, #2a2d28 0%, #161815 55%, #0e0f0d 100%);
  }
}

:root {
  --warn-bg: #fff6de;
  --warn-ink: #6a5316;
  --warn-line: #ead8a0;
}

html[data-text="large"] .brand-name { font-size: 20px; }
html[data-text="large"] .card-title { font-size: 18.5px; }
html[data-text="large"] .price, html[data-text="large"] .detail-price { font-size: 24px; }
html[data-text="large"] .detail-title { font-size: 24px; }
html[data-text="large"] .btn { min-height: 56px; font-size: 18px; }
html[data-text="large"] .tab { font-size: 13.5px; }
html[data-text="large"] .chip, html[data-text="large"] .rchip { font-size: 16px; height: 44px; }
html[data-text="large"] .meta, html[data-text="large"] .feed-note { font-size: 15px; }
html[data-text="large"] .bubble, html[data-text="large"] input, html[data-text="large"] textarea, html[data-text="large"] select { font-size: 17.5px; }
html[data-text="large"] .nav-title, html[data-text="large"] .profile-hero h2 { font-size: 20px; }

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { height: 100%; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: #cfc4b3;
  min-height: 100%;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: 16px;
  color: inherit;
}
button { cursor: pointer; border: 0; background: none; }
img { display: block; max-width: 100%; }

.device {
  min-height: 100dvh;
  display: flex;
  justify-content: center;
  align-items: stretch;
}

.app {
  width: 100%;
  height: 100vh;
  height: 100dvh;
  min-height: 100vh;
  min-height: 100dvh;
  max-height: 100vh;
  max-height: 100dvh;
  background: var(--bg);
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

@media (min-width: 540px) {
  body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 28px 16px;
    background:
      radial-gradient(ellipse at top, #e7ddd0 0%, #cfc4b3 55%, #b9ad9b 100%);
  }
  .device {
    min-height: 0;
    padding: 0;
  }
  .app {
    width: 390px;
    height: 844px;
    min-height: 844px;
    border-radius: 36px;
    box-shadow:
      0 0 0 12px #2b2622,
      0 0 0 14px #5a524a,
      0 40px 80px rgba(30, 24, 18, 0.35);
    overflow: hidden;
  }
}

/* ---------- top bars ---------- */
.topbar {
  flex: 0 0 auto;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 16px 10px;
  background: var(--bg);
  position: relative;
  z-index: 5;
}
.topbar.solid {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.logo-mark {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
}
.brand-text { min-width: 0; }
.brand-name {
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: var(--primary-2);
}
.brand-sub {
  font-size: 12.5px;
  color: var(--ink-3);
  font-weight: 500;
  margin-top: 1px;
}

.area-btn {
  margin-top: 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px 8px 10px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-weight: 600;
  font-size: 15px;
  min-height: 42px;
  box-shadow: var(--shadow-sm);
  max-width: 100%;
}
.area-btn svg { width: 18px; height: 18px; color: var(--primary); flex: 0 0 auto; }
.area-btn .chev { width: 16px; height: 16px; color: var(--ink-3); }

.search-wrap {
  margin-top: 12px;
  position: relative;
}
.search-wrap input {
  width: 100%;
  height: 48px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 14px;
  padding: 0 16px 0 44px;
  outline: none;
  font-size: 16px;
  box-shadow: var(--shadow-sm);
}
.search-wrap input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(27, 107, 84, 0.18);
}
.search-wrap .ico {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  color: var(--ink-3);
  pointer-events: none;
}
.search-clear {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: var(--ink-3);
  display: none;
  align-items: center;
  justify-content: center;
}
.search-wrap.has-query .search-clear { display: flex; }

.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 12px 16px 8px;
  scrollbar-width: none;
  flex: 0 0 auto;
  background: var(--bg);
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto;
  height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-weight: 600;
  font-size: 14.5px;
  color: var(--ink-2);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.chip.on {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.chip.gift.on {
  background: var(--gift);
  border-color: var(--gift);
}

/* ---------- scroll area ---------- */
.main {
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding-bottom: calc(var(--tab-h) + 20px + env(safe-area-inset-bottom, 0px));
}
.main.no-tab {
  padding-bottom: 24px;
}
.feed-note {
  margin: 4px 16px 8px;
  font-size: 13.5px;
  color: var(--ink-3);
}

/* ---------- listing ---------- */
.feed { padding: 0 12px 16px; }
.card {
  display: flex;
  gap: 14px;
  padding: 12px;
  background: var(--surface);
  border-radius: 20px;
  margin-bottom: 11px;
  transition: transform 0.16s ease, box-shadow 0.16s ease;
  text-decoration: none;
  color: inherit;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  min-height: 112px;
  width: 100%;
  text-align: left;
  align-items: stretch;
}
.card:active { transform: scale(0.992); }
.thumb {
  width: 104px;
  height: 104px;
  border-radius: 14px;
  flex: 0 0 104px;
  overflow: hidden;
  position: relative;
  background: var(--bg-deep);
}
.thumb img, .thumb svg, .thumb .ph {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.badge-sold, .badge-gift {
  position: absolute;
  left: 6px;
  top: 6px;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 7px;
  border-radius: 999px;
  letter-spacing: 0.02em;
}
.badge-sold { background: rgba(26, 36, 32, 0.78); color: #fff; }
.badge-gift { background: var(--gift); color: #fff; }
.card-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: 2px 0;
}
.card-title {
  font-size: 16.5px;
  font-weight: 600;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card.sold .card-title { color: var(--ink-3); }
.price {
  margin-top: 6px;
  font-size: 20px;
  font-weight: 700;
  color: var(--primary-2);
  letter-spacing: -0.02em;
}
.price.gift { color: var(--gift); }
.card.sold .price {
  color: var(--ink-3);
  text-decoration: line-through;
  font-size: 16px;
}
.meta {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
  color: var(--ink-3);
  padding-top: 6px;
}
.hearts {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: var(--ink-3);
  font-weight: 500;
}
.hearts svg { width: 15px; height: 15px; }

.empty {
  text-align: center;
  padding: 48px 28px;
  color: var(--ink-2);
}
.empty .big { font-size: 42px; margin-bottom: 10px; }
.empty h3 { margin: 0 0 8px; font-size: 18px; }
.empty p { margin: 0; color: var(--ink-3); font-size: 15px; line-height: 1.5; }

/* ---------- tab bar + FAB ---------- */
.tabbar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: calc(var(--tab-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: rgba(255, 253, 248, 0.94);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  z-index: 20;
}
.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--ink-3);
  font-size: 12px;
  font-weight: 600;
  position: relative;
  min-height: 56px;
}
.tab svg { width: 24px; height: 24px; }
.tab.on { color: var(--primary); }
.badge {
  position: absolute;
  top: 8px;
  transform: translateX(12px);
  background: var(--heart);
  color: #fff;
  font-size: 10px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 99px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

.fab {
  position: absolute;
  right: 18px;
  bottom: calc(var(--tab-h) + env(safe-area-inset-bottom, 0px) + 14px);
  width: var(--fab);
  height: var(--fab);
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  box-shadow: 0 10px 24px rgba(27, 107, 84, 0.38);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 25;
  border: 3px solid #fffdf8;
}
.fab svg { width: 30px; height: 30px; }
.fab:active { transform: scale(0.96); background: var(--primary-2); }
.fab-label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

/* ---------- nav header (subpages) ---------- */
.nav {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 52px;
}
.icon-btn {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 44px;
  color: var(--ink);
}
.icon-btn:active { background: var(--bg-deep); }
.icon-btn svg { width: 24px; height: 24px; }
.icon-btn.on { color: var(--heart); }
.nav-title {
  flex: 1;
  font-size: 18px;
  font-weight: 700;
  text-align: center;
  padding-right: 44px;
  letter-spacing: -0.02em;
}
.nav.has-right .nav-title { padding-right: 0; }

/* ---------- detail ---------- */
.carousel {
  position: relative;
  background: #1a2420;
  aspect-ratio: 1 / 0.82;
  overflow: hidden;
}
.carousel-track {
  display: flex;
  height: 100%;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}
.carousel-track::-webkit-scrollbar { display: none; }
.slide {
  min-width: 100%;
  height: 100%;
  scroll-snap-align: start;
  display: flex;
  align-items: center;
  justify-content: center;
}
.slide .ph, .slide img, .slide svg {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.dots {
  position: absolute;
  bottom: 12px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  gap: 6px;
}
.dots span {
  width: 7px;
  height: 7px;
  border-radius: 99px;
  background: rgba(255,255,255,0.4);
}
.dots span.on { background: #fff; width: 18px; }

.detail-body { padding: 18px 18px 8px; }
.detail-price {
  font-size: 28px;
  font-weight: 700;
  color: var(--primary-2);
  letter-spacing: -0.03em;
  line-height: 1.1;
}
.detail-price.gift { color: var(--gift); }
.detail-title {
  margin: 8px 0 0;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.02em;
}
.detail-loc {
  margin-top: 10px;
  color: var(--ink-2);
  font-size: 14.5px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.detail-loc svg { width: 16px; height: 16px; color: var(--primary); }
.detail-desc {
  margin: 16px 0 8px;
  font-size: 16.5px;
  line-height: 1.6;
  color: var(--ink);
  white-space: pre-wrap;
}

.seller {
  margin: 16px 18px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: var(--primary-2);
  background: var(--primary-soft);
  flex: 0 0 52px;
  font-size: 18px;
}
.seller h3 { margin: 0; font-size: 16.5px; font-weight: 700; }
.uytin {
  margin-top: 3px;
  font-size: 13.5px;
  color: var(--ink-2);
  font-weight: 500;
}
.star { color: #d4a017; }

.cta-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 8px 18px 24px;
}
.btn {
  min-height: 52px;
  border-radius: 14px;
  font-weight: 700;
  font-size: 16.5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 14px;
  text-decoration: none;
}
.btn svg { width: 20px; height: 20px; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:active { background: var(--primary-2); }
.btn-zalo { background: var(--zalo); color: #fff; }
.btn-zalo:active { filter: brightness(0.92); }
.btn-ghost {
  background: var(--surface);
  border: 1.5px solid var(--line-2);
  color: var(--ink);
}
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: default; }

/* ---------- compose ---------- */
.form { padding: 8px 16px 24px; }
.photos {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 4px 0 12px;
  scrollbar-width: none;
}
.photos::-webkit-scrollbar { display: none; }
.photo-slot {
  width: 92px;
  height: 92px;
  border-radius: 14px;
  flex: 0 0 92px;
  border: 1.5px dashed var(--line-2);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--ink-3);
  font-size: 12px;
  font-weight: 600;
  position: relative;
  overflow: hidden;
}
.photo-slot.add { color: var(--primary); border-color: var(--primary-soft-2); background: var(--primary-soft); }
.photo-slot img { width: 100%; height: 100%; object-fit: cover; }
.photo-slot .x {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(26,36,32,0.75);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}
.field { margin-bottom: 14px; }
.field label {
  display: block;
  font-weight: 600;
  font-size: 14.5px;
  margin-bottom: 6px;
  color: var(--ink-2);
}
.field input[type="text"],
.field input[type="tel"],
.field input[type="number"],
.field select,
.field textarea {
  width: 100%;
  border: 1.5px solid var(--line-2);
  background: var(--surface);
  border-radius: 14px;
  padding: 12px 14px;
  outline: none;
  min-height: 50px;
}
.field textarea { min-height: 110px; resize: vertical; line-height: 1.5; }
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(27, 107, 84, 0.16);
}
.price-row {
  display: flex;
  gap: 10px;
  align-items: stretch;
}
.price-row .field-grow { flex: 1; }
.toggle {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border-radius: 14px;
  border: 1.5px solid var(--line-2);
  background: var(--surface);
  font-weight: 700;
  font-size: 14px;
  color: var(--ink-2);
  min-height: 50px;
  margin-top: 24px;
}
.toggle.on {
  background: var(--gift-bg);
  border-color: var(--gift);
  color: var(--gift);
}
.hint { font-size: 13px; color: var(--ink-3); margin: -6px 0 14px; }
.sticky-cta {
  position: sticky;
  bottom: 0;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(to top, var(--bg) 70%, transparent);
}

/* ---------- messages ---------- */
.thread {
  display: flex;
  gap: 12px;
  width: 100%;
  padding: 14px 16px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  background: transparent;
  align-items: center;
}
.thread:active { background: var(--surface); }
.thread .avatar { width: 50px; height: 50px; flex-basis: 50px; font-size: 17px; }
.thread-body { flex: 1; min-width: 0; }
.thread-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: baseline;
}
.thread-top h3 { margin: 0; font-size: 16px; font-weight: 700; }
.thread-top time { font-size: 12px; color: var(--ink-3); flex: 0 0 auto; }
.thread-preview {
  margin: 3px 0 0;
  font-size: 14px;
  color: var(--ink-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.thread-item {
  font-size: 12.5px;
  color: var(--primary);
  font-weight: 600;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.thread-thumb {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  overflow: hidden;
  flex: 0 0 48px;
  background: var(--bg-deep);
}
.thread-thumb .ph, .thread-thumb svg, .thread-thumb img {
  width: 100%; height: 100%; object-fit: cover;
}
.unread .thread-preview { color: var(--ink); font-weight: 600; }

/* chat */
.chat-head-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px 10px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.chat-head-item .mini {
  width: 36px; height: 36px; border-radius: 8px; overflow: hidden; flex: 0 0 36px; background: var(--bg-deep);
}
.chat-head-item .mini .ph, .chat-head-item .mini svg, .chat-head-item .mini img { width:100%;height:100%;object-fit:cover; }
.chat-head-item p { margin: 0; font-size: 13px; color: var(--ink-3); }
.chat-head-item strong { display: block; font-size: 14px; }

.chat-log {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.bubble {
  max-width: 80%;
  padding: 10px 13px;
  border-radius: 18px;
  font-size: 16px;
  line-height: 1.45;
  word-wrap: break-word;
}
.bubble.them {
  align-self: flex-start;
  background: var(--surface);
  border: 1px solid var(--line);
  border-bottom-left-radius: 6px;
}
.bubble.me {
  align-self: flex-end;
  background: var(--primary);
  color: #fff;
  border-bottom-right-radius: 6px;
}
.bubble time {
  display: block;
  font-size: 11px;
  opacity: 0.7;
  margin-top: 4px;
}

.quick {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 8px 14px 6px;
  scrollbar-width: none;
  flex: 0 0 auto;
  background: var(--bg);
}
.quick::-webkit-scrollbar { display: none; }
.quick button {
  flex: 0 0 auto;
  height: 38px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-weight: 600;
  font-size: 13.5px;
  color: var(--primary-2);
}

.composer {
  display: flex;
  gap: 8px;
  padding: 8px 12px calc(10px + env(safe-area-inset-bottom, 0px));
  background: var(--surface);
  border-top: 1px solid var(--line);
  flex: 0 0 auto;
}
.composer input {
  flex: 1;
  height: 46px;
  border: 1.5px solid var(--line-2);
  border-radius: 999px;
  padding: 0 16px;
  outline: none;
  background: var(--bg);
}
.composer input:focus { border-color: var(--primary); }
.send-btn {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 46px;
}
.send-btn:disabled { opacity: 0.4; }
.send-btn svg { width: 20px; height: 20px; }

.chat-layout {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}
.app.chat-mode { background: #efeae0; }

/* ---------- profile ---------- */
.profile-hero {
  padding: 8px 18px 18px;
  text-align: center;
}
.avatar.lg {
  width: 84px;
  height: 84px;
  font-size: 28px;
  margin: 0 auto 12px;
}
.profile-hero h2 { margin: 0; font-size: 22px; font-weight: 700; }
.profile-hero p { margin: 6px 0 0; color: var(--ink-2); font-size: 14.5px; }
.login-box {
  margin: 8px 16px 16px;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
}
.login-box h3 { margin: 0 0 6px; font-size: 18px; }
.login-box p { margin: 0 0 14px; color: var(--ink-2); font-size: 14.5px; line-height: 1.5; }

.ptabs {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  margin: 0 16px 12px;
  background: var(--bg-deep);
  border-radius: 14px;
  padding: 4px;
  gap: 4px;
}
.ptab {
  height: 42px;
  border-radius: 11px;
  font-weight: 700;
  font-size: 13.5px;
  color: var(--ink-3);
}
.ptab.on { background: var(--surface); color: var(--primary-2); box-shadow: var(--shadow-sm); }

.mini-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}
.mini-actions .btn { min-height: 40px; font-size: 14px; padding: 0 10px; flex: 1; }

.demo-banner {
  margin: 0 16px 12px;
  padding: 10px 12px;
  background: #fff6de;
  border: 1px solid #ead8a0;
  color: #6a5316;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.45;
}

/* ---------- sheets / modal ---------- */
.overlay {
  position: absolute;
  inset: 0;
  background: rgba(26, 36, 32, 0.45);
  z-index: 40;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.sheet {
  width: 100%;
  background: var(--surface);
  border-radius: 22px 22px 0 0;
  padding: 10px 16px calc(18px + env(safe-area-inset-bottom, 0px));
  max-height: 78%;
  overflow-y: auto;
  animation: up 0.22s ease;
}
@keyframes up {
  from { transform: translateY(24px); opacity: 0.6; }
  to { transform: none; opacity: 1; }
}
.grab {
  width: 40px;
  height: 4px;
  background: var(--line-2);
  border-radius: 99px;
  margin: 4px auto 12px;
}
.sheet h2 { margin: 0 16px 12px 4px; font-size: 20px; }
.option {
  width: 100%;
  text-align: left;
  padding: 14px 12px;
  border-radius: 12px;
  font-size: 17px;
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 52px;
}
.option:active, .option.on { background: var(--primary-soft); color: var(--primary-2); }
.check { color: var(--primary); font-size: 20px; }

.toast {
  position: absolute;
  left: 50%;
  bottom: calc(var(--tab-h) + 86px);
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 14.5px;
  font-weight: 600;
  z-index: 60;
  max-width: 86%;
  text-align: center;
  box-shadow: var(--shadow);
  animation: fadein 0.2s ease;
}
@keyframes fadein { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }

.hidden { display: none !important; }

/* placeholder illustration */
.ph {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}
.ph .emo {
  font-size: 46px;
  line-height: 1;
  position: relative;
  z-index: 1;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.12));
}
.ph.lg .emo { font-size: 88px; }
.ph .blob {
  position: absolute;
  border-radius: 50%;
  opacity: 0.35;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}


/* ---------- v2 polish ---------- */
.main, .chat-log { scroll-behavior: smooth; }
.view-in { animation: viewin 0.28s ease; }
@keyframes viewin {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

.seg {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin: 0 16px 8px;
  background: var(--bg-deep);
  border-radius: 14px;
  padding: 4px;
  gap: 4px;
  flex: 0 0 auto;
}
.seg button {
  height: 40px;
  border-radius: 11px;
  font-weight: 700;
  font-size: 14.5px;
  color: var(--ink-3);
}
.seg button.on {
  background: var(--surface);
  color: var(--primary-2);
  box-shadow: var(--shadow-sm);
}

.radii {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 0 16px 8px;
  scrollbar-width: none;
  flex: 0 0 auto;
  background: var(--bg);
}
.radii::-webkit-scrollbar { display: none; }
.rchip {
  flex: 0 0 auto;
  height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  background: transparent;
  border: 1px solid var(--line);
  font-weight: 600;
  font-size: 13px;
  color: var(--ink-2);
}
.rchip.on {
  background: var(--primary-soft);
  border-color: var(--primary);
  color: var(--primary-2);
}
.rchip.ask { opacity: 0.92; }

.area-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 10px;
}
.area-row .area-btn { margin-top: 0; flex: 1; justify-content: flex-start; }
.gps-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 42px;
  box-shadow: var(--shadow-sm);
}
.gps-btn.on { background: var(--primary); color: #fff; border-color: var(--primary); }
.gps-btn.busy { opacity: 0.6; }
.gps-btn svg { width: 20px; height: 20px; }

.dist {
  color: var(--primary);
  font-weight: 600;
}
.meta .dot { margin: 0 4px; color: var(--line-2); }

/* featured gifts */
.featured { padding: 2px 0 12px; }
.featured-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0 16px 8px;
}
.featured-head h3 { margin: 0; font-size: 16px; font-weight: 700; }
.featured-head button { color: var(--primary); font-weight: 700; font-size: 13.5px; }
.gift-row {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 0 16px 4px;
  scrollbar-width: none;
}
.gift-row::-webkit-scrollbar { display: none; }
.gift-card {
  flex: 0 0 132px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  text-align: left;
  box-shadow: var(--shadow-sm);
  color: inherit;
}
.gift-card .thumb { width: 100%; height: 92px; border-radius: 0; flex-basis: auto; }
.gift-card .gbody { padding: 8px 10px 10px; }
.gift-card .gbody h4 {
  margin: 0;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.6em;
}
.gift-card .gprice { margin-top: 4px; font-weight: 700; color: var(--gift); font-size: 14px; }
.gift-card .gmeta { font-size: 11.5px; color: var(--ink-3); margin-top: 2px; }

.badge-want {
  position: absolute;
  left: 6px;
  top: 6px;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 7px;
  border-radius: 999px;
  background: var(--clay);
  color: #fff;
}
.budget { color: var(--clay); }
.detail-price.budget { color: var(--clay); }

.verified {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 700;
  color: var(--primary-2);
  background: var(--primary-soft);
  border-radius: 999px;
  padding: 2px 8px;
  margin-top: 4px;
}
.verified.inline { margin-top: 0; margin-left: 6px; vertical-align: middle; }
.verified svg { width: 12px; height: 12px; }

/* skeleton */
.skel .thumb, .skel-line {
  background: linear-gradient(90deg, var(--bg-deep) 25%, var(--line) 50%, var(--bg-deep) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.1s ease infinite;
}
@keyframes shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}
.skel-line { height: 12px; border-radius: 8px; margin: 8px 0; }
.skel-line.w80 { width: 80%; }
.skel-line.w50 { width: 50%; }
.skel-line.w30 { width: 30%; height: 18px; }

/* onboarding */
.onboard {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--bg);
  padding: calc(20px + env(safe-area-inset-top, 0px)) 24px calc(20px + env(safe-area-inset-bottom, 0px));
}
.onboard-hero {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 12px 8px;
}
.onboard-hero .logo-mark { width: 88px; height: 88px; margin-bottom: 22px; }
.onboard-emoji {
  width: 112px;
  height: 112px;
  border-radius: 32px;
  background: var(--primary-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 56px;
  margin-bottom: 22px;
  box-shadow: var(--shadow-sm);
}
.onboard-hero h1 {
  margin: 0 0 10px;
  font-size: 26px;
  letter-spacing: -0.03em;
  color: var(--primary-2);
}
.onboard-hero p {
  margin: 0;
  font-size: 16.5px;
  line-height: 1.55;
  color: var(--ink-2);
  max-width: 32ch;
}
.onboard-dots {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 8px 0 18px;
}
.onboard-dots span {
  width: 8px;
  height: 8px;
  border-radius: 99px;
  background: var(--line-2);
}
.onboard-dots span.on { background: var(--primary); width: 22px; }
.onboard-actions { display: flex; flex-direction: column; gap: 10px; }
.onboard-actions .skip {
  height: 44px;
  color: var(--ink-3);
  font-weight: 600;
}

/* area sheet extras */
.sheet-search {
  position: relative;
  margin: 0 0 10px;
}
.sheet-search input {
  width: 100%;
  height: 46px;
  border: 1.5px solid var(--line-2);
  background: var(--bg);
  border-radius: 14px;
  padding: 0 14px 0 42px;
  outline: none;
}
.sheet-search input:focus { border-color: var(--primary); }
.sheet-search .ico {
  position: absolute;
  left: 14px; top: 50%;
  transform: translateY(-50%);
  width: 18px; height: 18px;
  color: var(--ink-3);
  pointer-events: none;
}
.gps-cta {
  width: 100%;
  min-height: 48px;
  border-radius: 14px;
  background: var(--primary-soft);
  color: var(--primary-2);
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 8px;
}
.gps-cta svg { width: 18px; height: 18px; }
.privacy-note {
  font-size: 12.5px;
  color: var(--ink-3);
  line-height: 1.45;
  margin: 0 4px 12px;
}
.prov-name {
  width: 100%;
  text-align: left;
  padding: 12px 12px 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-3);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.option.sub { padding-left: 22px; font-weight: 600; }

/* scam + safe meetup */
.scam-banner {
  margin: 8px 14px;
  padding: 12px 12px 12px 14px;
  background: var(--warn-bg);
  border: 1px solid var(--warn-line);
  color: var(--warn-ink);
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.45;
  font-weight: 600;
}
.scam-banner strong { display: block; margin-bottom: 2px; font-size: 14px; }
.safe-card {
  margin: 0 14px 8px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
}
.safe-card h4 { margin: 0 0 8px; font-size: 14px; font-weight: 700; color: var(--primary-2); }
.safe-place {
  width: 100%;
  text-align: left;
  padding: 8px 0;
  border-top: 1px solid var(--line);
  font-size: 14px;
}
.safe-place strong { display: block; font-weight: 700; }
.safe-place span { color: var(--ink-3); font-size: 12.5px; }

/* settings */
.setting {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  margin: 0 16px 10px;
}
.setting h3 { margin: 0; font-size: 16px; font-weight: 700; }
.setting p { margin: 3px 0 0; font-size: 13px; color: var(--ink-3); }
.switch {
  width: 52px;
  height: 32px;
  border-radius: 999px;
  background: var(--line-2);
  position: relative;
  flex: 0 0 52px;
  transition: background 0.2s;
}
.switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #fff;
  box-shadow: var(--shadow-sm);
  transition: left 0.2s;
}
.switch.on { background: var(--primary); }
.switch.on::after { left: 23px; }

.empty .illus {
  width: 88px;
  height: 88px;
  border-radius: 28px;
  background: var(--primary-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 42px;
  margin: 0 auto 14px;
}

.demo-banner { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn-ink); }

html[data-theme="dark"] .tabbar {
  background: rgba(34, 37, 33, 0.94);
}
html[data-theme="dark"] .search-wrap input,
html[data-theme="dark"] .composer input {
  background: var(--bg-deep);
}
html[data-theme="dark"] .fab { border-color: var(--surface); }
html[data-theme="dark"] .onboard-emoji { background: var(--primary-soft); }
html[data-theme="dark"] .card:active { background: var(--bg-deep); }


.scam-banner {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.scam-banner svg, .safe-card h4 svg, .gps-cta svg {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  display: inline-block;
  vertical-align: middle;
}
.safe-card h4 { display: flex; align-items: center; gap: 6px; }
.gift-card .gprice { white-space: nowrap; }
.chat-pin { flex: 0 0 auto; }


/* v3 additions */
.thumb img, .thumb-img, .slide img, .thread-thumb img, .mini img, .avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.badge-seed, .seed-tag {
  background: #c9a227;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 999px;
}
.badge-seed {
  position: absolute;
  left: 8px;
  bottom: 8px;
  z-index: 1;
}
.badge-seed.inline { position: static; vertical-align: middle; }
.seed-tag { background: transparent; color: var(--muted, #6b6b6b); padding: 0; }
.report-card {
  margin: 0 16px 12px;
  padding: 12px 14px;
  background: var(--surface);
  border-radius: 14px;
  display: grid;
  gap: 8px;
}
.section-title { padding: 8px 16px 4px; font-size: 16px; }
.warn { color: #b42318; }
.mini-actions { padding: 0 16px 16px; display: flex; gap: 8px; flex-wrap: wrap; }
.hidden { display: none !important; }

/* v4: share, trust, invite, near-me, admin stats */
.share-btn { margin: 12px 0 0; display: inline-flex; gap: 8px; align-items: center; width: auto; }
.share-btn svg { width: 18px; height: 18px; }
.share-preview {
  background: var(--surface, #fff);
  padding: 12px 14px;
  border-radius: 12px;
  font-weight: 600;
  line-height: 1.45;
}
.share-fallbacks { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-top: 12px; }
.share-fallbacks .btn { text-align: center; text-decoration: none; }
.seller-meta { color: var(--muted, #5c6b64); font-size: 13px; margin: 4px 0 0; }
.safety-box {
  margin: 0 16px 16px;
  padding: 14px 16px;
  background: #eef6f2;
  border: 1px solid rgba(27,107,84,.16);
  border-radius: 14px;
}
.safety-box h4 { display: flex; gap: 8px; align-items: center; margin: 0 0 8px; font-size: 15px; }
.safety-box svg { width: 18px; height: 18px; flex: none; }
.safety-box ul { margin: 0; padding-left: 18px; color: var(--text, #1b2b24); }
.safety-box li { margin: 4px 0; }
.expand-hint {
  margin: 8px 16px 16px;
  padding: 14px 16px;
  background: var(--surface, #fff);
  border-radius: 14px;
}
.expand-hint p { margin: 0; }
.expand-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.invite-card {
  padding: 14px 16px;
  background: var(--surface, #fff);
  border-radius: 16px;
  display: grid;
  gap: 6px;
  text-align: left;
  border: 1px solid rgba(27,107,84,.12);
}
.invite-card h3 { margin: 0; }
.invite-card p { margin: 0; }
.invite-code, .invite-link { font-size: 14px; word-break: break-all; }
.stats-card {
  margin: 0 16px 16px;
  padding: 16px;
  background: var(--surface, #fff);
  border-radius: 16px;
}
.stats-card h3, .stats-card h4 { margin: 0 0 8px; }
.stats-card h4 { margin-top: 12px; font-size: 14px; }
.stat-line { margin: 4px 0; }
.stat-list { margin: 0; padding-left: 18px; }
.milestone {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(27,107,84,.12);
}
.near-you .featured-head span { color: var(--muted, #5c6b64); font-size: 13px; font-weight: 500; }
html.dark .safety-box, body.dark .safety-box, .app.dark .safety-box {
  background: rgba(27,107,84,.22);
  border-color: rgba(228,195,106,.2);
}
