/* ===== Settings — Code Health / Kaizen / Heartbeat ===== */

.kaizen-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  margin-bottom: 16px;
}

.kaizen-summary-score {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.kaizen-signal {
  font-size: 20px;
  line-height: 1;
}

.kaizen-total {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
}

.kaizen-total-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.kaizen-summary-date {
  font-size: 12px;
  color: var(--text-muted);
}

/* Radar + axes row */
.kaizen-radar-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 16px;
  align-items: flex-start;
}

.kaizen-radar-wrap {
  flex: 0 1 360px;
  min-width: 0;
  overflow: visible;
}

.kaizen-radar-wrap svg {
  display: block;
  width: 100%;
  height: auto;
  max-width: 360px;
  overflow: visible;
}

.kaizen-axes-list {
  flex: 1 1 200px;
  min-width: 160px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.kaizen-axis-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  font-size: 13px;
}

.kaizen-axis-signal {
  font-size: 14px;
  flex-shrink: 0;
}

.kaizen-axis-name {
  flex: 1;
  font-weight: 500;
  color: var(--text-primary);
}

.kaizen-axis-score {
  font-weight: 700;
  color: var(--text-primary);
  min-width: 32px;
  text-align: right;
}

.kaizen-axis-confidence {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 8px;
  font-weight: 600;
  flex-shrink: 0;
}

.kaizen-confidence--high {
  background: #D1FAE5;
  color: #059669;
}

.kaizen-confidence--medium {
  background: #FEF3C7;
  color: #D97706;
}

.kaizen-confidence--low {
  background: #F3F4F6;
  color: #6B7280;
}

/* Trend chart */
.kaizen-trend {
  margin-bottom: 16px;
}

.kaizen-trend-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-bottom: 8px;
}

.kaizen-trend svg {
  display: block;
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
}

/* Action card */
.kaizen-action-card {
  padding: 14px 16px;
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  border-left: 4px solid #EF4444;
  margin-bottom: 16px;
}

.kaizen-action-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.kaizen-action-signal {
  font-size: 16px;
}

.kaizen-action-axis {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.kaizen-action-body {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* Status */
.kaizen-status {
  padding: 12px 16px;
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
}

@media (max-width: 600px) {
  .kaizen-radar-row {
    flex-direction: column;
  }
  .kaizen-radar-wrap {
    align-self: center;
  }
}

/* ===== Code Health Dashboard ===== */

/* 모바일: 세로 스택 */
.health-dashboard-row {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* 섹션 공통 카드 스타일 */
.health-dashboard-row > .kaizen-section,
.health-dashboard-row > .hb-section,
.health-dashboard-row > .code-health-section {
  min-width: 0;
  padding: 20px;
  background: var(--bg-primary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
}

/* 데스크톱: 2-column grid (좌: kaizen 전체 높이, 우: hb 위 + code-health 아래) */
@media (min-width: 900px) {
  .health-dashboard-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto;
    gap: 20px;
    align-items: start;
  }

  .health-dashboard-row > .kaizen-section {
    grid-column: 1;
    grid-row: 1 / 3;
  }

  .health-dashboard-row > .hb-section {
    grid-column: 2;
    grid-row: 1;
  }

  .health-dashboard-row > .code-health-section {
    grid-column: 2;
    grid-row: 2;
  }
}

/* 섹션 제목 (border-top separator 제거 — 카드로 분리됨) */
.health-dashboard-row > .kaizen-section > .server-section-title:first-child,
.health-dashboard-row > .hb-section > .server-section-title:first-child,
.health-dashboard-row > .code-health-section > .server-section-title:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.code-health-section > .server-section-title:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

/* ===== Heartbeat Monitor ===== */

.hb-section {
  margin-bottom: 0;
}

.hb-section > .server-section-title:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.hb-registry-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 13px;
  color: var(--text-secondary);
}

.hb-registry-count {
  font-weight: 700;
  color: var(--text-primary);
}

.hb-registry-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 16px;
}

.hb-registry-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  font-size: 13px;
}

