/* ==========================================================================
   Riffzu 2.0 — member and public interface
   Layout: sticky bar, three columns on desktop, single column with a bottom
   tab bar on phones. One responsive origin, no separate mobile site.
   ========================================================================== */

:root {
  /* Brand values are re-declared inline per request from Control Center
     settings, so a colour change in the admin reaches every surface. */
  --brand: #e8383f;
  --brand-ink: #ffffff;
  --brand-soft: rgba(232, 56, 63, 0.1);
  --brand-strong: #c72a31;
  --accent: #ffc93c;

  --canvas: #f0f2f5;
  --surface: #ffffff;
  --surface-2: #f6f7f9;
  --surface-3: #eaecf0;
  --ink: #101426;
  --ink-2: #4b5563;
  --ink-3: #6b7280;
  --line: #dee2e8;
  --line-soft: #eceff3;

  --positive: #14804a;
  --positive-soft: #e7f5ed;
  --warning: #a3630a;
  --warning-soft: #fdf3e2;
  --danger: #c0272d;
  --danger-soft: #fdecec;

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --radius-pill: 999px;

  --shadow-1: 0 1px 2px rgba(16, 20, 38, 0.08);
  --shadow-2: 0 2px 8px rgba(16, 20, 38, 0.1);
  --shadow-3: 0 12px 32px rgba(16, 20, 38, 0.16);

  --bar-h: 56px;
  --rail-w: 264px;
  --aside-w: 300px;
  --feed-w: 620px;
  --gap: 16px;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    "Noto Sans", "Liberation Sans", Arial, sans-serif;
  --font-num: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  --ease: cubic-bezier(0.2, 0, 0.2, 1);
}

/* Dark mode follows the system unless the member has chosen a theme. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --canvas: #0f1115;
    --surface: #191b20;
    --surface-2: #212429;
    --surface-3: #2a2e35;
    --ink: #e9eaed;
    --ink-2: #b0b3b8;
    --ink-3: #8a8d93;
    --line: #33363d;
    --line-soft: #26292f;
    --brand-soft: rgba(232, 56, 63, 0.18);
    --positive-soft: #12251c;
    --warning-soft: #2a2114;
    --danger-soft: #2c1618;
    --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-2: 0 2px 8px rgba(0, 0, 0, 0.45);
    --shadow-3: 0 12px 32px rgba(0, 0, 0, 0.6);
  }
}

:root[data-theme='dark'] {
  --canvas: #0f1115;
  --surface: #191b20;
  --surface-2: #212429;
  --surface-3: #2a2e35;
  --ink: #e9eaed;
  --ink-2: #b0b3b8;
  --ink-3: #8a8d93;
  --line: #33363d;
  --line-soft: #26292f;
  --brand-soft: rgba(232, 56, 63, 0.18);
  --positive-soft: #12251c;
  --warning-soft: #2a2114;
  --danger-soft: #2c1618;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-2: 0 2px 8px rgba(0, 0, 0, 0.45);
  --shadow-3: 0 12px 32px rgba(0, 0, 0, 0.6);
}

/* --------------------------------------------------------------- base ---- */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 { margin: 0 0 8px; line-height: 1.25; font-weight: 700; letter-spacing: -0.011em; }
h1 { font-size: 26px; letter-spacing: -0.02em; }
h2 { font-size: 20px; }
h3 { font-size: 17px; }
h4 { font-size: 15px; }
p { margin: 0 0 12px; }
p:last-child { margin-bottom: 0; }

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

img, svg, video { max-width: 100%; height: auto; display: block; }

hr { border: 0; border-top: 1px solid var(--line-soft); margin: 16px 0; }

small, .small { font-size: 13px; }
.muted { color: var(--ink-3); }
.strong { font-weight: 600; }
.nowrap { white-space: nowrap; }
.center { text-align: center; }
.stack { display: grid; gap: 12px; }
.stack-sm { display: grid; gap: 8px; }
.row { display: flex; align-items: center; gap: 10px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1 1 auto; min-width: 0; }
.hide { display: none !important; }

