:root {
  --bg: #faf7f2;
  --surface: #ffffff;
  --surface-2: #f3eee6;
  --ink: #1d1a2b;
  --muted: #6b6578;
  --line: #e6dfd3;
  --accent: #e8573a;
  --accent-ink: #ffffff;
  --accent-soft: #fde6df;
  --plum: #3b2a5c;
  --pro: #2f6fde;
  --max: #b8860b;
  --ok: #1f8a5b;
  --shadow: 0 1px 2px rgba(29, 26, 43, .06), 0 8px 24px rgba(29, 26, 43, .06);
  --radius: 14px;
  --font: "Inter", system-ui, -apple-system, sans-serif;
  --display: "Fraunces", Georgia, serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14121c;
    --surface: #1d1a28;
    --surface-2: #262235;
    --ink: #f2eef8;
    --muted: #a49db3;
    --line: #34304a;
    --accent: #ff7a5c;
    --accent-soft: #3a2420;
    --plum: #c9b6f2;
    --pro: #6c9cff;
    --max: #e2b13c;
    --ok: #4cc38a;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 15px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { font-family: var(--display); font-weight: 700; line-height: 1.15; margin: 0 0 .4em; letter-spacing: -.01em; }
p { margin: 0 0 .8em; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.stack > * + * { margin-top: 12px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line); background: var(--surface); padding: 9px 16px; border-radius: 999px; cursor: pointer; font-weight: 600; text-decoration: none; font-size: 14px; transition: transform .05s, background .15s; white-space: nowrap; }
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.05); }
.btn.dark { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.sm { padding: 6px 12px; font-size: 13px; }
.btn.lg { padding: 13px 22px; font-size: 16px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn.done { background: var(--surface-2); color: var(--muted); }

/* Forms */
label.field { display: block; font-weight: 600; font-size: 13px; }
label.field > span { display: block; margin-bottom: 6px; }
input[type=text], input[type=email], input[type=password], input[type=datetime-local], input[type=number], input[type=search], select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); font-weight: 400;
}
textarea { min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus, .btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-size: 13px; font-weight: 500; user-select: none; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip:has(input:checked), .chip.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.tag { display: inline-block; padding: 2px 9px; border-radius: 999px; background: var(--surface-2); font-size: 12px; font-weight: 500; color: var(--muted); }
.tag.accent { background: var(--accent-soft); color: var(--accent); }
.tag.ok { background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); }

/* Plan badges */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.badge.free { background: var(--surface-2); color: var(--muted); }
.badge.pro { background: color-mix(in srgb, var(--pro) 15%, transparent); color: var(--pro); }
.badge.max { background: color-mix(in srgb, var(--max) 18%, transparent); color: var(--max); }

/* Avatars */
.avatar { --c: #888; display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--c); color: #fff; font-weight: 700; font-size: 14px; flex: none; }
.avatar.lg { width: 64px; height: 64px; font-size: 22px; }
.avatar.sm { width: 30px; height: 30px; font-size: 11px; }

/* Cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.card h3 { font-size: 18px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }

/* ---------- Public site ---------- */
.site { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.site-nav { display: flex; align-items: center; gap: 12px; padding: 18px 0; }
.logo { font-family: var(--display); font-weight: 700; font-size: 26px; letter-spacing: .06em; text-decoration: none; }
.logo b { color: var(--accent); }
.logo { display: inline-flex; flex-direction: column; line-height: 1; gap: 4px; }
.logo-sub { font-family: var(--font); font-size: 11.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--plum); white-space: nowrap; }
.hero { padding: 64px 0 48px; display: grid; grid-template-columns: 1.2fr 1fr; gap: 48px; align-items: center; }
.hero h1 { font-size: clamp(38px, 6vw, 64px); }
.hero p.lead { font-size: 18px; color: var(--muted); max-width: 520px; }
.eyebrow { display: inline-block; font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); margin-bottom: 14px; }
.hero-art { position: relative; aspect-ratio: 1; max-width: 420px; justify-self: center; width: 100%; }
.hero-art .bubble { position: absolute; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); border-radius: 18px; padding: 12px 14px; display: flex; gap: 10px; align-items: center; font-size: 13px; max-width: 240px; }
.hero-art .ring { position: absolute; inset: 12%; border-radius: 50%; background: radial-gradient(circle at 30% 30%, var(--accent-soft), transparent 70%); border: 1px dashed var(--line); }
section.block { padding: 56px 0; border-top: 1px solid var(--line); }
section.block > h2 { font-size: 34px; }
.pillars { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; margin-top: 24px; }
.pillar .icon { font-size: 26px; margin-bottom: 8px; }
.pillar h3 { font-size: 17px; }
.pillar p { color: var(--muted); font-size: 14px; margin: 0; }
.pricing { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 24px; }
.price-card { position: relative; display: flex; flex-direction: column; }
.price-card.featured { border: 2px solid var(--accent); }
.price-card .price { font-family: var(--display); font-size: 40px; font-weight: 700; }
.price-card ul { padding: 0; list-style: none; margin: 14px 0 20px; flex: 1; }
.price-card li { padding: 6px 0 6px 24px; position: relative; font-size: 14px; }
.price-card li::before { content: "✓"; position: absolute; left: 0; color: var(--accent); font-weight: 700; }
.ribbon { position: absolute; top: -12px; right: 16px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 999px; letter-spacing: .05em; text-transform: uppercase; }
.footer { padding: 32px 0 48px; color: var(--muted); font-size: 13px; border-top: 1px solid var(--line); }

