/* Журнал КЦ. Кольори, шапка, кнопки, поля й повідомлення — ті самі, що на
   робочому місці: base.css, layout.css, panel.css. Тут лише те, чого там немає. */

.journal {
  flex: 1;
  min-height: 0;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  overflow-y: auto;
}
.journal__title { font-family: var(--font-display); font-size: 18px; }

.journal-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}

/* Фільтри */
.filters-card { padding: 16px; display: flex; flex-direction: column; gap: 16px; }
.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px 16px; }
.filters__actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Таблиця */
.table-wrap { overflow-x: auto; }
.journal-table { width: 100%; border-collapse: collapse; }
.journal-table th {
  padding: 12px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}
.journal-table td { padding: 12px; vertical-align: middle; border-bottom: 1px solid var(--border); }
.journal-table th:first-child, .journal-table td:first-child { padding-left: 16px; }
.journal-table th:last-child, .journal-table td:last-child { padding-right: 16px; width: 1%; white-space: nowrap; }
/* Дати не переносяться на другий рядок, довга назва статусу обрізається. */
.journal-table .nowrap { white-space: nowrap; }
.journal-table .col-icon { width: 1%; text-align: center; }
.journal-table .badge { max-width: 160px; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; }
.journal-table tbody tr:last-child td { border-bottom: 0; }
.journal-table tbody tr:hover { background: var(--action-bg); }
.task-id { font-family: var(--font-mono); font-size: 12px; color: var(--muted); }

/* Статуси — готові .badge--<статус> з base.css. Позначка архіву поруч зі статусом. */
.archived-mark { margin-left: 6px; color: var(--muted); }

/* Значки каналу й типу — ті самі, що в стрічці робочого місця (feed.css). */
.icon { display: inline-flex; align-items: center; justify-content: center; flex: none; vertical-align: middle; }
.icon svg { display: block; }
.icon--kind { width: 28px; height: 28px; border-radius: 8px; background: #E6EAF0; color: #16202E; }
.icon--kind.icon--chat { background: #16202E; color: #FFFFFF; }
.icon--channel { width: 28px; height: 28px; color: var(--muted); }
.icon--telegram { color: #229ED9; }
.icon--viber { color: #7360F2; }
.icon--whatsapp { color: #1FA855; }

/* Кнопка рядка: «Переглянути» і значок додаткової дії (експорт / інфо) в одній рамці. */
.split-button {
  display: inline-flex;
  align-items: stretch;
  height: 32px;
  border: 1px solid var(--border-input);
  border-radius: 8px;
  background: var(--surface);
  overflow: hidden;
}
.split-button button {
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.split-button button:hover { background: var(--action-bg); }
.split-button button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.split-button .split-button__main { padding: 0 12px; white-space: nowrap; }
.split-button .split-button__side {
  width: 32px;
  display: grid;
  place-items: center;
  border-left: 1px solid var(--border-input);
  color: var(--muted);
}
.split-button .split-button__side:hover { color: var(--accent); }

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}

.empty-state { padding: 48px 16px; text-align: center; color: var(--muted); }
.empty-state h3 { font-size: 15px; font-weight: 600; color: var(--text); margin-bottom: 4px; }

/* Завантаження */
.loading-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 30;
  justify-content: center;
  align-items: center;
  background: rgba(22, 32, 46, .35);
}
.loading-overlay.active { display: flex; }
.loading-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--track);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Перегляд розмови */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 20;
  justify-content: center;
  align-items: center;
  padding: 16px;
  background: rgba(22, 32, 46, .5);
}
.modal.active { display: flex; }
.modal-content {
  width: 100%;
  max-width: 720px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 12px;
  background: var(--surface);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
}
.modal-header h2 { font-family: var(--font-display); font-size: 18px; min-width: 0; }
.modal-number { font-family: var(--font-mono); font-size: 12px; font-weight: 400; color: var(--muted); overflow-wrap: anywhere; }
.close-modal {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  border: 1px solid var(--border-input);
  background: var(--surface) url("/app/img/close.svg") no-repeat center;
  cursor: pointer;
}
.close-modal:hover { border-color: var(--muted); }
.modal-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px 24px 24px;
  overflow-y: auto;
  background: var(--bg);
}

/* Перегляд задачі: розділи й історія статусів. */
.modal-section { font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.modal-section:not(:first-child) { margin-top: 8px; }
.history { list-style: none; display: flex; flex-direction: column; gap: 8px; padding: 0; margin: 0; }
.history__item { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.history__who { font-weight: 500; }
.history__reason { color: var(--muted); }
.history__message { flex-basis: 100%; margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.history__item .message__time { margin-left: auto; white-space: nowrap; }
/* Плитки заявки й результат тесту — як у панелі робочого місця. */
.modal-body .tiles { margin: 0; }
.modal-body .tile-group { display: flex; flex-direction: column; gap: 6px; }
.modal-body .tile-group__title { font-weight: 600; }

/* Колонка «Користувач → співробітник» */
.people__arrow { color: var(--muted); margin: 0 6px; vertical-align: -2px; }
.people__arrow svg { width: 14px; height: 14px; }
.people__operator { color: var(--text-2); }