.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.clamp-3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* Keyboard focus is visible everywhere, and only for keyboard users. */
:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}
:focus:not(:focus-visible) { outline: none; }

.skip-link {
  position: absolute; left: 8px; top: -60px; z-index: 200;
  background: var(--surface); color: var(--ink); padding: 10px 16px;
  border-radius: var(--radius); box-shadow: var(--shadow-2); font-weight: 600;
  transition: top 0.15s var(--ease);
}
.skip-link:focus { top: 8px; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* --------------------------------------------------------------- bar ----- */

.topbar {
  position: sticky; top: 0; z-index: 60;
  height: var(--bar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  box-shadow: var(--shadow-1);
}

.topbar-inner {
  height: 100%;
  max-width: 1360px;
  margin: 0 auto;
  padding: 0 12px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
}

.brand-lockup { display: flex; align-items: center; gap: 8px; text-decoration: none; }
.brand-lockup:hover { text-decoration: none; }
.brand-lockup img { height: 30px; width: auto; }
.brand-name { font-size: 19px; font-weight: 800; color: var(--brand); letter-spacing: -0.02em; }

.searchbox { position: relative; max-width: 420px; width: 100%; }
.searchbox input {
  width: 100%; height: 38px; padding: 0 14px 0 38px;
  border: 1px solid transparent; border-radius: var(--radius-pill);
  background: var(--surface-2); color: var(--ink); font-size: 14px; font-family: inherit;
}
.searchbox input::placeholder { color: var(--ink-3); }
.searchbox input:focus { background: var(--surface); border-color: var(--line); }
.searchbox .search-icon {
  position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; color: var(--ink-3); pointer-events: none;
}

.bar-actions { display: flex; align-items: center; gap: 6px; }

.icon-btn {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px;
  border: 0; border-radius: 50%;
  background: var(--surface-2); color: var(--ink);
  cursor: pointer; text-decoration: none;
  transition: background 0.12s var(--ease);
}
.icon-btn:hover { background: var(--surface-3); text-decoration: none; }
.icon-btn.is-active { background: var(--brand-soft); color: var(--brand); }
.icon-btn svg { width: 19px; height: 19px; }

.badge-dot {
  position: absolute; top: 2px; right: 2px;
  min-width: 17px; height: 17px; padding: 0 4px;
  display: grid; place-items: center;
  background: var(--brand); color: #fff;
  font-size: 10px; font-weight: 700; line-height: 1;
  border-radius: var(--radius-pill);
  border: 2px solid var(--surface);
}

.avatar-btn { padding: 0; border: 0; background: none; cursor: pointer; border-radius: 50%; }

/* --------------------------------------------------------------- shell --- */

.shell {
  max-width: 1360px;
  margin: 0 auto;
  padding: var(--gap) 12px 96px;
  display: grid;
  gap: 20px;
  grid-template-columns: var(--rail-w) minmax(0, 1fr) var(--aside-w);
  align-items: start;
}
.shell.shell-wide { grid-template-columns: var(--rail-w) minmax(0, 1fr); }
.shell.shell-plain { grid-template-columns: minmax(0, 1fr); max-width: 760px; }

.rail, .aside {
  position: sticky;
  top: calc(var(--bar-h) + var(--gap));
  max-height: calc(100vh - var(--bar-h) - var(--gap) * 2);
  overflow-y: auto;
  overscroll-behavior: contain;
}
.rail::-webkit-scrollbar, .aside::-webkit-scrollbar { width: 8px; }
.rail::-webkit-scrollbar-thumb, .aside::-webkit-scrollbar-thumb {
  background: var(--line); border-radius: 4px;
}

.column { min-width: 0; display: grid; gap: var(--gap); }
.column-narrow { max-width: var(--feed-w); margin: 0 auto; width: 100%; }

/* ----------------------------------------------------------- rail nav ---- */

.nav { display: grid; gap: 2px; }

.nav-link {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 10px;
  border-radius: var(--radius);
  color: var(--ink); font-weight: 500; font-size: 14.5px;
  text-decoration: none;
  transition: background 0.12s var(--ease);
}
.nav-link:hover { background: var(--surface-3); text-decoration: none; }
.nav-link.is-current { background: var(--brand-soft); color: var(--brand); font-weight: 650; }
.nav-link svg { width: 20px; height: 20px; flex: none; }
.nav-link .count {
  margin-left: auto; font-size: 12px; font-weight: 700;
  background: var(--brand); color: #fff;
  padding: 1px 7px; border-radius: var(--radius-pill);
}

.nav-heading {
  padding: 14px 10px 6px;
  font-size: 12px; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--ink-3);
}

.rail-profile {
  display: flex; align-items: center; gap: 10px;
  padding: 10px; margin-bottom: 8px;
  border-radius: var(--radius); text-decoration: none; color: var(--ink);
}
.rail-profile:hover { background: var(--surface-3); text-decoration: none; }

/* --------------------------------------------------------------- card --- */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1);
}
.card-pad { padding: 16px; }
.card-head {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line-soft);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.card-head h2, .card-head h3 { margin: 0; }
.card-body { padding: 16px; }
.card-foot {
  padding: 12px 16px;
  border-top: 1px solid var(--line-soft);
  background: var(--surface-2);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}
