/* Панель оператора — темизация ТОЛЬКО через --tg-theme-* с фолбэками */
:root {
  --bg: var(--tg-theme-bg-color, #ffffff);
  --bg2: var(--tg-theme-secondary-bg-color, #f0f2f5);
  --text: var(--tg-theme-text-color, #111111);
  --hint: var(--tg-theme-hint-color, #8a8f98);
  --link: var(--tg-theme-link-color, #2481cc);
  --btn: var(--tg-theme-button-color, #2481cc);
  --btn-text: var(--tg-theme-button-text-color, #ffffff);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  font-size: 15px;
  background: var(--bg2);
  color: var(--text);
  overscroll-behavior: none;
}

#app { height: 100%; display: flex; flex-direction: column; }

.hidden { display: none !important; }

.screen { flex: 1; display: flex; flex-direction: column; min-height: 0; }

/* --- Загрузка --- */
#screen-loading { align-items: center; justify-content: center; }
.spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--hint);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --- Заглушки (нет доступа / не из Telegram / сессия) --- */
#screen-stub { align-items: center; justify-content: center; padding: 24px; }
.stub { text-align: center; max-width: 280px; }
.stub-icon { font-size: 44px; margin-bottom: 12px; }
.stub-text { color: var(--hint); font-size: 16px; line-height: 1.4; }

/* --- Вкладки --- */
.tabs {
  display: flex;
  background: var(--bg);
  border-bottom: 1px solid var(--bg2);
  position: sticky; top: 0; z-index: 5;
}
.tab {
  flex: 1;
  padding: 12px 4px;
  background: none; border: none;
  font-size: 14px; font-weight: 500;
  color: var(--hint);
  border-bottom: 2px solid transparent;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 5px;
}
.tab.active { color: var(--link); border-bottom-color: var(--link); }
.tab-badge {
  background: var(--bg2); color: var(--hint);
  border-radius: 9px; padding: 1px 6px; font-size: 12px;
}
.tab.active .tab-badge { background: var(--link); color: var(--btn-text); }
.tab-unread {
  background: #e53935; color: #fff;
  border-radius: 9px; padding: 1px 6px; font-size: 12px; font-weight: 600;
}

/* --- Фильтр --- */
#filter-row {
  padding: 8px 12px; background: var(--bg);
  display: flex; gap: 8px; align-items: center;
}
#filter-input {
  width: 100%; padding: 8px 12px;
  border: none; border-radius: 10px;
  background: var(--bg2); color: var(--text);
  font-size: 15px; outline: none;
}
#filter-input::placeholder { color: var(--hint); }

/* --- Список чатов --- */
#dialog-list { flex: 1; overflow-y: auto; background: var(--bg); }
.chat-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--bg2);
  cursor: pointer;
}
.chat-row:active { background: var(--bg2); }
.chat-main { flex: 1; min-width: 0; }
.chat-top { display: flex; align-items: baseline; gap: 6px; }
.chat-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-username { color: var(--hint); font-size: 13px; white-space: nowrap; }
.chat-last {
  color: var(--hint); font-size: 13px; margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chat-last .lm-prefix { color: var(--text); }
.chat-last.lm-event { font-style: italic; }
.chat-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex-shrink: 0; }
.chat-time { color: var(--hint); font-size: 12px; }
.chat-badges { display: flex; align-items: center; gap: 5px; }
.ticket-badge {
  font-size: 11px; font-weight: 600; border-radius: 8px; padding: 1px 6px; color: #fff;
}
.ticket-badge.st-open { background: #fb8c00; }
.ticket-badge.st-mine { background: #43a047; }
.ticket-badge.st-foreign { background: #9e9e9e; }
.unread-badge {
  background: #e53935; color: #fff; font-size: 12px; font-weight: 600;
  border-radius: 10px; min-width: 20px; height: 20px;
  display: flex; align-items: center; justify-content: center; padding: 0 5px;
}
.empty { padding: 48px 24px; text-align: center; color: var(--hint); font-size: 15px; }

/* --- Диалог: шапка --- */
#dlg-header {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px;
  background: var(--bg);
  border-bottom: 1px solid var(--bg2);
  position: sticky; top: 0; z-index: 5;
}
#dlg-back {
  background: none; border: none; font-size: 22px; color: var(--link);
  cursor: pointer; padding: 4px 8px 4px 0; line-height: 1;
}
#dlg-head-main { flex: 1; min-width: 0; }
#dlg-title-row { display: flex; align-items: baseline; gap: 6px; min-width: 0; }
#dlg-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#dlg-username { color: var(--hint); font-size: 13px; white-space: nowrap; }
#dlg-status { color: var(--hint); font-size: 12px; margin-top: 1px; }

/* --- Вкладки внутри тикета: «Клиент» | «Ассистент» ---
 * Вкладка «Ассистент» окрашена в свой (фиолетовый) цвет: оператор обязан
 * видеть без чтения, где он сейчас пишет. */
.dlg-tabs {
  display: flex;
  background: var(--bg);
  border-bottom: 1px solid var(--bg2);
  flex-shrink: 0;
}
.dlg-tab {
  flex: 1;
  padding: 9px 4px;
  background: none; border: none;
  border-bottom: 2px solid transparent;
  font-size: 14px; font-weight: 600;
  color: var(--hint); cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.dlg-tab.active { color: var(--link); border-bottom-color: var(--link); }
#dlg-tab-assistant.active { color: #7e57c2; border-bottom-color: #7e57c2; }
/* Непрочитанное на заголовке вкладки: оператор сидит на одной, новое приходит
 * на обе — счётчик, а не тишина */
.dlg-tab-dot {
  background: #e53935; color: #fff;
  border-radius: 9px; min-width: 18px; padding: 1px 6px;
  font-size: 11px; font-weight: 700; line-height: 16px;
}
/* Скрыто вкладкой — отдельный класс: hidden на тех же узлах значит
 * «показывать нечего вообще», и вкладка его не затирает */
.tab-hidden { display: none !important; }
#screen-dialog.tab-assistant #dlg-assistant {
  flex: 1; min-height: 0; max-height: none; border-top: none;
}

/* --- Диалог: блок «Данные клиента» из базы VPN (FR-12) --- */
#dlg-customer {
  background: var(--bg);
  border-bottom: 1px solid var(--bg2);
  flex-shrink: 0;
}
#dlg-customer-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 12px;
}
#dlg-customer-title { font-size: 12px; font-weight: 600; color: var(--hint); text-transform: uppercase; letter-spacing: 0.03em; }
#dlg-customer-actions { display: flex; align-items: center; gap: 8px; }
#cust-refresh {
  background: none; border: 1px solid var(--link); color: var(--link);
  border-radius: 8px; padding: 2px 10px; font-size: 12px; cursor: pointer;
}
#cust-collapse {
  background: none; border: 1px solid var(--bg2); color: var(--hint);
  border-radius: 8px; padding: 2px 8px; font-size: 12px; line-height: 1; cursor: pointer;
}
/* Свёрнуто: тело данных клиента скрыто, стрелка смотрит вправо (см. app.js) */
#dlg-customer.collapsed #dlg-customer-body { display: none; }
#dlg-customer-body {
  max-height: 34vh; overflow-y: auto;
  padding: 0 12px 8px;
  display: flex; flex-direction: column; gap: 8px;
}
.cust-msg { color: var(--hint); font-size: 13px; padding: 2px 0; }
.cust-head { display: flex; flex-direction: column; gap: 3px; }
.cust-contacts { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; }
.cust-name { font-weight: 600; font-size: 14px; }
.cust-chip {
  font-size: 12px; color: var(--text); background: var(--bg2);
  border-radius: 6px; padding: 1px 7px; word-break: break-all;
}
.cust-summary { font-size: 12px; color: var(--hint); }

