/* Atlas веб-чат — минимальный mobile-first CSS (brief web-service-chat-public). */
:root {
  --bg: #0e1621;
  --bg-elev: #17212b;
  --bg-input: #1d2733;
  --accent: #3390ec;
  --accent-2: #2b7fd4;
  --text: #e7eef5;
  --text-dim: #8a98a5;
  --bubble-user: #2b5278;
  --bubble-bot: #1d2733;
  --danger: #e15b5b;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.view { height: 100dvh; display: flex; flex-direction: column; }
[hidden] { display: none !important; }

/* ---------- Login ---------- */
#login-view { align-items: center; justify-content: center; padding: 24px; }
.login-card {
  background: var(--bg-elev);
  border-radius: 16px;
  padding: 36px 28px;
  max-width: 360px;
  width: 100%;
  text-align: center;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.4);
}
.brand { font-size: 34px; font-weight: 700; letter-spacing: 0.5px; margin-bottom: 12px; }
.subtitle { color: var(--text-dim); font-size: 15px; line-height: 1.5; margin: 0 0 26px; }
#tg-widget-holder { display: flex; justify-content: center; min-height: 48px; }
.login-error { color: var(--danger); font-size: 14px; margin-top: 18px; }

/* ---------- App shell (header + вкладки) ---------- */
.app-header, .chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-elev);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  flex: 0 0 auto;
}

.tabs { display: flex; gap: 4px; }
.tab {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 15px;
  padding: 6px 14px;
  border-radius: 8px;
  cursor: pointer;
}
.tab.is-active { background: var(--bg-input); color: var(--text); font-weight: 600; }
.tab:active { background: rgba(255, 255, 255, 0.06); }

/* Вкладка занимает всё пространство под header */
.pane { flex: 1 1 auto; display: flex; flex-direction: column; min-height: 0; }
.chat-title { font-weight: 600; font-size: 17px; }
.chat-user { color: var(--text-dim); font-size: 14px; margin-left: auto; }
.logout-btn {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-dim);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 13px;
  cursor: pointer;
}
.logout-btn:active { background: rgba(255, 255, 255, 0.06); }

