@font-face {
  font-family: "Geist";
  src: url("/fonts/Geist-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: "Geist Mono";
  src: url("/fonts/GeistMono-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --bg: #0a0a0a;
  --bg-2: #111;
  --bg-3: #171717;
  --line: #232323;
  --line-2: #2e2e2e;
  --text: #ededed;
  --text-2: #a1a1a1;
  --mute: #737373;
  --acc: #fff;
  --acc-ink: #0a0a0a;
  --blue: #3b82f6;
  --red: #f87171;
  --green: #4ade80;
  --amber: #fbbf24;
  --r: 10px;
  --head: 52px;
  --font: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #fff;
    --bg-2: #fafafa;
    --bg-3: #f2f2f2;
    --line: #eaeaea;
    --line-2: #dedede;
    --text: #171717;
    --text-2: #525252;
    --mute: #737373;
    --acc: #0a0a0a;
    --acc-ink: #fff;
    color-scheme: light;
  }
}
* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font: 15px / 1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}
#app {
  height: 100dvh;
}
button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
}
a {
  color: inherit;
}
:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}
.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.mono {
  font-family: var(--mono);
}
.muted {
  color: var(--mute);
}

/* Buttons + inputs */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 8px;
  border: 1px solid var(--line-2);
  background: var(--bg-2);
  font-weight: 550;
  text-decoration: none;
}
.btn:hover {
  background: var(--bg-3);
}
.btn-primary {
  background: var(--acc);
  color: var(--acc-ink);
  border-color: var(--acc);
}
.btn-primary:hover {
  background: var(--acc);
  opacity: 0.88;
}
.btn-ghost {
  background: none;
  border-color: transparent;
}
.btn[disabled] {
  opacity: 0.5;
  cursor: default;
}
.icon-btn {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--text-2);
}
.icon-btn:hover {
  background: var(--bg-3);
  color: var(--text);
}
.input {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--line-2);
  background: var(--bg);
  font-size: 16px;
}
.input:focus {
  outline: none;
  border-color: var(--text-2);
}
.field {
  display: grid;
  gap: 6px;
  margin: 0 0 14px;
}
.field > span {
  font-size: 13px;
  color: var(--text-2);
  font-weight: 500;
}
.error {
  color: var(--red);
  font-size: 14px;
  margin: 0 0 12px;
}
.hint {
  color: var(--mute);
  font-size: 13px;
}

/* Auth screens */
.auth {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
}
.auth-card {
  width: 100%;
  max-width: 380px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 650;
  letter-spacing: -0.02em;
}
.brand-mark {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: var(--acc);
  color: var(--acc-ink);
  display: grid;
  place-items: center;
  font: 700 13px var(--mono);
}
.auth h1 {
  font-size: 24px;
  letter-spacing: -0.03em;
  margin: 28px 0 6px;
}
.auth p.lead {
  margin: 0 0 22px;
  color: var(--text-2);
}
.auth .btn-primary {
  width: 100%;
}
.check {
  display: flex;
  gap: 10px;
  align-items: center;
  min-height: 44px;
  font-size: 14px;
  color: var(--text-2);
}
.check input {
  width: 18px;
  height: 18px;
}
.lock-note {
  display: flex;
  gap: 8px;
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  color: var(--mute);
}

