* { box-sizing: border-box; }

html {
  color-scheme: light;
}

html, body {
  margin: 0;
  height: 100%;
  color: #3d3c40;
  background: #fff;
  font: 14px/1.45 "Segoe UI", "Open Sans", sans-serif;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: transparent; }
a { color: #2389d7; }
a:hover { text-decoration: underline; }

input, select, textarea {
  background: #fff;
  border: 1px solid rgba(61, 60, 64, 0.24);
  border-radius: 4px;
}

textarea { resize: vertical; }

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: #1c58d9;
  box-shadow: inset 0 0 0 1px #1c58d9;
}

button:focus-visible { outline: 2px solid #5d89ea; outline-offset: -2px; }

.ico { display: inline-flex; flex: none; width: 16px; height: 16px; }
.ico svg { display: block; width: 16px; height: 16px; }

[hidden] { display: none !important; }

#app { height: 100%; }

.shell {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.program-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: none;
  height: 48px;
  padding: 0 12px;
  background: #152544;
  color: #fff;
}

.program-bar .brand { margin: 0 12px 0 4px; }

.section-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  padding: 0 12px;
  border-radius: 4px;
  color: rgba(255, 255, 255, 0.75);
}

.section-tab.active, .section-tab:hover { background: #28427b; color: #fff; }

.shell .app { flex: 1; height: auto; min-height: 0; }
.shell.section-tasks .rail,
.shell.section-tasks .thread { display: none !important; }
.shell.section-tasks .app { grid-template-columns: minmax(0, 1fr); }

.app {
  --rail-width: 240px;
  position: relative;
  display: grid;
  grid-template-columns: var(--rail-width) minmax(0, 1fr);
  height: 100%;
  background: #fff;
}

.app.with-thread { grid-template-columns: var(--rail-width) minmax(0, 1fr) minmax(300px, 420px); }

.rail, .feed, .thread {
  min-width: 0;
  min-height: 0;
}

.rail {
  position: relative;
  display: flex;
  flex-direction: column;
  background: #1e325c;
  color: rgba(255, 255, 255, 0.8);
}

.rail-resize {
  position: absolute;
  top: 0;
  right: -5px;
  bottom: 0;
  z-index: 2;
  width: 10px;
  padding: 0;
  cursor: col-resize;
  touch-action: none;
}

.rail-resize::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 4px;
  width: 2px;
  background: transparent;
}

.rail-resize::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 2px;
  width: 6px;
  height: 40px;
  margin-top: -20px;
  border-radius: 3px;
  background: #8ea4d4;
  box-shadow: 0 0 0 1px rgba(30, 50, 92, 0.35);
}

