/* Memory Lane Messenger — styles v1.7 */

.mlm-native-hide {
  display: none !important;
}

/* Ñáðîñ êëàññè÷åñêîé ñåòêè ËÑ (nav ñëåâà + margin) */
#pun-messages.mlm-on #profile.messages-container,
#pun-messages.mlm-on #profile.messages-container > .container {
  display: block !important;
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box;
  float: none !important;
  margin: 0 !important;
  padding: 0 !important;
}

#pun-messages.mlm-on #profilenav,
#pun-messages.mlm-on #notify-settings,
#pun-messages.mlm-on #messages,
#pun-messages.mlm-on form#post,
#pun-messages.mlm-on #profile.messages-container > .container > fieldset.mlm-native-hide,
#pun-messages.mlm-on .mlm-native-hide {
  display: none !important;
  float: none !important;
  width: 0 !important;
  max-width: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
  border: 0 !important;
}

/* íà ñëó÷àé æ¸ñòêîé øèðèíû òåìû */
#pun-messages.mlm-on #pun-main,
#pun-messages.mlm-on #profile {
  max-width: none !important;
  width: 100% !important;
  box-sizing: border-box;
}

#pun-messages.mlm-on #mlm-app,
.mlm-app {
  display: grid !important;
  grid-template-columns: minmax(280px, 340px) 1fr;
  width: 100% !important;
  max-width: 100% !important;
  min-height: 72vh;
  margin: 0 !important;
  float: none !important;
  clear: both !important;
  box-sizing: border-box;
  border: 1px solid rgba(127, 127, 127, 0.18);
  border-radius: 16px;
  overflow: hidden;
  background: var(--container-bg, rgba(255, 255, 255, 0.45));
  position: relative;
  z-index: 2;
}

.mlm-side,
.mlm-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.mlm-side {
  border-right: 1px solid rgba(127, 127, 127, 0.15);
  background: rgba(0, 0, 0, 0.02);
}

.mlm-head {
  min-height: 58px;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(127, 127, 127, 0.12);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-shrink: 0;
}

.mlm-title {
  font-weight: 700;
  font-size: 1.05em;
  line-height: 1.25;
}

.mlm-sub {
  font-size: 0.9em;
  opacity: 0.7;
  margin-top: 2px;
  line-height: 1.3;
}

