/* ─────────── Диагностика: оформление 09.10.2026 ───────────
 *
 * Экран собран заново (renderDiagnostics в app.js): сверху вердикт с кольцом
 * здоровья, ниже быстрые тесты с итогом прошлого запуска, список компонентов,
 * справа нагрузка системы и файлы логов, внизу журнал во всю ширину.
 * Классы dg-* новые; старые diag-ring и diag-bar оставлены ради живого
 * обновления (updateDiagLive ищет их по классу).
 *
 * Chromium 83: в флексе только margin. Grid-gap там работает, им и пользуемся.
 */

#screen-diagnostics .diag-header{margin-bottom:16px}

/* ── Вердикт ── */
#screen-diagnostics .dg-hero{position:relative;overflow:hidden;display:flex;align-items:center;
  padding:22px 26px;min-height:168px;border-radius:22px;
  background:
    radial-gradient(70% 140% at 0% 0%,rgba(50,217,138,.14),transparent 60%),
    linear-gradient(135deg,var(--surf-2),var(--surf-1));
  border:1px solid var(--border)}
#screen-diagnostics .dg-hero.warn{background:
    radial-gradient(70% 140% at 0% 0%,rgba(255,176,46,.16),transparent 60%),
    linear-gradient(135deg,var(--surf-2),var(--surf-1))}
#screen-diagnostics .dg-hero.err{background:
    radial-gradient(70% 140% at 0% 0%,rgba(255,90,122,.16),transparent 60%),
    linear-gradient(135deg,var(--surf-2),var(--surf-1))}
#screen-diagnostics .dg-hero-txt{position:relative;z-index:1;flex:1;min-width:0;margin-left:26px;
  padding-right:150px}
#screen-diagnostics .dg-hero-kicker{display:inline-flex;align-items:center;font-size:12px;font-weight:700;
  color:var(--good);padding:4px 10px;border-radius:999px;background:rgba(50,217,138,.12);
  border:1px solid rgba(50,217,138,.30)}
#screen-diagnostics .dg-hero-kicker i{width:7px;height:7px;border-radius:50%;margin-right:7px;
  background:currentColor;box-shadow:0 0 8px currentColor}
#screen-diagnostics .dg-hero.warn .dg-hero-kicker{color:var(--warn);background:rgba(255,176,46,.12);
  border-color:rgba(255,176,46,.32)}
#screen-diagnostics .dg-hero.err .dg-hero-kicker{color:var(--bad);background:rgba(255,90,122,.12);
  border-color:rgba(255,90,122,.32)}
#screen-diagnostics .dg-hero h3{margin:12px 0 6px;font-family:var(--ui);font-size:22px;font-weight:700;
  line-height:1.2;color:var(--ink-1)}
#screen-diagnostics .dg-hero p{margin:0;font-size:13px;line-height:1.5;color:var(--text-muted);max-width:560px}
#screen-diagnostics .dg-hero-actions{display:flex;flex-wrap:wrap;margin-top:16px}
#screen-diagnostics .dg-hero-actions > *{margin:0 10px 0 0}
#screen-diagnostics .dg-hero-btn{display:inline-flex;align-items:center;height:40px;padding:0 16px;
  border-radius:12px;font-size:13px;font-weight:700}
#screen-diagnostics .dg-hero-btn .ic{margin-right:8px}
#screen-diagnostics .dg-hero-btn.ghost{background:var(--surf-1);border:1px solid var(--border-strong);color:var(--ink-2)}
#screen-diagnostics .dg-hero-btn.ghost:hover{background:var(--surf-3);color:var(--ink-1)}
#screen-diagnostics .dg-hero-fig{position:absolute;right:18px;bottom:-34px;height:220px;width:auto;
  object-fit:contain;pointer-events:none;opacity:.95;
  filter:drop-shadow(0 10px 24px rgba(0,0,0,.35))}

