:root {
  --ink: #14181F;
  --ink-2: #3D434D;
  --muted: #5A606B;
  --line: #E4E4DE;
  --line-2: #D4D4CC;
  --ground: #F5F5F1;
  --card: #FFFFFF;
  --sun: #F5A400;
  --sun-soft: #FFF6DE;
  --sun-ink: #5C4200;
  --link: #1B4D99;
  --help-bg: #FDE7D6; --help-ink: #8A3A00;
  --save-bg: #DDF2E3; --save-ink: #155C2E;
  --want-bg: #EDE3FA; --want-ink: #5B2A99;
  --job-bg: #DCE8FA;  --job-ink: #1B4D99;
  --danger: #B42318;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: #E9E9E3;
  font-family: Inter, system-ui, -apple-system, sans-serif;
  color: var(--ink);
  font-size: 15px;
  -webkit-text-size-adjust: 100%;
}
a { color: var(--link); text-decoration: none; }
button, input, textarea, select { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }
h1, h2, h3 { margin: 0; }
.grotesk { font-family: 'Space Grotesk', Inter, sans-serif; }

.shell {
  max-width: 560px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--ground);
  position: relative;
  padding-bottom: calc(76px + env(safe-area-inset-bottom));
}

/* ---------- top bars ---------- */
.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 8px;
  padding: 12px 12px; background: var(--card); border-bottom: 1px solid var(--line);
}
.topbar .title { font-weight: 600; font-size: 17px; flex: 1; }
.brandbar { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px 10px; background: var(--card); }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); }
.brand-mark { width: 36px; height: 36px; border-radius: 10px; background: var(--sun); display: flex; align-items: center; justify-content: center; }
.brand-mark svg { width: 20px; height: 20px; stroke: var(--ink); fill: none; stroke-width: 2; stroke-linecap: round; }
.brand-name { font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 22px; }
.icon-btn {
  width: 44px; height: 44px; border: none; background: transparent; border-radius: 22px;
  display: inline-flex; align-items: center; justify-content: center; color: var(--ink); cursor: pointer;
}
.icon-btn svg { width: 24px; height: 24px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.chips { display: flex; gap: 8px; padding: 4px 20px 14px; background: var(--card); overflow-x: auto; scrollbar-width: none; }
.chip {
  min-height: 36px; padding: 0 16px; border-radius: 999px; font-size: 14px; font-weight: 600;
  white-space: nowrap; cursor: pointer; background: var(--card); border: 1px solid var(--line-2);
}
.chip[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }

/* ---------- layout ---------- */
.stack { display: flex; flex-direction: column; gap: 14px; padding: 14px 16px 20px; }
.section-label { font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; padding: 4px 4px 0; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 16px; display: flex; flex-direction: column; gap: 10px; color: var(--ink); }
a.card:active { background: #FAFAF7; }
.card.highlight { border: 2px solid var(--sun); }
.panel { background: var(--card); padding: 16px 20px; display: flex; flex-direction: column; gap: 12px; }
.empty { text-align: center; color: var(--muted); padding: 40px 20px; line-height: 1.5; }

.composer { display: flex; align-items: center; gap: 12px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; color: var(--muted); }
.composer .dot { width: 36px; height: 36px; border-radius: 18px; background: #E9E9E3; flex-shrink: 0; }

/* ---------- post bits ---------- */
.who { display: flex; align-items: center; gap: 10px; }
.who-text { flex: 1; min-width: 0; }
.who-name { font-weight: 600; font-size: 15px; display: flex; align-items: center; gap: 5px; }
.who-meta { font-size: 13px; color: var(--muted); }
.avatar {
  width: 40px; height: 40px; border-radius: 20px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 14px;
}
.avatar.biz { border-radius: 10px; background: var(--ink); color: var(--sun); font-weight: 700; }
.avatar.lg { width: 64px; height: 64px; border-radius: 16px; font-size: 24px; font-family: 'Space Grotesk', sans-serif; background: var(--sun); color: var(--ink); }
.verified { width: 16px; height: 16px; stroke: var(--link); fill: none; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }

.tag { font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.tag.problem { background: var(--help-bg); color: var(--help-ink); }
.tag.savings { background: var(--save-bg); color: var(--save-ink); }
.tag.want { background: var(--want-bg); color: var(--want-ink); }
.tag.job { background: var(--job-bg); color: var(--job-ink); }
.tag.solved { background: var(--save-bg); color: var(--save-ink); }

.post-title { font-size: 16px; font-weight: 600; line-height: 1.35; overflow-wrap: anywhere; }
.post-title.lg { font-size: 20px; line-height: 1.3; }
.post-body { font-size: 14px; color: var(--ink-2); line-height: 1.5; white-space: pre-line; overflow-wrap: anywhere; }
.post-body.clamp { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.post-foot { display: flex; gap: 18px; font-size: 13px; color: var(--muted); flex-wrap: wrap; }

.photos { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.photos.one { grid-template-columns: minmax(0, 1fr); }
.photos img { width: 100%; height: 150px; object-fit: cover; border-radius: 12px; background: #E9E9E3; }
.photos.one img { height: 220px; }
.photos.lg img { height: 180px; cursor: zoom-in; }
.photos.lg.one img { height: auto; max-height: 420px; }

.bills { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.bill { background: var(--ground); border-radius: 12px; padding: 12px; }
.bill.after { background: var(--save-bg); color: var(--save-ink); }
.bill .k { font-size: 12px; }
.bill .v { font-family: 'Space Grotesk', sans-serif; font-size: 22px; font-weight: 700; }
.saving-big { font-family: 'Space Grotesk', sans-serif; font-size: 24px; font-weight: 700; color: var(--save-ink); }

.offer { display: flex; align-items: center; justify-content: space-between; gap: 8px; background: var(--sun-soft); border-radius: 10px; padding: 10px 12px; font-size: 13px; color: var(--sun-ink); }

/* ---------- forms ---------- */
.form { display: flex; flex-direction: column; gap: 16px; padding: 18px 20px 24px; background: var(--card); min-height: calc(100vh - 69px); }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label, .label { font-size: 14px; font-weight: 600; }
.hint { font-size: 13px; color: var(--muted); }
.input, .textarea, .select {
  min-height: 48px; border-radius: 12px; border: 1px solid var(--line-2); padding: 0 14px; font-size: 16px; background: #fff; width: 100%;
}
.textarea { padding: 12px 14px; resize: vertical; min-height: 110px; line-height: 1.45; }
.input:focus, .textarea:focus, .select:focus { outline: 2px solid var(--sun); outline-offset: 1px; border-color: var(--sun); }
.row2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.choice {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; width: 100%;
  padding: 14px 16px; border-radius: 14px; cursor: pointer; background: #fff; border: 2px solid var(--line);
}
.choice[aria-pressed="true"] { background: var(--sun-soft); border-color: var(--sun); }
.choice .t { font-weight: 600; font-size: 15px; }
.choice .s { font-size: 13px; color: var(--muted); }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: 15px; }
.check input { width: 22px; height: 22px; accent-color: var(--sun); }
.error { color: var(--danger); font-size: 14px; font-weight: 500; }

.photo-pick {
  min-height: 88px; border-radius: 12px; border: 2px dashed var(--line-2); background: var(--ground);
  color: var(--ink-2); font-size: 14px; font-weight: 600; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%;
}
.photo-pick svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.thumbs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.thumb { position: relative; }
.thumb img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; }
.thumb button {
  position: absolute; top: 2px; right: 2px; width: 28px; height: 28px; border-radius: 14px; border: none;
  background: rgba(20,24,31,.8); color: #fff; font-size: 16px; line-height: 1; cursor: pointer;
}

/* ---------- buttons ---------- */
.btn {
  min-height: 48px; border-radius: 12px; border: none; padding: 0 18px; font-weight: 700; font-size: 15px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer; text-align: center;
}
.btn.primary { background: var(--sun); color: var(--ink); }
.btn.dark { background: var(--ink); color: #fff; }
.btn.ghost { background: #fff; color: var(--ink); border: 1px solid var(--line-2); font-weight: 600; }
.btn.danger { background: #fff; color: var(--danger); border: 1px solid #F1C4C0; font-weight: 600; }
.btn.sm { min-height: 40px; font-size: 14px; padding: 0 14px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .55; cursor: default; }
.btn-row { display: flex; gap: 8px; }
.btn-row > * { flex: 1; }
.link-btn { background: none; border: none; color: var(--link); font-weight: 600; cursor: pointer; padding: 8px 0; min-height: 44px; }
.link-btn.muted { color: var(--muted); font-weight: 500; }

/* ---------- profile ---------- */
.hero { background: var(--ink); color: #fff; padding: 8px 20px 22px; display: flex; flex-direction: column; gap: 14px; }
.hero .meta { font-size: 13px; color: #C9CDD4; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.stat { background: #232934; border-radius: 12px; padding: 10px; text-align: center; }
.stat .v { font-family: 'Space Grotesk', sans-serif; font-size: 20px; font-weight: 700; }
.stat .k { font-size: 11px; color: #C9CDD4; }
.ticks { display: flex; flex-direction: column; gap: 8px; }
.tick { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.tick svg { width: 20px; height: 20px; stroke: var(--save-ink); fill: none; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pill { font-size: 13px; padding: 6px 12px; border-radius: 999px; background: var(--ground); }
.stars { color: #8A5A00; font-weight: 600; font-size: 13px; letter-spacing: 1px; }
.star-pick { display: flex; gap: 4px; }
.star-pick button { width: 44px; height: 44px; border: none; background: none; font-size: 28px; color: #D4D4CC; cursor: pointer; }
.star-pick button[aria-pressed="true"] { color: var(--sun); }

.searchbar { padding: 12px 16px; background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }

/* ---------- reply bar ---------- */
.replybar {
  position: fixed; left: 0; right: 0; bottom: calc(68px + env(safe-area-inset-bottom)); z-index: 6;
  max-width: 560px; margin: 0 auto; background: var(--card); border-top: 1px solid var(--line);
  padding: 10px 16px; display: flex; flex-direction: column; gap: 8px;
}
.replybar .line { display: flex; gap: 8px; align-items: flex-end; }
.replybar .textarea { min-height: 44px; height: 44px; border-radius: 22px; padding: 10px 16px; resize: none; }
.send { width: 44px; height: 44px; border-radius: 22px; border: none; background: var(--ink); display: flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0; }
.send svg { width: 20px; height: 20px; stroke: #fff; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.has-replybar { padding-bottom: 150px; }

/* ---------- tab bar ---------- */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 10;
  max-width: 560px; margin: 0 auto;
  display: flex; justify-content: space-around; align-items: center;
  background: var(--card); border-top: 1px solid var(--line);
  padding: 6px 8px calc(8px + env(safe-area-inset-bottom));
}
.tabbar a { display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 56px; min-height: 48px; justify-content: center; padding: 4px; color: var(--muted); font-size: 11px; }
.tabbar a[aria-current="page"] { color: var(--ink); font-weight: 600; }
.tabbar svg { width: 24px; height: 24px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tabbar .tab-post { width: 52px; min-width: 52px; height: 52px; min-height: 52px; border-radius: 26px; background: var(--sun); color: var(--ink); }
.tabbar .tab-post svg { width: 26px; height: 26px; stroke-width: 2.4; }

.toast {
  position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 12px; font-size: 14px;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 50; max-width: calc(100% - 32px);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

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

.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.92); z-index: 60; display: flex; align-items: center; justify-content: center; padding: 16px; }
.lightbox img { max-height: 100%; border-radius: 8px; }

.admin-row { display: flex; align-items: center; gap: 10px; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--line); }
.admin-row:last-child { border-bottom: none; }
.small { font-size: 13px; color: var(--muted); }
.footer-links { text-align: center; font-size: 13px; color: var(--muted); padding: 8px 0 16px; }
