:root {
  --bg: #0f172a;
  --bg-soft: #1e293b;
  --panel: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --accent: #2563eb;
  --add: #16803c;
  --del: #c0392b;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.08), 0 8px 24px rgba(15, 23, 42, 0.06);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
    Helvetica, Arial, sans-serif;
  color: var(--text);
  background: #f1f5f9;
  font-size: 14px;
  line-height: 1.5;
}

code,
pre,
.mono {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
    monospace;
}

.topbar {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px 24px;
  background: var(--bg);
  color: #fff;
}

.topbar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.topbar h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.topbar .meta {
  margin: 4px 0 0;
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 12px;
  color: #cbd5e1;
}

.topbar .meta code {
  color: #e2e8f0;
}

.topbar .label {
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 10px;
  color: #94a3b8;
}

.repo-commit {
  color: #94a3b8;
}

.repo-menu {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.repo-menu[hidden] {
  display: none;
}

.repo-tab {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  text-decoration: none;
  color: #cbd5e1;
  background: rgba(148, 163, 184, 0.12);
  border: 1px solid transparent;
  font-size: 13px;
  white-space: nowrap;
}

.repo-tab:hover {
  background: rgba(148, 163, 184, 0.22);
  color: #fff;
}

.repo-tab.active {
  background: #fff;
  color: var(--bg);
  border-color: #fff;
  font-weight: 600;
}

.repo-tab-time {
  font-size: 11px;
  opacity: 0.7;
  font-variant-numeric: tabular-nums;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.status {
  font-size: 12px;
  color: #cbd5e1;
}

.status.error {
  color: #fecaca;
}

.btn {
  border: 0;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  background: var(--accent);
  color: #fff;
}

.btn:hover {
  filter: brightness(1.08);
}

a.btn {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.btn.ghost {
  background: #eef2ff;
  color: #1e293b;
}

.btn.ghost:hover {
  background: #e0e7ff;
}

.alerts {
  padding: 0 24px;
}

.alert {
  margin: 16px 0 0;
  padding: 12px 14px;
  border-radius: 8px;
  background: #fef3c7;
  border: 1px solid #fcd34d;
  color: #78350f;
  font-size: 13px;
}

main {
  padding: 20px 24px 48px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 1400px;
  margin: 0 auto;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}

.panel-head h2 {
  margin: 0;
  font-size: 15px;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 12px;
}

.legend .item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
}

.legend .swatch {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.graph {
  padding: 18px;
  overflow: auto;
  max-height: 70vh;
}

.graph svg {
  display: block;
}

.graph .commit-date {
  fill: var(--muted);
  font-size: 11px;
}

.activity {
  padding: 18px;
}

/* Long histories get a scrollable, fixed-pixel timeline instead of cramped
   bars; gap columns keep the axis short while showing the idle period. */
.chart-scroll {
  overflow-x: auto;
  overflow-y: hidden;
}

.chart-inner {
  position: relative;
}

.activity .empty {
  padding: 24px 0;
  text-align: center;
}

.cards {
  padding: 18px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(420px, 1fr));
  gap: 16px;
}

.card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #fff;
}

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 600;
  word-break: break-all;
}

.dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex: none;
}

.card-sub {
  margin-top: 2px;
  font-size: 12px;
  color: var(--muted);
}

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

.badge {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #334155;
  white-space: nowrap;
}

.badge.ahead {
  background: #dcfce7;
  color: var(--add);
}

.badge.behind {
  background: #fee2e2;
  color: var(--del);
}

.badge.add {
  background: #dcfce7;
  color: var(--add);
}

.badge.del {
  background: #fee2e2;
  color: var(--del);
}

.tip {
  font-size: 12px;
  color: #334155;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
}

.tip code {
  color: #1d4ed8;
}

details {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0;
}

details > summary {
  cursor: pointer;
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 600;
  color: #334155;
  user-select: none;
}

details[open] > summary {
  border-bottom: 1px solid var(--border);
}

.list {
  margin: 0;
  padding: 6px 10px 10px;
  list-style: none;
  max-height: 280px;
  overflow: auto;
  font-size: 12px;
}

.list li {
  display: flex;
  gap: 8px;
  padding: 3px 0;
  border-bottom: 1px dashed #eef2f7;
}

.list li:last-child {
  border-bottom: 0;
}

.list .sha {
  color: #1d4ed8;
  flex: none;
}

.list .subject {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.list .who {
  color: var(--muted);
  flex: none;
}

.status-letter {
  font-weight: 700;
  width: 14px;
  flex: none;
  text-align: center;
}

.status-letter.A {
  color: var(--add);
}

.status-letter.D,
.status-letter.R {
  color: var(--del);
}

.status-letter.M {
  color: #b45309;
}

.diff {
  margin: 0;
  padding: 10px;
  max-height: 420px;
  overflow: auto;
  background: #0b1220;
  color: #e2e8f0;
  font-size: 12px;
  white-space: pre;
  border-radius: 0 0 8px 8px;
}

.card-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.muted {
  color: var(--muted);
  font-size: 12px;
}

.empty {
  color: var(--muted);
  font-size: 13px;
}