.messages {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.bubble {
  max-width: 84%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 15px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.bubble.user { align-self: flex-end; background: var(--bubble-user); border-bottom-right-radius: 4px; }
.bubble.bot  { align-self: flex-start; background: var(--bubble-bot); border-bottom-left-radius: 4px; }
.bubble.bot.pending { color: var(--text-dim); font-style: italic; }
.bubble .meta { display: block; margin-top: 6px; font-size: 11px; color: var(--text-dim); }

.empty-hint { color: var(--text-dim); text-align: center; margin: auto; font-size: 14px; }

.chat-form {
  flex: 0 0 auto;
  display: flex;
  gap: 8px;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  background: var(--bg-elev);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.chat-input {
  flex: 1 1 auto;
  resize: none;
  background: var(--bg-input);
  color: var(--text);
  border: none;
  border-radius: 18px;
  padding: 11px 16px;
  font-size: 16px; /* >=16px чтобы iOS Safari не зумил при фокусе */
  max-height: 140px;
  outline: none;
  line-height: 1.4;
}
.chat-input::placeholder { color: var(--text-dim); }
.send-btn {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  align-self: flex-end;
}
.send-btn:disabled { opacity: 0.5; cursor: default; }
.send-btn:active:not(:disabled) { background: var(--accent-2); }

/* ---------- Голосовой ввод (кнопка 🎤) ---------- */
.mic-btn {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: var(--bg-input);
  color: var(--text);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  align-self: flex-end;
  transition: background 0.15s, transform 0.1s;
}
.mic-btn:active:not(:disabled) { transform: scale(0.92); }
.mic-btn:disabled { opacity: 0.5; cursor: default; }

/* recording — красная пульсирующая */
.mic-btn.recording {
  background: var(--danger);
  color: #fff;
  animation: mic-pulse 1.2s ease-in-out infinite;
}
@keyframes mic-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(225, 91, 91, 0.55); }
  70%  { box-shadow: 0 0 0 12px rgba(225, 91, 91, 0); }
  100% { box-shadow: 0 0 0 0 rgba(225, 91, 91, 0); }
}

/* transcribing — синяя «думает», курсор-ожидание */
.mic-btn.transcribing {
  background: var(--accent);
  color: #fff;
  cursor: progress;
}

/* error — красная рамка-предупреждение */
.mic-btn.error {
  background: transparent;
  border: 1px solid var(--danger);
  color: var(--danger);
}

/* Скрыть кнопку целиком, если браузер не умеет MediaRecorder/getUserMedia */
.mic-btn.unsupported { display: none; }

.mic-hint {
  flex: 0 0 auto;
  padding: 0 16px calc(8px + env(safe-area-inset-bottom));
  background: var(--bg-elev);
  color: var(--text-dim);
  font-size: 13px;
  line-height: 1.4;
}
.mic-hint.recording { color: var(--danger); }
.mic-hint.is-error { color: var(--danger); }
.mic-hint a { color: var(--accent); }

/* ---------- Поиск ---------- */
.search-form {
  flex: 0 0 auto;
  padding: 12px 12px 8px;
  background: var(--bg-elev);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.search-bar { display: flex; gap: 8px; align-items: center; }
.search-input {
  flex: 1 1 auto;
  background: var(--bg-input);
  color: var(--text);
  border: none;
  border-radius: 18px;
  padding: 11px 16px;
  font-size: 16px; /* >=16px чтобы iOS Safari не зумил */
  outline: none;
}
.search-input::placeholder { color: var(--text-dim); }

.search-filters { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.filter {
  background: var(--bg-input);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 7px 10px;
  font-size: 13px;
  outline: none;
  cursor: pointer;
  flex: 1 1 auto;
  min-width: 110px;
}

.search-results {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 12px 14px calc(16px + env(safe-area-inset-bottom));
}
.search-summary { color: var(--text-dim); font-size: 13px; margin: 2px 2px 12px; }

.result-group { margin-bottom: 18px; }
.group-head {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin: 0 2px 8px;
  position: sticky;
  top: -12px;
  background: var(--bg);
  padding: 4px 0;
}

.result-card {
  background: var(--bg-elev);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 8px;
  border: 1px solid rgba(255, 255, 255, 0.04);
}
.result-card.is-weak { opacity: 0.62; }
.card-title { font-size: 15px; font-weight: 600; line-height: 1.35; word-wrap: break-word; }
.card-preview {
  font-size: 14px;
  color: var(--text-dim);
  margin-top: 5px;
  line-height: 1.45;
  word-wrap: break-word;
}
.card-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 9px;
}
.card-meta { font-size: 12px; color: var(--text-dim); flex: 1 1 auto; word-wrap: break-word; }
.card-open {
  flex: 0 0 auto;
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
  border-radius: 8px;
  padding: 5px 12px;
  font-size: 13px;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}
.card-open:active { background: rgba(51, 144, 236, 0.12); }

/* ---------- Модалка превью ---------- */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 50;
}
.modal-card {
  background: var(--bg-elev);
  border-radius: 14px;
  max-width: 560px;
  width: 100%;
  max-height: 80dvh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.5);
}
.modal-header {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 16px 18px 8px;
}
.modal-title { font-size: 16px; font-weight: 600; flex: 1 1 auto; line-height: 1.35; }
.modal-close {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 18px;
  cursor: pointer;
  flex: 0 0 auto;
}
.modal-meta { padding: 0 18px; font-size: 12px; color: var(--text-dim); }
.modal-body {
  padding: 12px 18px 18px;
  overflow-y: auto;
  font-size: 15px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-wrap: break-word;
}

/* ---------- Дашборд «Сегодня» ---------- */
.today-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px 10px;
  background: var(--bg-elev);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.today-head-left { flex: 1 1 auto; min-width: 0; }