.hb-reg-name {
  flex: 1;
  font-weight: 500;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hb-reg-cron {
  font-family: var(--font-mono, monospace);
  font-size: 11px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.hb-reg-source {
  font-size: 11px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.hb-prio-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  flex-shrink: 0;
}

.hb-prio--critical { background: #FEE2E2; color: #DC2626; }
.hb-prio--normal   { background: #FEF3C7; color: #D97706; }
.hb-prio--low      { background: #E0E7FF; color: #4F46E5; }

.hb-check {
  margin-bottom: 12px;
}

.hb-check-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.hb-check-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  font-size: 13px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.hb-check-signal { font-size: 16px; }
.hb-check-date { font-weight: 600; color: var(--text-primary); }
.hb-check-stat { color: var(--text-secondary); }
.hb-check-miss { font-weight: 600; }
.hb-check-none { color: var(--text-muted); font-style: italic; }

.hb-degraded-badge {
  display: inline-block;
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 10px;
  background: #FEF3C7;
  color: #D97706;
}

.hb-misses-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.hb-miss-card {
  padding: 10px 14px;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  border-left: 3px solid var(--border-light);
}

.hb-prio--critical-border { border-left-color: #EF4444; }
.hb-prio--normal-border   { border-left-color: #F59E0B; }
.hb-prio--low-border      { border-left-color: #6366F1; }

.hb-miss-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.hb-miss-name {
  font-weight: 500;
  font-size: 13px;
  color: var(--text-primary);
}

.hb-miss-time {
  font-size: 11px;
  color: var(--text-muted);
  margin-left: auto;
}

.hb-miss-impact {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.hb-miss-action {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
  font-style: italic;
}

.hb-empty {
  padding: 12px;
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
}

.hb-status {
  padding: 12px;
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
}

.hb-live-alerts {
  margin-bottom: 12px;
}

.hb-live-title {
  font-size: 11px;
  font-weight: 600;
  color: #DC2626;
  margin-bottom: 4px;
  text-transform: uppercase;
}

.hb-live-alert {
  padding: 8px 12px;
  background: #FEF2F2;
  border: 1px solid #FECACA;
  border-radius: var(--radius-md);
  font-size: 12px;
  color: #991B1B;
  margin-bottom: 4px;
}

.ch-summary-card {
  display: flex;
  align-items: center;
  gap: 32px;
  padding: 20px;
  background: var(--bg-secondary);
  border-radius: 12px;
  margin-bottom: 16px;
}

.ch-composite {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 140px;
}

.ch-composite-ring {
  position: relative;
}

.ch-composite-score {
  font-size: 28px;
  font-weight: 700;
  fill: var(--text-primary);
}

.ch-composite-label {
  margin-top: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.ch-composite-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.ch-principles {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ch-principle-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.ch-principle-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.ch-principle-name {
  font-weight: 400;
  color: var(--text-muted);
  font-size: 12px;
}

.ch-principle-score {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.ch-bar {
  height: 8px;
  background: var(--bg-tertiary);
  border-radius: 4px;
  overflow: hidden;
}

.ch-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.6s ease, background 0.3s;
}

.ch-bar--good { background: var(--green, #22c55e); }
.ch-bar--warn { background: var(--yellow, #eab308); }
.ch-bar--danger { background: var(--red, #ef4444); }

/* Alerts */
.ch-alerts {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.ch-alert {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
}

.ch-alert--danger {
  background: rgba(239, 68, 68, 0.1);
  color: var(--red, #ef4444);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.ch-alert--warn {
  background: rgba(234, 179, 8, 0.1);
  color: var(--yellow, #eab308);
  border: 1px solid rgba(234, 179, 8, 0.2);
}

.ch-alert-icon {
  font-size: 12px;
  flex-shrink: 0;
}

/* Stats Grid */
.ch-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.ch-stat {
  padding: 14px;
  background: var(--bg-secondary);
  border-radius: 8px;
  text-align: center;
}

.ch-stat-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
}

.ch-stat-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Section Titles */
.ch-section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 10px;
}

.ch-refresh-btn {
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Violations List */
.ch-violations-section {
  margin-bottom: 20px;
}

.ch-violations-list {
  max-height: 400px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ch-violation-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--bg-secondary);
  border-left: 3px solid transparent;
}

.ch-violation--danger {
  border-left-color: var(--red, #ef4444);
}

.ch-violation--warn {
  border-left-color: var(--yellow, #eab308);
}

.ch-violation-path {
  font-size: 13px;
  font-family: "SF Mono", "Fira Code", monospace;
  color: var(--text-primary);
  word-break: break-all;
  flex: 1;
  min-width: 0;
}

.ch-violation-badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
  margin-left: 12px;
}

.ch-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  white-space: nowrap;
}

.ch-badge--danger {
  background: rgba(239, 68, 68, 0.12);
  color: var(--red, #ef4444);
}

.ch-badge--warn {
  background: rgba(234, 179, 8, 0.12);
  color: var(--yellow, #eab308);
}

.ch-no-violations {
  padding: 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
}

/* Circular Dependencies */
.ch-circular-section {
  margin-bottom: 20px;
}

.ch-circular-item {
  padding: 8px 12px;
  background: rgba(239, 68, 68, 0.08);
  border-radius: 6px;
  font-size: 12px;
  font-family: "SF Mono", "Fira Code", monospace;
  color: var(--red, #ef4444);
  margin-bottom: 6px;
}

/* Trend Chart */
.ch-trend-section {
  margin-bottom: 20px;
}

.ch-trend-section svg {
  width: 100%;
  background: var(--bg-secondary);
  border-radius: 8px;
  padding: 8px;
}

/* Thresholds Reference */
.ch-thresholds-ref {
  margin-bottom: 20px;
}

.ch-thresholds-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.ch-thresholds-table th {
  text-align: left;
  padding: 8px 12px;
  background: var(--bg-secondary);
  color: var(--text-muted);
  font-weight: 500;
  border-bottom: 1px solid var(--bg-tertiary);
}

.ch-thresholds-table td {
  padding: 8px 12px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--bg-tertiary);
}

.ch-thresholds-table tr:last-child td {
  border-bottom: none;
}

/* Responsive */
@media (max-width: 768px) {
  .ch-summary-card {
    flex-direction: column;
    gap: 16px;
  }

  .ch-stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .ch-violation-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .ch-violation-badges {
    margin-left: 0;
    justify-content: flex-start;
  }
}

