/* Chat (pages/chat.html) */
.chat-shell {
  display: flex; flex-direction: column; height: calc(100dvh - var(--header-h) - 96px); min-height: 460px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-xl); box-shadow: var(--shadow-2); overflow: hidden;
}
.chat-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.chat-head-title { display: flex; align-items: center; gap: 12px; min-width: 0; }
.chat-head h1 { font: 650 19px/1.2 var(--font-body); margin: 0 0 2px; }
.chat-head p { margin: 0; }
.chat-log { list-style: none; margin: 0; padding: 14px 12px; overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 2px; background: var(--bg-2); }
.chat-msg { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 0 10px; padding: 6px 8px; border-radius: 12px; }
.chat-msg:hover { background: color-mix(in srgb, var(--surface-2) 70%, transparent); }
.chat-msg.cont { padding-top: 0; }
.chat-msg.cont .chat-avatar, .chat-msg.cont .chat-meta { display: none; }
.chat-msg.cont .chat-text { grid-column: 2; }
.chat-avatar { grid-row: span 2; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-weight: 700; font-size: 14px; color: #1a1108; }
.chat-meta { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; min-width: 0; }
.chat-name { font-weight: 700; font-size: 14.5px; overflow-wrap: anywhere; }
.chat-name.team { color: var(--bad); }
.chat-name.system { color: var(--accent-text); }
.chat-time { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.chat-text { margin: 0; overflow-wrap: anywhere; white-space: pre-wrap; color: var(--text-2); grid-column: 2; }
.chat-msg.own { background: var(--accent-soft); }
.chat-msg.chat-local { color: var(--muted); font-style: italic; display: block; text-align: center; font-size: 13px; }
.chat-actions { margin-left: auto; display: flex; gap: 4px; opacity: 0; transition: opacity .15s; }
.chat-msg:hover .chat-actions, .chat-actions:focus-within { opacity: 1; }
.chat-day { align-self: center; margin: 10px 0 6px; padding: 2px 12px; border-radius: 999px; font-size: 12px; font-weight: 600; color: var(--muted); background: var(--surface); border: 1px solid var(--border); }
.chat-form { display: flex; align-items: center; gap: 10px; padding: 12px; border-top: 1px solid var(--border); }
.chat-form input { flex: 1; min-height: 46px; border-radius: 12px; }
.chat-form .btn { --btn-h: 46px; }
.chat-form .char-count { margin: 0; min-width: 46px; text-align: right; }
.chat-shell > .msg { margin: 0 16px 8px; }
.chat-muted { margin: 0 12px 8px; }
.chat-foot { padding: 0 16px 12px; }
@media (max-width: 600px) {
  .chat-page { padding-top: 12px; padding-bottom: 12px; }
  .chat-shell { height: calc(100dvh - var(--header-h) - 24px); border-radius: var(--radius-l); }
  .chat-actions { opacity: 1; }
  .chat-head #chat-live { display: none; }
  .chat-form .char-count { display: none; }
}
