:root {
  --bg: #F7F8FA;
  --ink: #0D1117;
  --ink-2: #4B5361;
  --ink-3: #8B929D;
  --hair: rgba(13, 17, 23, .08);
  --hair-2: rgba(13, 17, 23, .14);
  --glass: rgba(255, 255, 255, .62);
  --glass-strong: rgba(255, 255, 255, .86);
  --edge: rgba(255, 255, 255, .95);
  --accent: #0E7C76;
  --accent-soft: rgba(14, 124, 118, .10);
  --good: #127A4B;
  --good-soft: rgba(18, 122, 75, .10);
  --danger: #B4362A;
  --danger-soft: rgba(180, 54, 42, .08);
  --shadow: 0 1px 1px rgba(13, 17, 23, .03), 0 10px 30px -14px rgba(13, 17, 23, .16);
  --radius: 20px;
  --sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;
  --bar-h: 60px;
  --tab-h: 64px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; letter-spacing: -.025em; text-wrap: balance; font-weight: 600; }
p { margin: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 10px; }
[hidden] { display: none !important; }

/* Soft colour fields the glass picks up. Fixed so panels blur them as you scroll. */
.wash { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.wash i { position: absolute; border-radius: 50%; filter: blur(70px); opacity: .75; }
.wash i:nth-child(1) { width: 60vmax; height: 60vmax; left: -18vmax; top: -22vmax; background: #CDEDEE; }
.wash i:nth-child(2) { width: 50vmax; height: 50vmax; right: -20vmax; top: 18vh; background: #F3E3D3; }
.wash i:nth-child(3) { width: 46vmax; height: 46vmax; left: 10vw; bottom: -26vmax; background: #E3E1F4; }

.glass, .glass-strong {
  background: var(--glass);
  -webkit-backdrop-filter: blur(22px) saturate(170%);
  backdrop-filter: blur(22px) saturate(170%);
  border: 1px solid var(--edge);
  box-shadow: var(--shadow), inset 0 0 0 .5px var(--hair);
}
.glass-strong { background: var(--glass-strong); }

/* ---------- top bar ---------- */
.bar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  height: calc(var(--bar-h) + env(safe-area-inset-top, 0px));
  padding: env(safe-area-inset-top, 0px) max(16px, calc((100vw - 1040px) / 2)) 0;
  border-width: 0 0 1px; border-radius: 0; box-shadow: none;
}
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; font-size: 18px; letter-spacing: -.02em; text-decoration: none; }
.orb {
  width: 24px; height: 24px; border-radius: 50%; flex: none;
  background: radial-gradient(circle at 32% 28%, #fff 0 18%, transparent 40%), linear-gradient(140deg, #0D1117, #2C3440);
  box-shadow: inset 0 0 0 4px rgba(255,255,255,.0), 0 2px 8px rgba(13,17,23,.25);
}
.topnav { display: none; gap: 4px; }
.topnav a { position: relative; text-decoration: none; padding: 8px 14px; border-radius: 999px; color: var(--ink-2); font-weight: 500; }
.topnav a:hover { color: var(--ink); background: rgba(255,255,255,.6); }
.topnav a[aria-current="page"] { color: var(--ink); background: #fff; box-shadow: inset 0 0 0 1px var(--hair); }
.bar-right { display: flex; align-items: center; gap: 8px; }
.who-pill { display: inline-flex; align-items: center; gap: 8px; border: 0; background: rgba(255,255,255,.7); border-radius: 999px; padding: 4px 12px 4px 4px; cursor: pointer; box-shadow: inset 0 0 0 1px var(--hair); font-weight: 500; font-size: 14px; }

/* ---------- bottom tab bar (phones) ---------- */
.tabbar {
  position: fixed; left: 12px; right: 12px; z-index: 20;
  bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  height: var(--tab-h); border-radius: 22px;
  display: grid; grid-template-columns: repeat(3, 1fr);
}
.tabbar a { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; text-decoration: none; color: var(--ink-3); font-size: 11.5px; font-weight: 500; }
.tabbar svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.tabbar a[aria-current="page"] { color: var(--ink); }
.dot { position: absolute; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px #fff; }
.tabbar .dot { top: 10px; left: calc(50% + 8px); }
.topnav .dot { top: 6px; right: 6px; }

@media (min-width: 860px) {
  .topnav { display: flex; }
  .tabbar { display: none !important; }
}

/* ---------- verify-email banner ---------- */
.banner {
  max-width: 1040px; margin: 12px auto 0; width: calc(100% - 32px);
  border-radius: 16px; padding: 10px 10px 10px 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: 14px;
}
.banner b { font-weight: 600; }
.banner + #view { padding-top: 16px; }

/* ---------- page ---------- */
#view {
  max-width: 1040px; margin: 0 auto; outline: none;
  padding-inline: 16px;
  padding-block: 24px calc(var(--tab-h) + 40px + env(safe-area-inset-bottom, 0px));
}
@media (min-width: 860px) { #view { padding-block: 40px 64px; } }
.narrow { max-width: 680px; margin-inline: auto; }
.page-head { display: flex; flex-direction: column; gap: 6px; margin-bottom: 20px; }
.page-head h1 { font-size: clamp(26px, 5vw, 34px); }
.page-head p { color: var(--ink-2); max-width: 60ch; }
.label { font: 500 11.5px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.muted { color: var(--ink-2); }
.small { font-size: 13px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 20px; border-radius: 999px; border: 0; cursor: pointer;
  font-weight: 600; font-size: 14.5px; text-decoration: none; white-space: nowrap;
  transition: transform .15s ease, background .15s ease, box-shadow .15s ease;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--ink); color: #fff; box-shadow: 0 6px 18px -8px rgba(13,17,23,.5); }
.btn-primary:hover { background: #222833; }
.btn-glass { background: rgba(255,255,255,.75); color: var(--ink); box-shadow: inset 0 0 0 1px var(--hair-2); }
.btn-glass:hover { background: #fff; }
.btn-quiet { background: transparent; color: var(--ink-2); height: 36px; padding: 0 12px; }
.btn-quiet:hover { color: var(--ink); background: rgba(255,255,255,.6); }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-sm { height: 36px; padding: 0 14px; font-size: 13.5px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: default; }
.btn.done { background: var(--good-soft); color: var(--good); box-shadow: none; }

/* ---------- landing ---------- */
.hero { display: grid; gap: 40px; align-items: center; padding-block: 12px 32px; }
@media (min-width: 900px) { .hero { grid-template-columns: 1.05fr 1fr; padding-block: 40px 56px; } }
.hero h1 { font-size: clamp(38px, 7.4vw, 64px); line-height: 1.02; letter-spacing: -.045em; font-weight: 600; }
.hero .lede { font-size: 17px; color: var(--ink-2); max-width: 46ch; margin-top: 18px; }
.hero .actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 28px; }
.hero .fine { margin-top: 14px; font-size: 13px; color: var(--ink-3); }
.preview { position: relative; }
.preview .card { transform: rotate(-1.2deg); }
.preview .ghost { position: absolute; inset: 18px -10px -14px 22px; border-radius: var(--radius); z-index: -1; transform: rotate(2.5deg); }
.features { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 720px) { .features { grid-template-columns: repeat(3, 1fr); } }
.feature { border-radius: var(--radius); padding: 20px; display: flex; flex-direction: column; gap: 8px; }
.feature h3 { font-size: 16.5px; }
.feature p { color: var(--ink-2); font-size: 14.5px; }
.feature .label { margin-bottom: 4px; }

/* ---------- auth ---------- */
.auth { max-width: 440px; margin: 8px auto 0; border-radius: 26px; padding: 28px 22px; display: flex; flex-direction: column; gap: 18px; }
@media (min-width: 520px) { .auth { padding: 36px 32px; margin-top: 24px; } }
.auth h1 { font-size: 26px; }
.auth .switch { text-align: center; font-size: 14px; color: var(--ink-2); }
.auth .switch a { font-weight: 600; color: var(--ink); }
.label-row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.label-row a { font-size: 13px; color: var(--ink-2); }
.label-row a:hover { color: var(--ink); }
.success { color: var(--good); font-size: 14px; background: var(--good-soft); padding: 12px 14px; border-radius: 12px; }
.status-dot { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500; }
.status-dot::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status-dot.ok { color: var(--good); }
.status-dot.no { color: var(--danger); }
form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .field > .flabel { font-size: 13px; font-weight: 500; color: var(--ink-2); }
.input, select.input, textarea.input {
  width: 100%; height: 46px; padding: 0 14px; border-radius: 14px;
  border: 0; background: rgba(255,255,255,.8); box-shadow: inset 0 0 0 1px var(--hair-2);
  transition: box-shadow .15s ease, background .15s ease;
}
textarea.input { height: auto; min-height: 96px; padding: 12px 14px; resize: vertical; line-height: 1.5; }
.input:focus { outline: none; background: #fff; box-shadow: inset 0 0 0 1.5px var(--ink); }
.grid-2 { display: grid; gap: 14px; grid-template-columns: 1fr 1fr; }
.check { display: grid; grid-template-columns: 20px 1fr; gap: 10px; align-items: start; font-size: 14px; color: var(--ink-2); }
.check input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--ink); }
.check a { color: var(--ink); font-weight: 600; }
.error { color: var(--danger); font-size: 13.5px; background: var(--danger-soft); padding: 10px 12px; border-radius: 12px; }

/* role picker */
.roles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.role {
  display: flex; flex-direction: column; gap: 2px; text-align: left; cursor: pointer;
  padding: 12px; border-radius: 16px; border: 0; background: rgba(255,255,255,.6);
  box-shadow: inset 0 0 0 1px var(--hair-2);
}
.role b { font-weight: 600; font-size: 14px; }
.role span { font-size: 12px; color: var(--ink-3); line-height: 1.3; }
.role[aria-pressed="true"] { background: #fff; box-shadow: inset 0 0 0 1.5px var(--ink), 0 6px 16px -10px rgba(13,17,23,.4); }

/* ---------- chips & segments ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 0; cursor: pointer; padding: 8px 14px; border-radius: 999px; font-size: 13.5px; line-height: 1.25;
  background: rgba(255,255,255,.7); box-shadow: inset 0 0 0 1px var(--hair-2); color: var(--ink);
  transition: background .12s ease, color .12s ease;
}
.chip:hover { background: #fff; }
.chip[aria-pressed="true"] { background: var(--ink); color: #fff; box-shadow: none; }
.seg { display: inline-grid; grid-auto-flow: column; grid-auto-columns: 1fr; padding: 3px; border-radius: 12px; background: rgba(13,17,23,.05); }
.seg button { border: 0; background: transparent; padding: 6px 12px; border-radius: 9px; font-size: 13px; font-weight: 500; color: var(--ink-2); cursor: pointer; }
.seg button[aria-pressed="true"] { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(13,17,23,.12); }

/* ---------- panels ---------- */
.panel { border-radius: var(--radius); padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.panel h2 { font-size: 17px; }
.panel .hint { color: var(--ink-2); font-size: 13.5px; margin-top: -8px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.comm { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.comm > span { font-weight: 500; }
.inline-num { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; flex-wrap: wrap; }
.inline-num .input { width: 84px; height: 38px; font-family: var(--mono); }
.savebar {
  position: sticky; z-index: 10;
  bottom: calc(var(--tab-h) + 18px + env(safe-area-inset-bottom, 0px));
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  border-radius: 18px; padding: 10px 10px 10px 18px; font-size: 14px;
}
@media (min-width: 860px) { .savebar { bottom: 20px; } }

/* ---------- matches ---------- */
.switcher { display: flex; margin-bottom: 18px; }
.switcher .seg { width: 100%; max-width: 420px; }
.switcher .seg button { padding: 9px 12px; font-size: 14px; }
.cards { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 860px) { .cards { grid-template-columns: 1fr 1fr; } }
.card { border-radius: var(--radius); padding: 18px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.card-head { display: grid; grid-template-columns: 44px 1fr auto; gap: 12px; align-items: center; }
.avatar {
  width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 600; font-size: 15px; color: var(--ink);
  background: linear-gradient(150deg, #fff, #E9ECF1); box-shadow: inset 0 0 0 1px var(--hair-2);
}
.card-who { min-width: 0; }
.card-who h3 { font-size: 16.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-who .meta { font: 12.5px/1.4 var(--mono); color: var(--ink-3); }
.headline { color: var(--ink-2); font-size: 14.5px; }
.ring {
  --p: 0; width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: conic-gradient(var(--accent) calc(var(--p) * 1%), rgba(13,17,23,.07) 0);
}
.ring span { width: 44px; height: 44px; border-radius: 50%; background: #fff; display: grid; place-items: center; font: 500 15px var(--mono); font-variant-numeric: tabular-nums; }
.why { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.why li { display: grid; grid-template-columns: 18px 1fr; gap: 6px; }
.why li::before { content: ""; width: 6px; height: 6px; margin: 8px 0 0 4px; border-radius: 50%; background: var(--accent); }
.why li.weak { color: var(--ink-3); }
.why li.weak::before { background: var(--ink-3); opacity: .5; }
details.breakdown summary { cursor: pointer; font-size: 13px; color: var(--ink-3); list-style: none; }
details.breakdown summary::-webkit-details-marker { display: none; }
details.breakdown summary::after { content: " +"; }
details.breakdown[open] summary::after { content: " −"; }
.bars { display: grid; grid-template-columns: auto 1fr 30px; gap: 6px 10px; align-items: center; font-size: 12.5px; margin-top: 10px; }
.bars span { color: var(--ink-2); }
.bar-track { height: 5px; border-radius: 3px; background: rgba(13,17,23,.07); overflow: hidden; }
.bar-track i { display: block; height: 100%; background: var(--ink); border-radius: 3px; }
.bars em { font: normal 12px var(--mono); text-align: right; color: var(--ink-3); }
.card-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: auto; padding-top: 12px; border-top: 1px solid var(--hair); }
.pills { display: flex; gap: 6px; flex-wrap: wrap; }
.pill { font-size: 12px; font-weight: 500; padding: 4px 10px; border-radius: 999px; background: rgba(13,17,23,.05); color: var(--ink-2); white-space: nowrap; }
.pill.accent { background: var(--accent-soft); color: var(--accent); }
.pill.good { background: var(--good-soft); color: var(--good); }
.hidden-list { margin-top: 16px; border-radius: 16px; padding: 14px 18px; font-size: 14px; }
.hidden-list summary { cursor: pointer; color: var(--ink-2); font-weight: 500; }
.hidden-list ul { margin: 10px 0 0; padding-left: 18px; color: var(--ink-2); display: flex; flex-direction: column; gap: 4px; }
.empty { border-radius: var(--radius); padding: 28px 22px; text-align: center; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.empty p { color: var(--ink-2); max-width: 44ch; }
.notice { border-radius: 16px; padding: 12px 16px; font-size: 14px; display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-bottom: 16px; }

/* ---------- connections ---------- */
.section-title { display: flex; align-items: baseline; gap: 8px; margin: 26px 0 10px; }
.section-title:first-child { margin-top: 0; }
.section-title h2 { font-size: 15px; }
.section-title .count { font: 12px var(--mono); color: var(--ink-3); }
.rows { border-radius: var(--radius); overflow: hidden; }
.row { display: grid; grid-template-columns: 44px 1fr auto; gap: 12px; align-items: center; padding: 14px 16px; text-decoration: none; }
.row + .row { border-top: 1px solid var(--hair); }
a.row:hover { background: rgba(255,255,255,.5); }
.row-main { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.row-main b { font-weight: 600; }
.row-main .sub { color: var(--ink-2); font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-main .note { color: var(--ink-2); font-size: 13.5px; font-style: italic; }
.row-actions { display: flex; gap: 6px; }
@media (max-width: 480px) {
  .row.incoming { grid-template-columns: 44px 1fr; }
  .row.incoming .row-actions { grid-column: 1 / -1; }
  .row.incoming .row-actions .btn { flex: 1; }
}

/* ---------- chat ---------- */
.chat { display: flex; flex-direction: column; max-width: 720px; margin: 0 auto; min-height: calc(100vh - var(--bar-h) - var(--tab-h) - 80px); }
.chat-head { display: grid; grid-template-columns: auto 44px 1fr auto; gap: 12px; align-items: center; border-radius: 18px; padding: 10px 12px; position: sticky; top: calc(var(--bar-h) + env(safe-area-inset-top, 0px) + 8px); z-index: 5; }
.back { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; text-decoration: none; font-size: 20px; color: var(--ink-2); }
.back:hover { background: rgba(255,255,255,.7); color: var(--ink); }
.safety { margin: 16px 0 8px; font-size: 13px; color: var(--ink-2); text-align: center; padding: 10px 14px; border-radius: 14px; }
.msgs { display: flex; flex-direction: column; gap: 6px; padding-block: 12px; flex: 1; }
.msg { max-width: min(78%, 520px); padding: 10px 14px; border-radius: 18px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 15px; }
.msg.theirs { align-self: flex-start; border-bottom-left-radius: 6px; }
.msg.mine { align-self: flex-end; background: var(--ink); color: #fff; border-bottom-right-radius: 6px; }
.msg time { display: block; font: 11px var(--mono); opacity: .55; margin-top: 4px; }
.composer {
  position: sticky; bottom: calc(var(--tab-h) + 18px + env(safe-area-inset-bottom, 0px));
  display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: end; padding: 8px; border-radius: 22px;
}
@media (min-width: 860px) { .composer { bottom: 20px; } }
.composer textarea { border: 0; background: transparent; resize: none; min-height: 44px; max-height: 160px; padding: 11px 12px; line-height: 1.45; outline: none; }

/* ---------- sheet ---------- */
.sheet-wrap { position: fixed; inset: 0; z-index: 50; display: grid; align-items: end; justify-items: center; }
@media (min-width: 640px) { .sheet-wrap { align-items: center; } }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(13,17,23,.22); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.sheet {
  position: relative; width: min(100%, 480px); border-radius: 26px 26px 0 0;
  padding: 24px 20px calc(20px + env(safe-area-inset-bottom, 0px));
  display: flex; flex-direction: column; gap: 14px; max-height: 88vh; overflow: auto;
}
@media (min-width: 640px) { .sheet { border-radius: 26px; padding: 28px; } }
.sheet h2 { font-size: 20px; }
.sheet .actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.sheet ol { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; color: var(--ink-2); }
.sheet ol b { color: var(--ink); }

.menu { position: relative; }
.menu-list { position: absolute; right: 0; top: calc(100% + 6px); min-width: 200px; border-radius: 16px; padding: 6px; display: flex; flex-direction: column; z-index: 30; }
.menu-list button { border: 0; background: transparent; text-align: left; padding: 10px 12px; border-radius: 10px; cursor: pointer; font-size: 14px; }
.menu-list button:hover { background: rgba(13,17,23,.05); }
.menu-list .danger { color: var(--danger); }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; transform: translateX(-50%); z-index: 60;
  bottom: calc(var(--tab-h) + 26px + env(safe-area-inset-bottom, 0px));
  background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 999px; font-size: 14px; font-weight: 500;
  box-shadow: 0 10px 30px -10px rgba(13,17,23,.5); max-width: calc(100vw - 32px);
}
@media (min-width: 860px) { .toast { bottom: 28px; } }

.loading { color: var(--ink-3); text-align: center; padding: 48px 0; font-size: 14px; }

@media (prefers-reduced-motion: no-preference) {
  #view > * { animation: rise .35s ease both; }
  @keyframes rise { from { opacity: .001; transform: translateY(6px); } to { opacity: 1; transform: none; } }
}
