:root {
  color-scheme: dark;
  --app: #1e1f22;
  --rail: #111214;
  --panel: #2b2d31;
  --panel-soft: #313338;
  --message-hover: #34363c;
  --input: #383a40;
  --line: #3f4147;
  --ink: #f2f3f5;
  --muted: #b5bac1;
  --quiet: #80848e;
  --accent: #5865f2;
  --accent-dark: #4752c4;
  --good: #23a559;
  --danger: #f23f42;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--app);
  color: var(--ink);
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: white;
  cursor: pointer;
  font-weight: 800;
  min-height: 36px;
  padding: 0 13px;
  white-space: nowrap;
}

button:hover {
  background: var(--accent-dark);
}

textarea,
input {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 6px;
  background: var(--input);
  color: var(--ink);
  outline: none;
  padding: 11px 12px;
}

input::placeholder,
textarea::placeholder {
  color: var(--quiet);
}

textarea:focus,
input:focus {
  border-color: var(--accent);
}

textarea {
  min-height: 78px;
  resize: vertical;
}

.hidden {
  display: none !important;
}

.app-shell {
  min-height: 100vh;
}

.auth-view {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  gap: 40px;
  align-items: center;
  min-height: 100vh;
  padding: 48px clamp(20px, 6vw, 92px);
  background:
    radial-gradient(circle at 20% 20%, rgba(88, 101, 242, 0.24), transparent 34%),
    linear-gradient(135deg, #15161a, #25272d 54%, #191b20);
}

.brand-panel h1 {
  max-width: 760px;
  margin: 0;
  font-size: clamp(48px, 8vw, 104px);
  line-height: 0.92;
  letter-spacing: 0;
}

.intro {
  max-width: 620px;
  color: var(--muted);
  font-size: 20px;
  line-height: 1.6;
}

.eyebrow,
.channel-heading {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.auth-card,
.dialog-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(43, 45, 49, 0.94);
  box-shadow: 0 20px 70px rgba(0, 0, 0, 0.24);
}

.auth-card {
  padding: 20px;
}

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 18px;
}

.tab,
.ghost {
  border: 1px solid var(--line);
  background: var(--panel-soft);
  color: var(--ink);
}

.tab.active,
.ghost:hover {
  background: #3b3d45;
}

.auth-form,
.stack {
  display: grid;
  gap: 12px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-weight: 800;
}

.error {
  min-height: 20px;
  color: var(--danger);
  font-weight: 800;
}

.social-view {
  display: grid;
  grid-template-columns: 292px minmax(420px, 1fr) 340px;
  height: 100vh;
  min-height: 0;
  background: var(--panel-soft);
}

.chat-sidebar,
.community-sidebar {
  min-height: 0;
  overflow-y: auto;
}

.chat-sidebar {
  display: grid;
  grid-template-rows: auto auto auto 1fr auto;
  gap: 12px;
  background: var(--panel);
  border-right: 1px solid var(--rail);
  padding: 14px;
}

.community-sidebar {
  display: flex;
  flex-direction: column;
  gap: 18px;
  background: var(--panel);
  border-left: 1px solid var(--rail);
  padding: 14px;
}

.profile {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 10px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
}

.profile .bio {
  grid-column: 1 / -1;
}

.avatar {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  overflow: hidden;
  border-radius: 50%;
  color: white;
  font-weight: 900;
}

.avatar.small {
  width: 34px;
  height: 34px;
  font-size: 13px;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.name {
  margin: 0;
  font-size: 16px;
  font-weight: 900;
}

.handle,
.time,
.bio,
.conversation span {
  color: var(--quiet);
  font-size: 13px;
}

.panel h2,
.chat-topbar h1,
.dialog-card h2 {
  margin: 0;
}

.panel {
  display: grid;
  gap: 12px;
}

.full {
  width: 100%;
}

.logout {
  align-self: end;
}

.conversation-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  overflow-y: auto;
}

.conversation {
  display: grid;
  gap: 4px;
  width: 100%;
  min-height: 54px;
  border: 0;
  background: transparent;
  color: var(--muted);
  text-align: left;
  padding: 9px 10px;
}

.conversation:hover,
.conversation.active {
  background: #3b3d45;
  color: var(--ink);
}

.conversation.active {
  box-shadow: inset 3px 0 0 var(--accent);
}

.conversation span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-main {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-width: 0;
  min-height: 0;
  background: var(--panel-soft);
}

