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

:root {
  --bg-root: #06060e;
  --bg-surface: #0a0a1a;
  --bg-elevated: #10102a;
  --bg-input: #0d0d20;
  --border-subtle: rgba(99, 102, 241, 0.12);
  --border-default: rgba(99, 102, 241, 0.2);
  --text-primary: #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent: #6366f1;
  --accent-hover: #818cf8;
  --success: #10b981;
  --error: #ef4444;
  --warning: #f59e0b;
  --radius: 8px;
  --radius-sm: 4px;
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;
}

html,
body,
#root {
  height: 100%;
  font-family: var(--font-sans);
  background: var(--bg-root);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
}

.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* Header */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  height: 52px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

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

.logo {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo-icon {
  color: var(--accent);
  font-size: 18px;
}

.header-badge {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  background: rgba(99, 102, 241, 0.1);
  padding: 3px 10px;
  border-radius: 20px;
  border: 1px solid rgba(99, 102, 241, 0.2);
}

.header-right {
  display: flex;
  align-items: center;
}

.selected-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.status-dot.online {
  background: var(--success);
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.5);
}

.status-dot.offline {
  background: var(--error);
}

.selected-name {
  font-weight: 600;
  color: var(--text-primary);
}

.selected-detail {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 11px;
}

/* Main layout */
.app-main {
  display: flex;
  flex: 1;
  overflow: hidden;
}

.sidebar {
  width: 300px;
  flex-shrink: 0;
  border-right: 1px solid var(--border-subtle);
  overflow-y: auto;
  background: var(--bg-surface);
}

.graph-area {
  flex: 1;
  position: relative;
  overflow: hidden;
}

.feed-area {
  width: 280px;
  flex-shrink: 0;
  border-left: 1px solid var(--border-subtle);
  overflow: hidden;
  background: var(--bg-surface);
}

/* Network Graph */
.network-graph {
  width: 100%;
  height: 100%;
}

.network-graph canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* Panels */
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle);
}

.panel-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
}

.badge {
  font-size: 10px;
  font-weight: 600;
  background: rgba(99, 102, 241, 0.15);
  color: var(--accent);
  padding: 2px 8px;
  border-radius: 10px;
}

/* Node selector */
.node-selector {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle);
}

.node-selector label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

.node-pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.node-pill {
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font-mono);
  border: 1px solid var(--border-default);
  border-radius: 20px;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
}

.node-pill:hover {
  border-color: var(--accent);
  color: var(--text-primary);
}

.node-pill.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.node-pill.offline {
  opacity: 0.4;
}

.node-pill.offline.active {
  opacity: 0.7;
}

/* Tab bar */
.tab-bar {
  display: flex;
  gap: 2px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-subtle);
  overflow-x: auto;
  flex-wrap: wrap;
}

.tab-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.tab-btn:hover {
  color: var(--text-secondary);
  background: var(--bg-elevated);
}

.tab-btn.active {
  color: var(--text-primary);
  background: var(--bg-elevated);
  border-bottom-width: 2px;
}

.tab-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Tab content / forms */
.tab-content {
  flex: 1;
  overflow-y: auto;
  padding: 0;
}

.tab-form {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-group label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px !important;
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 8px 10px;
  font-size: 13px;
  font-family: var(--font-mono);
  color: var(--text-primary);
  background: var(--bg-input);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 0.15s;
}

.form-group input:focus,
.form-group textarea:focus {
  border-color: var(--accent);
}

.form-group textarea {
  resize: vertical;
  min-height: 60px;
}

/* Buttons */
.btn {
  padding: 8px 16px;
  font-size: 12px;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent);
  color: white;
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
}

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text-secondary);
  border: 1px solid var(--border-default);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--bg-input);
  color: var(--text-primary);
}

.btn-wide {
  width: 100%;
}

.btn-row {
  display: flex;
  gap: 8px;
}

.btn-row .btn {
  flex: 1;
}

/* Setup tab */
.setup-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.setup-section-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
}

.setup-hint {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.5;
}

.setup-divider {
  height: 1px;
  background: var(--border-subtle);
  margin: 4px 0;
}

.context-graph-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.context-graph-list label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.context-graph-item {
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--accent);
  padding: 4px 8px;
  background: rgba(99, 102, 241, 0.08);
  border-radius: var(--radius-sm);
}

/* Graph target pills */
.graph-target-pills {
  display: flex;
  gap: 4px;
  background: var(--bg-input);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  padding: 3px;
}

.target-pill {
  flex: 1;
  padding: 5px 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.15s;
}

.target-pill:hover {
  color: var(--text-secondary);
}