.card-title-sm {
  font-size: 12px; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--ink-3); margin-bottom: 10px;
}

/* ------------------------------------------------------------ avatars ---- */

.avatar {
  border-radius: 50%; object-fit: cover; flex: none;
  background: var(--surface-3); border: 1px solid var(--line-soft);
}
.avatar-20 { width: 20px; height: 20px; }
.avatar-28 { width: 28px; height: 28px; }
.avatar-32 { width: 32px; height: 32px; }
.avatar-36 { width: 36px; height: 36px; }
.avatar-40 { width: 40px; height: 40px; }
.avatar-48 { width: 48px; height: 48px; }
.avatar-96 { width: 96px; height: 96px; border-width: 4px; border-color: var(--surface); }
.avatar-square { border-radius: var(--radius); }

/* ------------------------------------------------------------ buttons ---- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 38px; padding: 0 16px;
  border: 1px solid transparent; border-radius: var(--radius);
  background: var(--surface-2); color: var(--ink);
  font-family: inherit; font-size: 14.5px; font-weight: 600; line-height: 1;
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background 0.12s var(--ease), border-color 0.12s var(--ease), transform 0.06s var(--ease);
}
.btn:hover { background: var(--surface-3); text-decoration: none; }
.btn:active { transform: scale(0.98); }
.btn svg { width: 17px; height: 17px; flex: none; }
.btn[disabled], .btn[aria-disabled='true'] { opacity: 0.55; cursor: not-allowed; }

.btn-primary { background: var(--brand); color: var(--brand-ink); }
.btn-primary:hover { background: var(--brand-strong); }

.btn-outline { background: transparent; border-color: var(--line); }
.btn-outline:hover { background: var(--surface-2); }

.btn-ghost { background: transparent; }
.btn-ghost:hover { background: var(--surface-2); }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #a01f24; }

.btn-quiet-danger { background: transparent; color: var(--danger); border-color: transparent; }
.btn-quiet-danger:hover { background: var(--danger-soft); }

.btn-sm { min-height: 32px; padding: 0 12px; font-size: 13.5px; }
.btn-lg { min-height: 46px; padding: 0 24px; font-size: 16px; }
.btn-block { width: 100%; }
.btn-pill { border-radius: var(--radius-pill); }

.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }

/* -------------------------------------------------------------- forms ---- */

