:root {
  --bg: #0d1117;
  --bg-secondary: #161b22;
  --bg-tertiary: #21262d;
  --border: #30363d;
  --text: #c9d1d9;
  --text-muted: #8b949e;
  --text-bright: #f0f6fc;
  --accent: #58a6ff;
  --green: #3fb950;
  --red: #f85149;
  --yellow: #d29922;
  --purple: #bc8cff;
  --font-mono: 'SF Mono', 'Cascadia Code', 'Fira Code', monospace;
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

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

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Layout */
.app {
  display: grid;
  grid-template-columns: 220px 1fr;
  grid-template-rows: 48px 1fr;
  height: 100vh;
}

/* Header */
.header {
  grid-column: 1 / -1;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 16px;
}

.header h1 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-bright);
}

.header .status-pill {
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 12px;
  background: var(--bg-tertiary);
  color: var(--text-muted);
}

.header .status-pill.ok {
  background: rgba(63, 185, 80, 0.15);
  color: var(--green);
}

.header-stats {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  gap: 16px;
  align-items: center;
}

.header-stats .stat {
  display: flex;
  align-items: center;
  gap: 4px;
}

.header-stats .stat-value {
  color: var(--text);
  font-weight: 500;
}

/* Sidebar */
.sidebar {
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  padding: 12px 0;
  overflow-y: auto;
}

.sidebar h3 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  padding: 8px 16px 4px;
}

.sidebar ul { list-style: none; }

.sidebar li {
  padding: 6px 16px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
  transition: background 0.1s;
}

.sidebar li:hover { background: var(--bg-tertiary); }
.sidebar li.active { background: var(--bg-tertiary); color: var(--accent); }

.sidebar .lane-badge {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  margin-right: 6px;
}

/* Main content */
.content {
  padding: 20px;
  overflow-y: auto;
}

/* Cards */
.card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 16px;
  margin-bottom: 16px;
}

.card h2 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-bright);
  margin-bottom: 12px;
}

/* Status grid */
.status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px 16px;
}

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

.stat-card .value {
  font-size: 24px;
  font-weight: 600;
  color: var(--text-bright);
  font-family: var(--font-mono);
}

.stat-card .value.small {
  font-size: 16px;
}

/* History table */
.history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.history-table th {
  text-align: left;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  font-weight: 500;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.history-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.history-table tr:hover { background: var(--bg-tertiary); }

.hash {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent);
  cursor: pointer;
}

.badge {
  display: inline-block;
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 3px;
  font-weight: 500;
}

.badge.accepted {
  background: rgba(63, 185, 80, 0.15);
  color: var(--green);
}

.badge.proposed {
  background: rgba(210, 153, 34, 0.15);
  color: var(--yellow);
}

.badge.rejected {
  background: rgba(248, 81, 73, 0.15);
  color: var(--red);
}

/* Agent badge */
.agent-badge {
  display: inline-block;
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 3px;
  background: rgba(188, 140, 255, 0.12);
  color: var(--purple);
  font-weight: 500;
  white-space: nowrap;
}

/* Cost inline display */
.cost-inline {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

/* Prompt cell */
.prompt-cell {
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Relative time */
.time-relative {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}

/* File tree */
.file-tree {
  font-family: var(--font-mono);
  font-size: 12px;
}

.file-tree li {
  padding: 3px 0;
  cursor: pointer;
}

.file-tree li:hover { color: var(--accent); }

/* Diff view */
.diff-view {
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.6;
  white-space: pre;
  overflow-x: auto;
}

.diff-added { background: rgba(63, 185, 80, 0.1); color: var(--green); }
.diff-removed { background: rgba(248, 81, 73, 0.1); color: var(--red); }
.diff-header { color: var(--accent); font-weight: 600; }

/* Loading */
.loading {
  color: var(--text-muted);
  font-style: italic;
  padding: 20px;
  text-align: center;
}

/* Empty state */
.empty {
  color: var(--text-muted);
  text-align: center;
  padding: 40px;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}

.tab {
  padding: 8px 16px;
  font-size: 13px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  transition: color 0.1s;
}

.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* Lane detail info */
.lane-info {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 12px;
}

.lane-info-item {
  font-size: 12px;
}

.lane-info-item .info-label {
  color: var(--text-muted);
  margin-right: 4px;
}

/* Diff file list with hashes */
.diff-file-entry {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 0;
}

.diff-file-entry .diff-hash {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}
