/* ФАЯНС · Сообщения */
.dm-page { padding-top: 104px; padding-bottom: 40px; }
.dm-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; flex-wrap: wrap; padding-bottom: 22px; border-bottom: 1px solid var(--ink); margin-bottom: 0; }
.dm-head .eyebrow { margin-bottom: 12px; }
.dm-title { font-size: clamp(44px, 7vw, 84px); line-height: .95; }
.dm-lead { max-width: 380px; margin: 0; color: var(--ink-2); font: italic 400 19px/1.35 var(--serif); }

.dm { display: grid; grid-template-columns: 340px 1fr; height: max(560px, calc(100vh - 290px)); border-bottom: 1px solid var(--rule); background: var(--paper); border-inline: 1px solid var(--rule); }
.dm.is-guest { display: block; height: auto; background: none; border: 0; }

/* список */
.dm-list { display: grid; grid-template-rows: auto auto 1fr; min-height: 0; border-right: 1px solid var(--rule); }
.dm-list__top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--rule); }
.dm-list__h { font-size: 11px; letter-spacing: .2em; text-transform: uppercase; font-weight: 600; color: var(--mute); }
.dm-new { height: 36px; padding: 0 16px; font-size: 12px; }
.dm-share { display: flex; align-items: center; gap: 10px; justify-content: space-between; padding: 10px 18px; background: color-mix(in srgb, var(--brass) 14%, transparent); font-size: 13px; border-bottom: 1px solid var(--rule); }
.dm-convs { overflow-y: auto; min-height: 0; }
.dm-pad { padding: 22px 18px; }
.dm-none p { margin: 0 0 10px; color: var(--mute); }
.dm-conv { display: flex; gap: 12px; align-items: center; width: 100%; text-align: left; background: none; border: 0; border-bottom: 1px solid var(--rule); padding: 14px 18px; position: relative; transition: background .25s; }
.dm-conv:hover { background: var(--porcelain); }
.dm-conv.is-on { background: var(--porcelain); }
.dm-conv.is-on::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 2px; background: var(--brass); }
.dm-conv__body { flex: 1; min-width: 0; display: grid; gap: 2px; }
.dm-conv__row { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 0; }
.dm-conv__row b { font: 500 19px/1.2 var(--serif); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dm-conv__row time { font-size: 11px; color: var(--mute); flex: none; }
.dm-conv__last { font-size: 13px; color: var(--mute); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.dm-tag { font-style: normal; font-size: 9px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--brass); border: 1px solid currentColor; border-radius: 999px; padding: 1px 6px; margin-right: 6px; vertical-align: 1px; }
.dm-tag--mute { color: var(--rose); }
.dm-badge { flex: none; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--brass); color: #14161A; font-size: 11px; font-weight: 700; display: inline-grid; place-items: center; }

/* чат */
.dm-chat { display: grid; grid-template-rows: auto auto 1fr auto; min-height: 0; min-width: 0; position: relative; }
.dm-empty { grid-row: 1 / -1; display: grid; place-items: center; align-content: center; text-align: center; gap: 12px; padding: 40px 24px; }
.dm-empty h2 { font-size: clamp(30px, 4vw, 44px); }
.dm-empty p { max-width: 360px; margin: 0; color: var(--mute); }
.dm-empty__mark { width: 84px; height: 84px; border-radius: 50%; display: grid; place-items: center; font: 400 48px/1 var(--serif); color: var(--brass); border: 1px solid var(--brass); position: relative; }
.dm-empty__mark::after { content: ""; position: absolute; inset: 6px; border-radius: 50%; border: 1px solid var(--rule); }

.dm-chat__head { display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--rule); position: relative; }
.dm-back { display: none; width: 38px; height: 38px; border: 1px solid var(--rule); border-radius: 50%; background: none; font-size: 18px; flex: none; }
.dm-peer { display: flex; align-items: center; gap: 12px; text-decoration: none; min-width: 0; flex: 1; }
.dm-peer > span:not(.kit-ava) { display: grid; min-width: 0; }
.dm-peer b { font: 500 22px/1.15 var(--serif); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dm-peer small { font-size: 12px; color: var(--mute); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dm-more { width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--rule); background: none; font-size: 18px; line-height: 1; flex: none; }
.dm-menu { position: absolute; right: 18px; top: calc(100% - 4px); z-index: 5; background: var(--paper); border: 1px solid var(--rule); box-shadow: 0 12px 30px rgba(0, 0, 0, .14); min-width: 190px; }
.dm-menu button { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 12px 16px; font-size: 14px; color: var(--rose); }
.dm-menu button:hover { background: var(--porcelain); }

.dm-banner { display: flex; align-items: center; justify-content: space-between; gap: 12px 18px; flex-wrap: wrap; padding: 12px 18px; border-bottom: 1px solid var(--rule); background: color-mix(in srgb, var(--brass) 10%, transparent); font-size: 13px; }
.dm-banner p { margin: 0; flex: 1 1 260px; }
.dm-banner span { display: flex; gap: 8px; }

.dm-scroll { overflow-y: auto; min-height: 0; padding: 18px clamp(14px, 3vw, 32px); scroll-behavior: auto;
  background-image: radial-gradient(var(--grid) 1px, transparent 1px); background-size: 22px 22px; }
.dm-scroll:focus { outline: none; }
.dm-msgs { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.dm-day { text-align: center; margin: 14px 0 6px; }
.dm-day span { font-size: 10px; letter-spacing: .2em; text-transform: uppercase; color: var(--mute); background: var(--paper); padding: 4px 12px; border: 1px solid var(--rule); border-radius: 999px; }
.dm-hello { display: grid; justify-items: center; text-align: center; gap: 14px; padding: 40px 10px; color: var(--mute); }
.dm-hello p { margin: 0; }
.dm-msg { display: flex; animation: dmIn .35s var(--ease); }
.dm-msg.is-mine { justify-content: flex-end; }
@keyframes dmIn { from { opacity: 0; transform: translateY(8px); } }
.dm-bub { max-width: min(520px, 78%); background: var(--porcelain); border: 1px solid var(--rule); border-radius: 18px 18px 18px 4px; padding: 9px 13px 6px; display: grid; gap: 8px; min-width: 0; }
.dm-msg.is-mine .dm-bub { background: var(--ink); color: var(--porcelain); border-color: var(--ink); border-radius: 18px 18px 4px 18px; }
.dm-msg.is-req .dm-bub { border-style: dashed; border-color: var(--brass); }
.dm-bub p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 15px; line-height: 1.45; }
.dm-bub p a { color: inherit; }
.dm-meta { justify-self: end; font-size: 10.5px; opacity: .6; display: inline-flex; gap: 4px; align-items: center; }
.dm-meta em { font-style: normal; color: var(--brass); }
.dm-tick { letter-spacing: -.25em; margin-left: 2px; }
.dm-tick.is-read { color: var(--brass-hi); opacity: 1; }
.dm-msg:not(.is-mine) .dm-tick.is-read { color: var(--brass); }
.dm-photo { display: block; margin: -3px -7px 0; border-radius: 13px; overflow: hidden; }
.dm-photo img { display: block; width: 100%; max-height: 340px; object-fit: cover; }
.sc-venue--chat { min-width: min(300px, 62vw); }
.dm-msg.is-mine .sc-venue--chat { background: color-mix(in srgb, var(--porcelain) 8%, transparent); color: var(--porcelain); border-color: rgba(244, 241, 234, .2); border-left-color: var(--brass); }
.dm-msg.is-mine .sc-venue--chat .sc-venue__go, .dm-msg.is-mine .sc-venue--chat .sc-venue__addr { color: inherit; opacity: .7; }
.dm-msg.is-mine .sc-venue--chat .sc-venue__score { border-color: rgba(244, 241, 234, .2); }
:root[data-theme="dark"] .dm-msg.is-mine .sc-venue--chat { background: rgba(0, 0, 0, .06); }

/* поле ввода */
.dm-compose { border-top: 1px solid var(--rule); padding: 10px 14px 12px; background: var(--paper); }
.dm-draft { display: flex; gap: 8px; flex-wrap: wrap; padding-bottom: 10px; }
.dm-chip { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--rule); border-radius: 999px; padding: 4px 4px 4px 4px; background: var(--porcelain); font-size: 13px; max-width: 100%; }
.dm-chip img { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; }
.dm-chip--venue { padding-left: 12px; }
.dm-chip--venue span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dm-compose__row { display: flex; align-items: flex-end; gap: 10px; }
.dm-compose__row.is-off { opacity: .45; pointer-events: none; }
.dm-tools { display: flex; gap: 6px; flex: none; padding-bottom: 4px; }
.dm-tools .kit-photo, .dm-tool { height: 38px; padding: 0 12px; font-size: 12px; }
.dm-tools .kit-photo > span { display: inline-flex; gap: 6px; align-items: center; }
.dm-tool { display: inline-flex; align-items: center; gap: 6px; border: 1px dashed var(--brass); border-radius: 999px; background: none; color: var(--ink); }
.dm-tool span[aria-hidden] { color: var(--brass); }
.dm-field { flex: 1; min-width: 0; position: relative; }
.dm-field textarea { width: 100%; resize: none; font: 400 15px/1.45 var(--sans); color: var(--ink); background: var(--porcelain); border: 1px solid var(--rule); border-radius: 22px; padding: 10px 16px; max-height: 160px; display: block; }
.dm-field textarea:focus { outline: none; border-color: var(--brass); }
.dm-count { position: absolute; right: 14px; top: -16px; font-size: 10px; color: var(--mute); }
.dm-send { width: 46px; height: 46px; padding: 0; flex: none; }
.dm-why { margin: 8px 0 0; font-size: 13px; color: var(--rose); }