/* Shell */
.shell {
  display: grid;
  grid-template-columns: 1fr;
  height: 100dvh;
}
.side {
  display: none;
  flex-direction: column;
  background: var(--bg-2);
  border-right: 1px solid var(--line);
  min-height: 0;
}
.shell.nav-open .side {
  display: flex;
  position: fixed;
  inset: 0;
  z-index: 30;
}
.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}
@media (min-width: 768px) {
  .shell {
    grid-template-columns: 264px 1fr;
  }
  .side,
  .shell.nav-open .side {
    display: flex;
    position: static;
  }
  .only-mobile {
    display: none !important;
  }
}
.side-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--head);
  padding: 0 8px 0 16px;
  border-bottom: 1px solid var(--line);
}
.side-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}
.side-section {
  margin: 10px 0 2px;
  padding: 0 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--mute);
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 44px;
  padding: 0 10px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--text-2);
  text-align: left;
}
.nav-item:hover {
  background: var(--bg-3);
  color: var(--text);
}
.nav-item[aria-current="page"] {
  background: var(--bg-3);
  color: var(--text);
  font-weight: 550;
}
.nav-item.unread {
  color: var(--text);
  font-weight: 600;
}
.nav-item .label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nav-item .hash {
  font-family: var(--mono);
  color: var(--mute);
  width: 16px;
  text-align: center;
}
.badge {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: var(--red);
  color: #fff;
  font-size: 12px;
  font-weight: 650;
  display: inline-grid;
  place-items: center;
}
.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--line-2);
  flex: none;
}
.dot.on {
  background: var(--green);
}
.side-foot {
  border-top: 1px solid var(--line);
  padding: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.me {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 6px;
}
.me .who {
  min-width: 0;
}
.me .who b {
  display: block;
  font-weight: 550;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.me .who small {
  color: var(--mute);
  font-size: 12px;
  text-transform: capitalize;
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  flex: none;
  background: var(--bg-3);
  color: var(--text-2);
  display: grid;
  place-items: center;
  font-weight: 600;
  font-size: 13px;
  object-fit: cover;
}
.avatar.sm {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  font-size: 11px;
}

/* Channel header */
.head {
  display: flex;
  align-items: center;
  gap: 6px;
  height: var(--head);
  padding: 0 8px 0 12px;
  border-bottom: 1px solid var(--line);
  flex: none;
}
.head h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.head h2 span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.head .topic {
  flex: 1;
  min-width: 0;
  color: var(--mute);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.e2ee-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  color: var(--text-2);
  font-size: 11px;
  font-family: var(--mono);
  white-space: nowrap;
}
.offline {
  background: var(--amber);
  color: #111;
  text-align: center;
  font-size: 13px;
  padding: 4px;
}

/* Messages */
.body {
  flex: 1;
  display: flex;
  min-height: 0;
}
.pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}
.list {
  flex: 1;
  overflow-y: auto;
  padding: 12px 0 8px;
  overscroll-behavior: contain;
}
.empty {
  margin: auto;
  padding: 40px 20px;
  text-align: center;
  color: var(--mute);
  max-width: 360px;
}
.empty h3 {
  color: var(--text);
  margin: 0 0 6px;
  font-size: 16px;
}
.day {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 14px 16px 6px;
  font-size: 12px;
  color: var(--mute);
  font-weight: 550;
}
.day::before,
.day::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}
.msg {
  position: relative;
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 10px;
  padding: 4px 16px;
}
.msg:hover,
.msg:focus-within {
  background: var(--bg-2);
}
.msg.cont {
  padding-top: 0;
}
.msg.cont .avatar {
  visibility: hidden;
  height: 0;
}
.msg-meta {
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.msg-meta b {
  font-weight: 600;
  font-size: 14px;
}
.msg-meta time {
  font-size: 12px;
  color: var(--mute);
}
.msg-text {
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
.msg-text code {
  font-family: var(--mono);
  font-size: 13px;
  padding: 1px 5px;
  border-radius: 5px;
  background: var(--bg-3);
  border: 1px solid var(--line);
}
.msg-text pre {
  margin: 6px 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--bg-3);
  border: 1px solid var(--line);
  overflow-x: auto;
  font: 13px / 1.5 var(--mono);
  white-space: pre;
}
.msg-text pre code {
  padding: 0;
  border: 0;
  background: none;
}
.msg-text .mention {
  padding: 0 3px;
  border-radius: 4px;
  background: color-mix(in srgb, var(--blue) 22%, transparent);
  color: var(--text);
  font-weight: 550;
}
.msg-text .mention.me {
  background: color-mix(in srgb, var(--amber) 30%, transparent);
}
.msg-text a {
  color: var(--blue);
}
.msg.mentions-me {
  box-shadow: inset 2px 0 var(--amber);
}
.msg-deleted,
.msg-locked {
  color: var(--mute);
  font-style: italic;
}
.edited {
  color: var(--mute);
  font-size: 12px;
  margin-left: 4px;
}
.msg-actions {
  position: absolute;
  top: -14px;
  right: 12px;
  display: none;
  gap: 2px;
  padding: 2px;
  border-radius: 8px;
  background: var(--bg);
  border: 1px solid var(--line-2);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}
.msg:hover .msg-actions,
.msg:focus-within .msg-actions,
.msg.show-actions .msg-actions {
  display: flex;
}
.msg-actions .icon-btn {
  width: 36px;
  height: 36px;
}
@media (hover: none) {
  .msg-actions .icon-btn {
    width: 44px;
    height: 44px;
  }
}
.reactions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}
.reaction {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 30px;
  padding: 0 9px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  background: var(--bg-2);
  font-size: 13px;
}
.reaction.mine {
  border-color: var(--blue);
  background: color-mix(in srgb, var(--blue) 14%, transparent);
}
.thread-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  margin-top: 2px;
  padding: 0 8px 0 0;
  border: 0;
  background: none;
  color: var(--blue);
  font-size: 13px;
  font-weight: 550;
}
.picker {
  display: flex;
  gap: 2px;
}