.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field:last-child { margin-bottom: 0; }
.field > label, .label { font-size: 13.5px; font-weight: 600; color: var(--ink); }
.field .hint { font-size: 12.5px; color: var(--ink-3); }
.field .error-text { font-size: 12.5px; color: var(--danger); font-weight: 500; }

input[type='text'], input[type='email'], input[type='password'], input[type='number'],
input[type='url'], input[type='search'], input[type='tel'], input[type='date'],
input[type='datetime-local'], select, textarea {
  width: 100%;
  min-height: 40px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font-family: inherit;
  font-size: 15px;
  line-height: 1.4;
}
textarea { min-height: 92px; resize: vertical; }
input:focus, select:focus, textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
  outline: none;
}
input::placeholder, textarea::placeholder { color: var(--ink-3); }
input[type='color'] { padding: 4px; height: 40px; cursor: pointer; }
input[type='file'] { padding: 8px; background: var(--surface-2); cursor: pointer; }
select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%236b7280' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 34px;
}

.field-inline { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 12px; }
.field-inline input[type='checkbox'], .field-inline input[type='radio'] {
  width: 17px; height: 17px; margin: 2px 0 0; flex: none; accent-color: var(--brand); cursor: pointer;
}
.field-inline label { font-weight: 500; font-size: 14px; cursor: pointer; }

/* Switch, used for every boolean setting. */
.switch { display: flex; align-items: center; gap: 12px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track {
  position: relative; width: 44px; height: 25px; flex: none;
  background: var(--surface-3); border-radius: var(--radius-pill);
  transition: background 0.15s var(--ease);
}
.switch .track::after {
  content: ''; position: absolute; top: 3px; left: 3px;
  width: 19px; height: 19px; background: #fff; border-radius: 50%;
  box-shadow: var(--shadow-1);
  transition: transform 0.15s var(--ease);
}
.switch input:checked + .track { background: var(--brand); }
.switch input:checked + .track::after { transform: translateX(19px); }
.switch input:focus-visible + .track { outline: 2px solid var(--brand); outline-offset: 2px; }

.radio-cards { display: grid; gap: 8px; }
.radio-card {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px; border: 1px solid var(--line); border-radius: var(--radius);
  cursor: pointer; transition: border-color 0.12s var(--ease), background 0.12s var(--ease);
}
.radio-card:hover { background: var(--surface-2); }
.radio-card:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.radio-card input { margin-top: 2px; accent-color: var(--brand); }
.radio-card .rc-title { font-weight: 600; font-size: 14px; }
.radio-card .rc-note { font-size: 12.5px; color: var(--ink-3); }

/* --------------------------------------------------------------- chips --- */

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  background: var(--surface-2); color: var(--ink-2);
  font-size: 12px; font-weight: 600; line-height: 1.6;
  white-space: nowrap;
}
.chip-brand { background: var(--brand-soft); color: var(--brand); }
.chip-positive { background: var(--positive-soft); color: var(--positive); }
.chip-warning { background: var(--warning-soft); color: var(--warning); }
.chip-danger { background: var(--danger-soft); color: var(--danger); }
.chip-outline { background: transparent; border: 1px solid var(--line); }

.tabs {
  display: flex; gap: 4px; padding: 4px;
  background: var(--surface-2); border-radius: var(--radius);
  overflow-x: auto; scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: 1 1 auto; text-align: center; white-space: nowrap;
  padding: 8px 14px; border-radius: var(--radius-sm);
  color: var(--ink-2); font-size: 14px; font-weight: 600; text-decoration: none;
}
.tab:hover { color: var(--ink); text-decoration: none; }
.tab.is-current { background: var(--surface); color: var(--brand); box-shadow: var(--shadow-1); }

/* ------------------------------------------------------------- notice ---- */

