:root {
  --bg: #0f1115;
  --bg-panel: #151821;
  --bg-elevated: #1c202b;
  --border: #2a2f3c;
  --text: #e4e6eb;
  --text-dim: #8b92a5;
  --accent: #6ea8fe;
  --add: #2ea04326;
  --add-text: #3fb950;
  --del: #f8514926;
  --del-text: #f85149;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: 14px;
}

.app { display: flex; height: 100vh; }

.sidebar {
  width: 300px;
  min-width: 300px;
  background: var(--bg-panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-heading {
  padding: 16px;
  border-bottom: 1px solid var(--border);
}

.sidebar h1 {
  font-size: 15px;
  margin: 0;
  font-weight: 600;
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar h1::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px 1px var(--accent);
}

.sidebar-tagline {
  margin: 4px 0 0 16px;
  font-size: 11.5px;
  color: var(--text-dim);
  line-height: 1.4;
}

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

.list-item {
  padding: 10px;
  border-radius: 8px;
  cursor: pointer;
  margin-bottom: 4px;
  transition: background 0.12s ease;
}
.list-item:hover { background: var(--bg-elevated); }
.list-item.selected { background: var(--bg-elevated); outline: 1px solid var(--accent); }

.title-row { display: flex; align-items: center; gap: 6px; }

.list-item .title {
  font-weight: 500;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.list-item .subtitle {
  color: var(--text-dim);
  font-size: 12px;
  margin-top: 2px;
}

.badge {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 700;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 999px;
  padding: 1px 7px;
  flex-shrink: 0;
}

.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

.empty-state {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.empty-state-card { max-width: 440px; text-align: center; }
.empty-state-card h2 { font-size: 19px; margin: 0 0 10px; }
.empty-state-card p { color: var(--text-dim); line-height: 1.6; font-size: 13.5px; }

.hidden { display: none !important; }

.project-view { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

.project-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
}
.project-header h2 { margin: 0; font-size: 17px; font-weight: 700; }
.project-meta { color: var(--text-dim); font-size: 12.5px; }

.project-body { flex: 1; display: flex; overflow: hidden; }

.checkpoint-list {
  width: 320px;
  min-width: 320px;
  overflow-y: auto;
  border-right: 1px solid var(--border);
  padding: 10px;
}

.compare-all-btn {
  display: block;
  width: 100%;
  padding: 8px 10px;
  margin-bottom: 12px;
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px solid var(--accent);
  border-radius: 8px;
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 600;
}
.compare-all-btn:hover { background: var(--accent); color: #0f1115; }

.checkpoint-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px;
  border-radius: 8px;
  cursor: pointer;
  margin-bottom: 6px;
  border-left: 3px solid var(--border);
}
.checkpoint-item:hover { background: var(--bg-elevated); }
.checkpoint-item.selected { background: var(--bg-elevated); border-left-color: var(--accent); }

.checkpoint-number {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--bg-elevated);
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
}
.checkpoint-item.selected .checkpoint-number { background: var(--accent); color: #0f1115; }

.checkpoint-body { min-width: 0; flex: 1; }

.checkpoint-date { font-size: 11px; color: var(--text-dim); }
.checkpoint-preview {
  font-size: 12.5px;
  margin: 3px 0;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.checkpoint-commit {
  font-size: 11px;
  color: var(--text-dim);
  font-family: "SFMono-Regular", Consolas, monospace;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.diff-panel { flex: 1; overflow-y: auto; padding: 20px; }
.diff-panel .hint { color: var(--text-dim); }

.diff-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  font-weight: 700;
  margin-bottom: 12px;
}

.commit-chain {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 16px;
}

.commits-during-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  font-weight: 700;
  margin-bottom: 8px;
}

.rollback-footer {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-panel);
}

.rollback-footer-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  font-weight: 700;
  margin-bottom: 8px;
}

.rollback-footer-controls { display: flex; gap: 8px; }

.rollback-select {
  flex: 1;
  min-width: 0;
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 12.5px;
}

.rollback-btn {
  flex-shrink: 0;
  padding: 6px 14px;
  background: var(--accent);
  color: #0f1115;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 700;
}
.rollback-btn:hover { opacity: 0.85; }

.commit-chain .commit-ref { margin-bottom: 4px; }
.commit-chain .commit-ref:last-child { margin-bottom: 0; }

.commit-ref { display: flex; align-items: baseline; gap: 8px; font-size: 13px; }
.commit-hash { font-family: "SFMono-Regular", Consolas, monospace; color: var(--accent); flex-shrink: 0; }
.range-arrow { color: var(--text-dim); margin: 4px 0 4px 4px; }

.diff {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 0;
  overflow-x: auto;
}

.diff pre {
  margin: 0;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
  line-height: 1.5;
}

.diff-line { padding: 0 14px; white-space: pre; }
.diff-line.add { background: var(--add); color: var(--add-text); }
.diff-line.del { background: var(--del); color: var(--del-text); }
.diff-line.hunk { color: var(--accent); }
.diff-line.meta { color: var(--text-dim); }
