.messages-workspace .right-rail {
  display: none;
}
.messages-workspace .content-layout {
  display: block;
}
.messages-workspace .primary {
  max-width: none;
}
.messages-workspace main {
  padding: 0;
  max-width: none;
  margin: 0;
}
.messages-workspace .account-strip {
  min-height: 52px;
  margin: 0;
  padding: 0 28px;
  border-bottom: 1px solid var(--mode-line, #e5e9dd);
}
.messenger {
  display: grid;
  grid-template-columns: 290px minmax(0, 1fr);
  height: calc(100dvh - 140px);
  min-height: 0;
  max-height: none;
  border: 0;
  border-radius: 0;
  background: var(--mode-surface, #fffefa);
  overflow: hidden;
  box-shadow: none;
}
.conversation-list {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--mode-surface, #fffefa);
  border-right: 1px solid var(--mode-line, #e5e9dd);
}
.conversation-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 26px 22px 20px;
}
.conversation-title .eyebrow {
  font-size: 8px;
  letter-spacing: 1px;
}
.conversation-title h1 {
  font-size: 30px;
  margin-top: 6px;
  letter-spacing: -1px;
}
.new-chat-button {
  width: 40px;
  height: 40px;
  border-radius: 13px;
  background: var(--mode-soft, #e5edd9);
  color: var(--mode-text, #536b43);
  display: grid;
  place-items: center;
}
.new-chat-button:hover {
  background: var(--mode-soft, #d7e3c6);
}
.conversation-search {
  display: flex;
  gap: 9px;
  align-items: center;
  border-radius: 11px;
  background: var(--mode-surface, #f2f4ec);
  margin: 0 18px;
  padding: 12px 13px;
  color: var(--mode-muted, #8c9780);
}
.conversation-search input {
  width: 100%;
  min-width: 0;
  border: 0;
  background: none;
  outline: none;
  font-size: 12px;
  color: var(--mode-text, #4c5c40);
}
.conversation-list-label {
  display: flex;
  justify-content: space-between;
  padding: 24px 22px 12px;
  font-size: 10px;
  font-weight: 600;
  color: var(--mode-muted, #8a947e);
}
.conversation-list-label > span:last-child {
  font-size: 9px;
  background: var(--mode-soft, #eef2e5);
  padding: 2px 6px;
  border-radius: 5px;
}
.conversation-rows {
  flex: 1;
  overflow-y: auto;
  padding: 0 8px;
}
.conversation-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 12px;
  border-radius: 12px;
  width: 100%;
  text-align: left;
  margin: 3px 0;
  position: relative;
}
.conversation-row:hover {
  background: var(--mode-surface, #f2f5e9);
}
.conversation-row.selected {
  background: var(--mode-soft, #edf2e4);
}
.chat-avatar {
  width: 46px;
  height: 46px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 16px;
}
.conversation-preview {
  min-width: 0;
  flex: 1;
}
.conversation-name {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
.conversation-name strong {
  font-size: 12px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-weight: 650;
}
.conversation-name time {
  font-size: 9px;
  color: var(--mode-muted, #96a087);
  flex-shrink: 0;
}
.conversation-snippet {
  display: block;
  margin-top: 7px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 11px;
  color: var(--mode-muted, #89957b);
}
.conversation-snippet > span {
  color: var(--mode-text, #657956);
}
.conversation-footer {
  padding: 18px 20px;
  border-top: 1px solid var(--mode-line, #edf0e6);
  color: var(--mode-muted, #89987b);
  font-size: 9px;
  display: flex;
  align-items: center;
  gap: 7px;
}
.conversation-thread {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: var(--mode-surface, #f4f5ed);
}
.thread-header {
  height: 82px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--mode-surface, #fffefa);
  border-bottom: 1px solid var(--mode-line, #e6eadf);
  padding: 0 24px;
  position: relative;
  z-index: 2;
}
.thread-header .chat-avatar {
  width: 43px;
  height: 43px;
  border-radius: 14px;
}
.thread-identity {
  flex: 1;
  min-width: 0;
}
.thread-identity h2 {
  font-size: 15px;
  font-weight: 750;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.2px;
}
.thread-identity p {
  font-size: 10px;
  color: var(--mode-muted, #96a087);
  margin-top: 6px;
}
.thread-identity p > span {
  margin: 0 4px;
}
.thread-back {
  display: none;
}
.thread-options {
  color: var(--mode-muted, #768866);
  border: 1px solid var(--mode-line, #e6eadf);
  border-radius: 10px;
  width: 34px;
  height: 34px;
}
.thread-action-menu {
  position: absolute;
  right: 20px;
  top: 68px;
  border: 1px solid var(--mode-line, #dfe7d3);
  border-radius: 11px;
  background: var(--mode-surface, #fffefa);
  padding: 6px;
  box-shadow: 0 8px 25px #46563518;
  z-index: 3;
  min-width: 160px;
}
.thread-action-menu button {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  padding: 12px;
  width: 100%;
  border-radius: 7px;
}
.thread-action-menu button:hover {
  background: var(--mode-soft, #f0f3e8);
}
.thread-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 22px 24px 26px;
  background-image: radial-gradient(#93a47917 0.8px, transparent 0.8px);
  background-size: 22px 22px;
  overscroll-behavior: contain;
}
.thread-safety {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  max-width: 380px;
  font-size: 10px;
  line-height: 1.7;
  color: var(--mode-muted, #8d977e);
  margin: 0 auto 18px;
  text-align: center;
}
.message-group {
  margin: 8px 0;
}
.message-day {
  display: flex;
  justify-content: center;
  margin: 22px 0 24px;
}
.message-day > span {
  font-size: 9px;
  font-weight: 500;
  border: 1px solid var(--mode-line, #e0e5d5);
  background: var(--mode-surface, #fdfef7);
  border-radius: 8px;
  padding: 6px 11px;
  color: var(--mode-muted, #8a967c);
  box-shadow: 0 2px 4px #52633e03;
}
.message-line {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}
.message-line.outgoing {
  justify-content: flex-end;
}
.message-avatar {
  width: 26px;
  height: 26px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 8px;
  font-weight: 600;
  flex-shrink: 0;
  margin-bottom: 3px;
}
.message-bubble {
  max-width: 82%;
  background: var(--mode-surface, #fffefa);
  border: 1px solid var(--mode-line, #e6eadf);
  border-radius: 15px 15px 15px 4px;
  padding: 12px 15px 8px;
  box-shadow: 0 2px 5px #46563503;
}
.message-bubble.mine {
  background: var(--mode-soft, #e3edcf);
  border-color: var(--mode-muted, #dae5c5);
  border-radius: 15px 15px 4px 15px;
}
.message-author {
  display: block;
  color: var(--mode-muted, #718653);
  font-size: 10px;
  font-weight: 650;
  margin-bottom: 6px;
}
.message-bubble p {
  font-size: 13px;
  line-height: 1.65;
  color: var(--mode-text, #45523c);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.message-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  font-size: 9px;
  color: var(--mode-muted, #92a17f);
  margin-top: 4px;
}
.thread-composer {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-shrink: 0;
  padding: 16px 20px 12px;
  background: var(--mode-surface, #fffefa);
  border-top: 1px solid var(--mode-line, #e5eadb);
  position: relative;
  flex-wrap: wrap;
}
.composer-input {
  background: var(--mode-surface, #f2f5eb);
  border: 1px solid var(--mode-line, #e6ebdd);
  border-radius: 15px;
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
}
.composer-input:focus-within {
  border-color: var(--mode-muted, #afc295);
  box-shadow: 0 0 0 2px #cbdab828;
}
.composer-input textarea {
  width: 100%;
  resize: none;
  background: none;
  border: 0;
  outline: none !important;
  font-size: 13px;
  color: var(--mode-text, #46563a);
  padding: 13px 15px;
  line-height: 1.6;
  min-height: 48px;
  max-height: 130px;
  field-sizing: content;
  overflow-y: auto;
}
.send-message-button {
  width: 48px;
  height: 48px;
  border-radius: 15px;
  background: #536b43;
  color: #fffdf4;
  display: grid;
  place-items: center;
}
.send-message-button:hover {
  background: #405633;
}
.send-message-button:disabled {
  background: var(--mode-soft, #c7d2ba);
  color: #f9fcf2;
  cursor: default;
  opacity: 1;
}
.composer-hint {
  width: 100%;
  font-size: 8px;
  color: var(--mode-muted, #a0a98f);
  margin: 0 2px;
  line-height: 1.5;
}
.thread-welcome,
.thread-placeholder,
.chat-list-empty {
  text-align: center;
  color: var(--mode-muted, #88997a);
}
.thread-welcome {
  padding: 35px 20px;
}
.thread-welcome > span {
  font-size: 50px;
  color: var(--mode-muted, #b4c793);
}
.thread-welcome h3 {
  font-size: 17px;
  color: var(--mode-text, #657b50);
  margin: 15px 0 8px;
}
.thread-welcome p {
  font-size: 12px;
  line-height: 1.8;
}
.thread-placeholder {
  margin: auto;
  padding: 30px;
  max-width: 380px;
}
.placeholder-symbol {
  display: block;
  font-size: 80px;
  color: var(--mode-muted, #b1c58f);
  line-height: 1.3;
}
.thread-placeholder h2 {
  font-size: 24px;
  letter-spacing: -0.8px;
  margin: 15px 0;
}
.thread-placeholder p {
  font-size: 12px;
  line-height: 1.8;
  margin: 12px 0 24px;
}
.chat-list-empty {
  padding: 35px 15px;
}
.chat-list-empty h3 {
  font-size: 13px;
  margin: 15px 0 8px;
}
.chat-list-empty p {
  font-size: 11px;
  line-height: 1.8;
  margin: 12px 0 20px;
}
@media (max-width: 1200px) {
  .messenger {
    grid-template-columns: 250px minmax(0, 1fr);
  }
  .conversation-title {
    padding: 24px 18px 20px;
  }
  .conversation-row {
    gap: 9px;
    padding: 14px 9px;
  }
  .conversation-name strong {
    font-size: 11px;
  }
  .conversation-name time {
    font-size: 8px;
  }
  .chat-avatar {
    width: 42px;
    height: 42px;
  }
  .thread-header {
    padding: 0 18px;
  }
  .thread-messages {
    padding-left: 18px;
    padding-right: 18px;
  }
}
@media (max-width: 760px) {
  .mobile-nav button {
    width: 16.6667%;
    font-size: 9px;
  }
  .messages-workspace main {
    padding: 0;
  }
  .messages-workspace .account-strip {
    padding: 0 20px;
    margin-bottom: 0;
  }
  .messenger {
    display: block;
    height: calc(100dvh - 186px - env(safe-area-inset-bottom, 0px));
    min-height: 0;
    max-height: none;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    background: var(--mode-surface, #fbfaf7);
  }
  .conversation-list {
    height: 100%;
    border: 0;
    background: var(--mode-surface, #fbfaf7);
  }
  .app-shell:has(.messages-workspace) .mobile-nav {
    height: calc(65px + env(safe-area-inset-bottom, 0px));
  }
  .conversation-title {
    padding: 19px 22px 22px;
  }
  .conversation-title h1 {
    font-size: 34px;
  }
  .conversation-title .eyebrow {
    font-size: 8px;
  }
  .new-chat-button {
    width: 43px;
    height: 43px;
  }
  .conversation-search {
    margin: 0 21px;
    padding: 13px 14px;
  }
  .conversation-search input {
    font-size: 13px;
  }
  .conversation-list-label {
    padding: 24px 25px 10px;
    font-size: 11px;
  }
  .conversation-rows {
    padding: 0 12px;
  }
  .conversation-row {
    padding: 17px 11px;
    gap: 13px;
  }
  .conversation-row.selected {
    background: transparent;
  }
  .conversation-row + .conversation-row:before {
    content: "";
    position: absolute;
    top: 0;
    left: 71px;
    right: 12px;
    height: 1px;
    background: var(--mode-soft, #e7ebdf);
  }
  .chat-avatar {
    width: 47px;
    height: 47px;
  }
  .conversation-name strong {
    font-size: 14px;
  }
  .conversation-name time {
    font-size: 10px;
  }
  .conversation-snippet {
    font-size: 12px;
    margin-top: 8px;
  }
  .conversation-footer {
    font-size: 10px;
    padding: 20px 23px;
  }
  .conversation-thread {
    display: none;
  }
  .messenger.thread-open .conversation-list {
    display: none;
  }
  .messenger.thread-open .conversation-thread {
    display: flex;
    height: 100%;
  }
  .messenger,
  .messenger.thread-open {
    height: var(
      --chat-available-height,
      calc(100dvh - 186px - env(safe-area-inset-bottom, 0px))
    );
    min-height: 0;
  }
  .app-shell:has(.messages-workspace) {
    height: var(--app-viewport-height, 100dvh);
    overflow: hidden;
  }
  .app-shell:has(.messages-workspace) .mobile-nav {
    top: calc(
      var(--app-viewport-height, 100dvh) - 65px -
        env(safe-area-inset-bottom, 0px)
    );
    bottom: auto;
    display: flex;
  }
  .thread-back {
    display: grid;
    padding: 8px;
    margin-left: -9px;
  }
  .thread-header {
    height: 78px;
    padding: 0 17px;
    gap: 10px;
  }
  .thread-header .chat-avatar {
    width: 40px;
    height: 40px;
    border-radius: 14px;
  }
  .thread-identity h2 {
    font-size: 14px;
  }
  .thread-identity p {
    font-size: 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .thread-options {
    border: 0;
  }
  .thread-messages {
    padding: 21px 14px 25px;
  }
  .thread-safety {
    font-size: 10px;
    max-width: 300px;
    align-items: flex-start;
  }
  .message-bubble {
    max-width: 84%;
    padding: 11px 13px 7px;
  }
  .message-bubble p {
    font-size: 14px;
  }
  .message-author {
    font-size: 11px;
  }
  .message-meta {
    font-size: 10px;
  }
  .message-avatar {
    width: 25px;
    height: 25px;
  }
  .message-line {
    gap: 6px;
  }
  .message-day > span {
    font-size: 10px;
  }
  .thread-composer {
    padding: 12px 12px max(10px, env(safe-area-inset-bottom));
    gap: 9px;
  }
  .composer-input textarea {
    font-size: 16px;
    padding: 12px;
    min-height: 48px;
  }
  .composer-hint {
    font-size: 9px;
  }
  .thread-action-menu {
    top: 65px;
    right: 12px;
  }
  .thread-action-menu button {
    font-size: 13px;
    padding: 14px;
  }
  .thread-welcome {
    padding: 40px 14px;
  }
}

@media (max-width: 760px) {
  .app-shell:has(.messenger.thread-open) {
    min-height: 0;
  }
}