@media (max-width: 860px) {
  .dm-page { padding-top: 84px; padding-bottom: 0; }
  .dm-head { padding-bottom: 14px; }
  .dm-lead { font-size: 16px; }
  .dm { grid-template-columns: 1fr; height: calc(100dvh - 250px); min-height: 460px; margin-inline: calc(-1 * var(--gutter)); border-inline: 0; }
  .dm-chat { display: none; }
  .dm.is-chat .dm-list { display: none; }
  /* открытый чат на телефоне — во весь экран между шапкой и таббаром */
  .dm.is-chat { position: fixed; left: 0; right: 0; top: var(--sc-top, 60px); bottom: var(--sc-bot, 0px); height: auto; min-height: 0; margin: 0; z-index: 40; border: 0; }
  .dm.is-chat .dm-chat { display: grid; }
  .dm-back { display: inline-grid; place-items: center; }
  .dm-bub { max-width: 86%; }
}
@media (max-width: 1060px) {
  .dm-page { padding-bottom: calc(var(--tabbar-h) + 16px); }
}
@media (max-width: 560px) {
  .dm-head { display: block; }
  .dm-lead { margin-top: 8px; }
  .dm-tool__t { display: none; }
  .dm-tools .kit-photo, .dm-tool { padding: 0; width: 38px; justify-content: center; }
  .dm-chat__head { padding: 10px 12px; }
  .sc-venue--chat { min-width: 0; }
}
