/* Nadim — quiet paper, warm ink. */

:root {
  --paper: #f6f1e7;
  --paper-2: #fffdf8;
  --paper-3: #efe7d8;
  --ink: #1b1814;
  --ink-2: #4c463c;
  --muted: #8b8173;
  --line: #e3d9c8;
  --line-strong: #d3c5ae;
  --clay: #a8482a;
  --clay-soft: #f3e2d8;
  --olive: #5f6b46;
  --olive-soft: #e8ecd9;
  --gold: #b98a3e;
  --danger: #94331f;
  --radius: 18px;
  --shadow: 0 1px 2px rgba(27, 24, 20, .04), 0 8px 24px -16px rgba(27, 24, 20, .28);
  --shadow-lift: 0 2px 4px rgba(27, 24, 20, .05), 0 18px 40px -24px rgba(27, 24, 20, .4);
  --sans: 'Karla', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --serif: 'Fraunces', 'Iowan Old Style', Georgia, serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: #ece4d5;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: .5;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='.16'/%3E%3C/svg%3E");
}
#app {
  position: relative;
  z-index: 1;
  max-width: 520px;
  height: 100dvh;
  margin: 0 auto;
  background: var(--paper);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 0 0 1px rgba(27, 24, 20, .04);
}
@media (min-width: 600px) {
  #app { height: calc(100dvh - 48px); margin: 24px auto; border-radius: 26px; box-shadow: var(--shadow-lift), 0 0 0 1px rgba(27,24,20,.05); }
}
main { flex: 1; overflow-y: auto; overflow-anchor: none; overscroll-behavior: contain; padding: 0 22px 30px; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
main::-webkit-scrollbar { width: 8px; }
main::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 8px; border: 2px solid var(--paper); }

h1, h2, h3 { margin: 0; font-weight: 500; }
p { margin: 0; }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: inherit; }
::selection { background: var(--clay-soft); }

/* ── top bar ── */
.top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 22px 10px;
}
.wordmark {
  font-family: var(--serif);
  font-size: 24px;
  letter-spacing: -.03em;
  text-decoration: none;
  font-weight: 600;
}
.wordmark .dot { color: var(--clay); }
.top-right { display: flex; align-items: center; gap: 10px; }
.demo-pill {
  font-size: 11px; letter-spacing: .06em; text-transform: uppercase;
  color: var(--gold); border: 1px solid #e4d2ae; background: #fbf4e4;
  padding: 4px 8px; border-radius: 999px; font-weight: 600;
}