.chat-topbar {
  display: flex;
  align-items: center;
  min-height: 64px;
  border-bottom: 1px solid var(--line);
  padding: 0 20px;
}

.messages {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-height: 0;
  overflow-y: auto;
  padding: 18px 20px;
}

.message {
  border-radius: 6px;
  padding: 10px 12px;
}

.message:hover {
  background: var(--message-hover);
}

.message.mine {
  background: rgba(88, 101, 242, 0.12);
}

.message-head {
  display: flex;
  gap: 8px;
  align-items: baseline;
  flex-wrap: wrap;
}

.message p,
.post p {
  margin: 8px 0 0;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.chat-form {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 8px;
  padding: 14px 20px 18px;
}

.chat-form input[name="text"] {
  min-height: 44px;
}

.file-button {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--input);
  color: var(--muted);
  cursor: pointer;
  font-size: 24px;
  font-weight: 700;
}

.file-button:hover {
  color: var(--ink);
  background: #45474f;
}

.file-button input {
  display: none;
}

.attachment-name {
  grid-column: 2 / -1;
  min-height: 18px;
  color: var(--muted);
  font-size: 13px;
}

.attachment {
  display: inline-grid;
  gap: 8px;
  max-width: min(460px, 100%);
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--app);
  color: var(--ink);
  padding: 10px;
  text-decoration: none;
}

.image-attachment img {
  display: block;
  max-width: 100%;
  max-height: 280px;
  border-radius: 6px;
  object-fit: contain;
}

.file-attachment {
  grid-template-columns: auto 1fr;
  align-items: center;
}

.file-icon {
  border-radius: 5px;
  background: var(--accent);
  color: white;
  font-size: 11px;
  font-weight: 900;
  padding: 8px;
}

.person,
.request-row {
  display: grid;
  gap: 9px;
  align-items: center;
  border-radius: 6px;
  background: transparent;
  padding: 8px;
}

.person {
  grid-template-columns: 34px minmax(0, 1fr) 9px auto;
}

.request-row {
  grid-template-columns: 34px minmax(0, 1fr) auto auto;
}

.person:hover,
.request-row:hover {
  background: #3b3d45;
}

.person strong,
.request-row strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--quiet);
}

.status.online {
  background: var(--good);
}

.pill {
  border-radius: 999px;
  background: var(--input);
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  padding: 7px 9px;
}

.feed-panel {
  min-height: 0;
}

.composer {
  display: grid;
  gap: 8px;
}

.composer textarea {
  min-height: 86px;
}

.composer-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  color: var(--muted);
}

.post-list {
  display: grid;
  gap: 8px;
}

.post {
  border-radius: 6px;
  background: var(--panel-soft);
  padding: 12px;
}

.post-head {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.empty {
  border: 1px dashed var(--line);
  border-radius: 6px;
  color: var(--muted);
  padding: 14px;
  text-align: center;
}

dialog {
  width: min(460px, calc(100vw - 28px));
  border: 0;
  background: transparent;
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.55);
}

.dialog-card {
  display: grid;
  gap: 16px;
  padding: 18px;
}

.dialog-card header,
.dialog-card menu {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 0;
}

.icon-button {
  width: 38px;
  padding: 0;
}

.checkbox-list {
  display: grid;
  gap: 8px;
  max-height: 260px;
  overflow-y: auto;
}

.check-row {
  display: grid;
  grid-template-columns: auto 34px 1fr;
  align-items: center;
  border-radius: 6px;
  background: var(--panel-soft);
  padding: 8px;
}

@media (max-width: 1180px) {
  .social-view {
    grid-template-columns: 260px minmax(360px, 1fr);
  }

  .community-sidebar {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    border-left: 0;
    border-top: 1px solid var(--rail);
  }
}

@media (max-width: 780px) {
  .auth-view,
  .social-view {
    grid-template-columns: 1fr;
  }

  .auth-view {
    align-content: center;
    padding: 14px;
  }

  .brand-panel h1 {
    font-size: 54px;
  }

  .social-view {
    height: auto;
    min-height: 100vh;
  }

  .chat-sidebar,
  .community-sidebar {
    max-height: none;
  }

  .chat-main {
    min-height: 620px;
  }

  .community-sidebar {
    grid-template-columns: 1fr;
  }

  .chat-form {
    grid-template-columns: 42px minmax(0, 1fr);
  }

  .chat-form button {
    grid-column: 1 / -1;
  }
}