/* В светлой теме полупрозрачная подложка сливалась с фоном - нужна белая основа. */
html[data-theme="light"] #screen-diagnostics .dg-hero{background:
    radial-gradient(70% 140% at 0% 0%,rgba(50,217,138,.12),transparent 60%),#fff}
html[data-theme="light"] #screen-diagnostics .dg-hero.warn{background:
    radial-gradient(70% 140% at 0% 0%,rgba(255,176,46,.14),transparent 60%),#fff}
html[data-theme="light"] #screen-diagnostics .dg-hero.err{background:
    radial-gradient(70% 140% at 0% 0%,rgba(255,90,122,.12),transparent 60%),#fff}

/* Кольцо здоровья: фон центра берётся из темы, а не #0a0f1d - в светлой
   теме тёмный круг посреди белой карточки выглядел дырой. */
#screen-diagnostics .dg-ring{width:124px;height:124px;flex:none;position:relative;z-index:1;
  box-shadow:0 0 30px rgba(158,106,241,.22)}
#screen-diagnostics .dg-ring::before{top:10px;right:10px;bottom:10px;left:10px;
  background:var(--chat-panel-1)}
#screen-diagnostics .dg-ring .diag-ring-c b{font-size:28px;color:var(--ink-1)}
#screen-diagnostics .dg-ring .diag-ring-c small{display:block;margin-top:4px;font-size:12px;color:var(--accent-purple)}

/* ── Раскладка ── */
#screen-diagnostics .dg-layout{display:grid;grid-template-columns:minmax(0,1fr) 340px;
  grid-gap:18px;gap:18px;margin-top:18px;align-items:start}
#screen-diagnostics .dg-main > * + *{margin-top:14px}
#screen-diagnostics .dg-side > * + *{margin-top:18px}
#screen-diagnostics .dg-sec-h{font-size:12px;font-weight:700;letter-spacing:1.2px;text-transform:uppercase;
  color:var(--text-dim);margin:2px 0 0 4px}

/* ── Быстрые тесты ── */
#screen-diagnostics .dg-tests{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));grid-gap:14px;gap:14px}
#screen-diagnostics .dg-test{display:flex;flex-direction:column;padding:18px;border-radius:18px;
  transition:border-color .16s ease,transform .16s ease}
#screen-diagnostics .dg-test:hover{border-color:rgba(158,106,241,.40);transform:translateY(-2px)}
#screen-diagnostics .dg-test-top{display:flex;align-items:flex-start}
#screen-diagnostics .dg-test-ico{flex:none;width:42px;height:42px;border-radius:13px;display:flex;
  align-items:center;justify-content:center;color:var(--accent-purple);
  background:linear-gradient(135deg,rgba(158,106,241,.22),rgba(127,82,214,.08));
  border:1px solid rgba(158,106,241,.30)}
#screen-diagnostics .dg-test-ico .ic{width:19px;height:19px}
#screen-diagnostics .dg-test-txt{min-width:0;margin-left:12px;display:flex;flex-direction:column}
#screen-diagnostics .dg-test-txt b{font-size:14px;color:var(--ink-1);line-height:1.3}
#screen-diagnostics .dg-test-txt small{font-size:12px;color:var(--text-muted);line-height:1.4;margin-top:3px}
#screen-diagnostics .dg-test-foot{display:flex;align-items:flex-end;margin-top:auto;padding-top:16px}
#screen-diagnostics .dg-test-state{flex:1;min-width:0;display:flex;flex-direction:column;margin-right:10px}
#screen-diagnostics .dg-test-res{display:flex;align-items:center;font-size:12px;font-weight:600;color:var(--text-dim)}
#screen-diagnostics .dg-test-res i{flex:none;width:7px;height:7px;border-radius:50%;margin-right:7px;background:currentColor}
#screen-diagnostics .dg-test-res.ok{color:var(--good)}
#screen-diagnostics .dg-test-res.err{color:var(--bad)}
#screen-diagnostics .dg-test-detail{margin-top:3px;font-size:11.5px;color:var(--text-muted);
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
#screen-diagnostics .dg-test-btn{flex:none;display:inline-flex;align-items:center;height:34px;padding:0 13px;
  border-radius:11px;font-size:12.5px;font-weight:700;color:#fff;border-color:transparent;
  background:linear-gradient(135deg,var(--accent),var(--accent-2));box-shadow:0 4px 14px rgba(158,106,241,.28)}
