/* ============================================
   СОВМЕСТНАЯ РАБОТА: общие проекты, опросы и голосовые в чате,
   упоминания @, события календаря с приглашениями.
   Цвета — только токены из начала style.css. Внутри пузыря сообщения
   оттенки считаем от currentColor — так они подходят и к своим (синим), и к чужим пузырям
   ============================================ */

.btn-link { padding: 0; border: none; background: none; color: var(--accent-ink); font: inherit; font-size: 13px; cursor: pointer; }
.btn-link:hover { text-decoration: underline; }
.ch-bubble .btn-link { color: inherit; opacity: .85; }
.au-body label.au-check { display: flex; flex-direction: row; align-items: center; justify-content: flex-start; gap: 8px; font-size: 14px; font-weight: 400; color: var(--text); text-align: left; cursor: pointer; }
.au-body label.au-check input { width: auto; margin: 0; }

/* ---------- упоминания ---------- */

.mention { padding: 0 3px; border-radius: 4px; background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent-ink); font-weight: 600; }
.mention.is-me { background: color-mix(in srgb, var(--amber) 22%, transparent); color: var(--text); }
.ch-msg.is-mine .mention { background: color-mix(in srgb, currentColor 18%, transparent); color: inherit; }
.ch-bubble.is-mention { box-shadow: inset 3px 0 0 var(--amber); }

.mention-pop {
  position: fixed;
  z-index: 3000;
  width: 260px;
  max-height: 264px;
  overflow-y: auto;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  box-shadow: var(--shadow);
}
.mention-row { display: flex; align-items: center; gap: 8px; width: 100%; padding: 6px 8px; border: none; border-radius: 8px; background: none; color: var(--text); text-align: left; cursor: pointer; }
.mention-row span { display: flex; flex-direction: column; min-width: 0; }
.mention-row b { font-size: 13px; font-weight: 600; }
.mention-row small { font-size: 11.5px; color: var(--muted); }
.mention-row.is-on, .mention-row:hover { background: var(--bg-hover); }

/* ---------- опрос в чате ---------- */

.ch-bubble.has-poll { min-width: min(300px, 100%); }
.ch-poll { display: flex; flex-direction: column; gap: 6px; padding: 2px 0 4px; }
.ch-poll-kind { display: flex; align-items: center; gap: 5px; font-size: 11.5px; opacity: .75; }
.ch-poll-q { font-size: 15px; font-weight: 600; line-height: 1.35; }
.ch-poll-opt {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 6px 10px;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, currentColor 22%, transparent);
  border-radius: 10px;
  background: none;
  color: inherit;
  font: inherit;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
}
.ch-poll-opt:hover:not(:disabled) { border-color: color-mix(in srgb, currentColor 45%, transparent); }
.ch-poll-opt:disabled { cursor: default; }
.ch-poll-opt.is-on { border-color: currentColor; }
.ch-poll-opt.is-top { font-weight: 600; }
.ch-poll-bar { position: absolute; inset: 0 auto 0 0; background: color-mix(in srgb, currentColor 12%, transparent); transition: width .3s ease; }
.ch-poll-mark { position: relative; display: grid; place-items: center; flex: none; width: 18px; height: 18px; border: 1.5px solid color-mix(in srgb, currentColor 45%, transparent); border-radius: 50%; }
.ch-poll-opt.is-on .ch-poll-mark { border-color: currentColor; background: color-mix(in srgb, currentColor 20%, transparent); }
.ch-poll-mark .ico { width: 12px; height: 12px; }
.ch-poll-text { position: relative; flex: 1; min-width: 0; }
.ch-poll-n { position: relative; font-size: 12px; opacity: .8; white-space: nowrap; }
.ch-poll-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: 12px; opacity: .8; }

.ch-poll-edit { display: flex; flex-direction: column; gap: 6px; }
.ch-poll-edit-row { display: flex; gap: 6px; }
.ch-poll-edit-row input { flex: 1; }

/* ---------- голосовые ---------- */

.ch-voice { display: flex; align-items: center; gap: 10px; min-width: 200px; padding: 2px 0 4px; }
.ch-voice-btn {
  display: grid;
  place-items: center;
  flex: none;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: color-mix(in srgb, currentColor 14%, transparent);
  color: inherit;
  cursor: pointer;
}
.ch-voice-btn:hover { background: color-mix(in srgb, currentColor 22%, transparent); }
.ch-voice-btn .ico { width: 16px; height: 16px; fill: currentColor; }
.ch-voice-track { position: relative; flex: 1; height: 4px; border-radius: 2px; background: color-mix(in srgb, currentColor 20%, transparent); cursor: pointer; }
.ch-voice-track::before { content: ""; position: absolute; inset: -8px 0; }   /* по полоске легче попасть */
.ch-voice-track i { position: absolute; inset: 0 auto 0 0; border-radius: 2px; background: currentColor; }
.ch-voice-time { min-width: 34px; font-size: 12px; font-variant-numeric: tabular-nums; opacity: .8; }