/* ── avatars ── */
.avatar {
  width: 42px; height: 42px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  font-weight: 700; font-size: 14px; letter-spacing: .02em;
  color: #fff;
}
.avatar.sm { width: 30px; height: 30px; font-size: 11px; }
.avatar.lg { width: 56px; height: 56px; font-size: 18px; }
.c-clay { background: #b4643f; }
.c-olive { background: #6b7a4f; }
.c-plum { background: #7d5a72; }
.c-gold { background: #b98a3e; }
.c-blue { background: #4f6d82; }
.avatar-ring { box-shadow: 0 0 0 2px var(--paper), 0 0 0 3.5px var(--line-strong); }

/* ── ask ── */
.ask { padding-top: 18px; }
.ask.compact { padding-top: 4px; }
.ask.compact .lede, .ask.compact .how { display: none; }
.ask.compact h1 { font-size: 27px; margin-bottom: 12px; }
.ask.compact .askbox { margin-top: 2px; }
.eyebrow {
  font-size: 11.5px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--muted); font-weight: 700; margin-bottom: 10px;
}
.ask h1 {
  font-family: var(--serif);
  font-size: clamp(32px, 9vw, 40px);
  line-height: 1.04;
  letter-spacing: -.035em;
  margin-bottom: 10px;
}
.lede { color: var(--ink-2); font-size: 15.5px; max-width: 34ch; margin-bottom: 20px; }

.askbox {
  display: flex; align-items: center; gap: 8px;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 6px 6px 6px 16px;
  box-shadow: var(--shadow);
  transition: border-color .18s ease, box-shadow .18s ease;
}
.askbox:focus-within { border-color: var(--line-strong); box-shadow: 0 0 0 4px #efe4d2, var(--shadow); }
.askbox input {
  flex: 1; min-width: 0; border: 0; background: transparent; outline: none;
  font: 400 16.5px/1.4 var(--sans); color: var(--ink); padding: 12px 0;
}
.askbox input::placeholder { color: #a79c8b; }
.askbox button {
  width: 44px; height: 44px; border-radius: 12px; border: 0; flex: none;
  background: var(--ink); color: var(--paper-2); font-size: 19px;
  display: grid; place-items: center;
  transition: transform .12s ease, background .18s ease;
}
.askbox button:hover { background: var(--clay); }
.askbox button:active { transform: scale(.94); }

.chips { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 14px; }
.how { margin-top: 32px; padding-top: 18px; border-top: 1px solid var(--line); display: grid; gap: 11px; }
.how p { display: flex; gap: 10px; font-size: 13.5px; line-height: 1.45; color: var(--muted); }
.how span { font-family: var(--serif); font-size: 13px; color: var(--clay); flex: none; width: 14px; }
.chip {
  border: 1px solid var(--line); background: transparent; color: var(--ink-2);
  padding: 7px 12px; border-radius: 999px; font-size: 13px; font-weight: 500;
  transition: all .16s ease;
}
.chip:hover { border-color: var(--line-strong); background: var(--paper-2); color: var(--ink); }
.chip.on { background: var(--ink); border-color: var(--ink); color: var(--paper-2); }

/* ── asking strip ── */
.strip {
  display: flex; align-items: center; gap: 10px;
  margin: 16px 0 14px; padding: 10px 12px;
  background: var(--olive-soft); border: 1px solid #d9e0c6; border-radius: 12px;
  font-size: 12.5px; color: #4d5a38; line-height: 1.35;
}
.strip b { color: #39452a; font-weight: 700; }
.strip > div { flex: 1; min-width: 0; }
.strip .btn { flex: none; padding: 6px 10px; font-size: 12px; border-radius: 9px; }
.strip-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--olive); flex: none; }

/* ── results ── */
.results-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin: 30px 0 12px;
}
.results-head h2 { font-family: var(--serif); font-size: 20px; letter-spacing: -.02em; }
.results-head .count { font-size: 12.5px; color: var(--muted); }

.rec {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
  animation: rise .42s cubic-bezier(.2,.7,.3,1) both;
  animation-delay: calc(var(--i, 0) * 45ms);
}
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.rec-top { display: flex; gap: 12px; align-items: flex-start; }
.rec-top .who { min-width: 0; flex: 1; }
.rec h3 { font-size: 16.5px; font-weight: 700; letter-spacing: -.01em; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cat {
  font-size: 10.5px; letter-spacing: .07em; text-transform: uppercase;
  color: var(--olive); background: var(--olive-soft);
  padding: 3px 7px; border-radius: 6px; font-weight: 700;
}
.path { font-size: 13px; color: var(--muted); margin-top: 3px; }
.path b { color: var(--ink-2); font-weight: 600; }
.path .sep { margin: 0 5px; opacity: .6; }

.note {
  margin: 12px 0 0; padding: 10px 0 0 12px;
  border-left: 2px solid var(--clay-soft);
  font-family: var(--serif); font-size: 14.5px; line-height: 1.5; color: var(--ink-2);
}
.note .by { display: block; margin-top: 4px; font-family: var(--sans); font-size: 11.5px; color: var(--muted); }

.rec-meta { display: flex; align-items: center; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.tag {
  font-size: 12px; color: var(--ink-2); background: var(--paper-3);
  padding: 4px 9px; border-radius: 999px;
}
.tag.trust { background: var(--olive-soft); color: var(--olive); font-weight: 600; }
.tag.demo { background: #fbf4e4; color: var(--gold); }

.rec-actions { margin-top: 14px; display: flex; gap: 8px; }
.btn {
  border: 0; border-radius: 12px; padding: 11px 16px; font-weight: 700; font-size: 14px;
  background: var(--ink); color: var(--paper-2); text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  transition: transform .12s ease, background .18s ease, opacity .18s;
}
.btn:hover { background: #2b261f; }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.clay { background: var(--clay); }
.btn.clay:hover { background: #93402a; }
.btn.ghost { background: transparent; color: var(--ink-2); border: 1px solid var(--line); }
.btn.ghost:hover { background: var(--paper-3); color: var(--ink); }
.btn.sm { padding: 8px 12px; font-size: 13px; border-radius: 10px; }
.btn.wide { width: 100%; }
.btn.danger { background: transparent; color: var(--danger); border: 1px solid #e6c9c0; }

.empty {
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  padding: 26px 20px;
  text-align: center;
  color: var(--muted);
  background: rgba(255, 253, 248, .5);
}
.empty h3 { font-family: var(--serif); font-size: 18px; color: var(--ink-2); margin-bottom: 6px; }
.empty p { font-size: 14px; max-width: 30ch; margin: 0 auto 14px; }

/* ── section headers ── */
.page-head { padding: 22px 0 6px; }
.page-head h1 { font-family: var(--serif); font-size: 30px; letter-spacing: -.03em; }
.page-head p { color: var(--muted); font-size: 14.5px; margin-top: 4px; }
.head-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }

.group-label {
  font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
  color: var(--muted); margin: 24px 0 8px;
}

/* ── circle list ── */
.card-row {
  display: flex; gap: 12px; align-items: center;
  padding: 13px 4px; border-bottom: 1px solid var(--line);
  width: 100%; text-align: left; background: none; border-left: 0; border-right: 0; border-top: 0;
}
.card-row:last-child { border-bottom: 0; }
.card-row:hover { background: rgba(255,253,248,.7); }
.card-row .who { flex: 1; min-width: 0; }
.card-row .who b { display: block; font-size: 15.5px; }
.card-row .who span { display: block; font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pill {
  font-size: 10.5px; letter-spacing: .05em; text-transform: uppercase; font-weight: 700;
  padding: 3px 7px; border-radius: 6px; background: var(--paper-3); color: var(--muted);
}
.pill.private { background: #f1e6e2; color: var(--danger); }
.pill.linked { background: var(--olive-soft); color: var(--olive); }

/* ── inbox ── */
.inbox-item {
  background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 15px; margin-bottom: 10px; box-shadow: var(--shadow);
}
.inbox-item .line { display: flex; gap: 11px; align-items: flex-start; }
.inbox-item h3 { font-size: 15px; line-height: 1.35; }
.inbox-item h3 b { font-weight: 700; }
.inbox-item .when { font-size: 11.5px; color: var(--muted); margin-top: 6px; }
.inbox-item .actions { display: flex; gap: 8px; margin-top: 12px; }
.quote-line { font-family: var(--serif); font-size: 14px; color: var(--ink-2); margin-top: 8px; padding-left: 11px; border-left: 2px solid var(--line); }

/* ── profile ── */
.profile-card {
  display: flex; gap: 14px; align-items: center;
  background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow); margin-top: 14px;
}
.profile-card h2 { font-family: var(--serif); font-size: 22px; letter-spacing: -.02em; }
.profile-card p { font-size: 13px; color: var(--muted); }

.invite-box {
  margin-top: 10px; background: var(--paper-2); border: 1px solid var(--line);
  border-radius: 14px; padding: 12px; display: flex; gap: 8px; align-items: center;
}
.invite-box code { flex: 1; min-width: 0; font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }

.member { display: flex; align-items: center; gap: 10px; padding: 10px 2px; border-bottom: 1px solid var(--line); }
.member:last-child { border-bottom: 0; }
.member .who { flex: 1; min-width: 0; }
.member .who b { font-size: 14.5px; display: block; }
.member .who span { font-size: 12px; color: var(--muted); }
.member .hops { font-size: 11px; color: var(--muted); }

/* ── forms / sheet ── */
.backdrop {
  position: fixed; inset: 0; background: rgba(27, 24, 20, .34);
  z-index: 40; opacity: 0; animation: fade .2s ease forwards;
  backdrop-filter: blur(2px);
}
@keyframes fade { to { opacity: 1; } }
.sheet {
  position: fixed; left: 50%; bottom: 0; transform: translateX(-50%);
  width: 100%; max-width: 520px; z-index: 41;
  background: var(--paper); border-radius: 22px 22px 0 0;
  padding: 10px 22px calc(22px + env(safe-area-inset-bottom));
  box-shadow: 0 -20px 60px -20px rgba(27,24,20,.5);
  max-height: 92dvh; overflow-y: auto;
  animation: sheetUp .3s cubic-bezier(.2,.8,.2,1);
}
@keyframes sheetUp { from { transform: translate(-50%, 24px); opacity: .6; } }
.sheet .grab { width: 38px; height: 4px; border-radius: 4px; background: var(--line-strong); margin: 4px auto 16px; }
.sheet h2 { font-family: var(--serif); font-size: 24px; letter-spacing: -.02em; margin-bottom: 4px; }
.sheet .sub { font-size: 13.5px; color: var(--muted); margin-bottom: 16px; }

.field { margin-bottom: 13px; }
.field label { display: block; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.input, textarea.input, select.input {
  width: 100%; border: 1px solid var(--line); background: var(--paper-2);
  border-radius: 12px; padding: 12px 13px; font: 400 15.5px/1.4 var(--sans); color: var(--ink);
  outline: none; transition: border-color .15s, box-shadow .15s;
}
.input:focus, textarea.input:focus, select.input:focus { border-color: var(--line-strong); box-shadow: 0 0 0 3px #efe4d2; }
textarea.input { resize: vertical; min-height: 78px; }
.select-wrap { position: relative; }
.select-wrap::after { content: '⌄'; position: absolute; right: 14px; top: 10px; color: var(--muted); pointer-events: none; }
select.input { appearance: none; }
.hint { font-size: 11.5px; color: var(--muted); margin-top: 6px; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.seg { display: flex; background: var(--paper-3); border-radius: 11px; padding: 3px; }
.seg button { flex: 1; border: 0; background: transparent; padding: 8px 6px; border-radius: 8px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.seg button.on { background: var(--paper-2); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.08); }

.form-actions { display: flex; gap: 8px; margin-top: 18px; }
.form-actions .btn { flex: 1; }

/* ── auth ── */
.auth { padding: clamp(28px, 6vh, 56px) 26px 32px; display: flex; flex-direction: column; height: 100%; overflow-y: auto; overflow-anchor: none; justify-content: flex-start; }
.auth .mark { display: flex; gap: 6px; margin-bottom: 22px; }
.auth h1 { font-family: var(--serif); font-size: 40px; line-height: 1.02; letter-spacing: -.04em; margin-bottom: 12px; }
.auth .lede { font-size: 15.5px; color: var(--ink-2); margin-bottom: 24px; max-width: 32ch; }
.auth form { margin-top: 4px; }
.auth .fine { font-size: 12px; color: var(--muted); margin-top: 14px; line-height: 1.5; }
.auth .switch { margin-top: 18px; font-size: 13.5px; color: var(--muted); }
.auth .switch a { color: var(--clay); text-decoration: none; font-weight: 600; }

/* ── nav ── */
.tabs {
  flex: none; z-index: 20;
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: rgba(246, 241, 231, .92);
  backdrop-filter: blur(14px) saturate(1.2);
  border-top: 1px solid var(--line);
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
}
.tab {
  border: 0; background: none; display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 6px 0; color: var(--muted); font-size: 10.5px; font-weight: 600; letter-spacing: .02em;
  text-decoration: none; position: relative;
}
.tab svg { width: 21px; height: 21px; stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.tab.on { color: var(--ink); }
.tab.on::before { content: ''; position: absolute; top: -8px; width: 22px; height: 2px; border-radius: 2px; background: var(--clay); }
.tab .badge-dot {
  position: absolute; top: 3px; right: calc(50% - 16px); width: 7px; height: 7px;
  background: var(--clay); border-radius: 50%; border: 1.5px solid var(--paper);
}

/* ── misc ── */
.toast {
  position: fixed; left: 50%; bottom: 96px; transform: translate(-50%, 12px);
  background: var(--ink); color: var(--paper-2); font-size: 13.5px; font-weight: 600;
  padding: 11px 16px; border-radius: 12px; z-index: 60; opacity: 0; pointer-events: none;
  transition: opacity .22s, transform .22s; max-width: 88vw; text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.hidden { display: none !important; }
.skeleton { background: linear-gradient(90deg, var(--paper-3) 25%, #f7f0e3 50%, var(--paper-3) 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 14px; }
@keyframes shimmer { to { background-position: -200% 0; } }
.spin { display: inline-block; width: 14px; height: 14px; border: 2px solid rgba(255,255,255,.35); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
