/* css/side-panel.css
 * ★ E5.1-ux-fix18 — Полноэкранная панель: чаты + лог.
 * ★ E5.2-6: Мессенджер-стиль для лога. Модалка, фон.
 * ★ E5.2-7: Редизайн карточки Дела и формы.
 * ★ E5.2-11: Пул задач по роли.
 * ★ E5.2-12: Форма в одну строку, автоопределение типа.
 * ★ E5.2-13: Textarea с авто-ресайзом.
 * ★ E5.2-14: Время под сообщением, дата-разделитель.
 * ★ E5.2-15: Аватарка и имя для своих и входящих сообщений.
 * ★ E5.2-17: Авто-ресайз композера чата, единый тонкий паттерн.
 * ★ E5.2-18: Кнопки retry/delete для failed-сообщений чата.
 *
 * ★ log-highlight: визуальное отличие колонки «Общий лог» от чатов
 *   заказа/проекта в 3-колоночном режиме:
 *   — лог темнее (синеватый фон), контрастнее паттерн;
 *   — inset shadow для «глубины»;
 *   — заголовок лога затемнён (фиолетово-сиреневый градиент);
 *   — усилены тени сообщений (bubble, системные, даты).
 */

body.side-panel-open { overflow: hidden; }

/* ============================================================
   ★ Единый тонкий паттерн для чата и лога
   ============================================================ */
