.diagnostics-shell {
  min-height: calc(100vh - 72px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 10px;
}

.diagnostics-view-tabs {
  display: flex;
  gap: 7px;
  padding: 7px;
  background: #fff;
  border: 1px solid #dce6f2;
  border-radius: 10px;
}

.diagnostics-view-tabs button {
  min-width: 112px;
  min-height: 34px;
  padding: 0 14px;
  color: #315272;
  background: #f4f8fd;
  border: 1px solid #cbdced;
  border-radius: 7px;
  font: 800 13px/1 "Segoe UI", "Microsoft YaHei UI", sans-serif;
  cursor: pointer;
}

.diagnostics-view-tabs button:hover,
.diagnostics-view-tabs button.active {
  color: #fff;
  background: #2563eb;
  border-color: #2563eb;
}

.diagnostics-page {
  min-height: calc(100vh - 126px);
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  gap: 14px;
  color: #172033;
}

.diagnostics-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 20px;
  background: #fff;
  border: 1px solid #dce6f2;
  border-radius: 14px;
}

.diagnostics-header h1 {
  margin: 3px 0 4px;
  font-size: 26px;
}

.diagnostics-header p {
  margin: 0;
  color: #64748b;
}

.diagnostics-eyebrow {
  color: #2563eb;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .1em;
}

.diagnostics-filterbar {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr)) auto;
  align-items: end;
  gap: 10px;
  padding: 12px 14px;
  background: #fff;
  border: 1px solid #dce6f2;
  border-radius: 12px;
}

.diagnostics-filterbar label {
  display: grid;
  gap: 5px;
  color: #64748b;
  font-size: 12px;
  font-weight: 700;
}

.diagnostics-filterbar .input {
  min-width: 0;
}

.diagnostics-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.diagnostics-metric {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 17px;
  background: #fff;
  border: 1px solid #dce6f2;
  border-radius: 12px;
}

.diagnostics-metric::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: #2563eb;
}

.diagnostics-metric.danger::before { background: #dc2626; }
.diagnostics-metric.warning::before { background: #d97706; }
.diagnostics-metric.success::before { background: #059669; }

.diagnostics-metric span {
  color: #64748b;
  font-size: 13px;
}

.diagnostics-metric strong {
  font-size: 25px;
}

.diagnostics-workspace {
  min-height: 560px;
  display: grid;
  grid-template-columns: minmax(320px, .78fr) minmax(480px, 1.35fr);
  gap: 14px;
}

.diagnostics-list-panel,
.diagnostics-detail-panel {
  min-height: 0;
  background: #fff;
  border: 1px solid #dce6f2;
  border-radius: 14px;
  overflow: hidden;
}

.diagnostics-list-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.diagnostics-panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid #e7edf5;
}

.diagnostics-panel-title span {
  color: #64748b;
  font-size: 12px;
}

.diagnostics-issue-list,
.diagnostics-detail-scroll {
  min-height: 0;
  overflow: auto;
}

.diagnostics-issue-list {
  padding: 8px;
}

.diagnostics-issue {
  width: 100%;
  display: grid;
  gap: 6px;
  padding: 12px;
  margin: 0 0 8px;
  text-align: left;
  color: #172033;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  cursor: pointer;
}

.diagnostics-issue:hover,
.diagnostics-issue.active {
  border-color: #60a5fa;
  background: #eff6ff;
}

.diagnostics-issue > span:not(.diagnostics-severity),
.diagnostics-issue small {
  color: #64748b;
}

.diagnostics-severity {
  width: max-content;
  padding: 3px 7px;
  color: #1d4ed8;
  background: #dbeafe;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
}

.diagnostics-severity.critical,
.diagnostics-severity.error {
  color: #b91c1c;
  background: #fee2e2;
}

.diagnostics-severity.warning {
  color: #92400e;
  background: #fef3c7;
}

.diagnostics-detail-scroll {
  height: 100%;
  padding: 18px;
}

.diagnostics-detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid #e7edf5;
}

.diagnostics-detail-head h2 {
  margin: 8px 0 0;
  font-size: 20px;
  overflow-wrap: anywhere;
}

.diagnostics-state {
  flex: 0 0 auto;
  padding: 6px 9px;
  color: #b91c1c;
  background: #fee2e2;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 800;
}

.diagnostics-state.quiet {
  color: #047857;
  background: #d1fae5;
}

.diagnostics-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 15px 0;
}

.diagnostics-facts > div {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  background: #f8fafc;
  border-radius: 8px;
}

.diagnostics-facts span {
  color: #64748b;
  font-size: 11px;
}

.diagnostics-facts strong {
  overflow-wrap: anywhere;
  font-size: 13px;
}

.diagnostics-detail-section {
  margin-top: 14px;
}

.diagnostics-detail-section h3 {
  margin: 0 0 7px;
  font-size: 14px;
}

.diagnostics-detail-section p,
.diagnostics-detail-section li {
  line-height: 1.65;
}

.diagnostics-detail-section pre {
  max-height: 240px;
  overflow: auto;
  margin: 0;
  padding: 12px;
  color: #dbeafe;
  background: #172033;
  border-radius: 9px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.diagnostics-empty,
.diagnostics-loading,
.diagnostics-error {
  display: grid;
  place-items: center;
  min-height: 180px;
  padding: 24px;
  text-align: center;
  color: #64748b;
}

.diagnostics-loading,
.diagnostics-error {
  min-height: 120px;
  background: #fff;
  border: 1px solid #dce6f2;
  border-radius: 12px;
}

.diagnostics-error {
  color: #b91c1c;
  background: #fff7f7;
  border-color: #fecaca;
}

@media (max-width: 1180px) {
  .diagnostics-filterbar { grid-template-columns: repeat(3, minmax(140px, 1fr)); }
  .diagnostics-workspace { grid-template-columns: minmax(290px, .8fr) minmax(390px, 1.2fr); }
}

@media (max-width: 820px) {
  .diagnostics-header { align-items: flex-start; }
  .diagnostics-filterbar,
  .diagnostics-metrics,
  .diagnostics-workspace,
  .diagnostics-facts { grid-template-columns: 1fr; }
  .diagnostics-workspace { min-height: 0; }
  .diagnostics-list-panel,
  .diagnostics-detail-panel { min-height: 420px; }
}