/* Живая подписка (курс): две плотные строки */
.cust-sub {
  border: 1px solid var(--bg2); border-radius: 10px;
  padding: 6px 9px; display: flex; flex-direction: column; gap: 2px;
}
.cust-sub-top { display: flex; align-items: baseline; gap: 7px; flex-wrap: wrap; }
.cust-tariff { font-weight: 600; font-size: 14px; }
.cust-term { font-size: 12px; color: var(--hint); margin-left: auto; }
.cust-detail { color: var(--hint); font-size: 12px; }
.cust-line { font-size: 13px; color: var(--text); }
.cust-sub-line { color: var(--hint); font-size: 12px; word-break: break-all; }
.cust-warn { color: #e53935; font-weight: 500; }

/* Точка статуса вместо крупного бейджа — экономит строку */
.cust-dot {
  width: 7px; height: 7px; border-radius: 50%;
  display: inline-block; flex: none;
}
.cust-dot.st-active { background: #43a047; }
.cust-dot.st-exhausted { background: #fb8c00; }
.cust-dot.st-expired { background: var(--hint); }
.cust-dot.st-cancelled { background: #e53935; }
.cust-dot.st-unknown { background: var(--hint); }

/* Истёкшие: свёртка в одну строку */
.cust-dead { display: flex; flex-direction: column; gap: 4px; }
.cust-dead-head {
  display: flex; align-items: baseline; gap: 6px;
  font-size: 12px; color: var(--hint); cursor: pointer;
}
.cust-dead-label { flex: none; }
.cust-dead-preview {
  flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cust-dead-caret { flex: none; }
.cust-dead-list { display: flex; flex-direction: column; gap: 3px; padding-left: 2px; }
.cust-dead-row { display: flex; align-items: baseline; gap: 6px; font-size: 12px; }
.cust-dead-name { color: var(--text); }
.cust-dead-when { color: var(--hint); margin-left: auto; }
.cust-dead-fresh {
  flex: none; font-size: 11px; color: #fb8c00;
}

/* --- Диалог: лента --- */
#dlg-messages {
  flex: 1; overflow-y: auto;
  padding: 10px 12px;
  display: flex; flex-direction: column; gap: 6px;
}
.msg { max-width: 82%; display: flex; flex-direction: column; }
.msg-client { align-self: flex-start; }
.msg-operator, .msg-ai { align-self: flex-end; }
.bubble {
  padding: 7px 11px; border-radius: 14px;
  font-size: 15px; line-height: 1.35;
  white-space: pre-wrap; word-break: break-word;
}
.msg-client .bubble { background: var(--bg); border-bottom-left-radius: 4px; }
.msg-operator .bubble {
  background: var(--btn); color: var(--btn-text);
  border-bottom-right-radius: 4px;
}
.msg-ai .bubble {
  background: var(--bg); color: var(--hint);
  border: 1px dashed var(--hint);
  border-bottom-right-radius: 4px;
}
.msg-meta { font-size: 11px; color: var(--hint); margin-top: 2px; display: flex; gap: 6px; }
.msg-operator .msg-meta, .msg-ai .msg-meta { justify-content: flex-end; }
.msg-event { align-self: center; text-align: center; color: var(--hint); font-size: 12px; padding: 2px 8px; max-width: 92%; }
.msg-pending .bubble { opacity: 0.55; }
.msg-failed .bubble { background: #e53935; color: #fff; }
.msg-fail-note { font-size: 12px; color: #e53935; margin-top: 3px; text-align: right; }
.msg-retry {
  background: none; border: 1px solid #e53935; color: #e53935;
  border-radius: 8px; padding: 2px 10px; font-size: 12px; cursor: pointer;
  margin-top: 4px; align-self: flex-end;
}

/* --- Диалог: низ по input_mode --- */
#dlg-bottom { background: var(--bg); border-top: 1px solid var(--bg2); padding: 8px 12px; }
.compose { display: flex; gap: 8px; align-items: flex-end; }
#compose-text {
  flex: 1; resize: none; border: none; outline: none;
  background: var(--bg2); color: var(--text);
  border-radius: 12px; padding: 9px 12px;
  font: inherit; max-height: 120px; min-height: 38px;
}
#compose-text::placeholder { color: var(--hint); }
.btn {
  border: none; border-radius: 10px; cursor: pointer;
  font-size: 15px; font-weight: 500; padding: 10px 14px;
}
.btn-primary { background: var(--btn); color: var(--btn-text); }
.btn-primary:disabled { opacity: 0.5; }
.btn-wide { width: 100%; }
.btn-ghost { background: var(--bg2); color: var(--link); }
.compose-actions { display: flex; gap: 8px; margin-top: 8px; }
.compose-actions .btn { flex: 1; font-size: 13px; padding: 8px 10px; }
.foreign-note { text-align: center; color: var(--hint); font-size: 14px; padding: 6px 0; }

/* --- Вкладка «Ассистент»: разговор оператора с ассистентом ---
 * Клиент её не видит, значит и выглядеть она обязана иначе, чем переписка:
 * свой фон, свои рамки, фиолетовая метка. */
#dlg-assistant {
  background: var(--bg2);
  padding: 6px 12px 8px;
  overflow-y: auto;
}
.as-head { display: flex; align-items: center; gap: 8px; padding: 2px 0 6px; }
.as-mark { font-size: 12px; font-weight: 600; color: #7e57c2; letter-spacing: 0.4px; }
.as-private { font-size: 11px; color: var(--hint); }
.as-body { display: flex; flex-direction: column; gap: 6px; }
.as-msg { max-width: 88%; display: flex; flex-direction: column; }
.as-msg-op { align-self: flex-end; }
.as-msg-bot { align-self: flex-start; }
.as-bubble {
  padding: 6px 10px; border-radius: 12px; font-size: 14px; line-height: 1.35;
  white-space: pre-wrap; word-break: break-word;
  background: var(--bg); border: 1px solid #7e57c2;
}
.as-msg-op .as-bubble { background: #ede7f6; color: #311b92; }
.as-meta { font-size: 11px; color: var(--hint); margin-top: 2px; }
.as-msg-op .as-meta { text-align: right; }
.as-thinking {
  display: flex; align-items: center; gap: 8px;
  color: var(--hint); font-size: 13px; padding: 4px 0;
}
.spinner-sm { width: 14px; height: 14px; border-width: 2px; }

/* --- Ассистент: полоса ПРЕДЛОЖЕНИЯ над полем ввода --- */
#dlg-suggestion {
  background: var(--bg);
  border-top: 1px solid #7e57c2;
  padding: 8px 12px;
}
/* Свёрнуто: остаётся только голова с компактной строкой — полоса перестаёт
 * есть место над полем ввода. Тело и не рисуется (см. renderSuggestionBar),
 * правило ниже страхует случай закешированного старого app.js. */
#dlg-suggestion.collapsed > *:not(.sg-head) { display: none; }
.sg-head { display: flex; align-items: center; gap: 8px; }
.sg-title { font-size: 11px; font-weight: 700; letter-spacing: 1px; color: #7e57c2; }
/* Стрелка «свернуть» — тот же вид, что у #cust-collapse в блоке данных клиента */
.sg-collapse {
  background: none; border: 1px solid var(--bg2); color: var(--hint);
  border-radius: 8px; padding: 2px 8px; font-size: 12px; line-height: 1; cursor: pointer;
}
.sg-collapsed-label { font-size: 12px; color: var(--hint); cursor: pointer; }
.sg-alt {
  margin-left: auto; border: 1px solid var(--bg2); background: var(--bg2);
  color: var(--link); border-radius: 12px; padding: 3px 10px;
  font-size: 12px; cursor: pointer;
}
.sg-text {
  font-size: 15px; line-height: 1.35; margin: 6px 0 4px;
  white-space: pre-wrap; word-break: break-word;
}
.sg-based, .sg-note, .sg-locked, .sg-version-label { font-size: 11px; color: var(--hint); }
.sg-note { color: #fb8c00; margin-top: 2px; }
/* «Клиент написал — нажмите кнопку»: предложение не собирается само */
.sg-ask { font-size: 12px; color: var(--hint); margin: 6px 0 2px; line-height: 1.35; }
.sg-blocked { font-size: 12px; color: #fb8c00; margin-top: 2px; }
.sg-versions { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.sg-nav {
  border: none; background: none; color: var(--link);
  font-size: 12px; cursor: pointer; padding: 2px 0;
}
.sg-nav:disabled { color: var(--hint); cursor: default; }
.sg-versions .sg-version-label { margin-left: auto; }
.sg-actions { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.sg-actions .btn { font-size: 13px; padding: 8px 12px; }
.sg-actions .btn:disabled { opacity: 0.45; cursor: default; }

/* --- Поле ввода вкладки «Ассистент» ---
 * Переключателя получателя больше нет: адресат — это вкладка. Но разница
 * между «уйдёт клиенту» и «клиент не увидит» обязана оставаться грубой:
 * внутренний текст, уехавший клиенту, — худшая ошибка панели. */
#assistant-text {
  flex: 1; resize: none; outline: none;
  background: #ede7f6; color: #311b92;
  border: 1px dashed #7e57c2;
  border-radius: 12px; padding: 9px 12px;
  font: inherit; max-height: 120px; min-height: 38px;
}
#assistant-text::placeholder { color: #7e57c2; }
.compose-note {
  font-size: 11px; color: #7e57c2; font-weight: 600;
  padding: 6px 2px 0; text-align: right;
}
.as-count { font-size: 11px; color: var(--hint); margin-left: auto; }
.as-empty { color: var(--hint); font-size: 13px; padding: 6px 0; line-height: 1.4; }
.btn-assistant { background: #7e57c2; color: #fff; }
.btn-danger { background: #e53935; color: #fff; }
.btn-danger:disabled { opacity: 0.5; }

/* --- Ассистент: вопрос про действие ---
 * Карточек плана и кнопок одобрения тут больше нет: согласие даётся словами
 * в дорожке. Осталось то, ради чего карточка и была, — посчитанные числа. */
.pending {
  background: var(--bg); border: 1px solid var(--bg2);
  border-radius: 12px; padding: 8px 10px; margin-top: 4px;
}
.pending-head { font-size: 11px; color: var(--hint); text-transform: uppercase; }
.pending-q { font-size: 14px; font-weight: 600; margin-top: 2px; }
.pending-blast, .pending-rev { font-size: 12px; color: var(--hint); margin-top: 2px; }
.pending-hint { font-size: 12px; color: var(--link); margin-top: 6px; }
.pending-warn {
  font-size: 12px; color: #e53935; font-weight: 600; margin-top: 4px;
}
.step-diff {
  background: var(--bg2); border-radius: 8px; padding: 6px 8px; margin-top: 4px;
  font-size: 12px; word-break: break-word;
}
.step-diff-title { color: var(--hint); font-size: 11px; margin-bottom: 2px; }
.step-diff-empty { color: #e53935; }
/* Пересказ диффа: одна строка на одно изменившееся поле */
.step-diff-change { display: flex; flex-wrap: wrap; align-items: baseline; gap: 5px; margin: 2px 0; }
.step-diff-label { color: var(--hint); }
.step-diff-before { color: var(--hint); text-decoration: line-through; }
.step-diff-arrow { color: var(--hint); }
.step-diff-after { font-weight: 600; }
.step-diff-note { color: #43a047; }
/* Важные НЕизменности: «ключи и UUID не меняются» */
.step-diff-constant { color: var(--hint); font-size: 11px; margin-top: 3px; }
/* Технический вид — под спойлером, по умолчанию свёрнут */
.step-diff-raw { margin-top: 4px; }
.step-diff-toggle {
  background: none; border: none; color: var(--link);
  font-size: 11px; cursor: pointer; padding: 2px 0;
}
.step-diff-rawbody { margin-top: 2px; color: var(--hint); font-size: 11px; }
/* Откат последнего выполненного действия */
.as-undo { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.as-undo .btn { font-size: 13px; padding: 7px 12px; }
.as-undo-note { font-size: 11px; color: var(--hint); }

/* --- Плашка «Нет связи» и тост --- */
#offline-bar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  background: #e53935; color: #fff;
  text-align: center; font-size: 13px; padding: 4px;
}
#toast {
  position: fixed; bottom: 76px; left: 50%; transform: translateX(-50%);
  z-index: 60; max-width: 88%;
  background: rgba(0, 0, 0, 0.78); color: #fff;
  padding: 9px 16px; border-radius: 12px; font-size: 14px; text-align: center;
}



/* --- Оценки клиентов и статистика --- */

#rating-filter {
  border: none; border-radius: 8px; padding: 7px 10px;
  background: var(--bg2); color: var(--link); font-size: 13px; cursor: pointer;
  white-space: nowrap;
}
#rating-filter.active { background: var(--btn); color: var(--btn-text); }

.rating-badge { font-size: 11px; color: #f5a623; letter-spacing: -1px; }
.rating-badge.rating-low { color: #e53935; }

/* Карточка оценки внутри закрытого тикета */
#dlg-ratings { padding: 8px 12px 0; display: flex; flex-direction: column; gap: 8px; }
.rating-card {
  background: var(--bg); border-radius: 10px; padding: 10px 12px;
  border-left: 3px solid var(--hint);
}
.rating-card-low { border-left-color: #e53935; }
.rating-card-head { display: flex; align-items: baseline; gap: 8px; }
.rating-ticket { font-weight: 600; font-size: 13px; }
.rating-stars { color: #f5a623; letter-spacing: -1px; }
.rating-value { font-size: 12px; color: var(--hint); }
.rating-none { font-size: 12px; color: var(--hint); font-style: italic; }
.rating-label { font-size: 13px; margin-top: 2px; }
.rating-when, .rating-note { font-size: 11px; color: var(--hint); margin-top: 2px; }
.rating-comment { margin-top: 6px; }
.rating-comment-title { font-size: 11px; color: var(--hint); }
.rating-comment-text {
  background: var(--bg2); border-radius: 8px; padding: 6px 8px;
  font-size: 14px; margin-top: 2px; white-space: pre-wrap; word-break: break-word;
}
.msg-rating { color: #f5a623; }
.msg-rating-comment .bubble { background: var(--bg); border: 1px dashed var(--hint); }

/* Экран статистики */
#screen-stats { overflow-y: auto; }
.stats-head {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; background: var(--bg);
  border-bottom: 1px solid var(--bg2); font-weight: 600;
  position: sticky; top: 0; z-index: 2;
}
#stats-back {
  border: none; background: none; color: var(--link);
  font-size: 20px; line-height: 1; cursor: pointer; padding: 0 4px;
}
#stats-body { padding: 10px 12px 24px; display: flex; flex-direction: column; gap: 12px; }
.stat-section { background: var(--bg); border-radius: 12px; padding: 12px; }
.stat-section-title { font-weight: 600; margin-bottom: 8px; }
.stat-tiles { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.stat-tile {
  flex: 1 1 70px; background: var(--bg2); border-radius: 10px;
  padding: 8px 6px; text-align: center;
}
.stat-value { font-size: 18px; font-weight: 600; }
.stat-label { font-size: 11px; color: var(--hint); margin-top: 2px; }
.stat-muted .stat-value { color: var(--hint); }
.stat-bad .stat-value { color: #e53935; }
.stat-row {
  display: flex; justify-content: space-between; gap: 8px;
  padding: 5px 0; font-size: 14px; border-top: 1px solid var(--bg2);
}
.stat-row-label { color: var(--hint); }
.stat-total { font-weight: 600; }
.stat-total .stat-row-label { color: var(--text); }
.stat-empty { color: var(--hint); font-size: 13px; padding: 6px 0; }
/* Пояснение, почему видно не всё (разграничение доступа к персональным оценкам) */
.stat-note { color: var(--hint); font-size: 12px; padding: 4px 0 2px; }
/* Подстрока «… из них до появления статистики» — тише основной строки */
.stat-row.stat-muted .stat-row-value { color: var(--hint); font-size: 13px; }
.stat-dynamics { margin-top: 4px; }

.dist { margin-top: 6px; display: flex; flex-direction: column; gap: 3px; }
.dist-row { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.dist-star { width: 26px; color: var(--hint); }
.dist-count { width: 26px; text-align: right; color: var(--hint); }
.dist-bar { flex: 1; height: 8px; background: var(--bg2); border-radius: 4px; overflow: hidden; }
.dist-fill { height: 100%; background: #f5a623; border-radius: 4px; }
.dist-low .dist-fill { background: #e53935; }

.op-row {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 0; border-top: 1px solid var(--bg2); font-size: 14px;
}
.op-head { color: var(--hint); font-size: 12px; border-top: none; }
.op-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.op-num { width: 54px; text-align: right; }
.op-bad { color: #e53935; font-weight: 600; }
.op-clickable { cursor: pointer; }
.op-clickable .op-name { color: var(--link); }

.card-controls { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  border: none; border-radius: 14px; padding: 6px 11px;
  background: var(--bg); color: var(--link); font-size: 13px; cursor: pointer;
}
.chip.active { background: var(--btn); color: var(--btn-text); }

.rating-item {
  border-top: 1px solid var(--bg2); padding: 8px 0;
}
.rating-item-low .rating-item-head { color: #e53935; }
.rating-item-head { display: flex; align-items: baseline; gap: 8px; font-size: 13px; }
.rating-item-ticket { color: var(--hint); }
.rating-item-when { margin-left: auto; color: var(--hint); font-size: 11px; }
.rating-item-who { font-size: 13px; margin-top: 2px; }
.rating-item-op { color: var(--hint); }
.rating-item-comment {
  background: var(--bg2); border-radius: 8px; padding: 6px 8px;
  font-size: 14px; margin-top: 4px; white-space: pre-wrap; word-break: break-word;
}
.rating-item-open {
  border: none; background: none; color: var(--link);
  font-size: 13px; cursor: pointer; padding: 4px 0 0;
}
.tabs .tab { white-space: nowrap; }
.tab[data-tab="stats"] { font-size: 13px; }