.target-pill.active {
  background: var(--accent);
  color: white;
}

/* Result box */
.result-box {
  padding: 10px;
  font-size: 11px;
  line-height: 1.5;
  color: var(--text-secondary);
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  word-break: break-all;
  max-height: 200px;
  overflow-y: auto;
}

.result-box.code {
  font-family: var(--font-mono);
  font-size: 10px;
  white-space: pre-wrap;
}

/* Conviction / Stake preview */
.conviction-preview {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

.metric {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.metric-label {
  font-size: 11px;
  color: var(--text-muted);
}

.metric-value {
  font-size: 13px;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text-primary);
}

/* Activity Feed */
.activity-feed {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.activity-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}

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

.activity-item {
  padding: 8px 16px;
  border-bottom: 1px solid rgba(99, 102, 241, 0.06);
  transition: background 0.15s;
}

.activity-item:hover {
  background: rgba(99, 102, 241, 0.04);
}

.activity-item.activity-pending {
  opacity: 0.7;
}

.activity-item.activity-error .activity-text {
  color: var(--error);
}

.activity-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 2px;
}

.activity-icon {
  font-size: 11px;
  font-weight: 700;
  width: 14px;
  text-align: center;
}

.activity-time {
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

.activity-type {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.activity-label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--text-secondary);
  padding-left: 22px;
}

.activity-node {
  font-weight: 600;
  color: var(--accent);
  font-size: 10px;
}

.activity-arrow {
  color: var(--text-muted);
  font-size: 10px;
}

.activity-text {
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.activity-detail {
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  padding-left: 22px;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Control panel */
.control-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(99, 102, 241, 0.2);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(99, 102, 241, 0.35);
}

/* Simulate tab */
.sim-params {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}

.sim-params .form-group {
  margin-bottom: 0;
}

.sim-params input[type="number"] {
  text-align: center;
}

.tab-bar-divider {
  width: 100%;
  height: 1px;
  background: var(--border-subtle);
  margin: 4px 0;
}

.tab-btn-sim {
  font-weight: 600;
}

.btn-danger {
  background: #ef4444;
  color: white;
}

.btn-danger:hover {
  background: #dc2626;
}

.sim-stats {
  margin-top: 12px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius);
  padding: 12px;
  background: rgba(10, 10, 26, 0.6);
}

.sim-progress-bar {
  height: 6px;
  background: var(--bg-input);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 12px;
}

.sim-progress-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s ease;
}

.sim-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  text-align: center;
}

.sim-stat-value {
  display: block;
  font-size: 16px;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text-primary);
}

.sim-stat-label {
  display: block;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-top: 2px;
}

.sim-summary {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
  font-size: 11px;
  color: var(--text-secondary);
  text-align: center;
}

/* Header nav tabs */
.header-nav {
  display: flex;
  gap: 2px;
  margin-left: 24px;
  background: rgba(99, 102, 241, 0.08);
  border-radius: var(--radius-sm);
  padding: 2px;
}

.nav-tab {
  padding: 5px 16px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s;
}

.nav-tab:hover {
  color: var(--text-secondary);
}

.nav-tab.active {
  background: var(--accent);
  color: white;
}

/* Stats page layout */
.stats-page {
  overflow-y: auto;
  padding: 0 !important;
}

.stats-dashboard {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px 32px;
  width: 100%;
}

/* Stats toolbar */
.stats-toolbar {
  display: flex;
  gap: 24px;
  align-items: center;
  margin-bottom: 24px;
  padding: 12px 16px;
  background: rgba(10, 10, 26, 0.6);
  border: 1px solid var(--border-default);
  border-radius: var(--radius);
}

.stats-toolbar-section {
  display: flex;
  align-items: center;
  gap: 8px;
}

.stats-toolbar-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  white-space: nowrap;
}

/* Stats sections */
.stats-section {
  margin-bottom: 28px;
}

.stats-section-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-subtle);
}