.mlm-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.mlm-btn {
  appearance: none;
  border: 0;
  cursor: pointer;
  text-decoration: none !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px 11px;
  border-radius: 10px;
  background: var(--button-bg, rgba(100, 85, 80, 0.85));
  color: var(--button-text, #fff);
  font: inherit;
  line-height: 1.2;
  white-space: nowrap;
}

.mlm-btn.ghost {
  background: transparent;
  color: inherit;
  border: 1px solid rgba(127, 127, 127, 0.25);
}

.mlm-btn:disabled {
  opacity: 0.55;
  cursor: default;
}

.mlm-search {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(127, 127, 127, 0.1);
  flex-shrink: 0;
}

.mlm-search input,
.mlm-compose input,
.mlm-compose textarea {
  width: 100%;
  box-sizing: border-box;
  border-radius: 10px;
  border: var(--input-border, 1px solid rgba(127, 127, 127, 0.25));
  background: var(--input-bg, #fff);
  color: inherit;
  padding: 10px 12px;
  font: inherit;
}

.mlm-dialogs {
  overflow: auto;
  flex: 1;
  -webkit-overflow-scrolling: touch;
}

.mlm-dialog {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  gap: 10px;
  padding: 10px 12px;
  align-items: center;
  cursor: pointer;
  border-bottom: 1px solid rgba(127, 127, 127, 0.08);
}

.mlm-dialog:hover,
.mlm-dialog.active {
  background: rgba(127, 127, 127, 0.08);
}

.mlm-dialog.unread .mlm-name {
  font-weight: 700;
}

.mlm-ava {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: center / cover no-repeat rgba(127, 127, 127, 0.15);
  position: relative;
  flex-shrink: 0;
}

.mlm-ava .on {
  position: absolute;
  right: 1px;
  bottom: 1px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #3bb54a;
  border: 2px solid var(--container-bg, #fff);
}

.mlm-name,
.mlm-preview {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mlm-preview {
  margin-top: 3px;
  opacity: 0.7;
  font-size: 0.92em;
}

.mlm-meta {
  text-align: right;
  font-size: 0.84em;
  opacity: 0.65;
  white-space: nowrap;
}

.mlm-badge {
  display: inline-flex;
  min-width: 18px;
  height: 18px;
  margin-top: 6px;
  padding: 0 5px;
  border-radius: 999px;
  align-items: center;
  justify-content: center;
  background: #c0392b;
  color: #fff;
  font-size: 11px;
}

.mlm-chat {
  overflow: auto;
  flex: 1;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  -webkit-overflow-scrolling: touch;
}

.mlm-empty,
.mlm-loading {
  margin: auto;
  text-align: center;
  opacity: 0.7;
  line-height: 1.45;
  max-width: 340px;
  padding: 20px 12px;
}

.mlm-msg {
  max-width: min(760px, 92%);
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(127, 127, 127, 0.08);
  box-sizing: border-box;
}

.mlm-msg.mine {
  margin-left: auto;
  background: rgba(100, 85, 80, 0.16);
}

.mlm-msg-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
  font-size: 0.86em;
  opacity: 0.7;
}

.mlm-msg-subj {
  font-weight: 700;
  margin-bottom: 8px;
  word-break: break-word;
}

.mlm-msg-body {
  line-height: 1.45;
  word-break: break-word;
}

.mlm-msg-body img {
  max-width: 100%;
  height: auto;
}

.mlm-msg-actions {
  display: flex;
  gap: 10px;
  margin-top: 8px;
  font-size: 0.86em;
  opacity: 0.8;
  flex-wrap: wrap;
}

.mlm-compose {
  border-top: 1px solid rgba(127, 127, 127, 0.12);
  padding: 12px;
  display: none;
  gap: 8px;
  flex-shrink: 0;
  background: rgba(0, 0, 0, 0.015);
}

.mlm-compose.open {
  display: grid;
}

.mlm-compose textarea {
  min-height: 96px;
  resize: vertical;
}

.mlm-compose-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.mlm-hint {
  font-size: 0.84em;
  opacity: 0.6;
}

/* toast */
.mlm-toast {
  position: fixed;
  right: 16px;
  bottom: 16px;
  left: auto;
  z-index: 999999;
  max-width: min(320px, calc(100vw - 32px));
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.82);
  color: #fff;
  font-size: 13px;
  line-height: 1.35;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  display: none;
}

/* mobile */
@media (max-width: 860px) {
  #pun-messages.mlm-on #mlm-app,
  .mlm-app {
    grid-template-columns: 1fr;
    min-height: 78vh;
    border-radius: 12px;
  }

  .mlm-app.chat-open .mlm-side {
    display: none;
  }

  .mlm-app:not(.chat-open) .mlm-main {
    display: none;
  }

  .mlm-msg {
    max-width: 95%;
  }

  .mlm-compose textarea {
    min-height: 84px;
  }

  .mlm-toast {
    right: 12px;
    bottom: 12px;
    left: 12px;
    max-width: none;
  }
}

/* classic mode */
body.mlm-classic-mode #mlm-app {
  display: none !important;
}

body.mlm-classic-mode .mlm-native-hide {
  display: revert !important;
  width: auto !important;
  max-width: none !important;
  overflow: visible !important;
}

body.mlm-classic-mode #pun-messages.mlm-on #profilenav,
body.mlm-classic-mode #pun-messages.mlm-on #notify-settings,
body.mlm-classic-mode #pun-messages.mlm-on #messages,
body.mlm-classic-mode #pun-messages.mlm-on form#post {
  display: block !important;
  width: auto !important;
  max-width: none !important;
  margin: revert;
  padding: revert;
  overflow: visible !important;
}

body.mlm-classic-mode #pun-messages.mlm-on #profile.messages-container,
body.mlm-classic-mode #pun-messages.mlm-on #profile.messages-container > .container {
  display: revert;
  width: auto;
  max-width: none;
}