:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #090b10;
  color: #f1f5f9;
  --amd-red: #ed1c24;
  --amd-red-glow: rgba(237, 28, 36, 0.25);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 10% 0%, rgba(237, 28, 36, 0.16), transparent 38rem),
    radial-gradient(circle at 90% 15%, rgba(59, 130, 246, 0.12), transparent 35rem),
    #090b10;
}

main {
  width: min(920px, calc(100% - 2.5rem));
  margin: 0 auto;
  padding: 3.5rem 0 5rem;
}

.header-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 1.25rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.28rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border-radius: 9999px;
}

.badge-amd {
  background: rgba(237, 28, 36, 0.2);
  color: #ff6b72;
  border: 1px solid rgba(237, 28, 36, 0.4);
}

.badge-accent {
  background: rgba(59, 130, 246, 0.18);
  color: #93c5fd;
  border: 1px solid rgba(59, 130, 246, 0.35);
}

.badge-team {
  background: rgba(16, 185, 129, 0.15);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.35);
}

.badge-subtle {
  background: rgba(255, 255, 255, 0.06);
  color: #cbd5e1;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

h1 {
  margin: 0 0 1rem;
  font-size: clamp(2.3rem, 6vw, 4rem);
  line-height: 1.05;
  letter-spacing: -0.04em;
  font-weight: 800;
  background: linear-gradient(135deg, #ffffff 40%, #cbd5e1 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.lede {
  max-width: 760px;
  color: #94a3b8;
  font-size: 1.1rem;
  line-height: 1.65;
  margin-bottom: 2rem;
}

section, aside {
  margin-top: 1.75rem;
  padding: 1.6rem;
  border: 1px solid #1e293b;
  border-radius: 16px;
  background: rgba(15, 20, 31, 0.85);
  backdrop-filter: blur(14px);
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

h2 {
  margin: 0;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
  color: #f8fafc;
}

.panel-sub {
  font-size: 0.85rem;
  color: #64748b;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* Metrics Grid */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.85rem;
}

.metric-card {
  display: flex;
  flex-direction: column;
  padding: 0.85rem 1rem;
  background: rgba(10, 14, 23, 0.85);
  border: 1px solid #1e293b;
  border-radius: 12px;
}

.metric-card.highlight {
  border-color: rgba(16, 185, 129, 0.4);
  background: rgba(16, 185, 129, 0.08);
}

.metric-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748b;
  margin-bottom: 0.35rem;
}

.metric-val {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #f1f5f9;
}

.metric-card.highlight .metric-val {
  color: #10b981;
}

.status-normal { color: #60a5fa; }
.status-high { color: #f87171; }
.status-critical { color: #ef4444; }

/* Preset buttons */
.preset-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.preset-btn {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  text-align: left;
  padding: 0.85rem 1.1rem;
  font-size: 0.88rem;
  border-radius: 12px;
  border: 1px solid #273549;
  background: #0d131f;
  color: #e2e8f0;
  cursor: pointer;
  transition: all 0.15s ease;
}

.preset-btn:hover {
  border-color: #f87171;
  background: #141b2b;
  transform: translateY(-1px);
}

.preset-btn.active {
  border-color: var(--amd-red);
  background: rgba(237, 28, 36, 0.12);
  box-shadow: 0 0 16px var(--amd-red-glow);
}

.preset-icon {
  font-size: 1.25rem;
  line-height: 1;
}

.preset-info {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.preset-title {
  font-weight: 700;
  color: #f8fafc;
}

.preset-desc {
  font-size: 0.8rem;
  color: #94a3b8;
}

.action-row {
  margin-top: 1.25rem;
}

.primary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 10px;
  padding: 0.85rem 1.5rem;
  background: linear-gradient(135deg, #ed1c24 0%, #b91c1c 100%);
  color: #ffffff;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(237, 28, 36, 0.4);
  transition: transform 0.15s, box-shadow 0.15s;
}

.primary-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(237, 28, 36, 0.6);
}

.primary-btn:disabled {
  cursor: wait;
  opacity: 0.6;
  transform: none;
}

/* Trace table */
.table-wrapper {
  overflow-x: auto;
}

.trace-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  text-align: left;
}

.trace-table th {
  padding: 0.65rem 0.85rem;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  border-bottom: 1px solid #1e293b;
}

.trace-table td {
  padding: 0.75rem 0.85rem;
  border-bottom: 1px solid rgba(30, 41, 59, 0.7);
  color: #cbd5e1;
}

.trace-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.empty-state {
  text-align: center;
  color: #64748b;
  padding: 2.5rem !important;
  font-style: italic;
}

.status-pill {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 9999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.pill-normal {
  background: rgba(59, 130, 246, 0.18);
  color: #93c5fd;
  border: 1px solid rgba(59, 130, 246, 0.4);
}

.pill-anomaly {
  background: rgba(237, 28, 36, 0.2);
  color: #ff858a;
  border: 1px solid rgba(237, 28, 36, 0.4);
}

/* Analysis panel */
.analysis-panel {
  border-left: 4px solid var(--amd-red);
}

.diagnosis-box {
  background: #090e1a;
  border: 1px solid #1e293b;
  border-radius: 12px;
  padding: 1.25rem;
  color: #e2e8f0;
  line-height: 1.65;
  font-size: 0.95rem;
  white-space: pre-wrap;
}

.rocm-telemetry-box {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid #1e293b;
}

.rocm-chip {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  padding: 0.3rem 0.75rem;
  background: rgba(10, 15, 28, 0.9);
  border: 1px solid #273549;
  border-radius: 8px;
}

.rocm-label {
  color: #64748b;
  font-weight: 600;
}

.safety-footer {
  color: #94a3b8;
  line-height: 1.6;
  font-size: 0.9rem;
  border-style: dashed;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.85em;
  background: rgba(255, 255, 255, 0.06);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  color: #93c5fd;
}
