:root {
  color-scheme: light;
  --bg: #f5f5f1;
  --surface: #fff;
  --text: #20231f;
  --muted: #73766e;
  --line: #e5e7df;
  --accent: #f5e646;
  --accent-text: #24260f;
  --soft: #f1f2eb;
  --danger: #ac3345;
  --shadow: 0 20px 70px #25301a0b;
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    "Segoe UI",
    sans-serif;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #151814;
  --surface: #20241e;
  --text: #f0f1e8;
  --muted: #adb3a4;
  --line: #373d31;
  --soft: #2b3126;
  --danger: #ff9caa;
  --shadow: 0 20px 70px #0003;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
}
button,
input,
textarea {
  font: inherit;
}
button,
a,
input,
textarea {
  touch-action: manipulation;
}
button {
  cursor: pointer;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  padding: 10px 15px;
  font-weight: 650;
  transition:
    background 0.15s,
    transform 0.15s;
}
button:hover {
  background: var(--soft);
  transform: translateY(-1px);
}
button:disabled {
  opacity: 0.55;
  cursor: wait;
  transform: none;
}
button.primary {
  background: var(--accent);
  color: var(--accent-text);
  border-color: var(--accent);
}
button.quiet {
  background: transparent;
}
button.link {
  border: 0;
  background: none;
  color: var(--text);
  padding: 2px;
  text-decoration: underline;
  text-underline-offset: 4px;
}
button.danger,
.error {
  color: var(--danger);
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 3px solid #8d9e52;
  outline-offset: 3px;
}
input,
textarea {
  width: 100%;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--line);
  padding: 12px 14px;
  border-radius: 12px;
  min-width: 0;
}
textarea {
  resize: vertical;
}
label {
  display: block;
  margin: 12px 0 6px;
  font-weight: 600;
  font-size: 13px;
}
form > button[type="submit"] {
  margin-top: 18px;
}
a {
  color: inherit;
}
h1,
h2,
h3,
p {
  margin-top: 0;
}
h1,
h2 {
  letter-spacing: -0.04em;
  line-height: 1.15;
}
h3 {
  font-size: 14px;
}
hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 26px 0;
}
.muted,
.empty-state {
  color: var(--muted);
}
.eyebrow {
  display: block;
  font-size: 10px;
  letter-spacing: 0.17em;
  font-weight: 800;
  color: var(--muted);
}
.topbar {
  height: 90px;
  max-width: 1440px;
  margin: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 5%;
}
.brand {
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 24px;
  letter-spacing: -1px;
  font-weight: 850;
}
.brand-icon {
  width: 34px;
  height: 34px;
  border-radius: 11px;
  background: var(--accent);
  display: grid;
  place-items: center;
  color: var(--accent-text);
  font-size: 28px;
  line-height: 1;
}
.brand-dot {
  color: #929f63;
  font-size: 10px;
  align-self: flex-end;
  margin-bottom: 8px;
}
main {
  max-width: 1340px;
  margin: auto;
  padding: 0 28px 28px;
}
.auth-layout {
  display: grid;
  grid-template-columns: 1fr 440px;
  gap: 9%;
  align-items: center;
  max-width: 1130px;
  margin: 55px auto;
}
.auth-story {
  padding: 20px 0;
}
.auth-story h1 {
  font-size: clamp(42px, 5vw, 70px);
  font-weight: 750;
  margin: 20px 0;
}
.auth-story h1 > span {
  color: #a8ad40;
}
.auth-story > p {
  max-width: 380px;
  color: var(--muted);
  font-size: 17px;
}
.auth-card {
  padding: 38px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 26px;
  box-shadow: var(--shadow);
}
.auth-card h2 {
  font-size: 30px;
  margin: 16px 0 14px;
}
.auth-card form > .primary {
  width: 100%;
  display: flex;
  justify-content: space-between;
}
.auth-card > p:last-child {
  margin-bottom: 0;
}
.auth-links {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
}
.story-bubbles {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  margin: 40px 0 32px;
}
.story-bubbles span {
  background: var(--surface);
  padding: 14px 22px;
  border: 1px solid var(--line);
  border-radius: 20px 20px 20px 4px;
  font-weight: 550;
  box-shadow: var(--shadow);
}
.story-bubbles span + span {
  align-self: center;
  background: var(--accent);
  color: var(--accent-text);
  transform: rotate(-3deg);
  border-radius: 20px 20px 4px 20px;
}
.security-note {
  font-size: 12px;
  color: var(--muted);
}
.register-card {
  max-width: 740px;
  margin: 30px auto;
}
.register-card h1 {
  font-size: 32px;
  margin: 18px 0;
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 18px;
}
.wide {
  grid-column: 1/-1;
}
.check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 400;
}
.check input {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
}
.app-header {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
  padding: 12px 0 18px;
}
.identity {
  display: flex;
  gap: 12px;
  align-items: center;
}
.identity h1 {
  font-size: 22px;
  margin: 0 0 4px;
}
.identity p {
  font-size: 12px;
  margin: 0;
}
.avatar {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 50%;
  background: var(--soft);
}
.header-actions {
  display: flex;
  gap: 8px;
}
.status-line {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  color: var(--muted);
  font-size: 11px;
  min-height: 32px;
}
.status-line > span:first-child:before {
  content: "● ";
  color: #8d9e52;
}
.workspace {
  display: grid;
  grid-template-columns: 350px minmax(0, 1fr);
  height: calc(100dvh - 225px);
  min-height: 520px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--surface);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.sidebar {
  padding: 23px 18px;
  border-right: 1px solid var(--line);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.sidebar-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.sidebar-title h2 {
  font-size: 22px;
  margin: 0;
}
.sidebar-title button {
  padding: 3px 10px;
}
.tabs {
  display: flex;
  gap: 3px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
}
.tabs button {
  font-size: 12px;
  padding: 8px 10px;
  border-color: transparent;
  background: transparent;
  flex: 1;
}
.tabs button.active {
  background: var(--accent);
  color: var(--accent-text);
}
.sidebar-footer {
  margin-top: auto;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 5px;
  font-size: 10px;
}
.sidebar-footer > span:nth-child(2) {
  overflow-wrap: anywhere;
}
.sidebar-footer button {
  justify-self: start;
}
.chat-stage {
  min-width: 0;
  min-height: 0;
  background: var(--bg);
}
.welcome {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 35px;
}
.welcome-icon {
  font-size: 64px;
  color: #a3aa6c;
  line-height: 1;
  margin-bottom: 30px;
}
.welcome h2 {
  font-size: 34px;
  margin: 20px 0;
}
.welcome > p {
  color: var(--muted);
}
.welcome .security-note {
  margin-top: 45px;
}
#chatSection {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}
.chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.chat-header h2 {
  font-size: 18px;
  margin: 0;
}
.chat-header .muted {
  font-size: 11px;
}
.chat-header #chatActions {
  margin-left: auto;
  display: flex;
  gap: 5px;
}
.chat-header button {
  font-size: 11px;
  padding: 7px 10px;
}
.chat-tools {
  padding: 12px 20px;
}
.chat-tools input {
  font-size: 12px;
  padding: 8px 12px;
  background: var(--surface);
}
#chatRelationship:not(:empty) {
  padding: 10px 20px;
  margin: 0;
  font-size: 12px;
  background: var(--soft);
}
#messagesList {
  flex: 1;
  min-height: 150px;
  overflow: auto;
  padding: 16px 28px;
  scroll-behavior: smooth;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.chat-message {
  align-self: flex-start;
  max-width: 82%;
  background: var(--surface);
  padding: 12px 16px;
  border-radius: 18px 18px 18px 3px;
  border: 1px solid var(--line);
  animation: appear 0.2s ease-out;
  overflow-wrap: anywhere;
}
.chat-message.mine {
  align-self: flex-end;
  background: var(--accent);
  color: var(--accent-text);
  border-color: var(--accent);
  border-radius: 18px 18px 3px 18px;
}
.message-sender {
  font-size: 10px;
  opacity: 0.65;
  margin: 0 0 3px;
}
.message-text {
  white-space: pre-wrap;
  margin: 0;
  font-size: 14px;
}
.chat-message time {
  display: block;
  font-size: 9px;
  opacity: 0.6;
  margin-top: 7px;
}
.chat-message:has(.message-text:empty) {
  display: none;
}
#messageForm {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  background: var(--surface);
  border-top: 1px solid var(--line);
}
#messageForm textarea {
  resize: none;
  border: 0;
  max-height: 120px;
}
#messageForm > button {
  margin: 0;
  white-space: nowrap;
}
#messageStatus {
  font-size: 11px;
  margin: 0;
  padding: 0 20px;
  background: var(--surface);
}
#emojiPicker {
  padding: 10px;
  background: var(--surface);
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}
#emojiPicker button {
  padding: 6px;
  font-size: 20px;
}
.list-row {
  padding: 14px 8px;
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.list-info {
  min-width: 0;
}
.list-title {
  font-size: 14px;
  margin: 0 0 3px;
  font-weight: 650;
}
.list-title:before {
  content: "◉";
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  background: var(--soft);
  color: #909b67;
  margin-right: 8px;
}
.list-detail {
  font-size: 10px;
  margin: 0;
  color: var(--muted);
  overflow-wrap: anywhere;
}
.row-actions {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}
.row-actions button {
  font-size: 10px;
  padding: 5px 9px;
}
.empty-state {
  font-size: 12px;
  padding: 20px 8px;
}
.sidebar details {
  margin-top: 24px;
}
.sidebar h3 {
  margin: 16px 0 8px;
}
.sidebar form button {
  font-size: 12px;
}
.sidebar form label {
  font-size: 11px;
}
#foundUser {
  padding: 15px;
  background: var(--soft);
  border-radius: 16px;
}
#foundUser button {
  font-size: 11px;
}
#foundUser p {
  overflow-wrap: anywhere;
  font-size: 12px;
}
#foundExtraActions {
  display: flex;
  gap: 5px;
  margin-top: 10px;
}
.dialog-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.dialog-top h2 {
  margin: 0;
}
.dialog-top button {
  border: 0;
}
dialog {
  border: 1px solid var(--line);
  padding: 30px;
  border-radius: 22px;
  background: var(--surface);
  color: var(--text);
  width: min(620px, calc(100% - 28px));
  max-height: 88dvh;
  box-shadow: 0 30px 100px #0003;
}
dialog::backdrop {
  background: #0d170f88;
  backdrop-filter: blur(5px);
}
#confirmDialog {
  max-width: 430px;
}
.confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 24px;
}
.settings-block {
  padding-top: 22px;
  margin-top: 26px;
  border-top: 1px solid var(--line);
}
.settings-block p {
  font-size: 12px;
}
.settings-block button {
  font-size: 12px;
  margin: 6px 0;
}
.settings-block h3 {
  font-size: 16px;
}
.settings-block form:not(.form-grid) {
  max-width: 100%;
}
#sessionsList .list-detail {
  font-size: 11px;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.skip {
  position: absolute;
  left: -9999px;
}
.skip:focus {
  left: 20px;
  top: 20px;
  z-index: 100;
  background: var(--surface);
  padding: 10px;
}
#backToList {
  display: none;
}
[hidden] {
  display: none !important;
}
@keyframes appear {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@media (min-width: 1500px) {
  .auth-layout {
    margin-top: 90px;
  }
}
@media (max-width: 900px) {
  .auth-layout {
    gap: 35px;
    grid-template-columns: 1fr 390px;
  }
  .auth-story h1 {
    font-size: 46px;
  }
  .workspace {
    grid-template-columns: 300px 1fr;
  }
  .chat-header {
    padding: 14px;
  }
  .header-actions button {
    font-size: 12px;
  }
}
@media (max-width: 700px) {
  .topbar {
    height: 72px;
    padding: 0 20px;
  }
  .topbar .brand {
    font-size: 21px;
  }
  .topbar > button {
    font-size: 11px;
  }
  main {
    padding: 0 14px 14px;
  }
  .auth-layout {
    display: block;
    margin: 20px auto;
    max-width: 440px;
  }
  .auth-story {
    padding: 10px 6px 24px;
  }
  .auth-story h1 {
    font-size: 38px;
  }
  .auth-story > p {
    font-size: 14px;
  }
  .story-bubbles,
  .auth-story .security-note {
    display: none;
  }
  .auth-card {
    padding: 26px;
    border-radius: 22px;
  }
  .auth-card h2 {
    font-size: 27px;
  }
  .auth-story .eyebrow {
    font-size: 9px;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .wide {
    grid-column: auto;
  }
  .register-card {
    margin: 10px auto;
  }
  .app-header {
    align-items: flex-start;
    gap: 8px;
  }
  .header-actions {
    flex-direction: column;
  }
  .header-actions button {
    font-size: 10px;
    padding: 6px 9px;
  }
  .identity h1 {
    font-size: 18px;
  }
  .identity p {
    font-size: 10px;
    overflow-wrap: anywhere;
  }
  .status-line {
    display: block;
    min-height: 35px;
  }
  .status-line span {
    display: block;
  }
  .workspace {
    display: block;
    height: calc(100dvh - 225px);
    min-height: 430px;
  }
  .sidebar {
    height: 100%;
    border: 0;
  }
  .chat-stage {
    display: none;
    height: 100%;
  }
  .workspace.chat-open .sidebar {
    display: none;
  }
  .workspace.chat-open .chat-stage {
    display: block;
  }
  #backToList {
    display: block;
  }
  .chat-header #chatActions {
    max-width: 120px;
    flex-wrap: wrap;
    justify-content: flex-end;
  }
  #messagesList {
    padding: 16px;
  }
  .chat-message {
    max-width: 90%;
  }
  #messageForm {
    gap: 6px;
    padding: 10px;
  }
  #messageForm > button {
    padding: 9px;
  }
  .chat-header h2 {
    font-size: 16px;
  }
  dialog {
    padding: 22px;
  }
  .welcome {
    display: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
/* Groups and binary E2EE attachments */
#groupChatSection {
  height: 100%;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
#groupMessages {
  flex: 1;
  min-height: 120px;
  overflow: auto;
  padding: 16px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
#groupTrust {
  padding: 8px 20px;
  margin: 0;
  border-bottom: 1px solid var(--line);
}
#groupMessageForm {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 18px;
  border-top: 1px solid var(--line);
  background: var(--surface);
}
#groupMessageForm > button {
  margin: 0;
  white-space: nowrap;
}
#groupMessageForm textarea {
  resize: none;
}
#groupMessageStatus {
  font-size: 12px;
  padding: 0 18px;
  margin: 0;
}
.file-button {
  display: grid;
  place-items: center;
  cursor: pointer;
  width: 35px;
  min-width: 35px;
  height: 38px;
  margin: 0;
  background: var(--soft);
  border-radius: 10px;
  font-size: 24px;
}
.file-button:focus-within {
  outline: 2px solid #8d9e52;
}
.decrypted-preview {
  display: block;
  max-width: 100%;
  max-height: 320px;
  object-fit: contain;
  border-radius: 12px;
  margin-top: 10px;
}
.file-status {
  font-size: 11px;
  margin: 5px 0;
}
.chat-message button {
  font-size: 11px;
  padding: 6px 10px;
  margin: 8px 6px 0 0;
}
progress {
  width: 100%;
  height: 6px;
  accent-color: #929f63;
}
.tabs button {
  padding: 8px 6px;
  font-size: 11px;
}
#groupSettings {
  margin-left: auto;
  font-size: 11px;
}
#groupSettingsDialog h3 {
  margin: 20px 0 10px;
}
#groupSettingsDialog form {
  margin: 20px 0;
}
#groupSettingsDialog #leaveGroup {
  margin-top: 20px;
}
@media (max-width: 700px) {
  #groupMessages {
    padding: 14px;
  }
  #groupMessageForm {
    padding: 10px;
  }
  #groupMessageForm > button {
    padding: 9px;
  }
  .chat-header #groupAvatar {
    width: 32px;
    height: 32px;
  }
  .chat-header #groupSettings {
    padding: 7px;
    max-width: 74px;
  }
  .chat-header h2 {
    overflow-wrap: anywhere;
  }
}
.file-button:has(+ input:focus-visible) {
  outline: 3px solid #8d9e52;
  outline-offset: 3px;
}
#groupEmojiPicker {
  padding: 10px;
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  background: var(--surface);
}
#groupEmojiPicker button {
  padding: 6px;
  font-size: 20px;
}