.notice {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--ink-3);
  border-radius: var(--radius);
  background: var(--surface-2);
  font-size: 14px;
}
.notice svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.notice-success { border-left-color: var(--positive); background: var(--positive-soft); color: var(--positive); }
.notice-error { border-left-color: var(--danger); background: var(--danger-soft); color: var(--danger); }
.notice-warning { border-left-color: var(--warning); background: var(--warning-soft); color: var(--warning); }
.notice-brand { border-left-color: var(--brand); background: var(--brand-soft); color: var(--brand); }

/* Toasts, used by optimistic actions. */
.toast-stack {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  z-index: 120; display: grid; gap: 8px; width: min(420px, calc(100vw - 32px));
  pointer-events: none;
}
.toast {
  padding: 11px 16px; border-radius: var(--radius);
  background: var(--ink); color: var(--canvas);
  font-size: 14px; font-weight: 500; box-shadow: var(--shadow-3);
  animation: toast-in 0.18s var(--ease);
}
.toast-error { background: var(--danger); color: #fff; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ------------------------------------------------------------ composer -- */

.composer-trigger { display: flex; align-items: center; gap: 10px; padding: 12px 16px; }
.composer-trigger .fake-input {
  flex: 1; min-height: 40px; display: flex; align-items: center;
  padding: 0 16px; border-radius: var(--radius-pill);
  background: var(--surface-2); color: var(--ink-3); font-size: 15px;
  cursor: pointer; border: 0; text-align: left; font-family: inherit; width: 100%;
}
.composer-trigger .fake-input:hover { background: var(--surface-3); }
.composer-shortcuts {
  display: flex; gap: 4px; padding: 8px 12px;
  border-top: 1px solid var(--line-soft);
}
.composer-shortcuts a {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 7px;
  padding: 8px; border-radius: var(--radius);
  color: var(--ink-2); font-size: 13.5px; font-weight: 600; text-decoration: none;
}
.composer-shortcuts a:hover { background: var(--surface-2); text-decoration: none; }
.composer-shortcuts svg { width: 18px; height: 18px; }

/* ---------------------------------------------------------- post card --- */

.post { overflow: hidden; }

.post-head { display: flex; align-items: flex-start; gap: 10px; padding: 14px 16px 10px; }
.post-head .meta { min-width: 0; flex: 1; }
.post-author { font-weight: 650; color: var(--ink); font-size: 15px; }
.post-author:hover { text-decoration: underline; }
.post-sub { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-3); flex-wrap: wrap; }
.post-sub .dot::before { content: '·'; }

.post-title { padding: 0 16px 6px; font-size: 19px; font-weight: 700; letter-spacing: -0.015em; }
.post-title a { color: var(--ink); }

.post-body {
  padding: 0 16px 12px;
  font-size: 15px; line-height: 1.55;
  white-space: pre-wrap; overflow-wrap: anywhere;
}

.post-media {
  display: block; border-top: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft);
  background: var(--surface-2);
}
.post-media img { width: 100%; max-height: 560px; object-fit: cover; }

.post-cta { margin: 12px 16px; padding: 14px; border-radius: var(--radius); background: var(--brand-soft); }
.post-cta .cta-label { font-weight: 650; color: var(--brand); margin-bottom: 8px; }

/* Signature element: the Riffzu loop. A post is not finished when it is
   published; these four steps show how far it has travelled. */
