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

:root {
  --bg: #1a1a2e;
  --panel: #22223a;
  --border: #33334d;
  --text: #d4d4e0;
  --muted: #8888a4;
  --accent: #9b6bff;
  --accent2: #c3a9f0;
  --user-bar: #2e2e4a;

  --cell-0: #2a2a42;
  --cell-1: #5b3fc4;
  --cell-2: #7b55e0;
  --cell-3: #9b6bff;
  --cell-4: #c3a9f0;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: 'Space Grotesk', sans-serif;
  font-size: 14px;
  overflow: hidden;
}

#top-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.6rem 1.2rem;
  background: var(--accent);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 10;
  flex-shrink: 0;
}

#top-bar h1 {
  font-size: 1.15rem;
  font-weight: 600;
  flex: 1;
}

.back-link {
  color: #fff;
  text-decoration: none;
  font-size: 0.9rem;
  opacity: 0.85;
}
.back-link:hover { opacity: 1; }

#commit-count {
  font-size: 0.8rem;
  opacity: 0.75;
  font-family: 'JetBrains Mono', monospace;
}

/* ── Layout ── */
#layout {
  display: flex;
  height: calc(100vh - 2.6rem);
  overflow: hidden;
}

#main-panel {
  flex: 1;
  overflow-y: auto;
  padding: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

#sidebar {
  width: 240px;
  flex-shrink: 0;
  border-left: 1px solid var(--border);
  overflow-y: auto;
  background: var(--panel);
}

/* ── Section headings ── */
section h2 {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 0.7rem;
}

/* ── Commit Graph ── */
#graph-section {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.1rem 0.8rem;
}

#graph-wrap {
  position: relative;
  overflow-x: auto;
}

#graph-months {
  display: flex;
  margin-bottom: 2px;
  font-size: 0.7rem;
  color: var(--muted);
  font-family: 'JetBrains Mono', monospace;
  padding-left: 0;
  min-height: 14px;
}

.month-label {
  position: absolute;
  font-size: 0.68rem;
  color: var(--muted);
  font-family: 'JetBrains Mono', monospace;
  top: 0;
  white-space: nowrap;
}

#graph-grid {
  display: flex;
  gap: 3px;
  padding-top: 18px;
}

.graph-col {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.graph-cell {
  width: 13px;
  height: 13px;
  border-radius: 2px;
  background: var(--cell-0);
  cursor: default;
  transition: transform 0.1s;
}
.graph-cell:hover { transform: scale(1.3); }
.graph-cell[data-level="1"] { background: var(--cell-1); }
.graph-cell[data-level="2"] { background: var(--cell-2); }
.graph-cell[data-level="3"] { background: var(--cell-3); }
.graph-cell[data-level="4"] { background: var(--cell-4); }

#graph-legend {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 0.5rem;
  font-size: 0.7rem;
  color: var(--muted);
  justify-content: flex-end;
}

.legend-cell {
  width: 12px;
  height: 12px;
  border-radius: 2px;
  background: var(--cell-0);
}
.legend-cell[data-level="1"] { background: var(--cell-1); }
.legend-cell[data-level="2"] { background: var(--cell-2); }
.legend-cell[data-level="3"] { background: var(--cell-3); }
.legend-cell[data-level="4"] { background: var(--cell-4); }

/* ── Log list ── */
#log-section {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.1rem;
  flex: 1;
}

#log-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.log-entry {
  display: grid;
  grid-template-columns: 5.5rem 5.5rem 7rem 1fr;
  align-items: baseline;
  gap: 0.5rem;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.82rem;
}
.log-entry:last-child { border-bottom: none; }

.log-date {
  color: var(--muted);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  white-space: nowrap;
}

.log-user {
  font-weight: 600;
  color: var(--accent);
  font-size: 0.78rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.log-project {
  color: var(--accent2);
  font-size: 0.75rem;
  font-family: 'JetBrains Mono', monospace;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.log-project-link {
  color: var(--accent2);
  text-decoration: none;
}
.log-project-link:hover {
  text-decoration: underline;
  color: #fff;
}

.log-msg {
  color: var(--text);
  line-height: 1.35;
}

/* ── Sidebar / user list ── */
#users-section {
  padding: 1rem;
}

.user-row {
  margin-bottom: 0.55rem;
}

.user-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 3px;
}

.user-name {
  font-weight: 600;
  font-size: 0.82rem;
  color: var(--accent);
}

.user-count {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  color: var(--muted);
}

.user-bar-wrap {
  height: 5px;
  background: var(--cell-0);
  border-radius: 3px;
  overflow: hidden;
}

.user-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  border-radius: 3px;
  transition: width 0.5s ease;
}

/* ── Tooltip ── */
#tooltip {
  position: fixed;
  background: #e0e0ec;
  color: #1a1a2e;
  font-size: 0.72rem;
  padding: 4px 8px;
  border-radius: 5px;
  pointer-events: none;
  z-index: 100;
  white-space: nowrap;
  font-family: 'JetBrains Mono', monospace;
  opacity: 0.95;
}
#tooltip.hidden { display: none; }

/* ── Loading ── */
#log-list:empty::after,
#user-list:empty::after {
  content: 'Loading…';
  color: var(--muted);
  font-size: 0.82rem;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #44446a; border-radius: 3px; }