.ch-rec { border-left-color: var(--red); color: var(--text); }
.ch-rec-dot { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--red); animation: ch-rec-blink 1s ease-in-out infinite; }
.ch-rec b { font-variant-numeric: tabular-nums; }
@keyframes ch-rec-blink { 50% { opacity: .3; } }
.ch.is-recording .ch-input { opacity: .45; pointer-events: none; }

/* ---------- общие проекты: переключатель досок над Backlog ---------- */

.jr-project.pj-bar { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; letter-spacing: 0; }
.pj-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 15px;
  background: var(--bg-card);
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: border-color .15s ease, color .15s ease;
}
.pj-chip:hover { border-color: var(--border-strong); color: var(--text); }
.pj-chip.is-on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.pj-chip.is-add { border-style: dashed; }
.pj-emoji { font-size: 14px; }
.pj-faces { display: inline-flex; margin-left: 2px; }
.pj-faces > * { margin-left: -6px; border-radius: 50%; box-shadow: 0 0 0 2px var(--bg-card); }
.pj-faces > *:first-child { margin-left: 0; }
.pj-faces i { display: grid; place-items: center; width: 20px; height: 20px; background: var(--bg-hover); font-size: 10px; font-style: normal; color: var(--muted); }
.pj-gear { display: inline-grid; vertical-align: middle; }
.pj-emoji-row { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.pj-emojis { display: flex; flex-wrap: wrap; gap: 6px; }
.pj-emoji-pick { width: 38px; height: 38px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg-card); font-size: 18px; cursor: pointer; }
.pj-emoji-pick.is-on { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }

/* ---------- события в календаре ---------- */

.cal-chip.cal-ev { border-left-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); }
.cal-chip.cal-ev b { font-weight: 600; }
.cal-chip.cal-ev.is-invite { border-left-style: dashed; background: color-mix(in srgb, var(--amber) 16%, transparent); color: var(--text); }
.cal-chip.cal-ev.is-no { opacity: .5; text-decoration: line-through; }

.ev-day { margin-bottom: 16px; }
.ev-day-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.ev-day-head h4 { margin: 0; font-size: 13px; font-weight: 600; color: var(--muted); }
.ev-empty { margin: 0 0 4px; font-size: 13px; }
.ev-card {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 8px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
}
.ev-card.is-invite { border-left-color: var(--amber); }
.ev-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 20px; }
.ev-top .icon-btn { margin: -4px -6px -4px 0; }
.ev-time { font-size: 12px; font-weight: 600; color: var(--accent-ink); font-variant-numeric: tabular-nums; }
.ev-title { font-size: 14.5px; font-weight: 600; line-height: 1.35; }
.ev-place { display: flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--muted); }
.ev-note { margin: 0; font-size: 13px; color: var(--muted); white-space: pre-wrap; }
.ev-people { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.ev-people small { margin-left: 4px; font-size: 12px; color: var(--muted); }
.ev-face { position: relative; display: inline-flex; border-radius: 50%; }
.ev-face::after { content: ""; position: absolute; right: -1px; bottom: -1px; width: 9px; height: 9px; border-radius: 50%; box-shadow: 0 0 0 2px var(--bg-card); background: var(--border-strong); }
.ev-face.is-owner::after { display: none; }
.ev-face.is-yes::after { background: var(--green); }
.ev-face.is-maybe::after { background: var(--amber); }
.ev-face.is-no::after { background: var(--red); }
.ev-face.is-no { opacity: .55; }

.ev-rsvp { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.ev-ans { height: 30px; padding: 0 12px; border: 1px solid var(--border); border-radius: 15px; background: var(--bg-card); color: var(--text); font: inherit; font-size: 13px; cursor: pointer; }
.ev-ans:hover:not(:disabled) { border-color: var(--border-strong); }
.ev-ans:disabled { opacity: .6; cursor: progress; }
.ev-ans.is-on.is-yes { border-color: var(--green); background: color-mix(in srgb, var(--green) 14%, transparent); font-weight: 600; }
.ev-ans.is-on.is-maybe { border-color: var(--amber); background: color-mix(in srgb, var(--amber) 16%, transparent); font-weight: 600; }
.ev-ans.is-on.is-no { border-color: var(--red); background: color-mix(in srgb, var(--red) 12%, transparent); font-weight: 600; }
.ev-invite .nt-task-actions { align-items: center; }
.ev-when { grid-template-columns: 1.4fr 1fr 1fr; }

@media (max-width: 600px) {
  .ch-voice { min-width: 160px; }
  .ev-when { grid-template-columns: 1fr 1fr; }
  .ev-when label:first-child { grid-column: 1 / -1; }
}
