/* ===== Commits View ===== */
.commits-view-shell {
  display: grid;
  grid-template-columns: minmax(420px, 0.95fr) minmax(380px, 1.05fr);
  gap: 16px;
  min-height: calc(100vh - 170px);
}

.commits-list-panel,
.commit-detail-panel {
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 14px;
  min-height: 0;
}

.commits-list-panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.commits-header-block {
  padding: 16px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.commits-title {
  color: #58a6ff;
  font-size: 22px;
  margin: 0;
}

.commits-subtitle {
  color: #8b949e;
  font-size: 12px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.commits-range-switches,
.commits-filter-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.commits-chip,
.commit-filter-pill {
  border: 1px solid #30363d;
  background: #21262d;
  color: #c9d1d9;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.commits-chip:hover,
.commit-filter-pill:hover {
  border-color: #58a6ff;
  color: #f0f6fc;
}

.commits-chip.active,
.commit-filter-pill.active {
  border-color: var(--commit-accent, #58a6ff);
  background: color-mix(in srgb, var(--commit-accent, #58a6ff) 14%, #161b22);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--commit-accent, #58a6ff) 28%, transparent);
}

.commits-chip.stable.active,
.commits-chip.stable.add {
  --commit-accent: #3fb950;
}

.commits-chip.stable.remove {
  --commit-accent: #f85149;
}

.commit-filter-pill strong {
  color: var(--commit-accent, #58a6ff);
  margin-left: 4px;
}

.commit-list {
  overflow: auto;
  padding: 6px;
}

.commit-row {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: stretch;
  padding: 8px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
}

.commit-row:hover {
  background: rgba(255,255,255,0.03);
  border-color: rgba(255,255,255,0.08);
}

.commit-row.active {
  background: color-mix(in srgb, var(--commit-accent, #58a6ff) 10%, #0d1117);
  border-color: color-mix(in srgb, var(--commit-accent, #58a6ff) 45%, #30363d);
  box-shadow: inset 3px 0 0 var(--commit-accent, #58a6ff);
}

.commit-row-select {
  text-align: left;
  display: grid;
  grid-template-columns: 30px 1fr;
  gap: 10px;
  align-items: flex-start;
  padding: 4px;
  border: none;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

.commit-milestone-wrap {
  position: relative;
  align-self: center;
}

.commit-row-stable-btn {
  align-self: center;
  width: 26px;
  height: 26px;
  border: 1px solid rgba(88,166,255,0.16);
  background: rgba(88,166,255,0.04);
  color: rgba(143,191,255,0.55);
  border-radius: 999px;
  padding: 0;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transform: scale(0.92);
  transition: opacity .15s ease, transform .15s ease, border-color .15s ease, background .15s ease, color .15s ease;
}

.commit-row:hover .commit-row-stable-btn,
.commit-row.active .commit-row-stable-btn,
.commit-milestone-wrap.active .commit-row-stable-btn {
  opacity: 1;
  pointer-events: auto;
  transform: scale(1);
}

.commit-row-stable-btn:hover {
  filter: brightness(1.08);
}

.commit-row-stable-btn.add:hover {
  border-color: rgba(88,166,255,0.32);
  color: rgba(143,191,255,0.9);
}

.commit-milestone-wrap.active .commit-row-stable-btn {
  background: rgba(234,179,8,0.16);
  color: #ffd54a;
  border-color: rgba(234,179,8,0.42);
  box-shadow: 0 0 0 1px rgba(234,179,8,0.18);
}

.commit-milestone-popover {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 220px;
  max-width: 280px;
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 10px;
  padding: 10px;
  box-shadow: 0 12px 24px rgba(0,0,0,0.35);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transition: opacity .15s ease, transform .15s ease;
  z-index: 20;
}

.commit-milestone-wrap.active:hover .commit-milestone-popover,
.commit-milestone-popover:hover {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.commit-milestone-popover-title {
  color: #ffd54a;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 6px;
}

.commit-milestone-popover-note {
  color: #c9d1d9;
  font-size: 12px;
  line-height: 1.45;
  white-space: pre-wrap;
}

.commit-milestone-delete {
  margin-top: 10px;
  width: 100%;
  border: 1px solid rgba(248,81,73,0.35);
  background: rgba(248,81,73,0.10);
  color: #ffb4ae;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12px;
  cursor: pointer;
}

.commit-milestone-delete:hover {
  background: rgba(248,81,73,0.16);
}

.commit-row-icon {
  font-size: 18px;
  line-height: 1.2;
  margin-top: 1px;
}

.commit-row-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.commit-row-top {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.commit-row-hash {
  color: #58a6ff;
  font-family: 'Space Mono', monospace;
  font-size: 12px;
}

.commit-row-time {
  margin-left: auto;
  color: #8b949e;
  font-size: 11px;
}

.commit-row-subject {
  color: #c9d1d9;
  font-size: 13px;
  line-height: 1.4;
}

.commit-detail-panel {
  padding: 16px;
  overflow: auto;
}

.commit-detail-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  margin-bottom: 14px;
}

.commit-detail-kicker {
  color: #8b949e;
  font-size: 12px;
  margin-bottom: 6px;
}

.commit-detail-title {
  font-size: 18px;
  color: #f0f6fc;
  margin: 0 0 8px;
  line-height: 1.35;
}

.commit-detail-meta {
  color: #8b949e;
  font-size: 12px;
  line-height: 1.5;
}

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

.commit-stable-callout {
  margin-bottom: 14px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(63,185,80,0.32);
  background: rgba(63,185,80,0.09);
  color: #c9d1d9;
  font-size: 12px;
}

.commit-stable-note {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(255,255,255,0.08);
  color: #f0f6fc;
  white-space: pre-wrap;
  line-height: 1.45;
}

.commit-detail-section {
  margin-bottom: 16px;
}

.commit-detail-section-title {
  color: #f0f6fc;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 8px;
}

.commit-pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 10px;
  padding: 12px;
  color: #c9d1d9;
  font-family: 'Space Mono', monospace;
  font-size: 11px;
  line-height: 1.55;
}

.commit-diff {
  white-space: pre-wrap;
  max-height: calc(100vh - 370px);
  overflow: auto;
}

.commit-empty-state {
  color: #8b949e;
  padding: 40px 20px;
  text-align: center;
}

@media (max-width: 1200px) {
  .commits-view-shell {
    grid-template-columns: 1fr;
  }

  .commit-diff {
    max-height: none;
  }
}
