:root {
  --ink: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --bg: #f9fafb;
  --card: #fff;
  --brand: #5b5fe0;
  --brand-soft: #eef0ff;
  --accent: #f9a53c;
  --brand-ink: #fff;
  --good: #15803d;
  --bad: #b91c1c;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.5 -apple-system, "Segoe UI", Roboto, Arial, sans-serif; color: var(--ink); background: var(--bg); }
body.with-nav { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
main { max-width: 640px; margin: 0 auto; padding: 16px; }
body.admin main { max-width: 1100px; }
a { color: var(--brand); }
h1 { font-size: 24px; margin: 8px 0 12px; }
h2 { font-size: 18px; margin: 0 0 10px; }
.top { position: sticky; top: 0; z-index: 5; background: #fff; border-bottom: 1px solid var(--line); padding: 10px 16px; padding-top: calc(10px + env(safe-area-inset-top)); display: flex; align-items: center; justify-content: space-between; }
.top .brand { color: var(--ink); font-weight: 800; font-size: 20px; text-decoration: none; letter-spacing: -0.3px; display: inline-flex; align-items: center; gap: 8px; }
.top-link { color: var(--muted); text-decoration: none; font-size: 22px; }
.badge { background: rgba(255, 255, 255, 0.2); border-radius: 4px; padding: 1px 6px; font-size: 13px; margin-left: 6px; }
.bottom-nav { position: fixed; bottom: 0; left: 0; right: 0; z-index: 5; display: flex; justify-content: space-around; background: #fff; border-top: 1px solid var(--line); padding: 6px 0 calc(6px + env(safe-area-inset-bottom)); }
.bottom-nav a { color: var(--muted); text-decoration: none; display: flex; flex-direction: column; align-items: center; font-size: 22px; line-height: 1; min-width: 64px; }
.bottom-nav a span { font-size: 11px; margin-top: 4px; }
.bottom-nav a.on { color: var(--ink); }
.admin-nav { background: #fff; border-bottom: 1px solid var(--line); padding: 8px 16px; display: flex; flex-wrap: wrap; gap: 4px 14px; }
.admin-nav .who { margin-left: auto; color: var(--muted); font-size: 14px; }
.card, .hero { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px; margin: 0 0 16px; }
.narrow { max-width: 440px; margin-left: auto; margin-right: auto; }
.hero { text-align: center; padding: 32px 20px; }
.hero h1 { font-size: 28px; }
label { display: block; font-weight: 600; margin: 14px 0 6px; }
label.check { font-weight: normal; display: flex; gap: 10px; align-items: flex-start; }
label.inline { display: inline-flex; align-items: center; gap: 6px; margin: 0; font-weight: normal; }
input, select, textarea, button { font: inherit; }
input[type="email"], input[type="text"], input[type="date"], input[type="number"], input:not([type]), textarea, select { width: 100%; padding: 10px 12px; border: 1px solid #d1d5db; border-radius: 10px; background: #fff; font-size: 16px; }
input.code { font-size: 24px; letter-spacing: 6px; text-align: center; }
.prefixed { display: flex; align-items: center; border: 1px solid #d1d5db; border-radius: 10px; background: #fff; }
.prefixed span { padding-left: 12px; color: var(--muted); }
.prefixed input { border: 0; border-radius: 10px; }
button, .button { display: inline-block; background: var(--brand); color: var(--brand-ink); border: 0; border-radius: 10px; padding: 10px 18px; cursor: pointer; text-decoration: none; margin-top: 12px; font-weight: 600; }
button.wide, .button.wide { width: 100%; text-align: center; }
button.secondary, .button.secondary { background: #fff; color: var(--ink); border: 1px solid #d1d5db; }
button.danger { background: var(--bad); }
button.small, .button.small { padding: 6px 12px; font-size: 14px; margin-top: 6px; }
button.link { background: none; color: var(--muted); padding: 0; margin-top: 8px; text-decoration: underline; font-weight: normal; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.row input:not([type="file"]) { width: auto; flex: 1; }
.row button { margin: 0; }
.grow { flex: 1; }
.spaced { margin-top: 12px; }
.hint, .muted { color: var(--muted); }
.hint { font-size: 14px; margin-top: 4px; }
.small { font-size: 14px; }
.mono { font-family: ui-monospace, Menlo, monospace; letter-spacing: 1px; }
.error { background: #fef2f2; color: var(--bad); border-radius: 10px; padding: 10px 12px; }
.error-text { color: var(--bad); }
.notice { background: #f0fdf4; color: var(--good); border-radius: 10px; padding: 10px 12px; }
.steps { list-style: none; padding: 0; }
.steps li { padding: 6px 0; }
.avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; display: inline-flex; align-items: center; justify-content: center; background: #e5e7eb; color: var(--muted); font-weight: 700; flex: none; }
.avatar.tiny { width: 26px; height: 26px; font-size: 12px; }
.avatar.big { width: 84px; height: 84px; font-size: 32px; }
.profile-head { display: flex; gap: 16px; align-items: center; }
.profile-head h1 { margin: 0; }
.bio { white-space: pre-wrap; }
.grid-empty { text-align: center; padding: 40px 0; border-top: 1px solid var(--line); }
.danger-zone summary { color: var(--bad); cursor: pointer; }
.legal h2 { margin-top: 18px; }
.foot { text-align: center; color: var(--muted); font-size: 14px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; background: #fff; }
th, td { text-align: left; padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table-wrap { overflow-x: auto; }
input.copy { width: 100%; font-size: 13px; padding: 4px 6px; }
/* ── Part 2: feeds and posts ── */
.tabs { display: flex; gap: 24px; justify-content: center; margin: -4px 0 12px; }
.tabs a { color: var(--muted); text-decoration: none; font-weight: 700; padding: 6px 2px; }
.tabs a.on { color: var(--ink); border-bottom: 2px solid var(--ink); }
.feed-bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; }
.feed-bar select { width: auto; padding: 6px 10px; }
.feed-bar button { margin: 0; }
form.inline { display: inline-flex; align-items: center; gap: 6px; margin: 0; }
.center { text-align: center; }
.post { background: var(--card); border: 1px solid var(--line); border-radius: 14px; margin: 0 0 16px; overflow: hidden; }
.post-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; }
.post-head .who { display: flex; gap: 10px; align-items: center; color: var(--ink); text-decoration: none; }
.post-head .who > span { display: flex; flex-direction: column; line-height: 1.2; }
.carousel { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; background: #000; scrollbar-width: none; }
.carousel::-webkit-scrollbar { display: none; }
.carousel img { flex: 0 0 100%; width: 100%; height: auto; max-height: 80vh; object-fit: contain; scroll-snap-align: center; }
.dots { display: flex; justify-content: center; gap: 5px; padding-top: 8px; }
.dots span { width: 6px; height: 6px; border-radius: 50%; background: #d1d5db; }
.dots span.on { background: var(--brand); }
.post-actions { display: flex; align-items: center; gap: 8px; padding: 8px 12px 0; font-weight: 600; }
button.icon, a.icon { background: none; color: var(--ink); padding: 0; margin: 0; font-size: 26px; line-height: 1; text-decoration: none; font-weight: normal; }
button.icon.liked { color: var(--brand); }
.caption { padding: 4px 12px 0; margin: 4px 0; white-space: pre-wrap; word-wrap: break-word; }
.caption a, .comments a { color: var(--ink); text-decoration: none; }
.post > p.small { padding: 0 12px 10px; margin: 4px 0; }
.post > :last-child { padding-bottom: 12px; }
.comments { list-style: none; padding: 0; margin: 0 0 12px; }
.comments li { padding: 8px 0; border-bottom: 1px solid var(--line); white-space: pre-wrap; word-wrap: break-word; }
.comment-form { display: flex; gap: 8px; align-items: flex-end; }
.comment-form button { margin: 0; }
.counts { display: flex; gap: 18px; margin: 12px 0 0; }
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; margin: 0 -16px; }
.grid .cell { position: relative; aspect-ratio: 1; display: block; background: #e5e7eb; }
.grid .cell img { width: 100%; height: 100%; object-fit: cover; display: block; }
.grid .multi { position: absolute; top: 4px; right: 6px; color: #fff; text-shadow: 0 0 3px #000; }
.previews { display: flex; gap: 6px; overflow-x: auto; margin-top: 8px; }
.previews img { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; flex: none; }
.more { text-align: center; }
button:disabled { opacity: 0.6; }
.lead { font-size: 18px; font-weight: 600; }
/* ── Part 3: messages, snaps and activity ── */
.bottom-nav a { position: relative; min-width: 56px; }
.bottom-nav .count { position: absolute; top: -4px; left: 50%; margin-left: 6px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; line-height: 1; border-radius: 9px; padding: 3px 5px; }
.back { color: var(--ink); text-decoration: none; font-size: 30px; line-height: 1; padding-right: 8px; }
.inbox, .activity { list-style: none; padding: 0; margin: 0; background: var(--card); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.inbox li + li, .activity li + li { border-top: 1px solid var(--line); }
.inbox a { display: flex; gap: 12px; align-items: center; padding: 12px; color: var(--ink); text-decoration: none; }
.inbox a .grow { display: flex; flex-direction: column; min-width: 0; }
.inbox a .grow .small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.inbox a.unread { background: var(--brand-soft); }
.chat-head { display: flex; align-items: center; gap: 4px; margin-bottom: 8px; }
.chat-head .who { display: flex; gap: 10px; align-items: center; color: var(--ink); text-decoration: none; }
.chat-head .who > span { display: flex; flex-direction: column; line-height: 1.2; }
.keep { display: block; text-align: center; margin: 0 0 8px; }
.keep button.link { margin-top: 0; }
.chat { list-style: none; padding: 0; margin: 0 0 12px; display: flex; flex-direction: column; gap: 6px; }
.msg { max-width: 80%; display: flex; flex-direction: column; }
.msg.mine { align-self: flex-end; align-items: flex-end; }
.msg.theirs { align-self: flex-start; align-items: flex-start; }
.msg .text { padding: 8px 12px; border-radius: 18px; white-space: pre-wrap; word-wrap: break-word; }
.msg.mine .text { background: var(--brand); color: #fff; }
.msg.theirs .text { background: #fff; border: 1px solid var(--line); }
.msg .meta { font-size: 12px; display: flex; gap: 8px; align-items: center; padding: 0 4px; }
.msg .unsend { display: inline; }
.msg .unsend button.link { margin: 0; font-size: 12px; }
.msg form { margin: 0; }
.snap-chip { display: inline-block; padding: 8px 12px; border-radius: 18px; border: 1px solid var(--line); background: #fff; color: var(--muted); font-weight: 600; margin: 0; }
button.snap-chip.new { background: var(--accent); border-color: var(--accent); color: #fff; }
.compose { display: flex; gap: 8px; align-items: flex-end; position: sticky; bottom: calc(64px + env(safe-area-inset-bottom)); background: var(--bg); padding: 8px 0; }
.compose textarea { resize: none; border-radius: 20px; }
.compose button { margin: 0; border-radius: 20px; }
.snap-form { display: flex; align-items: center; gap: 10px; }
.snap-pick { position: relative; overflow: hidden; margin-top: 0; }
.snap-pick input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.snap-view { text-align: center; }
.snap-view img { width: 100%; max-height: 75vh; object-fit: contain; background: #000; border-radius: 14px; display: block; margin: 8px 0; }
.activity li { display: flex; gap: 12px; align-items: center; padding: 10px 12px; }
.activity li.fresh { background: var(--brand-soft); }
.activity .grow { min-width: 0; word-wrap: break-word; }
.activity .grow a { color: var(--ink); text-decoration: none; }
.activity .thumb img { width: 44px; height: 44px; object-fit: cover; border-radius: 6px; display: block; }
.activity form button { margin: 0; }
.profile-buttons { margin-top: 12px; }
.profile-buttons form { margin: 0; }
.profile-buttons button { margin: 0; }
.bottom-nav a { height: 46px; justify-content: flex-end; }
.bottom-nav a .avatar.tiny { margin-bottom: -2px; }
