/* styles-chat-internal.css — лист «Связь → Чат» (pages-chat-internal.js).
   Тулбар и кнопки — общие .plan-toolbar/.plan-btn/.roster-*; тёмная панель — .page-shell,
   светлый лист — .plan-sheet. Своё здесь: список переписок, переписка, поле ввода, значки. */

/* ── значок непрочитанных на кнопке «Связь» и вкладке «Чат» ───────────────── */
.module-btn .chat-nav-badge,
.sub-btn .chat-nav-badge {
  margin-left: 6px;
  min-width: 16px;
  padding: 0 5px;
  border-radius: 8px;
  background: #e5484d;
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  line-height: 15px;
  text-align: center;
}
.module-btn.active .chat-nav-badge { background: #1e2024; color: #ffe1a8; }

/* ── лист ───────────────────────────────────────────────────────────────── */
.page-shell.chat-internal-mode { position: relative; }
.chat-internal-mode .chat-search { width: 220px; min-width: 160px; }
.chat-seg-n { font-size: 9px; background: rgba(0, 0, 0, 0.14); border-radius: 7px; padding: 0 5px; margin-left: 2px; }

.chat-sheet {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  overflow: hidden;
  color: #1d3553;
}

.chat-list { border-right: 1px solid #c9d6e6; background: #f5f8fc; overflow-y: auto; min-height: 0; }
.chat-grp { font-size: 9px; font-weight: 800; letter-spacing: 0.8px; text-transform: uppercase; color: #5b7390; padding: 12px 14px 6px; }
.chat-item {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  padding: 9px 14px;
  border: 0;
  border-left: 3px solid transparent;
  background: none;
  color: inherit;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}
.chat-item:hover { background: #e3edf8; }
.chat-item.is-on { background: #dbe7f6; border-left-color: #ff9a2e; }
.chat-item-main { min-width: 0; display: grid; gap: 2px; }
.chat-item-name { font-size: 12px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-item-last { font-size: 11px; color: #5b7390; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-item-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; font-size: 10px; color: #5b7390; }
.chat-unread { background: #ff9a2e; color: #1e2024; font-weight: 800; font-size: 10px; border-radius: 9px; padding: 1px 7px; }

.chat-ava {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex: none;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
}
.chat-ava.is-group { border-radius: 10px; }

.chat-empty { padding: 20px 14px; font-size: 11px; color: #5b7390; text-align: center; }
.chat-empty.is-error { color: #9f1d1d; }

/* ── переписка ──────────────────────────────────────────────────────────── */
.chat-thread { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.chat-head { display: flex; align-items: center; gap: 10px; padding: 10px 16px; min-height: 53px; border-bottom: 1px solid #c9d6e6; background: #f5f8fc; }
.chat-head .chat-ava { width: 32px; height: 32px; }
.chat-head-text { min-width: 0; }
.chat-head-title { font-size: 13px; font-weight: 800; }
.chat-head-sub { font-size: 10px; color: #5b7390; margin-top: 1px; }
.chat-head-actions { margin-left: auto; display: flex; gap: 6px; }
.chat-lbtn { height: 27px; padding: 0 10px; border-radius: 9px; border: 1px solid #b6c9df; background: #fff; color: #23384f; font-family: inherit; font-size: 10px; font-weight: 700; cursor: default; }

.chat-msgs { flex: 1; min-height: 0; overflow-y: auto; padding: 16px 20px; display: flex; flex-direction: column; gap: 8px; }
.chat-day { align-self: center; font-size: 10px; font-weight: 700; color: #5b7390; background: #dbe4ef; border-radius: 9px; padding: 2px 10px; margin: 6px 0; }
.chat-msg { max-width: min(560px, 78%); display: flex; flex-direction: column; gap: 3px; align-self: flex-start; }
.chat-msg.is-mine { align-self: flex-end; align-items: flex-end; }
.chat-who { font-size: 10px; font-weight: 800; color: #2f6db3; padding-left: 2px; }
.chat-who em { font-style: normal; font-weight: 600; color: #5b7390; }
.chat-bub {
  background: #fff;
  border: 1px solid #c9d6e6;
  border-radius: 12px 12px 12px 4px;
  padding: 8px 11px;
  font-size: 12.5px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}
.chat-msg.is-mine .chat-bub { background: #dbe9fb; border-color: #b3cbea; border-radius: 12px 12px 4px 12px; }
.chat-time { font-size: 9.5px; color: #5b7390; }
.chat-rd { color: #2f8a55; font-weight: 800; }
.chat-card { margin-top: 6px; border: 1px solid #b6c9df; border-radius: 9px; background: #f5f8fc; padding: 7px 9px; display: grid; gap: 2px; font-size: 11px; }
.chat-card span { color: #5b7390; }

.chat-compose { display: flex; gap: 8px; align-items: flex-end; padding: 10px 14px; border-top: 1px solid #c9d6e6; background: #f5f8fc; }
.chat-compose.is-off { display: none; }
.chat-compose textarea {
  flex: 1;
  resize: none;
  min-height: 36px;
  max-height: 120px;
  border: 1px solid #b6c9df;
  border-radius: 10px;
  padding: 9px 11px;
  font-family: inherit;
  font-size: 12.5px;
  color: #1d3553;
  background: #fff;
}
.chat-compose textarea:focus, .chat-task-sz:focus { outline: none; border-color: #7ea2c4; }
.chat-ibtn { height: 36px; min-width: 40px; padding: 0 8px; border-radius: 10px; border: 1px solid #b6c9df; background: #fff; color: #23384f; font-family: inherit; font-size: 11px; font-weight: 800; cursor: pointer; }
.chat-ibtn:hover { background: #e3edf8; }
.chat-task-sz { width: 96px; height: 36px; border: 1px solid #b6c9df; border-radius: 10px; padding: 0 9px; font-family: inherit; font-size: 12px; font-weight: 700; color: #1d3553; }
.chat-send.plan-btn { height: 36px; min-height: 36px; background: var(--module-active); color: #1e2024; border-color: rgba(255, 214, 150, 0.55); font-size: 11px; }
.chat-hint { font-size: 10px; color: #5b7390; padding: 0 14px 8px; background: #f5f8fc; min-height: 8px; }

/* ── «Новый чат» ────────────────────────────────────────────────────────── */
.chat-pop { position: absolute; top: 44px; left: 8px; width: 360px; z-index: 30; box-shadow: 0 12px 24px rgba(18, 34, 56, 0.35); }
.chat-pop .roster-win-group { justify-self: start; }
.chat-pop-input { width: 100%; min-width: 0; }
.chat-pop-people { max-height: 240px; overflow-y: auto; display: grid; gap: 2px; border: 1px solid #d3deea; border-radius: 9px; background: #fff; padding: 4px; }
.chat-pop-person { display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: #1d3553; padding: 5px 6px; border-radius: 7px; cursor: pointer; }
.chat-pop-person:hover { background: #e3edf8; }
.chat-pop-person small { margin-left: auto; color: #5b7390; font-size: 10px; text-align: right; }
.chat-pop-empty { padding: 10px; font-size: 11px; color: #5b7390; }
.chat-pop-foot { justify-content: flex-end; }

@media (max-width: 900px) {
  .chat-sheet { grid-template-columns: 220px minmax(0, 1fr); }
}