:root {
  /* Чаты (заказа / проекта) — светлый фон */
  --doodle-pattern: radial-gradient(#dde2ed 1px, transparent 1px);
  --doodle-size: 22px 22px;
  --doodle-bg: #f0f3f8;

  /* ★ Лог — темнее, синеватый, с более контрастным паттерном */
  --log-pattern: radial-gradient(#c5cfe2 1px, transparent 1px);
  --log-pattern-size: 20px 20px;
  --log-bg: #e4e9f2;
}

/* ============================================================
   ПАНЕЛЬ
   ============================================================ */
.side-panel {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg, #f6f7fb);
  z-index: 900;
  overflow: hidden;
  opacity: 0;
  transform: scale(0.98);
  transition: opacity .18s ease, transform .18s ease;
}
.side-panel.is-open { opacity: 1; transform: scale(1); }

/* ============================================================
   ТЕЛО: GRID 2 / 3 КОЛОНКИ
   ============================================================ */
.side-panel__body {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: 40% 60%;
  overflow: hidden;
}
.side-panel--three-col .side-panel__body {
  grid-template-columns: 35% 30% 35%;
}

.side-panel__col {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border-right: 1px solid var(--line, #dfe3ee);
  background: var(--surface, #fff);
}
.side-panel__col:last-child { border-right: 0; }

/* ★ log-highlight: лог визуально отделён — более тёмные границы */
.side-panel__col--log {
  border-left: 1px solid #c9d2e3;
  border-right: 1px solid #c9d2e3;
}

/* ============================================================
   ШАПКА КОЛОНКИ
   ============================================================ */
.side-panel__col-head {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line, #dfe3ee);
  background: linear-gradient(115deg, #fff 0%, #fcfbff 54%, #f1effc 100%);
}
.side-panel__col-head--log { padding: 10px 14px; }

/* ★ log-highlight: заголовок лога темнее — фиолетово-сиреневый */
.side-panel__col--log .side-panel__col-head--log {
  background: linear-gradient(115deg, #e8e3f7 0%, #ede9f9 54%, #e1daf3 100%);
  border-bottom-color: #cfc6e8;
}

.side-panel__col-head-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}
.side-panel__col-title {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text, #171a2b);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ★ log-highlight: заголовок лога — с акцентной полосой слева */
.side-panel__col--log .side-panel__col-title {
  color: #4d3e7a;
}

.side-panel__order-tag {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  font-weight: 700;
  color: var(--primary, #7867e6);
  background: var(--primary-soft, #eeeaff);
  padding: 2px 8px;
  border-radius: 6px;
  letter-spacing: .02em;
  white-space: nowrap;
}
.side-panel__col-close {
  margin-left: auto;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted, #6f7890);
  font-size: 20px;
  line-height: 1;
  border-radius: 8px;
  cursor: pointer;
  transition: .16s;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.side-panel__col-close:hover {
  color: var(--danger, #d66573);
  background: var(--danger-soft, #fdecef);
}

.side-panel__customer-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 12px;
  line-height: 1.4;
  color: var(--muted, #6f7890);
}
.side-panel__customer-meta-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
}
.side-panel__customer-meta-label {
  font-weight: 700;
  color: var(--text, #171a2b);
  margin-right: 2px;
}
.side-panel__dot { color: var(--line-strong, #cfd5e3); }
.side-panel__unread {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  background: var(--danger, #d66573);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  border-radius: 999px;
  line-height: 1;
}

/* ── Тело колонки ── */
.side-panel__col-body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 16px;
  background: var(--bg, #f6f7fb);
}
.side-panel__body-slot {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.side-panel__col--log .side-panel__col-body,
.side-panel__col--chat .side-panel__col-body {
  padding: 0;
  background: transparent;
}

/* ============================================================
   ЗАГЛУШКИ
   ============================================================ */
.side-panel__empty {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  text-align: center;
  gap: 10px;
  color: var(--muted, #6f7890);
  padding: 24px;
}
.side-panel__empty-title {
  font-size: 13px;
  font-weight: 800;
  color: var(--text, #171a2b);
  text-transform: uppercase;
  letter-spacing: .05em;
}
.side-panel__empty p { margin: 0; max-width: 340px; font-size: 13px; line-height: 1.55; }

/* ============================================================
   ЧАТ: КОНТЕЙНЕР (единый тонкий паттерн)
   ============================================================ */
.chat-list {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 0;
  overflow-y: auto;
  padding: 12px;
  background-color: var(--doodle-bg);
  background-image: var(--doodle-pattern);
  background-size: var(--doodle-size);
  background-repeat: repeat;
}

.chat-msg--incoming {
  display: flex;
  flex-direction: row;
  gap: 8px;
  align-items: flex-start;
  max-width: 85%;
  align-self: flex-start;
}

.chat-msg--self {
  display: flex;
  flex-direction: row-reverse;
  gap: 8px;
  align-items: flex-start;
  max-width: 85%;
  align-self: flex-end;
}

.chat-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary-soft, #eeeaff);
  color: var(--primary, #7867e6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 11px;
  flex-shrink: 0;
  border: 1px solid rgba(120,103,230,0.2);
}

.chat-msg__content {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.chat-msg--self .chat-msg__content { align-items: flex-end; }

.chat-msg__author {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted, #6f7890);
  padding-left: 4px;
}
.chat-msg--self .chat-msg__author {
  text-align: right;
  padding-left: 0;
  padding-right: 4px;
}

.chat-msg__bubble {
  background: var(--surface, #fff);
  border: 1px solid var(--line, #dfe3ee);
  border-radius: 4px 14px 14px 14px;
  padding: 8px 12px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text, #171a2b);
  word-break: break-word;
  overflow-wrap: anywhere;
  box-shadow: 0 2px 6px rgba(49,43,86,.03);
  max-width: 100%;
}
.chat-msg--self .chat-msg__bubble {
  background: var(--primary-soft, #eeeaff);
  border-color: var(--primary-soft, #eeeaff);
  border-radius: 14px 4px 14px 14px;
}

.chat-msg__text {
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.chat-msg__meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 3px;
}
.chat-msg__time { font-size: 10px; color: var(--soft, #98a0b5); }
.chat-msg__status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
}
.chat-msg__status svg { width: 12px; height: 12px; }
.chat-msg__status--pending { color: var(--muted, #6f7890); }
.chat-msg__status--sent    { color: var(--primary, #7867e6); }
.chat-msg__status--failed  { color: var(--danger, #d66573); }

/* ============================================================
   ★ Кнопки retry/delete для failed-сообщений
   ============================================================ */
.chat-msg__retry {
  background: none;
  border: none;
  padding: 0;
  margin-left: 4px;
  font-family: inherit;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--danger, #d66573);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
  pointer-events: auto;
  -webkit-user-drag: none;
  user-select: none;
}
.chat-msg__retry:hover { opacity: 0.75; }

.chat-msg__delete {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  padding: 0;
  margin-left: 6px;
  border: 1px solid var(--line-strong, #cfd5e3);
  background: transparent;
  color: var(--danger, #d66573);
  border-radius: 50%;
  cursor: pointer;
  transition: .16s;
  vertical-align: middle;
  flex-shrink: 0;
  font-family: inherit;
  line-height: 1;
  pointer-events: auto;
  -webkit-user-drag: none;
  user-select: none;
}
.chat-msg__delete:hover {
  background: var(--danger, #d66573);
  color: #fff;
  border-color: var(--danger, #d66573);
}

/* ★ SVG крестика: 8×8, pointer-events: none — клик идёт на button */
.chat-msg__status .chat-msg__delete svg {
  width: 8px;
  height: 8px;
  pointer-events: none;
  display: block;
  flex-shrink: 0;
}

/* ============================================================
   COMPOSER (ЧАТ)
   ============================================================ */
.chat-composer {
  flex-shrink: 0;
  display: flex;
  gap: 6px;
  align-items: flex-end;
  padding: 10px 12px;
  border-top: 1px solid var(--line, #dfe3ee);
  background: var(--surface, #fff);
}
.chat-composer__tool {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--line, #dfe3ee);
  background: var(--surface, #fff);
  color: var(--muted, #6f7890);
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: .16s;
}
.chat-composer__tool:hover {
  color: var(--primary, #7867e6);
  background: var(--primary-pale, #f7f5ff);
  border-color: var(--primary-soft, #eeeaff);
}
.chat-composer__tool svg { width: 18px; height: 18px; }

.chat-composer__input {
  flex: 1;
  min-width: 0;
  min-height: 36px;
  max-height: 200px;
  padding: 8px 12px;
  border: 1px solid var(--line-strong, #cfd5e3);
  border-radius: 8px;
  font: inherit;
  font-size: 13px;
  line-height: 1.5;
  background: var(--surface, #fff);
  color: var(--text, #171a2b);
  outline: none;
  resize: none;
  overflow-y: hidden;
  transition: border-color .16s, box-shadow .16s;
}
.chat-composer__input:focus {
  border-color: var(--primary, #7867e6);
  box-shadow: 0 0 0 3px var(--primary-soft, #eeeaff);
}
.chat-composer__input::placeholder { color: var(--soft, #98a0b5); }
.chat-composer__input--dragover {
  border-color: var(--primary, #7867e6);
  background: var(--primary-pale, #f7f5ff);
}

.chat-composer__send {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--primary, #7867e6);
  background: var(--primary, #7867e6);
  color: #fff;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: .16s;
}
.chat-composer__send:hover {
  background: var(--primary-strong, #5a4fd0);
  border-color: var(--primary-strong, #5a4fd0);
}
.chat-composer__send svg { width: 16px; height: 16px; }
.chat-composer.is-hidden { display: none; }

/* ============================================================
   ЧАТ: СОСТОЯНИЯ, СТАТУСЫ, TYPING, BANNER
   ============================================================ */
.chat-inline-loading,
.chat-inline-empty {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  gap: 8px;
  text-align: center;
  padding: 24px;
  color: var(--muted, #6f7890);
  font-size: 13px;
  line-height: 1.5;
}
.chat-inline-empty__title {
  font-size: 13px;
  font-weight: 800;
  color: var(--text, #171a2b);
  text-transform: uppercase;
  letter-spacing: .05em;
}
.chat-inline-empty p { margin: 0; max-width: 340px; }
.chat-inline-empty--small { min-height: 40px; font-size: 12px; }

.chat-retry-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  background: var(--danger-soft, #fdecef);
  border-top: 1px solid #f5c2c7;
  color: var(--danger, #d66573);
  font-size: 12.5px;
  font-weight: 650;
  flex-shrink: 0;
}
.chat-retry-banner.is-hidden { display: none; }
.chat-retry-banner__text { flex: 1; min-width: 0; }
.chat-retry-banner__btn {
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid currentColor;
  background: transparent;
  color: inherit;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: .16s;
  flex-shrink: 0;
}
.chat-retry-banner__btn:hover { background: var(--danger, #d66573); color: #fff; }
.chat-typing {
  font-style: italic;
  color: var(--muted, #6f7890);
  font-size: 12px;
  padding: 4px 6px;
  align-self: flex-start;
}

/* ============================================================
   ЛОГ: КОНТЕЙНЕР
   ★ log-highlight: темнее фон, контрастнее паттерн, inset shadow
   ============================================================ */
.log-container {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background-color: var(--log-bg);
  background-image: var(--log-pattern);
  background-size: var(--log-pattern-size);
  background-repeat: repeat;
  /* ★ лёгкая «вдавленность» — глубина */
  box-shadow: inset 0 2px 24px rgba(49,43,86,.06);
}

.log-tabs {
  flex-shrink: 0;
  display: flex;
  gap: 2px;
  padding: 10px 14px 0;
  border-bottom: 1px solid var(--line, #dfe3ee);
  background: var(--surface, #fff);
}
.log-tab {
  padding: 8px 16px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted, #6f7890);
  border-radius: 8px 8px 0 0;
  cursor: pointer;
  border: 1px solid transparent;
  border-bottom: none;
  background: transparent;
  transition: .16s;
}
.log-tab:hover { color: var(--text, #171a2b); }
.log-tab.is-active {
  background: var(--log-bg);
  color: var(--primary, #7867e6);
  border-color: var(--line, #dfe3ee);
  border-bottom-color: var(--log-bg);
  margin-bottom: -1px;
}

.log-feed {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ============================================================
   СИСТЕМНЫЕ СООБЩЕНИЯ
   ============================================================ */
.log-date-sep {
  display: flex;
  justify-content: center;
  margin: 10px 0;
}
.log-date-sep span {
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(4px);
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted, #6f7890);
  text-transform: uppercase;
  /* ★ log-highlight: дата-разделитель на тёмном фоне нуждается в тени */
  box-shadow: 0 2px 6px rgba(49,43,86,.08);
}

.log-system-msg {
  align-self: center;
  max-width: 80%;
  text-align: center;
  margin-bottom: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.log-system-text {
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(4px);
  padding: 6px 14px;
  border-radius: 16px;
  font-size: 12px;
  line-height: 1.4;
  color: var(--text, #171a2b);
  /* ★ log-highlight: усиленная тень для глубины */
  box-shadow: 0 2px 8px rgba(49,43,86,.06);
}
.log-system-time {
  font-size: 10px;
  color: var(--soft, #98a0b5);
}

/* ============================================================
   ПОЛЬЗОВАТЕЛЬСКИЕ СООБЩЕНИЯ (лог)
   ============================================================ */
.log-msg {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  max-width: 90%;
  min-width: 0;
}
.log-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary-soft, #eeeaff);
  color: var(--primary, #7867e6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 11px;
  flex-shrink: 0;
  border: 1px solid rgba(120,103,230,0.2);
}
.log-avatar--sm { width: 24px; height: 24px; font-size: 10px; }

.log-msg-content {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  flex: 1 1 auto;
}

.log-msg-header {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted, #6f7890);
  margin-bottom: 2px;
}

.log-bubble {
  background: var(--surface, #fff);
  border: 1px solid var(--line, #dfe3ee);
  border-radius: 4px 14px 14px 14px;
  padding: 10px 14px;
  /* ★ log-highlight: усиленная тень */
  box-shadow: 0 3px 10px rgba(49,43,86,.07);
  font-size: 13px;
  line-height: 1.5;
  color: var(--text, #171a2b);
  word-break: break-word;
  overflow-wrap: anywhere;
}

.log-msg-time {
  font-size: 10px;
  color: var(--soft, #98a0b5);
  text-align: right;
}

/* ============================================================
   КАРТОЧКА ДЕЛА
   ============================================================ */
.log-task-card {
  background: var(--surface, #fff);
  border: 1px solid var(--line, #dfe3ee);
  border-left: 3px solid var(--primary, #7867e6);
  border-radius: 4px 12px 12px 4px;
  padding: 12px 14px;
  /* ★ log-highlight: усиленная тень */
  box-shadow: 0 3px 12px rgba(49,43,86,.07);
  margin-top: 6px;
  transition: .16s;
  min-width: 0;
  max-width: 100%;
}
.log-task-card.is-overdue {
  border-left-color: var(--danger, #d66573);
  background: #fffcfc;
}
.log-task-card.is-completed {
  opacity: 0.65;
  border-left-color: var(--soft, #98a0b5);
  background: var(--surface-2, #fbfbfe);
}

.log-task-card__head {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}
.log-task-type-icon {
  color: var(--primary, #7867e6);
  display: flex;
  align-items: center;
  justify-content: center;
}
.log-task-type-label {
  font-size: 11px;
  font-weight: 800;
  color: var(--muted, #6f7890);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.log-task-overdue {
  margin-left: auto;
  font-size: 10px;
  font-weight: 800;
  color: var(--danger, #d66573);
  background: var(--danger-soft, #fdecef);
  padding: 2px 6px;
  border-radius: 4px;
}

.log-task-card__body {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  min-width: 0;
}
.log-task-checkbox {
  appearance: none;
  width: 18px;
  height: 18px;
  border: 1.5px solid var(--line-strong, #cfd5e3);
  border-radius: 5px;
  background: #fff;
  cursor: pointer;
  display: grid;
  place-items: center;
  margin-top: 1px;
  transition: .15s;
  flex-shrink: 0;
}
.log-task-checkbox:checked {
  background: var(--primary, #7867e6);
  border-color: var(--primary, #7867e6);
}
.log-task-checkbox:checked::after {
  content: "✓";
  color: #fff;
  font-size: 12px;
  font-weight: 900;
}
.log-task-text {
  font-size: 13.5px;
  line-height: 1.5;
  font-weight: 600;
  color: var(--text, #171a2b);
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
  min-width: 0;
  flex: 1 1 auto;
}
.log-task-card.is-completed .log-task-text {
  text-decoration: line-through;
  color: var(--muted, #6f7890);
}

.log-task-card__footer {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
  padding-left: 28px;
}
.log-task-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted, #6f7890);
}
.log-task-meta-item.text-danger {
  color: var(--danger, #d66573);
}

/* ============================================================
   ФУТЕР (ФОРМА ЛОГА)
   ============================================================ */
.log-footer {
  flex-shrink: 0;
  padding: 10px 14px;
  background: var(--surface, #fff);
  border-top: 1px solid var(--line, #dfe3ee);
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 10;
}

.log-switch {
  display: flex;
  gap: 4px;
  background: var(--surface-2, #fbfbfe);
  padding: 4px;
  border-radius: 10px;
  border: 1px solid var(--line, #dfe3ee);
  height: 38px;
}
.log-switch button {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  background: transparent;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted, #6f7890);
  cursor: pointer;
  transition: .16s;
}
.log-switch button:hover { color: var(--text, #171a2b); }
.log-switch button.active {
  background: var(--primary, #7867e6);
  color: #fff;
  box-shadow: 0 2px 8px rgba(120,103,230,0.3);
}

.log-form-container {
  display: flex;
  flex-direction: column;
}

.log-input-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  width: 100%;
}

.log-form-task {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.log-task-bottom {
  display: flex;
  gap: 6px;
  align-items: flex-end;
}

.log-input {
  flex: 1;
  min-width: 0;
  min-height: 38px;
  max-height: 200px;
  padding: 9px 12px;
  border: 1px solid var(--line-strong, #cfd5e3);
  border-radius: 8px;
  font: inherit;
  font-size: 13px;
  line-height: 1.4;
  color: var(--text, #171a2b);
  background: #fff;
  outline: none;
  resize: none;
  overflow-y: hidden;
  transition: border-color .16s, box-shadow .16s;
}
.log-input:focus {
  border-color: var(--primary, #7867e6);
  box-shadow: 0 0 0 3px var(--primary-soft, #eeeaff);
}
.log-input::placeholder { color: var(--soft, #98a0b5); }

.log-date-input--inline {
  flex-shrink: 0;
  width: 140px;
  height: 38px;
  padding: 0 8px;
  border-radius: 8px;
  border: 1px solid var(--line-strong, #cfd5e3);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text, #171a2b);
  background: #fff;
  outline: none;
  cursor: pointer;
}
.log-date-input--inline:focus {
  border-color: var(--primary, #7867e6);
  box-shadow: 0 0 0 3px var(--primary-soft, #eeeaff);
}

.log-assignee-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 38px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px dashed var(--line-strong, #cfd5e3);
  background: transparent;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted, #6f7890);
  cursor: pointer;
  flex-shrink: 0;
  white-space: nowrap;
}
.log-assignee-btn:hover {
  border-color: var(--primary, #7867e6);
  color: var(--primary, #7867e6);
  background: var(--primary-pale, #f7f5ff);
}

.log-assignee-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 38px;
  padding: 0 10px;
  border-radius: 8px;
  background: var(--primary-soft, #eeeaff);
  color: var(--primary, #7867e6);
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
  white-space: nowrap;
}
.log-assignee-pill button {
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--primary, #7867e6);
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.log-btn-send {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary, #7867e6);
  color: #fff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: .16s;
}
.log-btn-send:hover { background: var(--primary-strong, #5a4fd0); }
.log-btn-send:disabled { opacity: 0.5; cursor: not-allowed; }

/* ============================================================
   МОДАЛКА ВЫБОРА РОЛИ
   ============================================================ */
.log-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(30,29,43,0.3);
  backdrop-filter: blur(2px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.log-modal-overlay.is-open { display: flex; }

.log-modal {
  background: #fff;
  border-radius: 14px;
  width: 100%;
  max-width: 340px;
  max-height: 80vh;
  box-shadow: 0 10px 40px rgba(0,0,0,0.1);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.log-modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line, #dfe3ee);
  flex-shrink: 0;
}
.log-modal-head h3 { margin: 0; font-size: 14px; font-weight: 800; }
.log-modal-head button {
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--muted, #6f7890);
  cursor: pointer;
  padding: 0;
  line-height: 1;
}
.log-modal-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 6px;
}
.log-modal-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: .1s;
}
.log-modal-item:hover { background: var(--primary-pale, #f7f5ff); }
.log-modal-item span { font-size: 13px; font-weight: 600; }

/* ============================================================
   АДАПТИВ
   ============================================================ */
@media (max-width: 960px) {
  .side-panel__body,
  .side-panel--three-col .side-panel__body {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr 1fr;
    overflow-y: auto;
  }
  .side-panel__col {
    border-right: 0;
    border-bottom: 1px solid var(--line, #dfe3ee);
    min-height: 50vh;
  }
  .side-panel__col:last-child { border-bottom: 0; }

  /* ★ log-highlight: на мобиле разделитель лога сверху/снизу */
  .side-panel__col--log {
    border-left: 0;
    border-right: 0;
    border-top: 2px solid #c9d2e3;
    border-bottom: 2px solid #c9d2e3;
  }
}

/* ============================================================
   ★ publish-target: 2-строчная форма в 3-колоночном режиме
   ============================================================ */

.log-form-task--two-rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.log-task-controls {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.log-task-input-row {
  display: flex;
  gap: 6px;
  align-items: flex-end;
}

.log-task-input-row .log-input {
  flex: 1;
}

/* Chip «→ Заказ / → Проект» — всегда с текстом (не только иконка),
   чтобы менеджер сразу видел назначение переключателя. */
.log-publish-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 38px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid var(--primary-soft, #eeeaff);
  background: var(--primary-soft, #eeeaff);
  color: var(--primary, #7867e6);
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
  white-space: nowrap;
  transition: var(--t-fast, .16s);
}

.log-publish-chip:hover {
  background: var(--primary, #7867e6);
  color: #fff;
  border-color: var(--primary, #7867e6);
}

.log-publish-chip svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.log-publish-chip__label {
  letter-spacing: .02em;
}