#screen-diagnostics .dg-test-btn:hover{filter:brightness(1.08)}
#screen-diagnostics .dg-test-btn:disabled{opacity:.6;box-shadow:none}
#screen-diagnostics .dg-test-btn .ic{width:13px;height:13px;margin-right:6px}

/* ── Заголовок карточки ── */
#screen-diagnostics .dg-card-h{display:flex;align-items:center;justify-content:space-between;margin-bottom:12px}
#screen-diagnostics .dg-card-h > span{font-size:12px;font-weight:700;letter-spacing:1.2px;
  text-transform:uppercase;color:var(--text-dim)}
#screen-diagnostics .dg-mini-btn{display:inline-flex;align-items:center;height:30px;padding:0 11px;
  border-radius:10px;font-size:12px;font-weight:600;background:var(--surf-1);
  border:1px solid var(--border);color:var(--ink-3)}
#screen-diagnostics .dg-mini-btn:hover{background:var(--surf-3);color:var(--ink-1)}
#screen-diagnostics .dg-mini-btn .ic{width:13px;height:13px;margin-right:6px}

/* ── Компоненты ── */
#screen-diagnostics .dg-checks{padding:18px;border-radius:18px}
#screen-diagnostics .dg-rows > * + *{margin-top:8px}
#screen-diagnostics .dg-row{display:flex;align-items:center;padding:11px 12px;border-radius:14px;
  background:var(--surf-1);border:1px solid var(--border);transition:background .15s ease}
#screen-diagnostics .dg-row:hover{background:var(--surf-2)}
#screen-diagnostics .dg-row-ico{flex:none;width:36px;height:36px;border-radius:11px;display:flex;
  align-items:center;justify-content:center;color:var(--good);background:rgba(50,217,138,.10)}
#screen-diagnostics .dg-row.warn .dg-row-ico{color:var(--warn);background:rgba(255,176,46,.12)}
#screen-diagnostics .dg-row.err .dg-row-ico{color:var(--bad);background:rgba(255,90,122,.12)}
#screen-diagnostics .dg-row-ico .ic{width:17px;height:17px}
#screen-diagnostics .dg-row-txt{flex:1;min-width:0;margin:0 12px;display:flex;flex-direction:column}
#screen-diagnostics .dg-row-txt b{font-size:13.5px;color:var(--ink-1)}
#screen-diagnostics .dg-row-txt small{margin-top:2px;font-size:12px;color:var(--text-muted);
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
#screen-diagnostics .dg-pill{flex:none;display:inline-flex;align-items:center;height:26px;padding:0 10px;
  border-radius:999px;font-size:12px;font-weight:700;color:var(--good);
  background:rgba(50,217,138,.10);border:1px solid rgba(50,217,138,.28)}
#screen-diagnostics .dg-pill i{width:6px;height:6px;border-radius:50%;margin-right:6px;background:currentColor}
#screen-diagnostics .dg-pill.warn{color:var(--warn);background:rgba(255,176,46,.10);border-color:rgba(255,176,46,.30)}
#screen-diagnostics .dg-pill.err{color:var(--bad);background:rgba(255,90,122,.10);border-color:rgba(255,90,122,.30)}
#screen-diagnostics .dg-empty{font-size:12.5px;color:var(--text-muted);padding:6px 2px}

