:root {
  --brand: #5b3df5;
  --brand-dark: #4529d6;
  --brand-soft: #eeeaff;
  --lime: #c6f432;
  --ink: #14121f;
  --ink-2: #4b4860;
  --ink-3: #8a87a0;
  --line: #e7e5ef;
  --bg: #f6f5fa;
  --card: #ffffff;
  --ok: #12a150;
  --ok-soft: #e3f7ec;
  --warn: #b7791f;
  --warn-soft: #fff4dc;
  --bad: #d92d4b;
  --bad-soft: #ffe8ec;
  --radius: 16px;
  --tabbar-h: 68px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --shadow: 0 1px 2px rgba(20, 18, 31, 0.06), 0 4px 14px rgba(20, 18, 31, 0.06);
  color-scheme: light;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: #e9e7f2;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.4;
}
button, input, select, textarea { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }
a { color: var(--brand); text-decoration: none; }

#app {
  position: relative;
  max-width: 520px;
  min-height: 100%;
  margin: 0 auto;
  background: var(--bg);
  box-shadow: 0 0 40px rgba(20, 18, 31, 0.08);
}
.screen { padding: 0 16px calc(var(--tabbar-h) + var(--safe-b) + 24px); }
.screen.no-tabs { padding-bottom: 32px; }

/* ---------- top bar */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 10px;
  min-height: 56px; margin: 0 -16px 8px; padding: 10px 16px;
  background: rgba(246, 245, 250, 0.92);
  backdrop-filter: blur(12px);
}
.topbar h1 { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; margin: 0; flex: 1; }
.topbar .back {
  width: 38px; height: 38px; border-radius: 50%; border: 0; background: var(--card);
  box-shadow: var(--shadow); display: grid; place-items: center; cursor: pointer;
}
.logo { display: flex; align-items: center; gap: 8px; font-weight: 900; font-size: 24px; letter-spacing: -0.03em; flex: 1; }
.logo-mark {
  width: 32px; height: 32px; border-radius: 10px; background: var(--brand); color: var(--lime);
  display: grid; place-items: center; font-size: 17px;
}

/* ---------- tab bar */
.tabbar {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 520px; z-index: 50;
  height: calc(var(--tabbar-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: rgba(255, 255, 255, 0.96); backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
}
.tab {
  border: 0; background: none; cursor: pointer; position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--ink-3); font-size: 11px; font-weight: 600;
}
.tab svg { width: 24px; height: 24px; }
.tab.active { color: var(--brand); }
.tab.add .plus {
  width: 52px; height: 52px; margin-top: -22px; border-radius: 18px;
  background: var(--brand); color: #fff; display: grid; place-items: center;
  box-shadow: 0 6px 16px rgba(91, 61, 245, 0.4); border: 4px solid var(--bg);
}
.tab.add.active .plus { background: var(--brand-dark); }
.tab .badge {
  position: absolute; top: 8px; left: calc(50% + 6px);
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--bad); color: #fff; font-size: 11px; line-height: 18px; text-align: center;
}

/* ---------- basics */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 20px; border-radius: 14px; border: 0; cursor: pointer;
  background: var(--brand); color: #fff; font-weight: 700; font-size: 15px;
  transition: transform 0.05s, background 0.15s;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn.block { width: 100%; }
.btn.secondary { background: var(--card); color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--line); }
.btn.ghost { background: transparent; color: var(--brand); }
.btn.danger { background: var(--bad-soft); color: var(--bad); }
.btn.ok { background: var(--ok); }
.btn.small { min-height: 36px; padding: 0 14px; font-size: 14px; border-radius: 11px; }
.row { display: flex; gap: 10px; align-items: center; }
.row > .grow { flex: 1; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.muted { color: var(--ink-3); }
.small { font-size: 13px; }
.center { text-align: center; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; margin: 22px 0 10px; }
.section-title h2 { margin: 0; font-size: 18px; font-weight: 800; letter-spacing: -0.01em; }
.section-title .muted { font-size: 13px; }
.spacer { height: 16px; }
.hidden { display: none !important; }

label.field { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 14px; }
label.field .hint { font-weight: 400; color: var(--ink-3); font-size: 12.5px; }
.input, select.input, textarea.input {
  width: 100%; min-height: 48px; padding: 12px 14px; border-radius: 12px;
  border: 1.5px solid var(--line); background: var(--card); outline: none; font-size: 16px;
}
textarea.input { min-height: 90px; resize: vertical; }
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.input-prefix { position: relative; }
.input-prefix span { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--ink-3); font-weight: 700; }
.input-prefix .input { padding-left: 30px; }