/* Seruchat / Snap-inspired desktop + mobile shell */
:root {
  --bg: #f6f7f8;
  --surface: #fff;
  --text: #16171b;
  --muted: #70747d;
  --line: #eceef1;
  --accent: #fffc00;
  --accent-text: #111;
  --soft: #f2f3f5;
  --shadow: 0 12px 55px #1821360b;
}
:root[data-theme="dark"] {
  --bg: #101114;
  --surface: #191b20;
  --text: #f6f7f9;
  --muted: #a6aab4;
  --line: #2a2d35;
  --soft: #252830;
  --shadow: 0 12px 55px #0002;
}
body {
  font-family: "Segoe UI", system-ui, sans-serif;
  letter-spacing: -0.15px;
}
.topbar {
  height: 76px;
  max-width: 1600px;
  padding: 0 36px;
}
.brand {
  font-size: 26px;
  color: var(--text);
}
.brand-icon {
  border-radius: 50%;
  width: 42px;
  height: 42px;
  color: #111;
  background: #fffc00;
  font-weight: 900;
}
.brand-dot {
  display: none;
}
main {
  max-width: 1600px;
  padding: 0 24px 24px;
}
.signed-in main {
  max-width: none;
  padding: 0 18px 18px;
}
.signed-in .topbar {
  height: 64px;
  max-width: none;
  padding: 0 32px;
}
.signed-in .topbar .brand {
  font-size: 22px;
}
button {
  border-radius: 999px;
  transition:
    background 0.15s,
    box-shadow 0.15s;
  min-height: 40px;
}
button:hover {
  transform: none;
}
button:disabled {
  cursor: default;
}
button.primary:hover {
  background: #e9e700;
  border-color: #e9e700;
}
input,
textarea {
  border-radius: 16px;
  background: var(--soft);
  border-color: transparent;
}
input:focus,
textarea:focus {
  outline: 2px solid #999600;
  outline-offset: 1px;
}
button:focus-visible,
a:focus-visible,
summary:focus-visible {
  outline-color: #8a8500;
}
.auth-layout {
  max-width: 1120px;
  gap: 10%;
  margin: 48px auto;
}
.auth-story {
  background: #fffc00;
  color: #121212;
  border-radius: 42px;
  padding: 54px 40px;
  min-height: 520px;
  position: relative;
  overflow: hidden;
}
.auth-story h1 {
  font-size: 64px;
  line-height: 1.05;
  font-weight: 850;
  letter-spacing: -4px;
}
.auth-story h1 > span {
  color: #121212;
}
.auth-story > p,
.auth-story .eyebrow {
  color: #363600;
}
.auth-story .security-note {
  color: #454500;
}
.story-bubbles {
  margin: 36px 0;
}
.story-bubbles span {
  background: #fff;
  color: #16171b;
  border: none;
  box-shadow: 0 8px 20px #0001;
  transform: rotate(-4deg);
}
.story-bubbles span + span {
  background: #16171b;
  color: #fff;
  transform: rotate(4deg);
}
.auth-card {
  border: 0;
  border-radius: 30px;
  box-shadow: none;
  padding: 34px;
}
.auth-card h2 {
  font-weight: 800;
  font-size: 34px;
}
.auth-card form > .primary {
  justify-content: center;
  gap: 16px;
  min-height: 48px;
}
.auth-card input {
  min-height: 48px;
}
.auth-links {
  margin-top: 12px;
}
.register-card {
  border: 1px solid var(--line);
}
.app-header {
  padding: 0 12px 12px;
  min-height: 62px;
}
.identity {
  gap: 10px;
}
.identity h1 {
  font-size: 17px;
  letter-spacing: -0.4px;
}
.identity p {
  font-size: 11px;
}
.avatar {
  border: 3px solid var(--surface);
  box-shadow: 0 0 0 2px #fffc00;
  width: 40px;
  height: 40px;
}
.header-actions button {
  font-size: 12px;
  min-height: 36px;
  padding: 7px 16px;
}
.status-line {
  min-height: 0;
  display: block;
}
.status-line > span:first-child:before {
  content: none;
}
#operationStatus:not(:empty) {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  z-index: 50;
  padding: 12px 22px;
  background: var(--text);
  color: var(--surface);
  border-radius: 18px;
  box-shadow: 0 6px 28px #0002;
  max-width: calc(100vw - 30px);
  font-size: 13px;
}
.workspace {
  grid-template-columns: 82px 360px minmax(0, 1fr);
  height: calc(100dvh - 145px);
  min-height: 500px;
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.app-rail {
  background: #111216;
  color: #fff;
  display: flex;
  align-items: center;
  flex-direction: column;
  gap: 12px;
  padding: 20px 8px;
}
.rail-logo {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #fffc00;
  color: #111;
  font-size: 35px;
  font-weight: 900;
  margin-bottom: 20px;
}
.app-rail button {
  background: transparent;
  border: 0;
  border-radius: 18px;
  color: #b2b5be;
  width: 64px;
  min-height: 64px;
  padding: 8px 2px;
  font-size: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.app-rail button.active,
.app-rail button:hover {
  background: #fffc00;
  color: #111;
}
.app-rail svg {
  width: 23px;
  height: 23px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.app-rail #railProfile {
  margin-top: auto;
}
.sidebar {
  padding: 24px 18px;
  gap: 16px;
}
.sidebar-title h2 {
  font-size: 30px;
  font-weight: 850;
  letter-spacing: -1.4px;
}
.chat-dot {
  color: #aaa600;
}
.tabs {
  border: 0;
  background: var(--soft);
  border-radius: 999px;
  padding: 4px;
  gap: 0;
}
.tabs button {
  font-size: 11px;
  padding: 7px 9px;
  min-height: 34px;
}
.tabs button.active {
  box-shadow: 0 3px 10px #0001;
  background: #fffc00;
  color: #111;
}
#conversationSearch {
  min-height: 44px;
  border-radius: 999px;
  font-size: 13px;
}
.sidebar h3 {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin: 22px 0 8px;
}
.sidebar #newGroup {
  width: 100%;
  min-height: 43px;
}
.sidebar #v2Status:empty {
  display: none;
}
.list-row {
  position: relative;
  padding: 16px 4px 16px 57px;
  min-height: 77px;
  gap: 5px;
  border-color: var(--line);
  border-radius: 12px;
}
.list-row:before {
  content: attr(data-initials);
  position: absolute;
  left: 3px;
  top: 17px;
  width: 43px;
  height: 43px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #ffe9c4;
  color: #71440a;
  font-size: 15px;
  font-weight: 800;
}
.list-row[data-color="1"]:before {
  background: #e6defe;
  color: #624b96;
}
.list-row[data-color="2"]:before {
  background: #d4f3ec;
  color: #226e5a;
}
.list-row[data-color="3"]:before {
  background: #fce0e8;
  color: #9c395d;
}
.list-row[data-color="4"]:before {
  background: #dcecff;
  color: #38649c;
}
.list-title:before {
  display: none;
}
.list-title {
  font-size: 14px;
  letter-spacing: -0.2px;
  line-height: 1.4;
}
.list-detail {
  font-size: 11px;
}
.row-actions button {
  font-size: 11px;
  padding: 4px 9px;
  min-height: 29px;
}
.sidebar #conversationsList .row-actions button {
  border: 0;
  padding: 0;
  min-height: 20px;
  color: var(--muted);
  background: none;
}
.empty-state {
  padding: 24px 8px;
  line-height: 1.8;
  text-align: center;
  font-size: 12px;
}
.chat-stage {
  background: var(--bg);
  background-image: radial-gradient(#9299a514 0.8px, transparent 0.8px);
  background-size: 18px 18px;
}
.welcome-icon {
  width: 140px;
  height: 140px;
  border-radius: 40px;
  display: grid;
  place-items: center;
  background: #fffc00;
  color: #111;
  font-size: 96px;
  transform: rotate(-9deg);
  box-shadow: 8px 12px 0 #111;
  line-height: 1;
}
.welcome h2 {
  font-size: 40px;
  font-weight: 850;
  line-height: 1.15;
  letter-spacing: -1.8px;
}
.welcome .eyebrow {
  margin-top: 24px;
}
.welcome .security-note {
  margin-top: 28px;
  font-size: 11px;
}
.chat-header {
  padding: 16px 24px;
  min-height: 82px;
  flex-shrink: 0;
}
.chat-header h2 {
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.6px;
}
.chat-header .muted {
  font-size: 11px;
}
.chat-header button {
  border: 1px solid var(--line);
  min-height: 34px;
}
.chat-tools {
  padding: 10px 24px;
}
.chat-tools input {
  background: var(--surface);
  border-radius: 999px;
  max-width: 340px;
}
.chat-header > div {
  min-width: 0;
}
#chatActions {
  flex-shrink: 0;
}
#messagesList,
#groupMessages {
  padding: 20px 32px;
  gap: 14px;
  scroll-behavior: auto;
  overflow-anchor: none;
}
.chat-message {
  border: 0;
  border-radius: 20px 20px 20px 5px;
  background: var(--surface);
  box-shadow: 0 2px 4px #18213607;
  padding: 12px 17px;
  max-width: 76%;
  animation: none;
}
.chat-message.mine {
  background: #fffc00;
  color: #111;
  border: 0;
  border-radius: 20px 20px 5px 20px;
}
.message-sender {
  font-size: 11px;
  font-weight: 700;
  opacity: 0.6;
}
.message-text {
  font-size: 14px;
  line-height: 1.65;
}
.chat-message time {
  font-size: 10px;
}
.chat-message .list-detail {
  color: inherit;
  opacity: 0.65;
}
.chat-message > button {
  background: transparent;
  border-color: #9996;
  min-height: 32px;
}
#groupTrust:empty {
  display: none;
}
#groupTrust {
  font-size: 12px;
  padding: 12px 20px;
  background: var(--soft);
}
#messageForm,
#groupMessageForm {
  padding: 16px 22px;
  gap: 10px;
  flex-shrink: 0;
  border-top: 1px solid var(--line);
}
#messageForm textarea,
#groupMessageForm textarea {
  min-height: 43px;
  max-height: 130px;
  border-radius: 22px;
  background: var(--soft);
  padding: 11px 17px;
  resize: none;
}
#messageForm .primary,
#groupMessageForm .primary {
  background: #111216;
  color: #fffc00;
  border-color: #111216;
  min-height: 43px;
  padding: 9px 21px;
}
.file-button {
  border-radius: 50%;
  width: 39px;
  min-width: 39px;
  height: 39px;
  background: var(--soft);
  color: var(--text);
}
#messageStatus,
#groupMessageStatus {
  font-size: 11px;
  background: var(--surface);
  min-height: 0;
  padding: 0 24px;
}
#messageStatus:not(:empty),
#groupMessageStatus:not(:empty) {
  padding-bottom: 8px;
}
#groupEmojiToggle,
#emojiToggle {
  font-size: 23px;
  border: 0;
  padding: 2px 7px;
  min-width: 36px;
}
#groupBack {
  display: none;
}
#groupSettings {
  white-space: nowrap;
}
dialog {
  border: 0;
  border-radius: 28px;
  padding: 32px;
  max-height: 90dvh;
}
dialog::backdrop {
  background: #11152288;
  backdrop-filter: blur(8px);
}
.dialog-top h2 {
  font-size: 24px;
  font-weight: 800;
}
.recovery-dialog {
  max-width: 460px;
  padding: 32px;
}
.recovery-mark {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  font-size: 42px;
  border-radius: 22px;
  background: #fffc00;
  color: #111;
  margin-bottom: 24px;
}
.recovery-dialog h2 {
  font-size: 27px;
  font-weight: 800;
  letter-spacing: -0.8px;
}
.recovery-dialog .primary {
  width: 100%;
  min-height: 46px;
}
.recovery-dialog > button:last-child {
  margin-top: 20px;
  color: var(--muted);
  font-size: 12px;
}
.recovery-dialog #recoveryAlternative {
  margin-top: 16px;
  font-size: 12px;
}
.recovery-actions {
  display: flex;
  gap: 8px;
  margin: 18px 0;
}
.recovery-actions button {
  flex: 1;
  font-size: 12px;
}
#recoveryCode {
  display: block;
  padding: 20px;
  border: 1px dashed var(--muted);
  border-radius: 16px;
  overflow-wrap: anywhere;
  font-size: 15px;
  letter-spacing: 1px;
  background: var(--soft);
  user-select: all;
}
#recoveryCountdown {
  color: var(--danger);
  font-size: 12px;
}
#recoveryStatus {
  margin-top: 16px;
  font-size: 12px;
}
#recoveryPin,
#recoveryPinConfirm,
#recoveryValue {
  letter-spacing: 5px;
  font-size: 21px;
}
#recoveryValue[inputmode="text"] {
  font-size: 14px;
  letter-spacing: 1px;
}
@media (min-width: 1400px) {
  .workspace {
    grid-template-columns: 86px 390px minmax(0, 1fr);
  }
  .sidebar {
    padding: 28px 22px;
  }
  .auth-layout {
    margin-top: 70px;
  }
}
@media (max-width: 1000px) and (min-width: 701px) {
  .workspace {
    grid-template-columns: 70px 300px minmax(0, 1fr);
  }
  .app-rail button {
    width: 54px;
  }
  .auth-layout {
    grid-template-columns: 1fr 390px;
    gap: 20px;
  }
  .auth-story {
    padding: 38px 28px;
  }
  .auth-story h1 {
    font-size: 50px;
  }
}
@media (max-width: 700px) {
  .topbar,
  .signed-in .topbar {
    height: 62px;
    padding: 0 18px;
  }
  .topbar > button {
    min-height: 32px;
  }
  .signed-in main {
    padding: 0;
  }
  .signed-in .topbar {
    display: none;
  }
  .app-header {
    padding: 12px 16px;
    height: 73px;
  }
  .identity h1 {
    font-size: 16px;
  }
  .identity p {
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .header-actions {
    flex-direction: row;
    gap: 6px;
  }
  .header-actions button {
    font-size: 10px;
    padding: 6px 9px;
  }
  .header-actions #logout {
    display: none;
  }
  .workspace {
    position: relative;
    display: block;
    height: calc(100dvh - 73px);
    min-height: 0;
    border: 0;
    border-radius: 0;
    padding-bottom: 72px;
  }
  .sidebar {
    padding: 20px 18px;
    height: 100%;
    overflow-y: auto;
  }
  .sidebar-title h2 {
    font-size: 32px;
  }
  .app-rail {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 72px;
    z-index: 5;
    flex-direction: row;
    justify-content: space-around;
    padding: 6px 8px;
    background: var(--surface);
    border-top: 1px solid var(--line);
    gap: 0;
  }
  .app-rail .rail-logo {
    display: none;
  }
  .app-rail button {
    width: 58px;
    min-height: 54px;
    border-radius: 16px;
    color: var(--muted);
    font-size: 9px;
    gap: 3px;
    padding: 6px 2px;
  }
  .app-rail button.active {
    background: #fffc00;
    color: #111;
  }
  .app-rail #railProfile {
    margin-top: 0;
  }
  .workspace.chat-open {
    padding-bottom: 0;
  }
  .workspace.chat-open .app-rail {
    display: none;
  }
  .workspace.chat-open .chat-stage {
    display: block;
  }
  .chat-header {
    padding: 12px 14px;
    min-height: 70px;
    gap: 9px;
  }
  .chat-header h2 {
    font-size: 16px;
    overflow-wrap: anywhere;
  }
  .chat-header #chatActions {
    max-width: 90px;
    gap: 3px;
  }
  .chat-header button {
    font-size: 10px;
    padding: 6px 8px;
  }
  .chat-header #groupSettings {
    max-width: 80px;
    white-space: normal;
  }
  #backToList,
  #groupBack {
    display: block;
    border: 0;
  }
  #messagesList,
  #groupMessages {
    padding: 16px;
    gap: 12px;
  }
  .chat-message {
    max-width: 88%;
  }
  .message-text {
    font-size: 14px;
  }
  #messageForm,
  #groupMessageForm {
    padding: 12px 10px max(12px, env(safe-area-inset-bottom));
    gap: 5px;
  }
  #messageForm .primary,
  #groupMessageForm .primary {
    padding: 8px 13px;
  }
  #messageForm textarea,
  #groupMessageForm textarea {
    padding: 10px 13px;
    font-size: 14px;
  }
  .file-button {
    width: 32px;
    min-width: 32px;
    height: 36px;
  }
  #groupEmojiToggle,
  #emojiToggle {
    min-width: 30px;
    padding: 2px;
  }
  .chat-tools {
    padding: 8px 14px;
  }
  .chat-tools input {
    max-width: none;
  }
  .auth-layout {
    display: block;
    margin: 10px auto 24px;
    max-width: 460px;
  }
  .auth-story {
    border-radius: 28px;
    min-height: 0;
    padding: 30px 25px;
  }
  .auth-story h1 {
    font-size: 42px;
    letter-spacing: -2px;
    margin: 14px 0;
  }
  .auth-story > p {
    font-size: 14px;
    margin-bottom: 0;
  }
  .auth-card {
    padding: 28px 12px;
  }
  .auth-card h2 {
    font-size: 28px;
  }
  .register-card {
    padding: 28px 20px;
  }
  .welcome {
    display: none;
  }
  .recovery-dialog {
    padding: 26px;
  }
  #operationStatus:not(:empty) {
    bottom: 85px;
  }
  .workspace.chat-open ~ #operationStatus {
    bottom: 15px;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
    transition: none !important;
    animation: none !important;
  }
}
.app-header > .header-actions {
  margin-left: auto;
}
.app-header > p:empty {
  display: none;
}
.identity:has(#myAvatar[hidden]):before {
  content: attr(data-initials);
  width: 39px;
  height: 39px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #fffc00;
  color: #111;
  font-weight: 800;
  font-size: 15px;
}
