/* agentcat dashboard — dark theme */
:root {
  --bg: #0f0f0f;
  --card: #1a1a1a;
  --border: #2a2a2a;
  --text: #e0e0e0;
  --text-muted: #888;
  --accent: #6c63ff;
  --success: #4caf50;
  --warning: #ff9800;
  --danger: #f44336;
  --input-color: #42a5f5;
  --radius: 12px;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  line-height: 1.6;
  padding: 0 16px 48px;
  max-width: 960px;
  margin: 0 auto;
}

/* Header */
.header {
  text-align: center;
  padding: 32px 0 16px;
}
.header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.header h1 span { font-size: 1.6rem; margin-right: 6px; }
.header p {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 4px;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.tab-btn {
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 8px 20px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.15s;
}
.tab-btn:hover { border-color: var(--accent); color: var(--text); }
.tab-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* Section */
.section {
  margin-bottom: 24px;
}
.section-title {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 12px;
  padding-left: 4px;
}

/* Cards grid */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

/* Drift card */
.drift-card {
  text-align: center;
}
.drift-indicator {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  margin: 0 auto 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
}
.drift-indicator.low { background: rgba(76,175,80,0.2); }
.drift-indicator.mid { background: rgba(255,152,0,0.2); }
.drift-indicator.high { background: rgba(244,67,54,0.2); }
.drift-label {
  font-weight: 600;
  font-size: 1rem;
  margin-bottom: 8px;
}
.drift-reasons {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-align: left;
  list-style: none;
}
.drift-reasons li {
  padding: 3px 0;
  border-bottom: 1px solid var(--border);
}
.drift-reasons li:last-child { border-bottom: none; }

/* Metric card */
.metric-card { text-align: center; }
.metric-value {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.2;
}
.metric-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 4px;
}
.metric-value.success { color: var(--success); }
.metric-value.warning { color: var(--warning); }
.metric-value.danger { color: var(--danger); }
.metric-value.info { color: var(--input-color); }

/* Direction gauge */
.gauge-container {
  text-align: center;
  padding: 16px 20px;
}
.gauge-bar {
  width: 100%;
  height: 12px;
  background: var(--border);
  border-radius: 6px;
  overflow: hidden;
  margin: 8px 0;
}
.gauge-fill {
  height: 100%;
  border-radius: 6px;
  transition: width 0.4s ease;
}
.gauge-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* Chart containers */
.chart-wrap {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  position: relative;
}
.chart-wrap canvas {
  max-height: 300px;
}

/* Warning banner */
.warning-banner {
  background: rgba(255,152,0,0.12);
  border: 1px solid var(--warning);
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 0.85rem;
  color: var(--warning);
  margin-bottom: 12px;
  display: none;
}
.warning-banner.visible { display: block; }

/* Pattern cards */
.pattern-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.pattern-item {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.pattern-info { flex: 1; }
.pattern-ns {
  font-weight: 600;
  font-size: 0.9rem;
}
.pattern-detail {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 2px;
}
.badge {
  font-size: 0.7rem;
  padding: 3px 8px;
  border-radius: 10px;
  font-weight: 600;
}
.badge-danger {
  background: rgba(244,67,54,0.2);
  color: var(--danger);
}
.badge-success {
  background: rgba(76,175,80,0.2);
  color: var(--success);
}

/* Experiment table */
.exp-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.exp-table th {
  text-align: left;
  color: var(--text-muted);
  font-weight: 500;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 0.78rem;
}
.exp-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}
.exp-table tr:last-child td { border-bottom: none; }
.practiced-icon { font-size: 1rem; text-align: center; }
.practiced-true { color: var(--success); }
.practiced-false { color: var(--danger); }
.practiced-null { color: var(--text-muted); }

/* Insufficient data overlay */
.insufficient {
  text-align: center;
  padding: 32px 16px;
  color: var(--text-muted);
  font-size: 0.9rem;
}
.insufficient::before {
  content: '';
  display: block;
  font-size: 1.8rem;
  margin-bottom: 8px;
}

/* Loading & Error */
.loading {
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
}
.error-msg {
  text-align: center;
  padding: 20px;
  color: var(--danger);
  font-size: 0.85rem;
}

/* Responsive */
@media (max-width: 600px) {
  body { padding: 0 10px 32px; }
  .cards { grid-template-columns: 1fr; }
  .metric-value { font-size: 1.6rem; }
  .header h1 { font-size: 1.3rem; }
}