.rail-resize:hover::before,
.rail-resize:focus-visible::before,
.rail-resize.dragging::before { background: #5d89ea; }

.rail-resize:hover::after,
.rail-resize:focus-visible::after,
.rail-resize.dragging::after { background: #5d89ea; }

.rail-resize:focus-visible { outline: none; }

body.rail-dragging, body.rail-dragging * {
  cursor: col-resize !important;
  user-select: none !important;
}

.feed, .thread {
  display: flex;
  flex-direction: column;
  background: #fff;
}

.thread { display: none; border-left: 1px solid rgba(61, 60, 64, 0.12); }
.app.with-thread .thread { display: flex; }

.rail-top {
  display: flex;
  align-items: center;
  flex: none;
  height: 56px;
  padding: 0 16px;
  background: #192a4d;
}

.brand { margin: 0; color: #fff; font-size: 16px; font-weight: 700; }

#rail-nav { flex: none; padding: 8px 0 4px; }

.rail-scroll {
  flex: 1;
  overflow: auto;
  padding-bottom: 12px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.28) transparent;
}

.rail-section { margin-top: 10px; }

.section {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 28px;
  margin: 0;
  padding: 2px 8px 2px 16px;
  color: rgba(255, 255, 255, 0.5);
  font-size: 12px;
  font-weight: 600;
}

.section-actions { display: inline-flex; gap: 2px; }

/* Папка внутри «Личных»: один уровень, разговоры с отступом. */
.rail-folder { position: relative; margin: 2px 0 4px; }
.section.folder { padding-left: 22px; color: rgba(255, 255, 255, 0.62); }
.section.folder .ico, .section.folder .ico svg { width: 14px; height: 14px; }
.folder-title { display: inline-flex; align-items: center; gap: 6px; min-width: 0; flex: 1; }
.folder-title span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail-folder:not(.empty)::before {
  content: "";
  position: absolute;
  left: 25px;
  top: 28px;
  bottom: 2px;
  width: 1px;
  background: rgba(255, 255, 255, 0.12);
}
.folder-empty { margin: 0 0 2px; padding: 2px 16px 2px 40px; color: rgba(255, 255, 255, 0.38); font-size: 13px; }
.conv.in-folder { padding-left: 38px; height: 30px; font-size: 13px; }
/* Перенос в папку перетаскиванием: папка и раздел подсвечиваются под курсором. */
.rail-folder.drop-on { background: rgba(255, 255, 255, 0.1); border-radius: 4px; }
.rail-section.drop-on > .section { background: rgba(255, 255, 255, 0.1); border-radius: 4px; }
.conv.conv-dragging { opacity: 0.45; }
body.folder-dragging, body.folder-dragging * { cursor: grabbing !important; user-select: none !important; }
.folder-pick { flex-direction: row; align-items: center; gap: 10px; }
.folder-pick-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder-mark { display: inline-grid; place-items: center; width: 20px; height: 20px; flex: none; color: rgba(61, 60, 64, 0.45); }
.folder-pick.on .folder-mark { color: #2f6bd8; }

.section-add, .foot-btn, .icon, .tool, .composer .bar button {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: inherit;
}

.section-add { width: 22px; height: 22px; color: rgba(255, 255, 255, 0.6); }
.section-add:hover { background: rgba(255, 255, 255, 0.12); color: #fff; }

.nav, .conv {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  height: 32px;
  padding: 0 12px 0 16px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.72);
  font-size: 14px;
  text-align: left;
}

.nav:hover, .conv:hover, .nav.active, .conv.active {
  background: #28427b;
  color: #fff;
}

.nav.active, .conv.active { box-shadow: inset 4px 0 0 #5d89ea; }
.nav.unread, .conv.unread { color: #fff; font-weight: 600; }

.nav-label, .conv-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conv-prefix, .conv-avatar {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  flex: none;
}

.conv-prefix { color: rgba(255, 255, 255, 0.5); }

.conv-avatar { position: relative; }
.conv-avatar .avatar { width: 24px; height: 24px; font-size: 11px; }

.conv-avatar.plain {
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}

.conv-avatar .dot, .me-avatar .dot, .head-avatar .dot {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 12px;
  height: 12px;
  border: 2px solid #1e325c;
}

.conv:hover .conv-avatar .dot,
.conv.active .conv-avatar .dot { border-color: #28427b; }

.badge {
  margin-left: auto;
  min-width: 16px;
  height: 16px;
  padding: 0 5px;
  border-radius: 8px;
  background: #fff;
  color: #1e325c;
  font-size: 11px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
}

.rail-foot {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: none;
  min-height: 56px;
  padding: 8px 8px 8px 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: #192a4d;
}

.me {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
  color: #fff;
  text-align: left;
}

.me-name { display: flex; flex-direction: column; min-width: 0; }
.me-status { color: rgba(255, 255, 255, 0.62); font-size: 12px; font-weight: 400; }

.me-avatar, .head-avatar { position: relative; flex: none; }
.me-avatar { width: 32px; height: 32px; }
.me-avatar .dot { border-color: #192a4d; }
.me-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}

.foot-btn { color: rgba(255, 255, 255, 0.75); }
.foot-btn:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }

.head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
  min-height: 56px;
  padding: 8px 16px;
  border-bottom: 1px solid rgba(61, 60, 64, 0.12);
  background: #fff;
}

.titles { flex: 1; min-width: 0; }
.head h1 {
  margin: 0;
  overflow: hidden;
  color: #3d3c40;
  font-size: 16px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.channel-name { display: flex; align-items: center; gap: 8px; min-width: 0; }
.channel-name > .ico { width: 18px; height: 18px; color: rgba(61, 60, 64, 0.56); }
.channel-name > .ico svg { width: 18px; height: 18px; }

.head-avatar { width: 28px; height: 28px; }
.head-avatar .avatar { width: 28px; height: 28px; font-size: 12px; }
.head-avatar .dot { border-color: #fff; }
.head-avatar.plain {
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(61, 60, 64, 0.08);
  color: #3d3c40;
}

.titles .muted {
  margin: 1px 0 0;
  overflow: hidden;
  color: rgba(61, 60, 64, 0.64);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.head-actions { display: flex; align-items: center; gap: 4px; flex: none; }
.head-actions select { height: 32px; max-width: 11rem; padding: 0 8px; font-size: 13px; }

.icon { color: rgba(61, 60, 64, 0.64); }
.icon:hover, .text-btn:hover { background: rgba(61, 60, 64, 0.08); color: #3d3c40; }
.icon.on { color: #c67d00; }
.icon.on:hover { color: #c67d00; }

.text-btn {
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #1c58d9;
  font-weight: 600;
  padding: 6px 8px;
}

.text-btn.danger { color: #d24b4e; }
.text-btn.danger:hover { background: rgba(210, 75, 78, 0.08); color: #d24b4e; }

.back {
  display: none;
  align-items: center;
  gap: 2px;
  flex: none;
  padding: 4px 6px 4px 0;
  border: 0;
  background: transparent;
  color: #1c58d9;
  font-weight: 600;
}

.pinbar {
  flex: none;
  padding: 6px 16px;
  border-bottom: 1px solid rgba(61, 60, 64, 0.08);
  background: #fff;
}

.pin-toggle, .pin, .older, .result, .suggest-item, .card-open, .menu button {
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
}

.pin-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 0;
  color: #1c58d9;
  font-weight: 600;
}

.pin { display: block; width: 100%; padding: 6px 4px; border-radius: 4px; }
.pin:hover { background: rgba(61, 60, 64, 0.06); }

.messages, #feed-panel {
  flex: 1;
  min-height: 0;
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(61, 60, 64, 0.28) transparent;
}

.messages { display: flex; flex-direction: column; padding: 8px 0 12px; }

.msg {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 6px 16px 8px;
}

.msg:hover { background: rgba(61, 60, 64, 0.04); }
.msg.target { background: #fff4cc; }
.msg:hover, .msg.menu-open { z-index: 2; }

.msg + .msg::before {
  content: "";
  position: absolute;
  top: 0;
  left: 58px;
  right: 16px;
  border-top: 1px solid rgba(61, 60, 64, 0.1);
}

.thread-root + .msg::before { content: none; }

.thread-root {
  margin-bottom: 4px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(61, 60, 64, 0.08);
}

.msg-avatar { flex: none; width: 32px; padding-top: 1px; }
.msg-main { flex: 1; min-width: 0; }

.msg-head {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  min-height: 28px;
  padding-right: 110px;
}

.msg-reply { padding-left: 32px; }

.reply-quote {
  display: flex;
  flex-direction: column;
  width: min(420px, 100%);
  margin: 2px 0 6px;
  padding: 4px 8px;
  border-left: 3px solid #1c58d9;
  border-radius: 4px;
  background: rgba(28, 88, 217, 0.06);
  text-align: left;
}

.reply-quote:hover { background: rgba(28, 88, 217, 0.1); }
.reply-quote-author { color: #1c58d9; font-size: 12px; font-weight: 700; }
.reply-quote-text {
  overflow: hidden;
  color: rgba(61, 60, 64, 0.72);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.msg-tools {
  position: absolute;
  top: 6px;
  right: 12px;
  display: flex;
  height: 26px;
  opacity: 0;
  pointer-events: none;
  border: 1px solid rgba(61, 60, 64, 0.16);
  border-radius: 4px;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.tool { width: 28px; height: 24px; color: rgba(61, 60, 64, 0.72); }
.tool:hover { background: rgba(61, 60, 64, 0.08); color: #3d3c40; }

.msg:hover .msg-tools,
.msg:focus-within .msg-tools,
.msg.menu-open .msg-tools { opacity: 1; pointer-events: auto; }
.author { color: #3d3c40; font-weight: 700; }
time, .edited, .muted, .empty { color: rgba(61, 60, 64, 0.64); }
time, .edited { font-size: 12px; }
.edited { font-style: normal; }

.msg-body {
  margin-top: 1px;
  color: #3d3c40;
}
.msg-body p { margin: 0; white-space: pre-wrap; }
.msg-body ul, .msg-body ol { margin: 4px 0; padding-left: 1.2em; }
.msg-body blockquote {
  margin: 4px 0;
  padding-left: 8px;
  border-left: 3px solid rgba(61, 60, 64, 0.28);
}
.emoji { width: 1.2em; height: 1.2em; vertical-align: text-bottom; }
.preview {
  display: flex;
  gap: 8px;
  max-width: 420px;
  margin-top: 6px;
  padding: 8px;
  border: 1px solid rgba(61, 60, 64, 0.16);
  border-radius: 4px;
  color: inherit;
  text-decoration: none;
}
.preview img { width: 72px; height: 72px; object-fit: cover; border-radius: 4px; }
.preview span { display: flex; flex-direction: column; min-width: 0; }
.voice { display: block; width: min(280px, 100%); margin-top: 6px; }
.typing {
  flex: none;
  margin: 0;
  padding: 0 16px 2px;
  color: #7a797d;
  font-size: 12px;
  line-height: 1.3;
}
.palette-more, .palette-group { display: flex; flex-wrap: wrap; gap: 4px; }
.palette-title { flex: 1 0 100%; color: #7a797d; font-size: 12px; }
.dates { display: flex; gap: 8px; }
.dates input { flex: 1; min-width: 0; }

.msg-body, .msg-body a {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.msg-body code {
  padding: 1px 4px;
  border-radius: 4px;
  background: rgba(61, 60, 64, 0.08);
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 0.92em;
}

.mention {
  padding: 0 3px;
  border-radius: 4px;
  background: rgba(28, 88, 217, 0.1);
  color: #1c58d9;
  font-weight: 600;
}

.deleted { margin: 0; color: rgba(61, 60, 64, 0.64); font-style: italic; }

.forwarded { margin: 0 0 4px; color: rgba(61, 60, 64, 0.64); font-size: 13px; }

.menu {
  position: absolute;
  z-index: 3;
  top: 34px;
  right: 12px;
  display: flex;
  flex-direction: column;
  width: 280px;
  padding: 4px 0;
  border: 1px solid rgba(61, 60, 64, 0.16);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.menu.placed {
  position: fixed;
  right: auto;
  z-index: 6;
  overflow: auto;
}

.menu button { width: 100%; padding: 6px 16px; border-radius: 0; font-size: 14px; text-align: left; }
.menu button:hover { background: rgba(61, 60, 64, 0.06); }

.menu-reacts {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  align-items: center;
  width: 100%;
  margin-bottom: 2px;
  padding: 1px 8px 5px;
  border-bottom: 1px solid rgba(61, 60, 64, 0.1);
}

.menu-quick {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.menu .menu-reacts button {
  width: 32px;
  height: 32px;
  flex: none;
  padding: 0;
  border-radius: 8px;
  background: transparent;
  font-size: 20px;
  line-height: 1;
  text-align: center;
}

.menu .menu-reacts button.more {
  color: rgba(61, 60, 64, 0.55);
  font-size: 20px;
}

.menu .menu-reacts button:hover,
.menu .menu-reacts button.mine:hover { background: rgba(61, 60, 64, 0.08); }
.menu .menu-reacts button.mine { background: rgba(28, 88, 217, 0.12); }

.menu .palette-more {
  display: block;
  flex: 1 0 100%;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  max-height: 168px;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 4px 0 2px;
}

.menu .palette-group {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  margin-top: 6px;
}
.menu .palette-more button { width: 32px; height: 32px; font-size: 20px; }

.new-line {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 10px 16px;
  color: #c67d00;
  font-size: 12px;
  font-weight: 700;
}

.new-line::before, .new-line::after {
  content: "";
  flex: 1;
  height: 1px;
  background: #c67d00;
}

.thread-line {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  padding: 2px 4px;
  border-radius: 4px;
  color: #1c58d9;
  font-size: 13px;
  font-weight: 600;
}

.thread-line:hover { background: rgba(28, 88, 217, 0.08); }

.avatar {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  overflow: hidden;
  border-radius: 50%;
  background: #1c58d9;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  object-fit: cover;
  user-select: none;
}

.avatar svg { display: block; width: 100%; height: 100%; }
.avatar-photo { background: #e7ebf2; color: #3d3c40; }

.avatar-picker { display: flex; flex-direction: column; gap: 8px; font-size: 13px; font-weight: 600; }
.avatar-choices {
  display: grid;
  grid-template-columns: repeat(auto-fill, 40px);
  gap: 8px;
}
.avatar-choice {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 50%;
  background: transparent;
}
.avatar-choice.selected { border-color: #1c58d9; }
.avatar-choice .avatar { width: 32px; height: 32px; font-size: 13px; }

.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  flex: none;
  border-radius: 50%;
  background: #b7b9c2;
}

.dot.on { background: #3db887; }

.files, .cards, .plates, .reacts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }

.shot {
  max-width: 360px;
  max-height: 240px;
  border: 1px solid rgba(61, 60, 64, 0.08);
  border-radius: 4px;
}

.file, .chip {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  padding: 6px 8px;
  border: 1px solid rgba(61, 60, 64, 0.16);
  border-radius: 4px;
  background: #fafafa;
  color: #3d3c40;
  text-decoration: none;
}

.file:hover { border-color: #1c58d9; text-decoration: none; }

.chip { padding: 3px 4px 3px 8px; background: rgba(28, 88, 217, 0.08); font-size: 13px; }
.chip button, .plate button, .card-talk, .modal-head .icon {
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #1c58d9;
  font-weight: 600;
}

.chip button { padding: 0 6px; font-size: 16px; line-height: 1; }
.plate button, .card-talk { padding: 4px 8px; font-size: 13px; }
.chip button:hover, .plate button:hover, .card-talk:hover { background: rgba(28, 88, 217, 0.08); }

.card { position: relative; width: min(420px, 100%); }

.card-open {
  display: flex;
  flex-direction: column;
  width: 100%;
  padding: 8px 96px 8px 12px;
  border: 1px solid rgba(61, 60, 64, 0.16);
  border-left: 3px solid #1c58d9;
  border-radius: 4px;
  background: #fff;
}

.card-open:hover { background: rgba(28, 88, 217, 0.04); }
.card-label, .card-title, .card-stage { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-label { color: #1c58d9; font-size: 11px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }
.card-title { font-weight: 600; }
.card-stage { color: rgba(61, 60, 64, 0.64); font-size: 13px; }
.card-talk { position: absolute; top: 6px; right: 6px; }

.plate {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 8px;
  align-items: center;
  max-width: 100%;
  padding: 6px 8px;
  border: 1px solid rgba(198, 125, 0, 0.35);
  border-left: 3px solid #c67d00;
  border-radius: 4px;
  background: #fff8e8;
  font-size: 13px;
}

.plate-kind {
  flex: 1 0 100%;
  color: #c67d00;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.plate.done {
  border-color: rgba(61, 60, 64, 0.16);
  border-left-color: #3db887;
  background: #f7f8f8;
}

.plate.done .plate-kind { color: #2a8f68; }

.react {
  border: 0;
  border-radius: 16px;
  background: rgba(61, 60, 64, 0.06);
  padding: 2px 8px;
  font-size: 13px;
  color: #3d3c40;
}

.react:hover { background: rgba(61, 60, 64, 0.12); }
.react.mine { background: rgba(28, 88, 217, 0.1); }
.react.mine:hover { background: rgba(28, 88, 217, 0.16); }
.palette { display: inline-flex; gap: 4px; align-items: center; }

.older {
  align-self: center;
  margin: 4px auto 8px;
  padding: 4px 8px;
  color: #1c58d9;
  font-weight: 600;
}

.replying {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 6px;
  padding: 6px 8px;
  border-left: 3px solid #1c58d9;
  border-radius: 4px;
  background: rgba(28, 88, 217, 0.06);
}

.replying[hidden] { display: none; }
.replying div { flex: 1; min-width: 0; }
.replying strong { display: block; font-size: 13px; }
.replying span {
  display: block;
  overflow: hidden;
  color: rgba(61, 60, 64, 0.72);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.replying button { padding: 0 6px; font-size: 18px; line-height: 1; }

.composer {
  position: relative;
  display: flex;
  flex-direction: column;
  flex: none;
  padding: 8px 16px 16px;
  background: #fff;
}

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.chips:empty { display: none; }

.composer-box {
  border: 1px solid rgba(61, 60, 64, 0.16);
  border-radius: 4px;
  background: #fff;
}

.composer-box:focus-within {
  border-color: #1c58d9;
  box-shadow: 0 0 0 1px #1c58d9;
}

.composer textarea {
  display: block;
  width: 100%;
  min-height: 44px;
  max-height: 200px;
  padding: 10px 12px 2px;
  border: 0;
  border-radius: 4px 4px 0 0;
  background: transparent;
  resize: none;
  box-shadow: none;
}

.composer textarea:focus { border: 0; box-shadow: none; }

.composer .bar { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; padding: 2px 6px 6px; }

.composer .bar button { color: rgba(61, 60, 64, 0.64); }
.composer .bar button:hover { background: rgba(61, 60, 64, 0.08); color: #3d3c40; }

.send { margin-left: auto; color: rgba(61, 60, 64, 0.35); }
.composer.has-text .send { background: #1c58d9; color: #fff; }
.composer.has-text .send:hover { background: #1647b8; color: #fff; }

.suggest {
  position: absolute;
  z-index: 3;
  right: 16px;
  bottom: 100%;
  left: 16px;
  margin-bottom: 4px;
  display: flex;
  flex-direction: column;
  max-height: 240px;
  overflow: auto;
  border: 1px solid rgba(61, 60, 64, 0.16);
  border-radius: 4px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.suggest-item { width: 100%; padding: 8px 12px; }
.suggest-item:hover { background: rgba(28, 88, 217, 0.08); }

.primary, .bar button.primary {
  border: 0;
  border-radius: 4px;
  background: #1c58d9;
  color: #fff;
  font-weight: 600;
  padding: 8px 14px;
}

.primary:hover, .bar button.primary:hover { background: #1647b8; color: #fff; }

.panel { padding: 20px 24px 32px; }
.panel h2, #modal h3 {
  margin: 20px 0 8px;
  color: rgba(61, 60, 64, 0.56);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.panel h2:first-child, #modal h3:first-child { margin-top: 0; }
.panel .stack { max-width: 520px; }

.stack { display: flex; flex-direction: column; gap: 10px; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600; }
.field input, .field select, .field textarea, .stack input, .stack select, .stack textarea, .search-form input {
  font-weight: 400;
}

.field input, .field select, .stack input, .stack select, .search-form input { height: 36px; padding: 0 10px; }
.field textarea, .stack textarea { padding: 8px 10px; }

.checks {
  display: flex;
  flex-direction: column;
  max-height: 200px;
  overflow: auto;
  padding: 4px 10px;
  border: 1px solid rgba(61, 60, 64, 0.16);
  border-radius: 4px;
}

.checks label, .stack > label:not(.field) {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  font-weight: 400;
}

.bar, .search-form, .modal-head { display: flex; gap: 8px; align-items: center; }
.search-form input { flex: 1; min-width: 0; }
.bar select { flex: 1; height: 36px; min-width: 0; }

.results { display: flex; flex-direction: column; }
.result {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  padding: 10px 8px;
  border-radius: 4px;
}
.result:hover { background: rgba(61, 60, 64, 0.06); }
.result strong { font-weight: 600; }
.forward-list { max-height: min(360px, 50vh); overflow: auto; }

.people { margin: 0; padding: 0; list-style: none; }
.people li { display: flex; align-items: center; gap: 8px; padding: 5px 0; }

.msg .bar { margin-top: 8px; }
.msg .bar button {
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #1c58d9;
  font-weight: 600;
  padding: 6px 10px;
}
.msg .bar .primary { background: #1c58d9; color: #fff; }
.msg textarea { width: 100%; padding: 8px 10px; }

.empty-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 64px 24px;
  text-align: center;
}

.empty-block p { margin: 0; }
.empty-block p:first-child { color: #3d3c40; font-size: 20px; font-weight: 700; }
.messages > .empty { margin: 48px 16px; text-align: center; }

#modal {
  width: min(520px, calc(100% - 24px));
  padding: 0;
  border: 0;
  border-radius: 4px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
}

#modal::backdrop { background: rgba(0, 0, 0, 0.4); }
.modal-head { padding: 14px 12px 14px 20px; border-bottom: 1px solid rgba(61, 60, 64, 0.12); }
.modal-head h2 { flex: 1; margin: 0; font-size: 18px; font-weight: 700; }
#modal > .stack, #modal > .results { padding: 16px 20px 20px; }
.modal-head .icon { color: rgba(61, 60, 64, 0.64); }

#toasts {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 40;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(380px, calc(100vw - 32px));
  pointer-events: none;
}

.toast {
  position: relative;
  display: flex;
  pointer-events: auto;
  border-radius: 4px;
  background: #1e325c;
  color: #fff;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
}

.toast-open {
  flex: 1;
  display: flex;
  min-width: 0;
  padding: 12px 36px 12px 14px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #fff;
  text-align: left;
  cursor: pointer;
}

.toast-open:hover { background: #28427b; }

.toast-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.toast-title { font-weight: 700; line-height: 1.3; }

.toast-body {
  font-weight: 400;
  line-height: 1.4;
  color: rgba(255, 255, 255, 0.92);
  overflow-wrap: anywhere;
}

.toast-x {
  position: absolute;
  top: 4px;
  right: 4px;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 4px;
  color: rgba(255, 255, 255, 0.8);
  cursor: pointer;
}

.toast-x:hover { background: rgba(255, 255, 255, 0.14); color: #fff; }

.gate-wrap {
  display: grid;
  place-items: center;
  min-height: 100%;
  background: #f2f3f5;
}

.gate {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: min(400px, calc(100% - 32px));
  padding: 28px 24px 24px;
  border: 1px solid rgba(61, 60, 64, 0.12);
  border-radius: 4px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(20, 33, 62, 0.08);
}

.gate-logo {
  display: grid;
  place-items: center;
  align-self: center;
  width: 48px;
  height: 48px;
  border-radius: 8px;
  background: #1e325c;
  color: #fff;
  font-size: 22px;
  font-weight: 700;
}

.gate h1 { margin: 0; text-align: center; font-size: 22px; font-weight: 700; }
.gate .muted { margin: 0; text-align: center; }
.gate .primary { width: 100%; height: 40px; margin-top: 4px; }
.error { margin: 0; color: #d24b4e; }

@media (max-width: 1100px) {
  .app.with-thread { grid-template-columns: var(--rail-width) minmax(0, 1fr); }
  .app.with-thread .thread {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 4;
    width: min(420px, 100%);
    box-shadow: -4px 0 16px rgba(0, 0, 0, 0.12);
  }
}

@media (hover: none) {
  .msg-tools { opacity: 1; pointer-events: auto; }
}

@media (max-width: 700px) {
  .app, .app.with-thread { grid-template-columns: 1fr; }
  .rail-resize { display: none; }
  .app.with-thread .thread { position: static; width: auto; box-shadow: none; }
  .back { display: inline-flex; }
  .app[data-zone="rail"] .feed,
  .app[data-zone="rail"] .thread,
  .app[data-zone="feed"] .rail,
  .app[data-zone="feed"] .thread,
  .app[data-zone="thread"] .rail,
  .app[data-zone="thread"] .feed { display: none; }
  .app[data-zone="thread"] .thread { display: flex; }
  .head-actions select { max-width: 7.5rem; }
  .msg-head { padding-right: 64px; }
}
