:root {
  --bg-color: #0f172a;
  --card-bg: #1e293b;
  --card-border: #334155;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --primary: #38bdf8;
  --primary-hover: #0284c7;
  --accent-rpi: #ec4899;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --radius: 12px;
  --font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-color);
  color: var(--text-main);
  font-family: var(--font-family);
  line-height: 1.5;
  padding: 24px 16px;
  min-height: 100vh;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Header */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--card-border);
}

.header-title {
  display: flex;
  align-items: center;
  gap: 16px;
}

.logo-box {
  font-size: 2.2rem;
  background: rgba(236, 72, 153, 0.15);
  border: 1px solid rgba(236, 72, 153, 0.3);
  padding: 8px 12px;
  border-radius: var(--radius);
}

h1 {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.header-badges {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 9999px;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-success {
  background: rgba(34, 197, 94, 0.15);
  color: var(--success);
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.badge-warning {
  background: rgba(245, 158, 11, 0.15);
  color: var(--warning);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-neutral {
  background: rgba(148, 163, 184, 0.15);
  color: var(--text-muted);
  border: 1px solid rgba(148, 163, 184, 0.3);
}

.pulse-dot {
  width: 8px;
  height: 8px;
  background-color: var(--success);
  border-radius: 50%;
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(1.3); }
}

/* Grid layout */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(480px, 1fr));
  gap: 20px;
}

@media (max-width: 600px) {
  .grid {
    grid-template-columns: 1fr;
  }
}

/* Card */
.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--card-border);
}

.card-header h2 {
  font-size: 1.1rem;
  font-weight: 600;
}

.tag {
  font-size: 0.75rem;
  background: rgba(56, 189, 248, 0.12);
  color: var(--primary);
  border: 1px solid rgba(56, 189, 248, 0.25);
  padding: 3px 8px;
  border-radius: 6px;
}

.card-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex: 1;
}

.info-desc {
  font-size: 0.88rem;
  color: var(--text-muted);
}

/* Metrics Grid */
.metrics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.metric-item {
  background: rgba(15, 23, 42, 0.6);
  padding: 12px;
  border-radius: 8px;
  border: 1px solid rgba(51, 65, 85, 0.6);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.metric-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.metric-val {
  font-size: 0.95rem;
  font-weight: 600;
  word-break: break-all;
}

/* Progress bar */
.progress-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.progress-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.progress-track {
  height: 8px;
  background: #334155;
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent-rpi));
  transition: width 0.4s ease;
}

.load-avg-section {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.88rem;
}

code {
  background: #0f172a;
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid var(--card-border);
  color: #38bdf8;
  font-family: monospace;
  font-size: 0.85rem;
}

/* Inspector Table */
.table-container {
  overflow-x: auto;
}

.inspector-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.inspector-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--card-border);
}

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

/* Latency Box */
.latency-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.latency-display {
  display: flex;
  align-items: baseline;
  gap: 10px;
  background: rgba(15, 23, 42, 0.6);
  padding: 16px;
  border-radius: 8px;
  border: 1px solid rgba(51, 65, 85, 0.6);
}

.latency-val {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--success);
}

.quick-links {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.endpoint-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.link-chip {
  text-decoration: none;
  background: #0f172a;
  color: var(--primary);
  border: 1px solid var(--card-border);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-family: monospace;
  transition: all 0.2s;
}

.link-chip:hover {
  background: var(--card-border);
  color: #fff;
}

/* Notes Form */
.note-form {
  display: flex;
  gap: 8px;
}

.note-form input {
  flex: 1;
  background: #0f172a;
  border: 1px solid var(--card-border);
  padding: 10px 14px;
  border-radius: 6px;
  color: #fff;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s;
}

.note-form input:focus {
  border-color: var(--primary);
}

.btn {
  background: #334155;
  color: #fff;
  border: 1px solid transparent;
  padding: 8px 16px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  transition: all 0.2s;
}

.btn:hover {
  background: #475569;
}

.btn-primary {
  background: var(--primary);
  color: #0f172a;
}

.btn-primary:hover {
  background: var(--primary-hover);
  color: #fff;
}

.btn-sm {
  padding: 4px 10px;
  font-size: 0.8rem;
}

.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.3);
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
}

.btn-danger:hover {
  background: var(--danger);
  color: #fff;
}

/* Notes list */
.notes-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 220px;
  overflow-y: auto;
}

.note-item {
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid rgba(51, 65, 85, 0.5);
  border-radius: 6px;
  padding: 10px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.note-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.note-text {
  font-size: 0.9rem;
}

.note-time {
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* Footer */
.footer {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  padding-top: 16px;
  border-top: 1px solid var(--card-border);
}