.alert { padding: 12px 14px; border-radius: 12px; font-size: 14px; }
.alert.error { background: var(--bad-soft); color: var(--bad); }
.alert.warn { background: var(--warn-soft); color: var(--warn); }
.alert.ok { background: var(--ok-soft); color: var(--ok); }
.alert.info { background: var(--brand-soft); color: var(--brand-dark); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1.5px solid var(--line); background: var(--card); border-radius: 999px;
  padding: 8px 13px; font-size: 14px; font-weight: 600; cursor: pointer; color: var(--ink-2);
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
}
.chip.on { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-dark); }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; margin: 0 -16px; padding: 2px 16px; scrollbar-width: none; }
.chips.scroll::-webkit-scrollbar { display: none; }

.segmented { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: #e7e5f0; border-radius: 12px; padding: 4px; }
.segmented button { border: 0; background: none; padding: 9px 6px; border-radius: 9px; font-weight: 700; color: var(--ink-2); cursor: pointer; font-size: 14px; }
.segmented button.on { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }

.status { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; text-transform: capitalize; }
.status.pending { background: var(--warn-soft); color: var(--warn); }
.status.accepted { background: var(--brand-soft); color: var(--brand-dark); }
.status.completed, .status.traded, .status.active { background: var(--ok-soft); color: var(--ok); }
.status.declined, .status.withdrawn, .status.cancelled, .status.hidden, .status.removed { background: #efeef3; color: var(--ink-3); }

/* ---------- auth / onboarding */
.hero {
  min-height: 100vh; display: flex; flex-direction: column; justify-content: space-between;
  padding: 48px 24px 32px; background: radial-gradient(120% 80% at 80% 0%, #7a5cff 0%, var(--brand) 40%, #2d1a9e 100%);
  color: #fff;
}
.hero .big-logo { display: flex; align-items: center; gap: 12px; font-size: 40px; font-weight: 900; letter-spacing: -0.04em; }
.hero .big-logo .logo-mark { width: 54px; height: 54px; border-radius: 16px; font-size: 28px; background: var(--lime); color: var(--brand); }
.hero h2 { font-size: 40px; line-height: 1.02; letter-spacing: -0.03em; margin: 0 0 14px; font-weight: 900; }
.hero h2 em { font-style: normal; color: var(--lime); }
.hero p { opacity: 0.85; font-size: 17px; margin: 0; }
.hero .btn.secondary { background: rgba(255, 255, 255, 0.14); color: #fff; box-shadow: none; }
.hero .btn.primary-light { background: var(--lime); color: var(--ink); }
.swap-art { display: flex; gap: 12px; margin: 36px 0; font-size: 44px; align-items: center; }
.swap-art span.tile { width: 76px; height: 76px; border-radius: 22px; background: rgba(255, 255, 255, 0.14); display: grid; place-items: center; }
.swap-art .arrows { font-size: 28px; color: var(--lime); }

.auth { padding-top: 12px; }
.auth h1 { font-size: 30px; letter-spacing: -0.03em; margin: 12px 0 4px; }
.steps { display: flex; gap: 6px; margin: 8px 0 18px; }
.steps i { flex: 1; height: 4px; border-radius: 2px; background: var(--line); }
.steps i.on { background: var(--brand); }

.place-list { display: flex; flex-direction: column; gap: 8px; }
.place {
  display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 14px; cursor: pointer;
  background: var(--card); border: 1.5px solid var(--line); text-align: left; width: 100%;
}
.place:hover { border-color: var(--brand); }
.place .pin { width: 36px; height: 36px; border-radius: 10px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; flex-shrink: 0; }
.place b { display: block; }

.interest-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.interest {
  border: 2px solid var(--line); background: var(--card); border-radius: 16px; padding: 14px 12px;
  text-align: left; cursor: pointer; display: flex; flex-direction: column; gap: 8px; font-weight: 700; font-size: 14px;
}
.interest .e { font-size: 26px; }
.interest.on { border-color: var(--brand); background: var(--brand-soft); }

/* ---------- listing cards */
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.lcard { background: var(--card); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); cursor: pointer; display: flex; flex-direction: column; }
.lcard .img { position: relative; aspect-ratio: 1; background: #ecebf3; }
.lcard .img img { width: 100%; height: 100%; object-fit: cover; }
.lcard .val {
  position: absolute; left: 8px; bottom: 8px; background: rgba(20, 18, 31, 0.82); color: #fff;
  font-weight: 800; font-size: 13px; padding: 4px 9px; border-radius: 999px;
}
.lcard .tag { position: absolute; right: 8px; top: 8px; }
.lcard .body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 3px; }
.lcard .t { font-weight: 700; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lcard .wants { font-size: 12.5px; color: var(--brand-dark); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lcard .meta { font-size: 12px; color: var(--ink-3); display: flex; gap: 6px; align-items: center; white-space: nowrap; overflow: hidden; }
.hscroll { display: grid; grid-auto-flow: column; grid-auto-columns: 62%; gap: 12px; overflow-x: auto; margin: 0 -16px; padding: 4px 16px 10px; scroll-snap-type: x mandatory; scrollbar-width: none; }
.hscroll::-webkit-scrollbar { display: none; }
.hscroll > * { scroll-snap-align: start; }
.reason { font-size: 11.5px; font-weight: 700; color: var(--ok); }

.empty { text-align: center; padding: 36px 20px; color: var(--ink-2); }
.empty .e { font-size: 44px; margin-bottom: 8px; }
.empty h3 { margin: 0 0 6px; color: var(--ink); }

.loc-pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 999px;
  background: var(--card); box-shadow: var(--shadow); border: 0; font-weight: 700; font-size: 13px; cursor: pointer; max-width: 55%;
}
.loc-pill span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- avatar & stars */
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; font-weight: 800; overflow: hidden; flex-shrink: 0; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.lg { width: 96px; height: 96px; font-size: 36px; }
.avatar.sm { width: 28px; height: 28px; font-size: 12px; }
.stars { color: #f5a524; letter-spacing: 1px; white-space: nowrap; }
.stars .off { color: #d9d7e3; }

/* ---------- explore */
.explore-screen { position: fixed; inset: 0 auto 0 50%; transform: translateX(-50%); width: 100%; max-width: 520px; }
#map { position: absolute; inset: 0; bottom: calc(var(--tabbar-h) + var(--safe-b)); background: #dfe6ea; z-index: 1; }
.explore-top { position: absolute; top: 12px; left: 12px; right: 12px; z-index: 10; display: flex; gap: 8px; }
.explore-top .search { flex: 1; position: relative; }
.explore-top .search .input { box-shadow: var(--shadow); border: 0; padding-left: 40px; }
.explore-top .search svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--ink-3); width: 18px; }
.icon-btn {
  position: relative; width: 48px; height: 48px; border-radius: 12px; border: 0; background: var(--card);
  box-shadow: var(--shadow); display: grid; place-items: center; cursor: pointer; flex-shrink: 0;
}
.icon-btn .badge { position: absolute; top: -4px; right: -4px; background: var(--brand); color: #fff; border-radius: 9px; min-width: 18px; height: 18px; font-size: 11px; line-height: 18px; text-align: center; font-weight: 700; padding: 0 4px; }
.explore-chips { position: absolute; top: 70px; left: 0; right: 0; z-index: 10; }
.explore-chips .chips.scroll { margin: 0; padding: 0 12px; }
.explore-chips .chip { box-shadow: var(--shadow); border: 0; }
.explore-chips .chip.on { background: var(--brand); color: #fff; }
.results-sheet {
  position: absolute; left: 0; right: 0; bottom: calc(var(--tabbar-h) + var(--safe-b)); z-index: 10;
  background: var(--bg); border-radius: 22px 22px 0 0; box-shadow: 0 -6px 24px rgba(20, 18, 31, 0.14);
  max-height: 72%; display: flex; flex-direction: column; transition: max-height 0.25s;
}
.results-sheet.collapsed { max-height: 64px; }
.results-sheet .handle { padding: 10px 16px 12px; cursor: pointer; text-align: center; font-weight: 800; flex-shrink: 0; }
.results-sheet .handle::before { content: ''; display: block; width: 40px; height: 5px; border-radius: 3px; background: #cfccdc; margin: 0 auto 8px; }
.results-sheet .list { overflow-y: auto; padding: 0 16px 16px; }
.recenter { position: absolute; right: 12px; z-index: 10; bottom: calc(var(--tabbar-h) + var(--safe-b) + 78px); }

.map-pin {
  background: var(--ink); color: #fff; font-weight: 800; font-size: 12px; padding: 4px 8px; border-radius: 999px;
  white-space: nowrap; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3); border: 2px solid #fff; transform: translate(-50%, -50%);
  display: inline-block; cursor: pointer;
}
.map-cluster {
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; transform: translate(-50%, -50%);
  background: var(--brand); color: #fff; font-weight: 900; font-size: 14px; border: 3px solid #fff;
  box-shadow: 0 0 0 6px rgba(91, 61, 245, 0.25), 0 2px 8px rgba(0, 0, 0, 0.3); cursor: pointer;
}
.map-pin.sel { background: var(--brand); transform: translate(-50%, -50%) scale(1.15); }
.leaflet-div-icon.pin-wrap { background: none; border: 0; }
.leaflet-popup-content { margin: 10px; }
.popup-card { display: flex; gap: 10px; width: 230px; cursor: pointer; }
.popup-card img { width: 64px; height: 64px; border-radius: 10px; object-fit: cover; }
.popup-card b { display: block; font-size: 14px; }

/* ---------- sheet / modal */
.backdrop { position: fixed; inset: 0; background: rgba(20, 18, 31, 0.45); z-index: 100; display: flex; align-items: flex-end; justify-content: center; animation: fade 0.15s; }
.sheet {
  width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto; background: var(--bg);
  border-radius: 22px 22px 0 0; padding: 8px 16px calc(20px + var(--safe-b)); animation: up 0.2s ease-out;
}
.sheet .grab { width: 40px; height: 5px; border-radius: 3px; background: #cfccdc; margin: 4px auto 12px; }
.sheet h2 { margin: 0 0 14px; font-size: 20px; }
.sheet h3 { font-size: 14px; margin: 18px 0 8px; color: var(--ink-2); text-transform: uppercase; letter-spacing: 0.04em; }
.sheet-actions { position: sticky; bottom: calc(-20px - var(--safe-b)); background: var(--bg); padding: 12px 0 4px; display: flex; gap: 10px; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--tabbar-h) + var(--safe-b) + 16px); z-index: 200;
  background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 12px; font-weight: 600; font-size: 14px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25); max-width: 90%; animation: up 0.2s;
}

/* ---------- listing detail */
.gallery { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; margin: 0 -16px; aspect-ratio: 1; background: #ecebf3; scrollbar-width: none; }
.gallery::-webkit-scrollbar { display: none; }
.gallery img { flex: 0 0 100%; width: 100%; object-fit: cover; scroll-snap-align: start; }
.gallery-wrap { position: relative; }
.gallery-dots { position: absolute; bottom: 12px; left: 0; right: 0; display: flex; justify-content: center; gap: 6px; }
.gallery-dots i { width: 7px; height: 7px; border-radius: 50%; background: rgba(255, 255, 255, 0.5); }
.gallery-dots i.on { background: #fff; }
.detail-head { margin: 16px 0 6px; }
.detail-head h1 { font-size: 24px; letter-spacing: -0.02em; margin: 0 0 6px; }
.price { font-size: 26px; font-weight: 900; letter-spacing: -0.02em; }
.price small { font-size: 13px; font-weight: 600; color: var(--ink-3); }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 14px 0; }
.fact { background: var(--card); border-radius: 12px; padding: 10px 12px; box-shadow: var(--shadow); }
.fact .k { font-size: 12px; color: var(--ink-3); font-weight: 600; }
.fact .v { font-weight: 700; }
.wants-box { background: var(--brand-soft); border-radius: 14px; padding: 14px; margin: 12px 0; }
.wants-box .k { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em; color: var(--brand-dark); margin-bottom: 4px; }
.owner-card { display: flex; align-items: center; gap: 12px; cursor: pointer; }
.sticky-cta { position: sticky; bottom: calc(var(--tabbar-h) + var(--safe-b) + 10px); margin-top: 18px; display: flex; gap: 10px; }
.sticky-cta.flush { bottom: 0; flex-direction: column; align-items: center; gap: 6px; margin: 18px -16px 0; padding: 14px 16px 18px; background: linear-gradient(rgba(246, 245, 250, 0), var(--bg) 35%); }
.sticky-cta.flush.over-tabs { bottom: calc(var(--tabbar-h) + var(--safe-b)); }
.sticky-cta .btn { box-shadow: 0 8px 20px rgba(91, 61, 245, 0.3); }

.pick { display: flex; gap: 12px; align-items: center; padding: 10px; border-radius: 14px; background: var(--card); border: 2px solid var(--line); cursor: pointer; text-align: left; width: 100%; }
.pick img { width: 56px; height: 56px; border-radius: 10px; object-fit: cover; }
.pick.on { border-color: var(--brand); background: var(--brand-soft); }
.pick .check { margin-left: auto; width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; color: #fff; flex-shrink: 0; }
.pick.on .check { background: var(--brand); border-color: var(--brand); }

/* ---------- add trade */
.photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.photo-slot { position: relative; aspect-ratio: 1; border-radius: 14px; overflow: hidden; background: var(--card); border: 2px dashed #cfccdc; display: grid; place-items: center; cursor: pointer; color: var(--ink-3); font-weight: 600; font-size: 13px; text-align: center; }
.photo-slot img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.photo-slot.filled { border: 0; }
.photo-slot .x { position: absolute; top: 6px; right: 6px; width: 26px; height: 26px; border-radius: 50%; background: rgba(0, 0, 0, 0.6); color: #fff; border: 0; cursor: pointer; display: grid; place-items: center; }
.photo-slot .cover { position: absolute; left: 6px; bottom: 6px; background: var(--brand); color: #fff; font-size: 11px; padding: 2px 7px; border-radius: 6px; }
.range-row { display: flex; align-items: center; gap: 12px; }
.range-row input[type='range'] { flex: 1; accent-color: var(--brand); }
.range-row output { min-width: 64px; text-align: right; font-weight: 800; }
details.rules { background: var(--card); border-radius: 14px; padding: 12px 14px; box-shadow: var(--shadow); }
details.rules summary { cursor: pointer; font-weight: 700; }
details.rules ul { margin: 10px 0 0; padding-left: 20px; color: var(--ink-2); font-size: 14px; }

/* ---------- offers */
.offer-card { display: flex; flex-direction: column; gap: 10px; cursor: pointer; }
.offer-swap { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: center; }
.offer-side { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.offer-side .lbl { font-size: 11px; font-weight: 800; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.05em; }
.thumbs { display: flex; gap: 4px; }
.thumbs img { width: 52px; height: 52px; border-radius: 10px; object-fit: cover; }
.thumbs .more { width: 52px; height: 52px; border-radius: 10px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; font-weight: 800; }
.thumbs .note-thumb { width: 52px; height: 52px; border-radius: 10px; background: #f0eff6; display: grid; place-items: center; font-size: 22px; }
.offer-side .name { font-weight: 700; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.swap-icon { width: 34px; height: 34px; border-radius: 50%; background: var(--lime); display: grid; place-items: center; }

.chat { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; }
.bubble { max-width: 80%; padding: 9px 13px; border-radius: 18px; font-size: 14.5px; white-space: pre-wrap; word-wrap: break-word; }
.bubble.me { align-self: flex-end; background: var(--brand); color: #fff; border-bottom-right-radius: 6px; }
.bubble.them { align-self: flex-start; background: var(--card); box-shadow: var(--shadow); border-bottom-left-radius: 6px; }
.bubble .time { display: block; font-size: 10.5px; opacity: 0.6; margin-top: 2px; }
.composer { display: flex; gap: 8px; padding: 4px 0 8px; }
.composer .input { min-height: 46px; }
.star-input { display: flex; gap: 6px; font-size: 34px; }
.star-input button { border: 0; background: none; cursor: pointer; color: #d9d7e3; padding: 0; }
.star-input button.on { color: #f5a524; }

/* ---------- profile */
.profile-head { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 10px 0 4px; }
.profile-head h1 { margin: 6px 0 0; font-size: 24px; letter-spacing: -0.02em; }
.avatar-edit { position: relative; cursor: pointer; }
.avatar-edit .cam { position: absolute; right: 0; bottom: 0; width: 30px; height: 30px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; border: 3px solid var(--bg); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 16px 0; }
.stat { background: var(--card); border-radius: 14px; padding: 12px; text-align: center; box-shadow: var(--shadow); }
.stat b { display: block; font-size: 20px; font-weight: 900; }
.stat span { font-size: 12px; color: var(--ink-3); font-weight: 600; }
.menu { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.menu button { width: 100%; display: flex; align-items: center; gap: 12px; padding: 15px 16px; border: 0; background: none; border-bottom: 1px solid var(--line); cursor: pointer; font-weight: 600; text-align: left; }
.menu button:last-child { border-bottom: 0; }
.menu button .chev { margin-left: auto; color: var(--ink-3); }
.review { display: flex; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.review:last-child { border-bottom: 0; }

.spinner { width: 28px; height: 28px; border: 3px solid var(--brand-soft); border-top-color: var(--brand); border-radius: 50%; animation: spin 0.7s linear infinite; margin: 40px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