.center-wrap { min-height: 100vh; display: grid; place-items: center; padding: 32px 16px; }
.panel { width: 100%; max-width: 520px; }
.panel.wide { max-width: 1040px; }
.steps { display: flex; gap: 8px; margin-bottom: 18px; }
.steps span { height: 4px; flex: 1; border-radius: 4px; background: var(--line); }
.steps span.on { background: var(--accent); }
.code-input { font-family: ui-monospace, Menlo, monospace; letter-spacing: .12em; text-transform: uppercase; font-size: 18px !important; text-align: center; }
.error { color: var(--accent); font-size: 13px; font-weight: 600; }
.notice { background: var(--surface-2); border-radius: 10px; padding: 10px 14px; font-size: 13px; color: var(--muted); }
.summary-row { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--line); }

/* ---------- App shell ---------- */
.app { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; border-right: 1px solid var(--line); background: var(--surface); padding: 20px 14px; display: flex; flex-direction: column; gap: 18px; }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 10px; text-decoration: none; font-weight: 500; color: var(--muted); }
.nav-item:hover { background: var(--surface-2); color: var(--ink); }
.nav-item.active { background: var(--ink); color: var(--bg); }
.nav-item .ico { width: 20px; text-align: center; }
.nav-item .count { margin-left: auto; background: var(--accent); color: #fff; border-radius: 999px; font-size: 11px; padding: 1px 7px; font-weight: 700; }
.side-foot { margin-top: auto; display: flex; gap: 10px; align-items: center; padding: 10px; border-radius: 12px; background: var(--surface-2); }
.side-foot .who { min-width: 0; }
.side-foot .who b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 14px; }
.main { min-width: 0; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 16px 28px; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(8px); position: sticky; top: 0; z-index: 5; }
.topbar h1 { font-size: 24px; margin: 0; }
.demo-switch { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); font-weight: 600; border: 1px dashed var(--line); padding: 4px 4px 4px 10px; border-radius: 999px; }
.demo-switch select { width: auto; padding: 4px 8px; border-radius: 999px; font-size: 12px; }
.content { padding: 28px; max-width: 1180px; }
.section-head { display: flex; align-items: flex-end; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.section-head p { margin: 0; }

.welcome { background: linear-gradient(120deg, var(--plum), #6b3b6e 60%, var(--accent)); color: #fff; border: 0; }
.welcome .muted { color: rgba(255,255,255,.8); }
.home-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 16px; margin-top: 16px; }
@media (max-width: 1100px) { .home-grid { grid-template-columns: minmax(0, 1fr); } }
.list-item { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.list-item:last-child { border-bottom: 0; }
.list-item .grow { flex: 1; min-width: 0; }
.ellip { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat { font-family: var(--display); font-size: 34px; font-weight: 700; }

/* Messages */
.messenger { display: grid; grid-template-columns: 300px 1fr; height: calc(100vh - 140px); min-height: 460px; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.convos { border-right: 1px solid var(--line); overflow-y: auto; }
.convos-head { padding: 14px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 8px; }
.convo { display: flex; gap: 10px; align-items: center; padding: 12px 14px; text-decoration: none; border-bottom: 1px solid var(--line); }
.convo:hover { background: var(--surface-2); }
.convo.active { background: var(--accent-soft); }
.convo .grow { flex: 1; min-width: 0; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex: none; }
.thread-wrap { display: flex; flex-direction: column; min-width: 0; }
.thread-head { padding: 12px 16px; border-bottom: 1px solid var(--line); display: flex; gap: 10px; align-items: center; }
.thread { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 8px; }
.msg { max-width: 72%; padding: 9px 13px; border-radius: 16px; background: var(--surface-2); align-self: flex-start; white-space: pre-wrap; word-wrap: break-word; }
.msg.me { background: var(--ink); color: var(--bg); align-self: flex-end; border-bottom-right-radius: 4px; }
.msg:not(.me) { border-bottom-left-radius: 4px; }
.composer { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--line); }
.composer input { border-radius: 999px; }
.empty { display: grid; place-items: center; text-align: center; color: var(--muted); padding: 40px 16px; flex: 1; }

/* Activities */
.act { display: flex; flex-direction: column; gap: 8px; }
.act .when { font-weight: 700; color: var(--accent); font-size: 13px; }
.act h3 { margin: 0; }
.bar { height: 6px; background: var(--surface-2); border-radius: 6px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); }
.locked { position: relative; }
.lock-note { font-size: 12px; font-weight: 600; color: var(--max); }

/* Network */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.toolbar input[type=search] { max-width: 300px; }
.toolbar select { width: auto; }
.person { display: flex; flex-direction: column; gap: 10px; }
.person .top { display: flex; gap: 12px; align-items: center; }

/* Dating */
.dating-hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 16px; align-items: start; }
.match-card { text-align: center; }
.match-card .avatar { width: 120px; height: 120px; font-size: 40px; margin: 6px auto 12px; display: grid; }
.compat { font-family: var(--display); font-size: 44px; font-weight: 700; color: var(--accent); line-height: 1; }
.prompt { text-align: left; background: var(--surface-2); border-radius: 12px; padding: 12px 14px; margin-top: 10px; }
.prompt b { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.match-tabs { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.mini-thread { height: 320px; border: 1px solid var(--line); border-radius: 12px; display: flex; flex-direction: column; overflow: hidden; }
.locked-preview { position: relative; overflow: hidden; }
.locked-preview .blurred { filter: blur(6px); pointer-events: none; user-select: none; opacity: .6; }
.locked-preview .overlay { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 24px; background: color-mix(in srgb, var(--bg) 40%, transparent); }

/* Tabs */
.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.tab { background: none; border: 0; padding: 10px 14px; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; cursor: pointer; }
.tab.active { color: var(--ink); border-bottom-color: var(--accent); }

/* Membership */
.compare { width: 100%; border-collapse: collapse; font-size: 14px; }
.compare th, .compare td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.compare th { font-weight: 700; }
.compare td.c, .compare th.c { text-align: center; }
.table-scroll { overflow-x: auto; }

/* Modal + toast */
.modal-backdrop { position: fixed; inset: 0; background: rgba(20, 16, 30, .55); display: grid; place-items: center; padding: 16px; z-index: 50; animation: fade .15s; }
.modal { background: var(--surface); border-radius: 18px; padding: 24px; width: 100%; max-width: 480px; max-height: 90vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modal h2 { font-size: 24px; }
@keyframes fade { from { opacity: 0; } }
#toast { position: fixed; bottom: 24px; left: 50%; transform: translate(-50%, 20px); background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 999px; font-weight: 600; font-size: 14px; opacity: 0; pointer-events: none; transition: .2s; z-index: 60; max-width: calc(100vw - 32px); }
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .pillars { grid-template-columns: repeat(2, 1fr); }
  .pricing { grid-template-columns: 1fr; }
  .hero { grid-template-columns: 1fr; padding-top: 32px; }
  .hero-art { display: none; }
  .home-grid, .dating-hero { grid-template-columns: 1fr; }
}
@media (max-width: 800px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: sticky; top: 0; height: auto; flex-direction: row; align-items: center; padding: 10px 16px; z-index: 10; gap: 12px; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .sidebar nav { flex-direction: row; }
  .nav-item { padding: 7px 10px; white-space: nowrap; }
  .nav-item .label { display: none; }
  .nav-item.active .label { display: inline; }
  .side-foot { display: none; }
  .topbar { position: static; padding: 14px 16px; flex-wrap: wrap; }
  .content { padding: 16px; }
  .messenger { grid-template-columns: 1fr; height: auto; }
  .messenger.has-thread .convos { display: none; }
  .messenger:not(.has-thread) .thread-wrap { display: none; }
  .thread { min-height: 50vh; }
  .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .pillars { grid-template-columns: 1fr; }
  .msg { max-width: 85%; }
}

/* NY chapter */
.date-block { width: 48px; flex: none; text-align: center; background: var(--accent-soft); color: var(--accent); border-radius: 10px; padding: 5px 0; line-height: 1.1; }
.date-block span { display: block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.date-block b { font-family: var(--display); font-size: 20px; }
.club { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.club-icon { font-size: 26px; }
.area-row { display: grid; grid-template-columns: 140px 1fr 28px; gap: 10px; align-items: center; padding: 5px 0; }
.welcome .btn:not(.primary) { color: var(--ink); }

/* ---------- Backend states (loading, errors, offline) ---------- */
.loading { display: flex; align-items: center; gap: 10px; color: var(--muted, #6b6b6b); padding: 24px 4px; }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: tica-spin .8s linear infinite; }
@keyframes tica-spin { to { transform: rotate(360deg); } }
.error-state { max-width: 520px; }
[aria-busy="true"] { cursor: progress; }
button:disabled { cursor: not-allowed; opacity: .65; }
#net-banner { position: fixed; top: 0; left: 0; right: 0; z-index: 70; background: #b3261e; color: #fff; text-align: center; font-weight: 600; font-size: 14px; padding: 8px 16px; transform: translateY(-100%); transition: transform .2s; }
#net-banner.show { transform: translateY(0); }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } #net-banner { transition: none; } }

/* "Founding 100" badge (same shape as plan badges) */
.badge.founding { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); margin-left: 4px; }