/* Stats grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}

.stat-card {
  background: rgba(10, 10, 26, 0.7);
  border: 1px solid var(--border-default);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
  transition: border-color 0.3s, box-shadow 0.3s;
}

.stat-card.flash-up {
  animation: stat-flash-up 0.7s ease-out;
}

.stat-card.flash-down {
  animation: stat-flash-down 0.7s ease-out;
}

@keyframes stat-flash-up {
  0% {
    border-color: #10b981;
    box-shadow: 0 0 12px rgba(16, 185, 129, 0.4), inset 0 0 12px rgba(16, 185, 129, 0.05);
  }
  15% {
    border-color: #10b981;
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.5), inset 0 0 20px rgba(16, 185, 129, 0.08);
  }
  100% {
    border-color: var(--border-default);
    box-shadow: none;
  }
}

@keyframes stat-flash-down {
  0% {
    border-color: #f59e0b;
    box-shadow: 0 0 12px rgba(245, 158, 11, 0.4), inset 0 0 12px rgba(245, 158, 11, 0.05);
  }
  15% {
    border-color: #f59e0b;
    box-shadow: 0 0 20px rgba(245, 158, 11, 0.5), inset 0 0 20px rgba(245, 158, 11, 0.08);
  }
  100% {
    border-color: var(--border-default);
    box-shadow: none;
  }
}

.stat-card.flash-up .stat-card-value {
  animation: value-pop-up 0.7s ease-out;
}

.stat-card.flash-down .stat-card-value {
  animation: value-pop-down 0.7s ease-out;
}

@keyframes value-pop-up {
  0% { transform: scale(1); }
  15% { transform: scale(1.12); color: #10b981; }
  50% { transform: scale(1.04); }
  100% { transform: scale(1); }
}

@keyframes value-pop-down {
  0% { transform: scale(1); }
  15% { transform: scale(0.92); color: #f59e0b; }
  50% { transform: scale(0.97); }
  100% { transform: scale(1); }
}

.stat-card-value {
  font-size: 24px;
  font-weight: 800;
  font-family: var(--font-mono);
  color: var(--text-primary);
  line-height: 1.2;
  will-change: transform;
}

.stat-card-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-top: 4px;
}

.stat-card-detail {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 2px;
  opacity: 0.7;
}

/* Stats charts */
.stats-charts-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.stats-chart-card {
  background: rgba(10, 10, 26, 0.7);
  border: 1px solid var(--border-default);
  border-radius: var(--radius);
  padding: 16px;
}

.stats-chart-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.stats-chart-range {
  display: flex;
  justify-content: space-between;
  font-size: 9px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  margin-top: 4px;
}

/* Node stats table */
.node-stats-table {
  border: 1px solid var(--border-default);
  border-radius: var(--radius);
  overflow: hidden;
}

.node-stats-header,
.node-stats-row {
  display: grid;
  grid-template-columns: 60px 80px 100px 1fr 1fr 1fr 1fr;
  gap: 4px;
  padding: 8px 12px;
  font-size: 12px;
  align-items: center;
}

.node-stats-header {
  background: rgba(99, 102, 241, 0.08);
  font-weight: 700;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.node-stats-row {
  border-top: 1px solid var(--border-subtle);
  font-family: var(--font-mono);
  color: var(--text-secondary);
  transition: background 0.3s;
}

.node-stats-row.row-flash {
  animation: row-flash 0.6s ease-out;
}

@keyframes row-flash {
  0% { background: rgba(16, 185, 129, 0.12); }
  100% { background: transparent; }
}

.node-stats-row.offline {
  opacity: 0.4;
}

.node-stats-name {
  font-weight: 700;
  color: var(--text-primary);
}

.backend-badge {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.3px;
  opacity: 0.8;
}

.status-dot-sm {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  margin-right: 4px;
}

.status-dot-sm.online {
  background: #10b981;
}

.status-dot-sm.offline {
  background: #ef4444;
}

/* Live simulation metrics */
.live-section {
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 24px;
  background: rgba(245, 158, 11, 0.04);
}

.live-section .stats-section-title {
  border-bottom-color: rgba(245, 158, 11, 0.2);
  display: flex;
  align-items: center;
  gap: 8px;
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #f59e0b;
  animation: live-pulse 1.5s ease infinite;
}

@keyframes live-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.live-breakdown {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.live-breakdown-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}

.live-breakdown-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.live-breakdown-type {
  font-weight: 600;
  color: var(--text-secondary);
  width: 80px;
  text-transform: capitalize;
}

.live-breakdown-count {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--text-primary);
  width: 50px;
  text-align: right;
}

.live-breakdown-bar-bg {
  flex: 1;
  height: 6px;
  background: var(--bg-input);
  border-radius: 3px;
  overflow: hidden;
}

.live-breakdown-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s ease;
}

.live-breakdown-errors {
  font-size: 10px;
  font-weight: 600;
  color: #ef4444;
  flex-shrink: 0;
}

/* Per-operation metrics table */
.per-op-table {
  margin-top: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.per-op-header,
.per-op-row {
  display: grid;
  grid-template-columns: 1.5fr repeat(6, 1fr);
  padding: 8px 12px;
  font-size: 12px;
  align-items: center;
}

.per-op-header {
  background: var(--bg-input);
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border);
}

.per-op-row {
  border-bottom: 1px solid var(--border);
  font-family: var(--font-mono);
  transition: background 0.2s;
}