/* ── Система ── */
#screen-diagnostics .dg-sys,#screen-diagnostics .dg-files,#screen-diagnostics .dg-journal{padding:18px;border-radius:18px}
#screen-diagnostics .dg-metrics{display:grid;grid-template-columns:1fr 1fr;grid-gap:10px;gap:10px}
#screen-diagnostics .dg-metrics .diag-bar-row{margin:0;padding:11px 12px;border-radius:13px;
  background:var(--surf-1);border:1px solid var(--border)}
#screen-diagnostics .dg-metrics .diag-bar-top{display:flex;flex-direction:column;align-items:flex-start;margin-bottom:9px}
#screen-diagnostics .dg-metrics .diag-bar-top span{font-size:11.5px;font-weight:600;color:var(--text-dim)}
#screen-diagnostics .dg-metrics .diag-bar-top b{margin:3px 0 0;font-size:14px;color:var(--ink-1);
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:100%}
#screen-diagnostics .dg-metrics .diag-bar{height:5px;border-radius:5px;background:var(--surf-3);overflow:hidden}
#screen-diagnostics .dg-metrics .diag-bar > span{display:block;height:100%;border-radius:5px;
  background:linear-gradient(90deg,var(--accent-2),var(--accent));transition:width .4s ease}
#screen-diagnostics .dg-metrics .diag-bar > span.warn{background:linear-gradient(90deg,#e08a10,var(--warn))}
#screen-diagnostics .dg-facts{margin-top:14px}
#screen-diagnostics .dg-fact{display:flex;align-items:center;justify-content:space-between;padding:9px 2px;
  border-top:1px solid var(--border);font-size:12.5px}
#screen-diagnostics .dg-fact span{display:inline-flex;align-items:center;color:var(--text-muted)}
#screen-diagnostics .dg-fact span .ic{width:14px;height:14px;margin-right:8px;color:var(--accent-purple)}
#screen-diagnostics .dg-fact b{color:var(--ink-2);font-weight:600;margin-left:12px;text-align:right;
  min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}

/* ── Файлы логов ── */
#screen-diagnostics .dg-file-list > * + *{margin-top:6px}
#screen-diagnostics .dg-file{display:flex;align-items:center;padding:9px 10px;border-radius:12px;
  background:var(--surf-1);border:1px solid var(--border)}
#screen-diagnostics .dg-file-ic{flex:none;width:30px;height:30px;border-radius:9px;display:flex;
  align-items:center;justify-content:center;color:var(--accent-purple);background:rgba(158,106,241,.12)}
#screen-diagnostics .dg-file-ic .ic{width:14px;height:14px}
#screen-diagnostics .dg-file-txt{flex:1;min-width:0;margin:0 10px;display:flex;flex-direction:column}
#screen-diagnostics .dg-file-txt b{font-size:12.5px;color:var(--ink-2);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
#screen-diagnostics .dg-file-txt small{font-size:11.5px;color:var(--text-dim)}
#screen-diagnostics .dg-file-size{flex:none;font-size:12px;color:var(--text-muted);font-variant-numeric:tabular-nums}

/* ── Журнал ── */
#screen-diagnostics .dg-journal{margin-top:18px}
#screen-diagnostics .dg-journal .set-logs-bar{gap:0}
#screen-diagnostics .dg-journal .set-logs-bar > *{margin:0}
#screen-diagnostics .dg-journal .set-logs-view{max-height:360px;padding:14px 16px;border-radius:14px;
  background:var(--chat-field);border:1px solid var(--border);font-size:12px;line-height:1.55}

@media (max-width:1180px){
  #screen-diagnostics .dg-layout{grid-template-columns:1fr}
  #screen-diagnostics .dg-tests{grid-template-columns:1fr}
  #screen-diagnostics .dg-hero-fig{display:none}
  #screen-diagnostics .dg-hero-txt{padding-right:0}
}
@media (prefers-reduced-motion:reduce){
  #screen-diagnostics .dg-test{transition:none}
  #screen-diagnostics .dg-test:hover{transform:none}
}