.loop {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 1px; margin: 0 16px 12px;
  background: var(--line-soft);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  overflow: hidden;
}
.loop-step {
  background: var(--surface-2); padding: 8px 6px; text-align: center;
  display: grid; gap: 2px; align-content: center;
}
.loop-step .loop-name {
  font-size: 10px; font-weight: 700; letter-spacing: 0.07em;
  text-transform: uppercase; color: var(--ink-3);
}
.loop-step .loop-value { font-size: 15px; font-weight: 700; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.loop-step.is-reached { background: var(--surface); }
.loop-step.is-reached .loop-name { color: var(--ink-2); }
.loop-step.is-reached .loop-value { color: var(--ink); }
.loop-step.is-outcome.is-reached { background: var(--brand-soft); }
.loop-step.is-outcome.is-reached .loop-name,
.loop-step.is-outcome.is-reached .loop-value { color: var(--brand); }

.post-stats {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 8px 16px;
  font-size: 13px; color: var(--ink-3);
  border-top: 1px solid var(--line-soft);
}

.post-actions {
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  padding: 4px 8px; border-top: 1px solid var(--line-soft);
}
.act {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 38px; padding: 0 8px;
  border: 0; border-radius: var(--radius);
  background: transparent; color: var(--ink-2);
  font-family: inherit; font-size: 14px; font-weight: 600;
  cursor: pointer; text-decoration: none;
  transition: background 0.12s var(--ease), color 0.12s var(--ease);
}
.act:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.act svg { width: 18px; height: 18px; }
.act.is-on { color: var(--brand); }
.act.is-on svg { fill: currentColor; }
.act .act-label { display: inline; }

/* ------------------------------------------------------------- profile -- */

.cover {
  height: 220px; background: var(--surface-3);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0; overflow: hidden;
}
.cover img { width: 100%; height: 100%; object-fit: cover; }

.profile-head { padding: 0 20px 18px; }
.profile-id { display: flex; align-items: flex-end; gap: 16px; margin-top: -48px; flex-wrap: wrap; }
.profile-id .names { flex: 1; min-width: 200px; padding-bottom: 4px; }
.profile-name { font-size: 24px; font-weight: 800; letter-spacing: -0.02em; margin: 0; }
.profile-handle { color: var(--ink-3); font-size: 14px; }
.profile-bio { margin-top: 12px; font-size: 14.5px; max-width: 60ch; }
.profile-facts { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 10px; font-size: 13.5px; color: var(--ink-3); }
.profile-facts span { display: inline-flex; align-items: center; gap: 5px; }

.stat-row { display: flex; gap: 22px; margin-top: 14px; }
.stat-row a, .stat-row span { color: var(--ink-2); font-size: 14px; text-decoration: none; }
.stat-row strong { color: var(--ink); font-weight: 700; }
.stat-row a:hover { text-decoration: underline; }

/* --------------------------------------------------------------- lists -- */

.people { display: grid; gap: 2px; }
.person {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: var(--radius);
  color: var(--ink); text-decoration: none;
}
.person:hover { background: var(--surface-2); text-decoration: none; }
.person .p-name { font-weight: 600; font-size: 14px; }
.person .p-note { font-size: 12.5px; color: var(--ink-3); }

.metric-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.metric { padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.metric .m-label { font-size: 12px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--ink-3); }
.metric .m-value { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; margin-top: 4px; font-variant-numeric: tabular-nums; }
.metric .m-note { font-size: 12.5px; color: var(--ink-3); margin-top: 2px; }

.empty { padding: 44px 24px; text-align: center; }
.empty img { width: 96px; margin: 0 auto 16px; opacity: 0.85; }
.empty h3 { margin-bottom: 6px; }
.empty p { color: var(--ink-3); max-width: 42ch; margin: 0 auto 16px; }

/* -------------------------------------------------------------- tables -- */

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th, table.data td {
  padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
}
table.data th {
  font-size: 12px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase;
  color: var(--ink-3); background: var(--surface-2); white-space: nowrap;
  position: sticky; top: 0; z-index: 1;
}
table.data tbody tr:hover { background: var(--surface-2); }
table.data td.numeric { font-variant-numeric: tabular-nums; text-align: right; }

/* ---------------------------------------------------------- comments ---- */

.comment { display: flex; gap: 10px; padding: 10px 0; }
.comment .bubble {
  background: var(--surface-2); border-radius: var(--radius-lg);
  padding: 9px 14px; flex: 1; min-width: 0;
}
.comment .c-name { font-weight: 650; font-size: 13.5px; }
.comment .c-body { font-size: 14.5px; white-space: pre-wrap; overflow-wrap: anywhere; }
.comment .c-tools { display: flex; gap: 12px; margin-top: 4px; padding-left: 14px; font-size: 12.5px; color: var(--ink-3); }
.comment .c-tools button {
  border: 0; background: none; padding: 0; color: var(--ink-3);
  font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer;
}
.comment .c-tools button:hover { color: var(--danger); text-decoration: underline; }
.comment.is-reply { margin-left: 40px; }

/* ---------------------------------------------------------- messaging --- */

.thread { display: grid; gap: 10px; padding: 16px; max-height: 60vh; overflow-y: auto; }
.msg { max-width: 74%; padding: 9px 14px; border-radius: var(--radius-lg); font-size: 14.5px; overflow-wrap: anywhere; }
.msg.from-them { background: var(--surface-2); justify-self: start; border-bottom-left-radius: var(--radius-sm); }
.msg.from-me { background: var(--brand); color: var(--brand-ink); justify-self: end; border-bottom-right-radius: var(--radius-sm); }
.msg .m-time { font-size: 11px; opacity: 0.75; margin-top: 3px; }

.composer-bar { display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line-soft); }
.composer-bar textarea { min-height: 40px; max-height: 140px; }