/* Composer */
.composer {
  padding: 8px 12px calc(10px + env(safe-area-inset-bottom));
  flex: none;
}
.composer-box {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  border: 1px solid var(--line-2);
  border-radius: 12px;
  background: var(--bg-2);
  padding: 4px 4px 4px 12px;
}
.composer-box:focus-within {
  border-color: var(--text-2);
}
.composer textarea {
  flex: 1;
  min-height: 40px;
  max-height: 40vh;
  resize: none;
  border: 0;
  background: none;
  outline: none;
  padding: 9px 0;
  font-size: 16px;
  line-height: 1.45;
}
.composer .send {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  border: 0;
  background: var(--acc);
  color: var(--acc-ink);
  display: grid;
  place-items: center;
}
.composer .send[disabled] {
  opacity: 0.35;
}
.typing {
  height: 18px;
  padding: 0 16px;
  font-size: 12px;
  color: var(--mute);
}
.suggest {
  margin: 0 12px 6px;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  background: var(--bg);
  overflow: hidden;
}
.suggest button {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 12px;
  border: 0;
  background: none;
  text-align: left;
}
.suggest button[aria-selected="true"] {
  background: var(--bg-3);
}

/* Thread panel */
.thread {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--bg);
  position: fixed;
  inset: 0;
  z-index: 20;
}
@media (min-width: 1024px) {
  .thread {
    position: static;
    width: 380px;
    flex: none;
    border-left: 1px solid var(--line);
  }
}

/* Modal / sheet */
.backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(0, 0, 0, 0.55);
  display: grid;
  align-items: end;
}
.sheet {
  background: var(--bg);
  border: 1px solid var(--line-2);
  border-radius: 16px 16px 0 0;
  padding: 20px 16px calc(16px + env(safe-area-inset-bottom));
  max-height: 90dvh;
  overflow-y: auto;
  width: 100%;
}
@media (min-width: 640px) {
  .backdrop {
    place-items: center;
  }
  .sheet {
    border-radius: 14px;
    max-width: 460px;
  }
}
.sheet h3 {
  margin: 0 0 14px;
  font-size: 18px;
  letter-spacing: -0.02em;
}
.sheet-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 8px;
}
.seg {
  display: flex;
  gap: 4px;
  padding: 3px;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  margin-bottom: 14px;
}
.seg button {
  flex: 1;
  min-height: 38px;
  border: 0;
  border-radius: 7px;
  background: none;
  color: var(--text-2);
}
.seg button[aria-pressed="true"] {
  background: var(--bg-3);
  color: var(--text);
  font-weight: 550;
}
.people {
  max-height: 260px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.people label,
.people .row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 12px;
  border-bottom: 1px solid var(--line);
}
.people label:last-child,
.people .row:last-child {
  border-bottom: 0;
}

/* Inbox */
.inbox-item {
  display: block;
  width: 100%;
  padding: 12px 16px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: none;
  text-align: left;
}
.inbox-item:hover {
  background: var(--bg-2);
}
.inbox-item.unread {
  box-shadow: inset 3px 0 var(--blue);
}
.inbox-item small {
  color: var(--mute);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 50;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--text);
  color: var(--bg);
  font-size: 14px;
  max-width: calc(100vw - 32px);
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
    scroll-behavior: auto !important;
  }
}
.people .person {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: none;
  text-align: left;
}
.people .person:last-child {
  border-bottom: 0;
}
.people .person:hover {
  background: var(--bg-2);
}

@media (hover: none) {
  .reaction {
    min-height: 44px;
    min-width: 44px;
    justify-content: center;
  }
}