.per-op-row:last-child {
  border-bottom: none;
}

.per-op-row:hover {
  background: rgba(99, 102, 241, 0.05);
}

.per-op-total {
  background: rgba(99, 102, 241, 0.04);
}

.per-op-name {
  display: flex;
  align-items: center;
  gap: 8px;
  text-transform: capitalize;
  font-weight: 600;
  color: var(--text-primary);
  font-family: var(--font);
}

.per-op-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Errors list */
.error-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 18px;
  padding: 0 6px;
  font-size: 10px;
  font-weight: 700;
  font-family: var(--font-mono);
  color: white;
  background: #ef4444;
  border-radius: 9px;
  margin-left: 8px;
}

.errors-empty {
  padding: 16px;
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  background: rgba(10, 10, 26, 0.4);
  border: 1px solid var(--border-default);
  border-radius: var(--radius);
}

.errors-list {
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: var(--radius);
  overflow: hidden;
  max-height: 300px;
  overflow-y: auto;
}

.error-row {
  display: flex;
  gap: 8px;
  align-items: baseline;
  padding: 6px 12px;
  font-size: 11px;
  border-bottom: 1px solid var(--border-subtle);
}

.error-row:last-child {
  border-bottom: none;
}

.error-time {
  font-family: var(--font-mono);
  color: var(--text-muted);
  font-size: 10px;
  flex-shrink: 0;
}

.error-type {
  font-weight: 700;
  text-transform: uppercase;
  font-size: 9px;
  letter-spacing: 0.5px;
  flex-shrink: 0;
  width: 70px;
}

.error-node {
  font-weight: 700;
  color: var(--text-primary);
  flex-shrink: 0;
  font-family: var(--font-mono);
}

.error-label {
  color: var(--text-secondary);
  flex-shrink: 0;
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.error-detail {
  color: #ef4444;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: 10px;
}

/* ---- Stats last-updated indicator ---- */
.stats-last-updated {
  font-size: 10px;
  font-weight: 400;
  color: #10b981;
  margin-left: 8px;
  animation: stats-pulse 2s ease-in-out infinite;
}

@keyframes stats-pulse {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

/* ---- Simulation Picker ---- */
.sim-picker-section {
  border: 1px solid rgba(249, 115, 22, 0.2);
  background: rgba(249, 115, 22, 0.03);
}

.sim-picker-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.sim-picker-pills .target-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-size: 12px;
}

.sim-pill-meta {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 400;
}

.sim-picker-pills .target-pill.active .sim-pill-meta {
  color: rgba(255, 255, 255, 0.7);
}

/* ---- Simulation Run Detail ---- */
.sim-run-detail {
  border: 1px solid rgba(249, 115, 22, 0.3);
  background: rgba(249, 115, 22, 0.04);
}

.sim-run-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(249, 115, 22, 0.15);
  color: #f59e0b;
  margin-left: 8px;
}

.sim-run-config {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  padding: 8px 0;
  font-size: 12px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 12px;
}

.sim-run-config span {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Phase breakdown chips */
.phase-breakdown {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
}

.phase-chip {
  display: inline-block;
  padding: 1px 5px;
  border-radius: 3px;
  background: rgba(99, 102, 241, 0.12);
  color: var(--text-secondary);
  font-size: 10px;
  white-space: nowrap;
}

/* Phase Detail Sections */
.phase-detail-section {
  margin-top: 16px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
}

.phase-detail-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 10px;
}

.phase-detail-total {
  margin-left: auto;
  font-size: 11px;
  font-weight: 400;
  color: var(--text-muted);
}

.phase-bar-container {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.phase-bar-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.phase-bar-label {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-secondary);
}

.phase-bar-track {
  height: 8px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
  overflow: hidden;
}

.phase-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.3s ease;
  min-width: 2px;
}

/* System Resource Charts */
.stats-charts-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 12px;
}

.stats-chart-card {
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 12px;
}

.stats-chart-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.stats-chart-range {
  display: flex;
  justify-content: space-around;
  margin-top: 4px;
}

.chart-node-label {
  font-size: 10px;
  color: var(--text-muted);
}

/* Responsive */
@media (max-width: 1100px) {
  .feed-area {
    width: 240px;
  }
  .sidebar {
    width: 260px;
  }
}

@media (max-width: 800px) {
  .app-main {
    flex-direction: column;
  }
  .sidebar,
  .feed-area {
    width: 100%;
    max-height: 40vh;
    border: none;
    border-bottom: 1px solid var(--border-subtle);
  }
  .graph-area {
    min-height: 300px;
  }
}