/* -------------------------------------------------------------- polls --- */

.poll { display: grid; gap: 8px; margin: 0 16px 12px; }
.poll-option {
  position: relative; overflow: hidden;
  display: flex; align-items: center; gap: 10px;
  padding: 11px 14px; border: 1px solid var(--line);
  border-radius: var(--radius); cursor: pointer;
  font-size: 14.5px; background: var(--surface);
}
.poll-option:hover { border-color: var(--brand); }
.poll-option .fill {
  position: absolute; inset: 0 auto 0 0;
  background: var(--brand-soft); z-index: 0;
  transition: width 0.3s var(--ease);
}
.poll-option > * { position: relative; z-index: 1; }
.poll-option .pct { margin-left: auto; font-weight: 700; font-variant-numeric: tabular-nums; }
.poll-option.is-chosen { border-color: var(--brand); font-weight: 600; }

/* ------------------------------------------------------------ outcomes -- */

.outcome {
  margin: 0 16px 12px; padding: 14px;
  border: 1px solid var(--brand); border-radius: var(--radius);
  background: var(--brand-soft);
}
.outcome .o-eyebrow {
  font-size: 11px; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--brand); margin-bottom: 5px;
}
.outcome .o-headline { font-weight: 700; font-size: 16px; margin-bottom: 4px; }

/* --------------------------------------------------------------- misc --- */

.pagination { display: flex; justify-content: center; gap: 8px; padding: 4px 0 8px; }

.load-sentinel { height: 1px; }

.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 37%, var(--surface-2) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.3s ease-in-out infinite;
  border-radius: var(--radius);
}
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

.prose { font-size: 15.5px; line-height: 1.65; }
.prose h2 { margin-top: 26px; font-size: 21px; }
.prose h3 { margin-top: 20px; }
.prose ul, .prose ol { padding-left: 22px; margin: 0 0 14px; }
.prose li { margin-bottom: 5px; }
.prose blockquote {
  margin: 0 0 14px; padding: 10px 16px;
  border-left: 3px solid var(--brand); background: var(--surface-2);
  border-radius: 0 var(--radius) var(--radius) 0;
}

.split { display: grid; gap: 20px; grid-template-columns: 220px minmax(0, 1fr); align-items: start; }

/* --------------------------------------------------------------- auth --- */

.auth-page {
  min-height: 100vh; display: grid; place-items: center;
  padding: 32px 16px; background: var(--canvas);
}
.auth-card { width: 100%; max-width: 440px; }
.auth-brand { text-align: center; margin-bottom: 22px; }
.auth-brand img { height: 42px; margin: 0 auto 10px; }
.auth-brand .tagline { color: var(--ink-3); font-size: 14.5px; }

