.titlebar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  height: 48px;
  padding: 0 var(--spacing-3);
  border-bottom: 1px solid var(--color-border);
  background: var(--color-bg-root);
  -webkit-app-region: drag;
  flex-shrink: 0;
  gap: 4px;
}

.spacer {
  flex: 1;
}

.actionBtn {
  -webkit-app-region: no-drag;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: none;
  border: none;
  border-radius: var(--radius-md);
  color: var(--color-text-tertiary);
  cursor: pointer;
  flex-shrink: 0;

  &:hover {
    background: var(--color-bg-hover);
    color: var(--color-text-secondary);
  }
}

.actionBtnActive {
  background: var(--color-bg-hover);
  color: var(--color-text-primary);
}

.updateBtn {
  -webkit-app-region: no-drag;
  display: flex;
  align-items: center;
  gap: 4px;
  height: 28px;
  padding: 0 var(--spacing-2);
  background: none;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text-secondary);
  font-size: var(--font-size-sm);
  cursor: pointer;
  flex-shrink: 0;
  white-space: nowrap;

  &:hover {
    background: var(--color-bg-hover);
    border-color: var(--color-border-hover);
    color: var(--color-text-primary);
  }
}

.updateBtnReady {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: var(--color-btn-primary-text);

  &:hover {
    background: var(--color-accent-hover);
    border-color: var(--color-accent-hover);
  }
}

.docsBtn {
  -webkit-app-region: no-drag;
  display: flex;
  align-items: center;
  gap: 4px;
  height: 28px;
  padding: 0 var(--spacing-2);
  background: none;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text-tertiary);
  font-size: var(--font-size-sm);
  cursor: pointer;
  flex-shrink: 0;
  white-space: nowrap;

  &:hover {
    background: var(--color-bg-hover);
    border-color: var(--color-border-hover);
    color: var(--color-text-primary);
  }
}

.updateProgress {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 28px;
  padding: 0 var(--spacing-2);
  color: var(--color-text-tertiary);
  font-size: var(--font-size-sm);
  white-space: nowrap;
}

.overrideBadgeGroup {
  -webkit-app-region: no-drag;
  display: flex;
  align-items: center;
  flex-shrink: 0;

  &:hover .overrideClear {
    width: 22px;
    opacity: 1;
    margin-right: 4px;
  }
}

.overrideClear {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 0;
  height: 22px;
  padding: 0;
  background: var(--color-error-hover);
  border: none;
  border-radius: var(--radius-md);
  color: white;
  cursor: pointer;
  opacity: 0;
  overflow: hidden;
  margin-right: 0;
  flex-shrink: 0;
  transition: width 150ms ease, opacity 150ms ease, margin-right 150ms ease;

  &:hover {
    background: var(--color-error-active);
  }
}

.overrideBadge {
  -webkit-app-region: no-drag;
  display: flex;
  align-items: center;
  height: 22px;
  padding: 0 var(--spacing-2);
  background: var(--color-error);
  border: none;
  border-radius: var(--radius-md);
  color: white;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  white-space: nowrap;
  flex-shrink: 0;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: background 150ms ease;

  &:hover {
    background: var(--color-error-hover);
  }
}

.devHidden {
  filter: blur(3px);
  opacity: 0.15;
  pointer-events: none;
  user-select: none;
}