.today-title { font-size: 18px; font-weight: 700; }
.today-updated { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.today-refresh {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: var(--bg-input);
  color: var(--text);
  font-size: 19px;
  cursor: pointer;
}
.today-refresh:active { background: rgba(255, 255, 255, 0.06); }
.today-refresh.spinning { animation: today-spin 0.8s linear infinite; }
@keyframes today-spin { to { transform: rotate(360deg); } }

.today-ptr {
  flex: 0 0 auto;
  text-align: center;
  font-size: 12px;
  color: var(--text-dim);
  padding: 6px;
}

.today-cards {
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  padding: 12px 14px calc(16px + env(safe-area-inset-bottom));
}

/* На узких экранах header тесный: 4 таба (Чат|Поиск|Сегодня|Клиент) + Выйти.
   Прячем имя пользователя и бренд, ужимаем табы, оставляем им горизонтальный
   скролл как фолбэк — чтобы строка не распирала вьюпорт (без horizontal-overflow). */
@media (max-width: 560px) {
  .chat-user { display: none; }
  .chat-title { display: none; }
  .app-header { gap: 6px; padding: 12px 10px; }
  .tabs { gap: 2px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { padding: 6px 9px; font-size: 14px; white-space: nowrap; }
  .logout-btn { margin-left: auto; flex: 0 0 auto; }
}

.today-block-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 6px 2px 8px;
}

.card-grid {
  display: grid;
  /* minmax(0,1fr): без 0-минимума nowrap-превью раздувает трек шире вьюпорта */
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}
/* mobile: одна колонка, карточки стопкой */
@media (max-width: 560px) {
  .card-grid { grid-template-columns: minmax(0, 1fr); }
}

.dash-card {
  background: var(--bg-elev);
  border-radius: 14px;
  padding: 13px 14px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  min-height: 64px;
  min-width: 0; /* позволить grid-треку сжиматься, nowrap-превью клипается */
}
.dash-card.is-tappable { cursor: pointer; }
.dash-card.is-tappable:active { background: var(--bg-input); }

.dash-card-head { display: flex; align-items: center; gap: 9px; }
.dash-emoji { font-size: 20px; line-height: 1; flex: 0 0 auto; }
.dash-card-title {
  font-size: 15px;
  font-weight: 600;
  flex: 1 1 auto;
  min-width: 0;
  word-wrap: break-word;
}
.dash-badge {
  flex: 0 0 auto;
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  min-width: 24px;
  text-align: center;
  padding: 2px 8px;
  border-radius: 11px;
}

.dash-card-preview { margin-top: 9px; }
.dash-prev-line {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.45;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dash-prev-more { font-size: 12px; color: var(--accent); margin-top: 3px; }

.dash-info-body {
  margin-top: 8px;
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.5;
  white-space: pre-wrap;
}

/* ambient (погода) — занимает всю ширину строкой */
.dash-ambient {
  grid-column: 1 / -1;
  font-size: 15px;
  color: var(--text);
}

/* quiet — приглушённые, без действия */
.dash-card.type-quiet {
  opacity: 0.5;
  min-height: 0;
  padding: 11px 14px;
}
.dash-card.type-quiet .dash-card-title { font-weight: 500; }
.dash-quiet-note { font-size: 12px; color: var(--text-dim); margin-top: 4px; }

/* ---------- Slide-over с деталями ---------- */
.sheet {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 60;
}
.sheet-card {
  background: var(--bg-elev);
  border-radius: 18px 18px 0 0;
  width: 100%;
  max-width: 640px;
  max-height: 82dvh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 -8px 48px rgba(0, 0, 0, 0.5);
  animation: sheet-up 0.18s ease-out;
}
@keyframes sheet-up { from { transform: translateY(100%); } to { transform: translateY(0); } }
.sheet-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 18px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.sheet-title { font-size: 16px; font-weight: 600; flex: 1 1 auto; }
.sheet-body {
  padding: 8px 14px calc(18px + env(safe-area-inset-bottom));
  overflow-y: auto;
}

.sheet-item {
  padding: 12px 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.sheet-item:last-child { border-bottom: none; }
.sheet-item-label { font-size: 15px; line-height: 1.4; word-wrap: break-word; }
.sheet-item-sub { font-size: 13px; color: var(--text-dim); margin-top: 3px; }
.sheet-item-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.chip {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: var(--text);
  border-radius: 9px;
  padding: 6px 12px;
  font-size: 13px;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}
.chip:active { background: rgba(255, 255, 255, 0.06); }
.chip-open { border-color: var(--accent); color: var(--accent); }
.chip-vote { font-size: 15px; padding: 5px 10px; }
.chip-vote.voted { background: rgba(51, 144, 236, 0.18); border-color: var(--accent); }

/* ---------- Карточка контрагента (вкладка Клиент) ---------- */
.contractor-search-view { display: flex; flex-direction: column; min-height: 0; flex: 1 1 auto; }
.contractor-candidates {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 8px 16px 24px;
  -webkit-overflow-scrolling: touch;
}
.cand-row {
  display: block;
  width: 100%;
  text-align: left;
  background: var(--bg-elev);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 8px;
  color: var(--text);
  cursor: pointer;
}
.cand-row:active { background: var(--bg-input); }
.cand-name { font-size: 15px; font-weight: 600; word-wrap: break-word; }
.cand-meta { font-size: 13px; color: var(--text-dim); margin-top: 3px; }

.contractor-card {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 0 0 32px;
  -webkit-overflow-scrolling: touch;
  min-width: 0;
}
.cc-head { padding: 14px 16px 10px; border-bottom: 1px solid rgba(255, 255, 255, 0.06); }
.cc-back {
  background: transparent; border: none; color: var(--accent);
  font-size: 14px; cursor: pointer; padding: 0 0 8px;
}
.cc-title { font-size: 19px; font-weight: 700; line-height: 1.25; word-wrap: break-word; }
.cc-sub { font-size: 13px; color: var(--text-dim); margin-top: 4px; }
.cc-aliases { font-size: 12px; color: var(--text-dim); margin-top: 6px; line-height: 1.4; }
.cc-warning {
  margin-top: 10px; padding: 10px 12px; border-radius: 10px;
  background: rgba(225, 91, 91, 0.12); border: 1px solid rgba(225, 91, 91, 0.3);
  color: #f0a5a5; font-size: 13px; line-height: 1.45;
}

.cc-tabstrip {
  display: flex; gap: 6px; overflow-x: auto; padding: 10px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.cc-tabstrip::-webkit-scrollbar { display: none; }
.cc-tab {
  flex: 0 0 auto; background: var(--bg-input); border: 1px solid transparent;
  color: var(--text-dim); border-radius: 999px; padding: 7px 13px;
  font-size: 13px; cursor: pointer; white-space: nowrap;
}
.cc-tab.is-active { background: var(--accent); color: #fff; }

.cc-body { padding: 14px 16px; }

.cc-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.cc-metric {
  background: var(--bg-elev); border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px; padding: 12px 10px; min-width: 0;
}
.cc-metric.is-accent { border-color: rgba(225, 91, 91, 0.4); }
.cc-metric-val { font-size: 16px; font-weight: 700; word-wrap: break-word; }
.cc-metric.is-accent .cc-metric-val { color: #f0a5a5; }
.cc-metric-label { font-size: 11px; color: var(--text-dim); margin-top: 4px; line-height: 1.3; }

.cc-overdue {
  margin-top: 12px; padding: 10px 12px; border-radius: 10px;
  background: rgba(225, 91, 91, 0.1); font-size: 13px; line-height: 1.45;
}
.cc-dump { font-size: 12px; color: var(--text-dim); margin-top: 10px; }
.cc-section-h {
  font-size: 13px; font-weight: 600; color: var(--text-dim);
  margin: 18px 0 8px; text-transform: uppercase; letter-spacing: 0.4px;
}
.cc-rows { display: flex; flex-direction: column; }
.cc-row {
  padding: 11px 2px; border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.cc-row:last-child { border-bottom: none; }
.cc-row-main { font-size: 14px; line-height: 1.4; word-wrap: break-word; }
.cc-row-sub { font-size: 12px; color: var(--text-dim); margin-top: 3px; line-height: 1.4; word-wrap: break-word; }
.cc-row-link {
  display: inline-block; margin-top: 6px; font-size: 13px;
  color: var(--accent); text-decoration: none;
}
.cc-empty { color: var(--text-dim); font-size: 14px; padding: 14px 2px; }

@media (max-width: 480px) {
  .cc-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cc-title { font-size: 17px; }
}


/* ===== Вкладка «Монитор» (приборная панель, brief web-monitor-page) ===== */
:root {
  --mon-ok: #4bb96f;
  --mon-warn: #e0a83a;
  --mon-bad: #e15b5b;
  --mon-working: #3390ec;
  --mon-idle: #6b7884;
  --mon-track: #243140;
}
.monitor-body {
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  padding: 14px 16px calc(18px + env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  align-content: start;
}
@media (max-width: 760px) {
  .monitor-body { grid-template-columns: minmax(0, 1fr); }
}
.mon-panel {
  background: var(--bg-elev);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 14px;
  padding: 16px 18px;
}
.mon-panel-wide { grid-column: 1 / -1; }
.mon-panel-head {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 14px;
}
.mon-panel-emoji { font-size: 19px; }
.mon-panel-title { font-weight: 600; font-size: 16px; letter-spacing: 0.2px; }
.mon-subhead {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-dim);
  margin: 14px 0 8px;
}
.mon-subhead:first-child { margin-top: 0; }

/* Индикатор-точка */
.mon-dot {
  flex: 0 0 auto;
  width: 11px; height: 11px;
  border-radius: 50%;
  background: var(--mon-idle);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.03);
}
.mon-ok { background: var(--mon-ok); }
.mon-warn { background: var(--mon-warn); }
.mon-bad { background: var(--mon-bad); }
.mon-working { background: var(--mon-working); animation: mon-pulse 1.4s ease-in-out infinite; }
.mon-idle { background: var(--mon-idle); }
.mon-ok-text { color: var(--mon-ok); }
.mon-warn-text { color: var(--mon-warn); }
.mon-bad-text { color: var(--mon-bad); font-weight: 700; }
.mon-working-text { color: var(--mon-working); }
.mon-idle-text { color: var(--text-dim); }
@keyframes mon-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(51, 144, 236, 0.5); }
  50% { box-shadow: 0 0 0 5px rgba(51, 144, 236, 0); }
}

/* --- Свежесть данных: карточки источников --- */
.mon-src-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}
.mon-src {
  background: var(--bg);
  border-radius: 11px;
  padding: 12px 13px;
  border-left: 3px solid var(--mon-idle);
}
.mon-src-ok { border-left-color: var(--mon-ok); }
.mon-src-warn { border-left-color: var(--mon-warn); }
.mon-src-bad { border-left-color: var(--mon-bad); }
.mon-src-head { display: flex; align-items: center; gap: 8px; }
.mon-src-name { font-weight: 600; font-size: 15px; }
.mon-src-count {
  margin-left: auto;
  font-variant-numeric: tabular-nums;
  color: var(--text-dim);
  font-size: 14px;
}
.mon-src-what { font-size: 12px; color: var(--text-dim); margin: 5px 0 9px; line-height: 1.35; }
.mon-facts { display: flex; flex-direction: column; gap: 4px; }
.mon-fact { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; }
.mon-fact-k { color: var(--text-dim); }
.mon-fact-v { text-align: right; font-variant-numeric: tabular-nums; }
.mon-note {
  margin-top: 9px;
  font-size: 11.5px;
  color: var(--text-dim);
  background: rgba(224, 168, 58, 0.08);
  border-radius: 7px;
  padding: 6px 8px;
  line-height: 1.35;
}

/* --- Идёт обработка --- */
.mon-queue-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.mon-bignum { font-size: 30px; font-weight: 700; font-variant-numeric: tabular-nums; }
.mon-bignum-unit { font-size: 14px; font-weight: 400; color: var(--text-dim); }
.mon-explain {
  font-size: 12px; color: var(--text-dim); line-height: 1.4;
  margin: 8px 0 4px;
}
.mon-job {
  display: flex; gap: 9px; align-items: flex-start;
  background: var(--bg); border-radius: 9px; padding: 9px 11px; margin-top: 7px;
}
.mon-job-dot {
  flex: 0 0 auto; width: 9px; height: 9px; border-radius: 50%;
  margin-top: 4px; background: var(--mon-working);
  animation: mon-pulse 1.4s ease-in-out infinite;
}
.mon-job-label { font-size: 14px; font-weight: 600; }
.mon-job-time { font-size: 11.5px; font-weight: 400; color: var(--mon-working); }
.mon-job-what { font-size: 12px; color: var(--text-dim); line-height: 1.35; margin-top: 1px; }

/* --- Спарклайны --- */
.mon-spark { width: 120px; height: 26px; display: block; }
.mon-spark polyline { stroke: var(--mon-working); }
.mon-spark-ok polyline { stroke: var(--mon-ok); }
.mon-spark-warn polyline { stroke: var(--mon-warn); }
.mon-spark-bad polyline { stroke: var(--mon-bad); }

/* --- Нагрузка сервера: круговые шкалы --- */
.mon-gauges {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 14px;
  justify-items: center;
}
.mon-gauge { text-align: center; min-width: 0; }
.mon-ring {
  width: 92px; height: 92px; border-radius: 50%;
  margin: 0 auto;
  background: conic-gradient(var(--ring-color) calc(var(--p) * 1%), var(--mon-track) 0);
  display: flex; align-items: center; justify-content: center;
  transition: background 0.5s ease;
}
.mon-ring-ok { --ring-color: var(--mon-ok); }
.mon-ring-warn { --ring-color: var(--mon-warn); }
.mon-ring-bad { --ring-color: var(--mon-bad); }
.mon-ring-hole {
  width: 70px; height: 70px; border-radius: 50%;
  background: var(--bg-elev);
  display: flex; align-items: center; justify-content: center;
}
.mon-ring-val { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }
.mon-gauge-label { font-size: 13px; font-weight: 600; margin-top: 8px; }
.mon-gauge-sub { font-size: 11.5px; color: var(--text-dim); margin-top: 2px; }
.mon-gauge-sub .mon-spark { margin: 2px auto 0; width: 92px; }
.mon-srv-foot {
  display: flex; flex-wrap: wrap; gap: 6px 18px;
  margin-top: 14px; padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 12.5px; color: var(--text-dim);
}
.mon-srv-foot b { color: var(--text); font-weight: 600; }

/* --- Сервисы --- */
.mon-svc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 8px 16px;
}
.mon-svc { display: flex; align-items: center; gap: 9px; }
.mon-svc-name { flex: 1 1 auto; font-size: 13.5px; min-width: 0; }
.mon-svc-state { font-size: 12px; white-space: nowrap; }
.mon-svc-next { font-size: 11px; color: var(--text-dim); white-space: nowrap; margin-left: 4px; }

/* --- Данные: плитки --- */
.mon-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}
.mon-tile {
  background: var(--bg);
  border-radius: 11px;
  padding: 14px;
  text-align: center;
}
.mon-tile-val { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.mon-tile-label { font-size: 12px; color: var(--text-dim); margin-top: 4px; line-height: 1.3; }

/* --- Идёт обработка: герой «сколько осталось» + прогресс-бар --- */
.mon-queue-hero { margin-bottom: 12px; }
.mon-eta { font-size: 26px; font-weight: 700; line-height: 1.15; }
.mon-eta-sub { font-size: 13px; font-weight: 400; color: var(--text-dim); }
.mon-eta-dim { color: var(--text-dim); font-size: 18px; font-weight: 600; }
.mon-prog {
  height: 12px;
  border-radius: 7px;
  background: var(--mon-track);
  overflow: hidden;
}
.mon-prog-fill {
  height: 100%;
  border-radius: 7px;
  background: linear-gradient(90deg, var(--mon-working), #5eb0f5);
  transition: width 0.6s ease;
}
.mon-prog-cap {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-dim);
  margin: 5px 0 2px;
  font-variant-numeric: tabular-nums;
}
.mon-row-sub .mon-spark { display: inline-block; vertical-align: middle; width: 70px; height: 18px; margin-left: 4px; }