/* --------------------------------------------------------------- home --- */

.hero { padding: 64px 0 44px; text-align: center; }
.hero h1 {
  font-size: clamp(32px, 5.4vw, 52px); font-weight: 800;
  letter-spacing: -0.03em; line-height: 1.08; max-width: 18ch; margin: 0 auto 16px;
}
.hero p { font-size: clamp(16px, 2vw, 19px); color: var(--ink-2); max-width: 58ch; margin: 0 auto 26px; }
.hero .btn-group { justify-content: center; }

.loop-explainer {
  display: grid; gap: 12px; grid-template-columns: repeat(4, 1fr);
  margin: 44px 0;
}
.loop-card { padding: 18px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); }
.loop-card .step-index {
  font-family: var(--font-num); font-size: 12px; font-weight: 700;
  color: var(--brand); margin-bottom: 8px;
}
.loop-card h3 { font-size: 16px; margin-bottom: 4px; }
.loop-card p { font-size: 13.5px; color: var(--ink-3); margin: 0; }

.public-footer {
  border-top: 1px solid var(--line);
  margin-top: 48px; padding: 28px 0;
  font-size: 13.5px; color: var(--ink-3);
}
.public-footer nav { display: flex; flex-wrap: wrap; gap: 18px; }
.public-footer a { color: var(--ink-2); }

/* ---------------------------------------------------------- bottom nav -- */

.tabbar { display: none; }

/* ------------------------------------------------------------ responsive */

@media (max-width: 1200px) {
  .shell { grid-template-columns: var(--rail-w) minmax(0, 1fr); }
  .aside { display: none; }
}

@media (max-width: 980px) {
  .shell, .shell.shell-wide { grid-template-columns: minmax(0, 1fr); max-width: 680px; }
  .rail { display: none; }
  .split { grid-template-columns: minmax(0, 1fr); }
  .loop-explainer { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 720px) {
  body { font-size: 15px; }
  :root { --gap: 12px; }

  .shell { padding: 12px 0 84px; gap: 12px; }
  .card { border-radius: 0; border-left: 0; border-right: 0; }
  .card-foot { border-radius: 0; }
  .cover { border-radius: 0; height: 160px; }

  .topbar-inner { grid-template-columns: auto minmax(0, 1fr) auto; padding: 0 10px; gap: 8px; }
  .brand-name { display: none; }
  .searchbox { max-width: none; }

  /* Actions keep their icons; labels would wrap at this width. */
  .act .act-label { display: none; }
  .act { gap: 0; }

  .profile-head { padding: 0 16px 16px; }
  .profile-id { margin-top: -36px; }
  .avatar-96 { width: 76px; height: 76px; }
  .profile-name { font-size: 21px; }

  .msg { max-width: 86%; }
  .comment.is-reply { margin-left: 24px; }
  .hero { padding: 40px 16px 32px; }
  .loop-explainer { grid-template-columns: 1fr; margin: 32px 16px; }
  .public-footer { padding: 24px 16px; }

  /* Primary destinations move to a thumb-reachable bar. */
  .tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 70;
    display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
    background: var(--surface); border-top: 1px solid var(--line);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .tabbar a {
    position: relative;
    display: grid; place-items: center; gap: 2px;
    padding: 8px 4px 6px; color: var(--ink-3);
    font-size: 10.5px; font-weight: 600; text-decoration: none;
  }
  .tabbar a.is-current { color: var(--brand); }
  .tabbar svg { width: 22px; height: 22px; }
  .tabbar .badge-dot { top: 4px; right: calc(50% - 20px); }
}

@media (min-width: 721px) {
  .only-mobile { display: none !important; }
}

@media print {
  .topbar, .rail, .aside, .tabbar, .post-actions, .composer-bar { display: none !important; }
  .shell { grid-template-columns: 1fr; }
  .card { border: 0; box-shadow: none; }
}
