/* «Чаты» */
.chat-list { display: grid; gap: .5rem; margin-bottom: 1.5rem; }
.chat-row { display: grid; grid-template-columns: 1fr auto; gap: .15rem .75rem; text-decoration: none; color: inherit; }
.chat-row-title { font-weight: 600; }
.chat-row-last { grid-column: 1 / -1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-row.has-unread .chat-row-title { color: var(--accent, inherit); }
.chat-kinds, .chat-people { border: 0; padding: 0; margin: 0 0 .75rem; display: flex; flex-wrap: wrap; gap: .4rem 1rem; }
.chat-kinds legend, .chat-people legend { font-weight: 600; margin-bottom: .35rem; width: 100%; }
.chat-feed { display: flex; flex-direction: column; gap: .5rem; margin: 1rem 0; min-height: 30vh; }
.chat-msg { max-width: min(42rem, 88%); align-self: flex-start; background: var(--surface-2, rgba(127,127,127,.1)); border-radius: 14px 14px 14px 4px; padding: .5rem .75rem; position: relative; }
.chat-msg.is-mine { align-self: flex-end; border-radius: 14px 14px 4px 14px; background: color-mix(in srgb, var(--accent, #3b82f6) 16%, transparent); }
.chat-msg-meta { font-size: .78rem; opacity: .75; margin-bottom: .15rem; }
.chat-msg-meta time { margin-left: .35rem; }
.chat-msg-body { white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-msg-body a { text-decoration: underline; }
.chat-hide { display: none; position: absolute; top: .25rem; right: .5rem; }
.chat-msg:hover .chat-hide, .chat-msg:focus-within .chat-hide { display: block; }
.chat-compose { position: sticky; bottom: 0; display: grid; grid-template-columns: 1fr auto; gap: .5rem; align-items: end; padding: .75rem 0; background: var(--bg, Canvas); }
.chat-compose textarea { resize: vertical; min-height: 5rem; max-height: 40vh; font-size: 16px; }
/* «Отправить» — квадратная кнопка со значком (смайлики — с клавиатуры телефона) */
.chat-send { width: 3rem; height: 3rem; padding: 0; display: grid; place-items: center; border-radius: 14px; }
.chat-send .ic { width: 1.35rem; height: 1.35rem; margin: 0; }
.chat-compose.is-sending { opacity: .6; }
.chat-error { grid-column: 1 / -1; color: var(--danger, #c0392b); margin: 0; }
.chat-members { margin-top: 1.5rem; }
.chat-members ul { margin: .5rem 0; }
.chat-members form.inline { display: inline; }
.chat-invite-link { display: flex; gap: .5rem; flex-wrap: wrap; }
.chat-invite-link input { flex: 1 1 18rem; font-family: ui-monospace, monospace; font-size: .85rem; }
.card.is-off { opacity: .6; }
/* гостевое приложение /c */
.c-body { max-width: 46rem; margin: 0 auto; padding: 0 16px calc(16px + env(safe-area-inset-bottom)); }
.c-top { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; gap: 1rem; }
.c-brand { display: flex; flex-direction: column; text-decoration: none; color: inherit; line-height: 1.15; }
.c-brand small { opacity: .65; }
.c-h1 { font-size: 1.4rem; margin: .5rem 0 1rem; }
.c-center { max-width: 30rem; margin: 10vh auto; text-align: center; }
.chat-kinds label, .chat-people label { display: inline-flex; align-items: center; gap: .4rem; }
.chat-members li { display: flex; align-items: center; flex-wrap: wrap; gap: .35rem; margin: .25rem 0; }
.chat-members li form.inline { margin-left: auto; }
/* этап 2: фото, файлы, реакции, смайлики */
.chat-photo img { display: block; max-width: min(100%, 320px); max-height: 320px; border-radius: 10px; margin: .25rem 0; object-fit: cover; }
.chat-file { display: inline-flex; align-items: center; gap: .5rem; padding: .45rem .7rem; margin: .25rem 0; border-radius: 10px;
  background: color-mix(in srgb, currentColor 8%, transparent); text-decoration: none; color: inherit; max-width: 100%; }
.chat-file span { display: flex; flex-direction: column; min-width: 0; }
.chat-file b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-reactions { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem; margin-top: .3rem; }
.chat-reactions form { display: inline; }
.chat-reaction { font: inherit; font-size: .85rem; border: 1px solid color-mix(in srgb, currentColor 20%, transparent); background: transparent;
  color: inherit; border-radius: 999px; padding: .05rem .5rem; cursor: pointer; }
.chat-reaction.is-mine { background: color-mix(in srgb, var(--accent, #3b82f6) 18%, transparent); border-color: var(--accent, #3b82f6); }
.chat-react-add { position: relative; }
.chat-react-add summary { list-style: none; cursor: pointer; opacity: .55; padding: 0 .35rem; border-radius: 999px; }
.chat-react-add summary::-webkit-details-marker { display: none; }
.chat-react-menu { position: absolute; z-index: 5; bottom: 1.8rem; left: 0; display: flex; gap: .15rem; padding: .3rem;
  background: var(--surface, Canvas); border: 1px solid var(--line, #ddd); border-radius: 12px; box-shadow: 0 4px 16px rgba(0,0,0,.12); }
.chat-react-menu button, .chat-emoji-panel button { font-size: 1.25rem; background: none; border: 0; cursor: pointer; padding: .15rem .25rem; border-radius: 8px; }
.chat-react-menu button:hover, .chat-emoji-panel button:hover { background: color-mix(in srgb, currentColor 10%, transparent); }
.chat-tools { grid-column: 1 / -1; display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; order: -1; }
.chat-tool { display: inline-flex; align-items: center; justify-content: center; width: 2.2rem; height: 2.2rem; border-radius: 10px; cursor: pointer;
  list-style: none; font-size: 1.15rem; border: 1px solid var(--line, #ddd); }
.chat-emoji summary::-webkit-details-marker { display: none; }
.chat-emoji { position: relative; }
.chat-emoji-panel { position: absolute; z-index: 5; bottom: 2.6rem; left: 0; width: min(18rem, 80vw); display: grid; grid-template-columns: repeat(8, 1fr);
  padding: .4rem; background: var(--surface, Canvas); border: 1px solid var(--line, #ddd); border-radius: 12px; box-shadow: 0 4px 16px rgba(0,0,0,.12); }
/* архив и удаление чата */
.chat-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.chat-actions .inline-form { margin: 0; }
.chat-archive-link, .chat-archive-head { margin: 0 0 10px; font-size: 14px; display: flex; align-items: center; gap: 10px; }
.chat-archive-link a { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.chat-archive-link .ic { width: 16px; height: 16px; }
